Adapt Elements default adress prefix bytes to elements-0.14 style

This commit is contained in:
Gregory Sanders 2019-04-08 09:16:32 -04:00
parent 410d5fa083
commit 91294ca01a
4 changed files with 17 additions and 10 deletions

View file

@ -481,11 +481,17 @@ class CCustomParams : public CRegTestParams {
fMineBlocksOnDemand = args.GetBoolArg("-fmineblocksondemand", fMineBlocksOnDemand);
m_fallback_fee_enabled = args.GetBoolArg("-fallback_fee_enabled", m_fallback_fee_enabled);
bech32_hrp = args.GetArg("-bech32_hrp", bech32_hrp);
bech32_hrp = args.GetArg("-bech32_hrp", "ert");
blech32_hrp = args.GetArg("-blech32_hrp", "el");
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-pubkeyprefix", 111));
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-scriptprefix", 196));
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-pubkeyprefix", 235));
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-scriptprefix", 75));
base58Prefixes[BLINDED_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-blindedprefix", 4));
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, args.GetArg("-secretprefix", 239));
base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentpubkeyprefix", 111));
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentscriptprefix", 196));
parent_bech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");
parent_blech32_hrp = args.GetArg("-parent_blech32_hrp", "bcrt");
std::string extpubprefix = args.GetArg("-extpubkeyprefix", "043587CF");
assert(IsHex(extpubprefix) && extpubprefix.size() == 8 && "-extpubkeyprefix must be hex string of length 8");
@ -559,13 +565,6 @@ class CCustomParams : public CRegTestParams {
const CScript default_script(CScript() << OP_TRUE);
consensus.fedpegScript = StrHexToScriptWithDefault(args.GetArg("-fedpegscript", ""), default_script);
base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentpubkeyprefix", 111));
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentscriptprefix", 196));
parent_bech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");
parent_blech32_hrp = args.GetArg("-parent_blech32_hrp", "bcrt");
base58Prefixes[BLINDED_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-blindedprefix", 4));
// Calculate pegged Bitcoin asset
std::vector<unsigned char> commit = CommitToArguments(consensus, strNetworkID);
uint256 entropy;

View file

@ -319,6 +319,9 @@ def initialize_datadir(dirname, n, chain):
f.write("con_genesis_style=bitcoin\n")
f.write("con_csv_deploy_start=0\n") # Default is -1 (always active)
f.write("blindedaddresses=0\n")
f.write("pubkeyprefix=111\n")
f.write("scriptprefix=196\n")
f.write("bech32_hrp=bcrt\n")
os.makedirs(os.path.join(datadir, 'stderr'), exist_ok=True)
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
return datadir

View file

@ -68,6 +68,8 @@ class FedPegTest(BitcoinTestFramework):
"-anyonecanspendaremine",
"-signblockscript=51", # OP_TRUE
'-con_blocksubsidy=5000000000',
"-pubkeyprefix=111",
"-scriptprefix=196",
])
self.add_nodes(1, [extra_args], chain=[parent_chain], binary=parent_binary, chain_in_args=[not self.options.parent_bitcoin])

View file

@ -330,6 +330,9 @@ def initialize_datadir(dirname, n, chain):
f.write("con_bip66height=1251\n")
f.write("con_csv_deploy_start=0\n") # Enhance tests if removing this line
f.write("blindedaddresses=0\n") # Set to minimize broken tests in favor of custom
f.write("pubkeyprefix=111\n")
f.write("scriptprefix=196\n")
f.write("bech32_hrp=bcrt\n")
os.makedirs(os.path.join(datadir, 'stderr'), exist_ok=True)
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
return datadir