make lotus-miner net commands hit markets subsystem.
This commit is contained in:
parent
af9a71ac7c
commit
5f6166435c
@ -58,7 +58,7 @@ var GetMarketsAPI = cliutil.GetMarketsAPI
|
|||||||
var GetWorkerAPI = cliutil.GetWorkerAPI
|
var GetWorkerAPI = cliutil.GetWorkerAPI
|
||||||
|
|
||||||
var CommonCommands = []*cli.Command{
|
var CommonCommands = []*cli.Command{
|
||||||
NetCmd,
|
// NetCmd: no longer a common command, since lotus-miner nodes without a markets subsystem no longer run a libp2p node
|
||||||
AuthCmd,
|
AuthCmd,
|
||||||
LogCmd,
|
LogCmd,
|
||||||
WaitApiCmd,
|
WaitApiCmd,
|
||||||
|
@ -5,16 +5,17 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||||
"github.com/filecoin-project/lotus/lib/tracing"
|
"github.com/filecoin-project/lotus/lib/tracing"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
@ -78,6 +79,20 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adapt the Net* commands to always hit the node running the markets
|
||||||
|
// subsystem, as that is the only one that runs a libp2p node.
|
||||||
|
netCmd := *lcli.NetCmd // make a copy.
|
||||||
|
prev := netCmd.Before
|
||||||
|
netCmd.Before = func(c *cli.Context) error {
|
||||||
|
if prev != nil {
|
||||||
|
if err := prev(c); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.App.Metadata["repoType"] = repo.Markets
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Name: "lotus-miner",
|
Name: "lotus-miner",
|
||||||
Usage: "Filecoin decentralized storage network miner",
|
Usage: "Filecoin decentralized storage network miner",
|
||||||
@ -120,7 +135,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
cliutil.FlagVeryVerbose,
|
cliutil.FlagVeryVerbose,
|
||||||
},
|
},
|
||||||
Commands: append(local, lcli.CommonCommands...),
|
Commands: append(local, append(lcli.CommonCommands, &netCmd)...),
|
||||||
Before: func(c *cli.Context) error {
|
Before: func(c *cli.Context) error {
|
||||||
// this command is explicitly called on markets, inform
|
// this command is explicitly called on markets, inform
|
||||||
// common commands by overriding the repoType.
|
// common commands by overriding the repoType.
|
||||||
|
Loading…
Reference in New Issue
Block a user