Skip to content

Commit

Permalink
get network name from DI
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Mar 12, 2021
1 parent a345888 commit 77f58b5
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions node/impl/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/stmgr"
"github.com/filecoin-project/lotus/node/impl/client"
"github.com/filecoin-project/lotus/node/impl/common"
"github.com/filecoin-project/lotus/node/impl/full"
Expand All @@ -36,7 +35,8 @@ type FullNodeAPI struct {
full.SyncAPI
full.BeaconAPI

DS dtypes.MetadataDS
DS dtypes.MetadataDS
NetworkName dtypes.NetworkName
}

func (n *FullNodeAPI) CreateBackup(ctx context.Context, fpath string) error {
Expand All @@ -58,16 +58,11 @@ func (n *FullNodeAPI) NodeStatus(ctx context.Context, inclChainStatus bool) (sta
peersMsgs := make(map[peer.ID]struct{})
peersBlocks := make(map[peer.ID]struct{})

netName, err := stmgr.GetNetworkName(ctx, n.StateManager, curTs.ParentState())
if err != nil {
return status, err
}

for _, p := range n.PubSub.ListPeers(build.MessagesTopic(netName)) {
for _, p := range n.PubSub.ListPeers(build.MessagesTopic(n.NetworkName)) {
peersMsgs[p] = struct{}{}
}

for _, p := range n.PubSub.ListPeers(build.BlocksTopic(netName)) {
for _, p := range n.PubSub.ListPeers(build.BlocksTopic(n.NetworkName)) {
peersBlocks[p] = struct{}{}
}

Expand Down

0 comments on commit 77f58b5

Please sign in to comment.