From b6420da34c432dc201b0225302decd9f03a57665 Mon Sep 17 00:00:00 2001 From: motty Date: Thu, 30 Mar 2023 09:09:14 +0900 Subject: [PATCH] fix SCRIPT_ADDRESS Deprecate the old p2sh-segwit address prefix. --- configure.ac | 2 +- src/chainparams.cpp | 18 +++++++----------- src/chainparams.h | 1 - src/key_io.cpp | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 71ee302635f..f50e5594145 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.69]) define(_CLIENT_VERSION_MAJOR, 24) define(_CLIENT_VERSION_MINOR, 0) -define(_CLIENT_VERSION_BUILD, 2) +define(_CLIENT_VERSION_BUILD, 3) define(_CLIENT_VERSION_RC, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2023) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index b16fa7c4e17..0c3a5de6466 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -128,8 +128,7 @@ class CMainParams : public CChainParams { vSeeds.emplace_back("dnsseed.tamami-foundation.org"); base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,50); // M - base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,5); - base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1,55); // P + base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,55); // P base58Prefixes[SECRET_KEY] = std::vector(1,176); base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E}; base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4}; @@ -242,9 +241,8 @@ class CTestNetParams : public CChainParams { vSeeds.emplace_back("testnet-dnsseed.monacoin.org"); vSeeds.emplace_back("testnet-dnsseed.tamami-foundation.org"); - base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111); - base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,196); - base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1,117); + base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111); // m or n + base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,117); // p base58Prefixes[SECRET_KEY] = std::vector(1,239); base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF}; base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94}; @@ -376,9 +374,8 @@ class SigNetParams : public CChainParams { vFixedSeeds.clear(); - base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111); - base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,196); - base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1,117); + base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111); // m or n + base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,117); // p base58Prefixes[SECRET_KEY] = std::vector(1,239); base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF}; base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94}; @@ -478,9 +475,8 @@ class CRegTestParams : public CChainParams { 0 }; - base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111); - base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,196); - base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1,117); + base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111); // m or n + base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,117); // p base58Prefixes[SECRET_KEY] = std::vector(1,239); base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF}; base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94}; diff --git a/src/chainparams.h b/src/chainparams.h index 47b7ed2a75f..35e761e2d27 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -72,7 +72,6 @@ class CChainParams enum Base58Type { PUBKEY_ADDRESS, SCRIPT_ADDRESS, - SCRIPT_ADDRESS2, SECRET_KEY, EXT_PUBLIC_KEY, EXT_SECRET_KEY, diff --git a/src/key_io.cpp b/src/key_io.cpp index 98dad7c1059..6d77bcf4981 100644 --- a/src/key_io.cpp +++ b/src/key_io.cpp @@ -33,7 +33,7 @@ class DestinationEncoder std::string operator()(const ScriptHash& id) const { - std::vector data = m_params.Base58Prefix(CChainParams::SCRIPT_ADDRESS2); + std::vector data = m_params.Base58Prefix(CChainParams::SCRIPT_ADDRESS); data.insert(data.end(), id.begin(), id.end()); return EncodeBase58Check(data); }