cardano-cli
Safe HaskellNone
LanguageHaskell2010

Cardano.CLI.LocalStateQuery

Synopsis

Documentation

checkNodeNetworkId :: MonadIO m => LocalNodeConnectInfo -> m () Source #

Check that the network id the CLI was given matches the network id in the node's genesis, and throw a NodeNetworkIdMismatchError otherwise. This is meant to be run once, before a command that talks to the node.

The node-to-client handshake only compares network magics, so a NetworkId with the right magic but the wrong tag (for example CARDANO_NODE_NETWORK_ID=764824073 instead of CARDANO_NODE_NETWORK_ID=mainnet) connects successfully and would otherwise make the CLI render addresses for the wrong network.

When there is no evidence of a mismatch (the node cannot be reached, it is still in the Byron era, or it does not support the necessary queries) the check passes, and connection problems are left to be reported by the command itself.