Skip to content

Commit

Permalink
Check the lava chain id on provider startup
Browse files Browse the repository at this point in the history
  • Loading branch information
shleikes committed Oct 20, 2024
1 parent 247a41b commit e636e50
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions protocol/rpcprovider/rpcprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,18 @@ rpcprovider 127.0.0.1:3333 OSMOSIS tendermintrpc "wss://www.node-path.com:80,htt
}
utils.LavaFormatInfo("Running with chain-id:" + networkChainId)

resultStatus, err := clientCtx.Client.Status(ctx)
if err != nil {
utils.LavaFormatFatal("failed to get status from node", err)
}

if networkChainId != resultStatus.NodeInfo.Network {
utils.LavaFormatFatal("lava chain-id from flag does not match the lava chain-id of the node", nil,
utils.LogAttr("chain-id-from-flag", networkChainId),
utils.LogAttr("chain-id-from-node", resultStatus.NodeInfo.Network),
)
}

clientCtx = clientCtx.WithChainID(networkChainId)
err = common.VerifyAndHandleUnsupportedFlags(cmd.Flags())
if err != nil {
Expand Down

0 comments on commit e636e50

Please sign in to comment.