Include Base58 encoded prefixes in chainparams

This commit is contained in:
Reese Russell 2024-09-29 05:32:37 +00:00
parent 366678ffc6
commit 749977cbb5
2 changed files with 32 additions and 0 deletions

View file

@ -160,6 +160,12 @@ public:
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
base58EncodedPrefixes[PUBKEY_ADDRESS] = {"1"};
base58EncodedPrefixes[SCRIPT_ADDRESS] = {"3"};
base58EncodedPrefixes[SECRET_KEY] = {"5","K","L"};
base58EncodedPrefixes[EXT_PUBLIC_KEY] = {"xpub"};
base58EncodedPrefixes[EXT_SECRET_KEY] = {"xpriv"};
bech32_hrp = "bc";
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_main), std::end(chainparams_seed_main));
@ -273,6 +279,12 @@ public:
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
base58EncodedPrefixes[PUBKEY_ADDRESS] = {"m","n"};
base58EncodedPrefixes[SCRIPT_ADDRESS] = {"2"};
base58EncodedPrefixes[SECRET_KEY] = {"9","c"};
base58EncodedPrefixes[EXT_PUBLIC_KEY] = {"tpub"};
base58EncodedPrefixes[EXT_SECRET_KEY] = {"tpriv"};
bech32_hrp = "tb";
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));
@ -377,6 +389,12 @@ public:
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
base58EncodedPrefixes[PUBKEY_ADDRESS] = {"m","n"};
base58EncodedPrefixes[SCRIPT_ADDRESS] = {"2"};
base58EncodedPrefixes[SECRET_KEY] = {"9","c"};
base58EncodedPrefixes[EXT_PUBLIC_KEY] = {"tpub"};
base58EncodedPrefixes[EXT_SECRET_KEY] = {"tpriv"};
bech32_hrp = "tb";
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_testnet4), std::end(chainparams_seed_testnet4));
@ -511,6 +529,12 @@ public:
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
base58EncodedPrefixes[PUBKEY_ADDRESS] = {"m","n"};
base58EncodedPrefixes[SCRIPT_ADDRESS] = {"2"};
base58EncodedPrefixes[SECRET_KEY] = {"9","c"};
base58EncodedPrefixes[EXT_PUBLIC_KEY] = {"tpub"};
base58EncodedPrefixes[EXT_SECRET_KEY] = {"tpriv"};
bech32_hrp = "tb";
fDefaultConsistencyChecks = false;
@ -648,6 +672,12 @@ public:
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
base58EncodedPrefixes[PUBKEY_ADDRESS] = {"m","n"};
base58EncodedPrefixes[SCRIPT_ADDRESS] = {"2"};
base58EncodedPrefixes[SECRET_KEY] = {"9","c"};
base58EncodedPrefixes[EXT_PUBLIC_KEY] = {"tpub"};
base58EncodedPrefixes[EXT_SECRET_KEY] = {"tpriv"};
bech32_hrp = "bcrt";
}
};

View file

@ -118,6 +118,7 @@ public:
/** Return the list of hostnames to look up for DNS seeds */
const std::vector<std::string>& DNSSeeds() const { return vSeeds; }
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
const std::vector<std::string_view>& Base58EncodedPrefix(Base58Type type) const { return base58EncodedPrefixes[type]; }
const std::string& Bech32HRP() const { return bech32_hrp; }
const std::vector<uint8_t>& FixedSeeds() const { return vFixedSeeds; }
const CCheckpointData& Checkpoints() const { return checkpointData; }
@ -176,6 +177,7 @@ protected:
uint64_t m_assumed_chain_state_size;
std::vector<std::string> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
std::vector<std::string_view> base58EncodedPrefixes[MAX_BASE58_TYPES];
std::string bech32_hrp;
ChainType m_chain_type;
CBlock genesis;