Merge bitcoin/bitcoin#30625: chainparams: Handle Testnet4 in GetNetworkForMagic

b0ec8716bf chainparams: Handle Testnet4 in GetNetworkForMagic (Fabian Jahr)

Pull request description:

  Found during testing: The recently introduced `GetNetworkForMagic()` doesn't handle Testnet4 yet.

ACKs for top commit:
  tdb3:
    cr ACK b0ec8716bf
  maflcko:
    review ACK b0ec8716bf
  theStack:
    ACK b0ec8716bf
  willcl-ark:
    crACK b0ec8716bf

Tree-SHA512: 77cd0a6791529e5c5dfdb25cff3eff77224be9058d7cf4a8b3544651eb44c5e8ee90c5abfb9751ab0e11c5aa2d8477831dbf1868c4d5909481e0979e4db1eb28
This commit is contained in:
merge-script 2024-08-12 11:26:26 +01:00
commit c7b8f6f2e2
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -685,6 +685,7 @@ std::optional<ChainType> GetNetworkForMagic(const MessageStartChars& message)
{
const auto mainnet_msg = CChainParams::Main()->MessageStart();
const auto testnet_msg = CChainParams::TestNet()->MessageStart();
const auto testnet4_msg = CChainParams::TestNet4()->MessageStart();
const auto regtest_msg = CChainParams::RegTest({})->MessageStart();
const auto signet_msg = CChainParams::SigNet({})->MessageStart();
@ -692,6 +693,8 @@ std::optional<ChainType> GetNetworkForMagic(const MessageStartChars& message)
return ChainType::MAIN;
} else if (std::equal(message.begin(), message.end(), testnet_msg.data())) {
return ChainType::TESTNET;
} else if (std::equal(message.begin(), message.end(), testnet4_msg.data())) {
return ChainType::TESTNET4;
} else if (std::equal(message.begin(), message.end(), regtest_msg.data())) {
return ChainType::REGTEST;
} else if (std::equal(message.begin(), message.end(), signet_msg.data())) {