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 eed1e2b
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 eed1e2b

Please sign in to comment.