Skip to content

Commit

Permalink
Merge pull request #321 from filecoin-project/feat/tanlang/set-Curren…
Browse files Browse the repository at this point in the history
…tNetwork-of-address

feat: set address.CurrentNetwork when launch up
  • Loading branch information
simlecode authored Apr 20, 2023
2 parents 77b7095 + eed1e2b commit 91e9c12
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/clients/node_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import (

"go.uber.org/fx"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-jsonrpc"

"github.com/filecoin-project/venus-market/v2/config"
"github.com/filecoin-project/venus-market/v2/utils"

"github.com/filecoin-project/venus/venus-shared/api"
v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
"github.com/filecoin-project/venus/venus-shared/types"

"github.com/ipfs-force-community/metrics"
)
Expand All @@ -26,6 +28,17 @@ func NodeClient(mctx metrics.MetricsCtx, lc fx.Lifecycle, nodeCfg *config.Node)
}

closer, err := jsonrpc.NewMergeClient(mctx, addr, "Filecoin", utils.GetInternalStructs(&fullNode), aInfo.AuthHeader())
if err != nil {
return nil, err
}

netName, err := fullNode.StateNetworkName(mctx)
if err != nil {
return nil, err
}
if netName == types.NetworkNameMain {
address.CurrentNetwork = address.Mainnet
}

lc.Append(fx.Hook{
OnStop: func(_ context.Context) error {
Expand Down

0 comments on commit 91e9c12

Please sign in to comment.