From 15670942c36dd6ffc185ae80152c2cd3f0651eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 6 Oct 2020 16:29:16 +0200 Subject: [PATCH] Fix pond --- cmd/lotus-storage-miner/run.go | 16 ++++++++-------- lotuspond/spawn.go | 12 +++++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cmd/lotus-storage-miner/run.go b/cmd/lotus-storage-miner/run.go index a5d996f78..98a9cfaba 100644 --- a/cmd/lotus-storage-miner/run.go +++ b/cmd/lotus-storage-miner/run.go @@ -33,7 +33,7 @@ var runCmd = &cli.Command{ Usage: "Start a lotus miner process", Flags: []cli.Flag{ &cli.StringFlag{ - Name: "api", + Name: "miner-api", Usage: "2345", }, &cli.BoolFlag{ @@ -61,7 +61,7 @@ var runCmd = &cli.Command{ nodeApi, ncloser, err := lcli.GetFullNodeAPI(cctx) if err != nil { - return err + return xerrors.Errorf("getting full node api: %w", err) } defer ncloser() ctx := lcli.DaemonContext(cctx) @@ -112,29 +112,29 @@ var runCmd = &cli.Command{ node.Online(), node.Repo(r), - node.ApplyIf(func(s *node.Settings) bool { return cctx.IsSet("api") }, + node.ApplyIf(func(s *node.Settings) bool { return cctx.IsSet("miner-api") }, node.Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) { - return multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/" + cctx.String("api")) + return multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/" + cctx.String("miner-api")) })), node.Override(new(api.FullNode), nodeApi), ) if err != nil { - return err + return xerrors.Errorf("creating node: %w", err) } endpoint, err := r.APIEndpoint() if err != nil { - return err + return xerrors.Errorf("getting API endpoint: %w", err) } // Bootstrap with full node remoteAddrs, err := nodeApi.NetAddrsListen(ctx) if err != nil { - return err + return xerrors.Errorf("getting full node libp2p address: %w", err) } if err := minerapi.NetConnect(ctx, remoteAddrs); err != nil { - return err + return xerrors.Errorf("connecting to full node (libp2p): %w", err) } log.Infof("Remote version %s", v) diff --git a/lotuspond/spawn.go b/lotuspond/spawn.go index 8b2e8661d..ce01b115e 100644 --- a/lotuspond/spawn.go +++ b/lotuspond/spawn.go @@ -11,16 +11,16 @@ import ( "sync/atomic" "time" - "github.com/filecoin-project/lotus/chain/actors/policy" - "github.com/filecoin-project/lotus/chain/types" - + "github.com/google/uuid" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/gen" + "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/cmd/lotus-seed/seed" "github.com/filecoin-project/lotus/genesis" ) @@ -69,6 +69,8 @@ func (api *api) Spawn() (nodeInfo, error) { Meta: (&genesis.AccountMeta{Owner: genm.Owner}).ActorMeta(), }) template.VerifregRootKey = gen.DefaultVerifregRootkeyActor + template.RemainderAccount = gen.DefaultRemainderAccountActor + template.NetworkName = "pond-" + uuid.New().String() tb, err := json.Marshal(&template) if err != nil { @@ -188,7 +190,7 @@ func (api *api) SpawnStorage(fullNodeRepo string) (nodeInfo, error) { mux := newWsMux() - cmd = exec.Command("./lotus-miner", "run", "--api", fmt.Sprintf("%d", 2500+id), "--nosync") + cmd = exec.Command("./lotus-miner", "run", "--miner-api", fmt.Sprintf("%d", 2500+id), "--nosync") cmd.Stderr = io.MultiWriter(os.Stderr, errlogfile, mux.errpw) cmd.Stdout = io.MultiWriter(os.Stdout, logfile, mux.outpw) cmd.Env = append(os.Environ(), "LOTUS_MINER_PATH="+dir, "LOTUS_PATH="+fullNodeRepo) @@ -248,7 +250,7 @@ func (api *api) RestartNode(id int32) (nodeInfo, error) { var cmd *exec.Cmd if nd.meta.Storage { - cmd = exec.Command("./lotus-miner", "run", "--api", fmt.Sprintf("%d", 2500+id), "--nosync") + cmd = exec.Command("./lotus-miner", "run", "--miner-api", fmt.Sprintf("%d", 2500+id), "--nosync") } else { cmd = exec.Command("./lotus", "daemon", "--api", fmt.Sprintf("%d", 2500+id)) }