Add a shed command to turn raw commPs into CIDs

This commit is contained in:
Aayush Rajasekaran 2020-04-15 13:50:46 -04:00
parent efd435d763
commit c0204cdd83
2 changed files with 18 additions and 0 deletions

17
cmd/lotus-shed/commp.go Normal file
View File

@ -0,0 +1,17 @@
package main
import (
"fmt"
commcid "github.com/filecoin-project/go-fil-commcid"
"gopkg.in/urfave/cli.v2"
)
var commpToCidCmd = &cli.Command{
Name: "commp-to-cid",
Description: "Convert a raw commP to a piece-Cid",
Action: func(cctx *cli.Context) error {
cp := []byte(cctx.Args().Get(0))
fmt.Println(commcid.PieceCommitmentV1ToCID(cp))
return nil
},
}

View File

@ -23,6 +23,7 @@ func main() {
bigIntParseCmd,
staterootStatsCmd,
importCarCmd,
commpToCidCmd,
}
app := &cli.App{