allow all other base58 prefix things to be set by conf file

This commit is contained in:
Gregory Sanders 2018-06-05 13:19:58 -07:00
parent 0c7ab1f128
commit e8d416c9c0
2 changed files with 27 additions and 9 deletions

View file

@ -141,6 +141,26 @@ protected:
fRequireStandard = GetBoolArg("-frequirestandard", false);
fMineBlocksOnDemand = GetBoolArg("-fmineblocksondemand", true);
anyonecanspend_aremine = GetBoolArg("-anyonecanspendaremine", true);
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, GetArg("-pubkeyprefix", 235));
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, GetArg("-scriptprefix", 75));
base58Prefixes[BLINDED_ADDRESS]= std::vector<unsigned char>(1, GetArg("-blindedprefix", 4));
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, GetArg("-secretprefix", 239));
std::string extpubprefix = GetArg("-extpubkeyprefix", "043587CF");
if (!IsHex(extpubprefix) || extpubprefix.size() != 8) {
assert("-extpubkeyprefix must be hex string of length 8" && false);
}
base58Prefixes[EXT_PUBLIC_KEY] = ParseHex(extpubprefix);
std::string extprvprefix = GetArg("-extprvkeyprefix", "04358394");
if (!IsHex(extprvprefix) || extprvprefix.size() != 8) {
assert("-extprvkeyprefix must be hex string of length 8" && false);
}
base58Prefixes[EXT_SECRET_KEY] = ParseHex(extprvprefix);
base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentpubkeyprefix", 111));
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentscriptprefix", 196));
}
public:
@ -199,15 +219,6 @@ public:
0,
0
};
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,235);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,75);
base58Prefixes[BLINDED_ADDRESS]= std::vector<unsigned char>(1,4);
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentpubkeyprefix", 111));
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentscriptprefix", 196));
}
};

View file

@ -19,6 +19,13 @@ void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp)
strUsage += HelpMessageOpt("-chain=<chain>", strprintf(_("Use the chain <chain> (default: %s). Anything except main is allowed"), CHAINPARAMS_REGTEST));
if (debugHelp) {
strUsage += HelpMessageOpt("-regtest", strprintf(_("Equivalent to -chain=%s"), CHAINPARAMS_REGTEST));
strUsage += HelpMessageOpt("-pubkeyprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 pubkey address. (default: %d)"), 235));
strUsage += HelpMessageOpt("-scriptprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 script address. (default: %d)"), 75));
strUsage += HelpMessageOpt("-secretprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 secret key encoding. (default: %d)"), 239));
strUsage += HelpMessageOpt("-extpubkeyprefix", strprintf(_("The 4-byte prefix, in hex, of the chain's base58 extended public key encoding. (default: %s)"), "043587CF"));
strUsage += HelpMessageOpt("-extprvkeyprefix", strprintf(_("The 4-byte prefix, in hex, of the chain's base58 extended private key encoding. (default: %s)"), "04358394"));
strUsage += HelpMessageOpt("-blindedprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 script address. (default: %d)"), 4));
}
}