Does Catapult use a unique identifier for a network or is there some other unique manner of identifying a network?
As far as I can tell NetworkIdentifier is used to do this.
namespace {
const std::array<std::pair<const char*, NetworkIdentifier>, 4> String_To_Network_Identifier_Pairs{{
{ "mijin", NetworkIdentifier::Mijin },
{ "mijin-test", NetworkIdentifier::Mijin_Test },
{ "public", NetworkIdentifier::Public },
{ "public-test", NetworkIdentifier::Public_Test }
}};
}
Which seems to map to this:
#define NETWORK_IDENTIFIER_LIST \
/* A default (zero) identifier that does not identify any known network. */ \
ENUM_VALUE(Zero, 0) \
\
/* Mijin network identifier. */ \
ENUM_VALUE(Mijin, 0x60) \
\
/* Mijin test network identifier. */ \
ENUM_VALUE(Mijin_Test, 0x90) \
\
/* Public main network identifier. */ \
ENUM_VALUE(Public, 0x68) \
\
/* Public test network identifier. */ \
ENUM_VALUE(Public_Test, 0x98)
But I feel like this is not right. On Tendermint for instance, it generates a unique network hash, then you set at least one root peer - then all new nodes can find each other using that hash and listed peer(s).
Also I’m aware that there is a generationHash but it seems to be dependent on that NetworkIdentifier - if this is used, can we guarantee the unique network using network ID mijin-test?
/// Creates a network info around a network \a identifier, a nemesis public key (\a publicKey)
/// and a nemesis generation hash (\a generationHash).
constexpr NetworkInfo(NetworkIdentifier identifier, const Key& publicKey, const Hash256& generationHash)
: Identifier(identifier)
, PublicKey(publicKey)
, GenerationHash(generationHash)
{}
What is the process for Catapult?