Skip to content

Commit

Permalink
feat: set address.CurrentNetwork when launch up
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZexiao committed Apr 20, 2023
1 parent 77b7095 commit e97cd0e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 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 @@ -27,6 +29,14 @@ func NodeClient(mctx metrics.MetricsCtx, lc fx.Lifecycle, nodeCfg *config.Node)

closer, err := jsonrpc.NewMergeClient(mctx, addr, "Filecoin", utils.GetInternalStructs(&fullNode), aInfo.AuthHeader())

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 {
closer()
Expand Down

0 comments on commit e97cd0e

Please sign in to comment.