lotus/cmd/lotus-storage-miner/retrieval-deals.go
laser 176d0bb7c0 add "lotus-storage-miner retrieval-deals" subcommands
- enable retrieval
- disable retrieval
2020-06-24 08:08:10 -07:00

46 lines
1.0 KiB
Go

package main
import (
lcli "github.com/filecoin-project/lotus/cli"
"github.com/urfave/cli/v2"
)
var retrievalDealsCmd = &cli.Command{
Name: "retrieval-deals",
Usage: "Manage retrieval deals and related configuration",
Subcommands: []*cli.Command{
enableRetrievalCmd,
disableRetrievalCmd,
},
}
var enableRetrievalCmd = &cli.Command{
Name: "enable",
Usage: "Configure the miner to consider retrieval deal proposals",
Flags: []cli.Flag{},
Action: func(cctx *cli.Context) error {
api, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
return api.DealsSetAcceptingRetrievalDeals(lcli.DaemonContext(cctx), true)
},
}
var disableRetrievalCmd = &cli.Command{
Name: "disable",
Usage: "Configure the miner to reject all retrieval deal proposals",
Flags: []cli.Flag{},
Action: func(cctx *cli.Context) error {
api, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
return api.DealsSetAcceptingRetrievalDeals(lcli.DaemonContext(cctx), false)
},
}