mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge 8e9801bfc4 into merged_master (Bitcoin PR bitcoin/bitcoin#22818)
This commit is contained in:
commit
13fb374543
19 changed files with 98 additions and 91 deletions
|
|
@ -566,12 +566,12 @@ public:
|
|||
consensus.signet_challenge.clear();
|
||||
consensus.nSubsidyHalvingInterval = 150;
|
||||
consensus.BIP16Exception = uint256();
|
||||
consensus.BIP34Height = 2; // BIP34 activated on regtest (Block at height 1 not enforced for testing purposes)
|
||||
consensus.BIP34Height = 1; // Always active unless overridden
|
||||
consensus.BIP34Hash = uint256();
|
||||
consensus.BIP65Height = 111; // BIP65 activated on regtest (Block at height 110 and earlier not enforced for testing purposes)
|
||||
consensus.BIP66Height = 102; // BIP66 activated on regtest (Block at height 101 and earlier not enforced for testing purposes)
|
||||
consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)
|
||||
consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden
|
||||
consensus.BIP65Height = 1; // Always active unless overridden
|
||||
consensus.BIP66Height = 1; // Always active unless overridden
|
||||
consensus.CSVHeight = 1; // Always active unless overridden
|
||||
consensus.SegwitHeight = 1; // Always active unless overridden
|
||||
consensus.MinBIP9WarningHeight = 0;
|
||||
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
|
|
@ -685,15 +685,38 @@ public:
|
|||
void UpdateActivationParametersFromArgs(const ArgsManager& args);
|
||||
};
|
||||
|
||||
static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& consensus)
|
||||
{
|
||||
for (const std::string& arg : args.GetArgs("-testactivationheight")) {
|
||||
const auto found{arg.find('@')};
|
||||
if (found == std::string::npos) {
|
||||
throw std::runtime_error(strprintf("Invalid format (%s) for -testactivationheight=name@height.", arg));
|
||||
}
|
||||
const auto name{arg.substr(0, found)};
|
||||
const auto value{arg.substr(found + 1)};
|
||||
int32_t height;
|
||||
if (!ParseInt32(value, &height) || height < 0 || height >= std::numeric_limits<int>::max()) {
|
||||
throw std::runtime_error(strprintf("Invalid height value (%s) for -testactivationheight=name@height.", arg));
|
||||
}
|
||||
if (name == "segwit") {
|
||||
consensus.SegwitHeight = int{height};
|
||||
} else if (name == "bip34") {
|
||||
consensus.BIP34Height = int{height};
|
||||
} else if (name == "dersig") {
|
||||
consensus.BIP66Height = int{height};
|
||||
} else if (name == "cltv") {
|
||||
consensus.BIP65Height = int{height};
|
||||
} else if (name == "csv") {
|
||||
consensus.CSVHeight = int{height};
|
||||
} else {
|
||||
throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args)
|
||||
{
|
||||
if (args.IsArgSet("-segwitheight")) {
|
||||
int64_t height = args.GetArg("-segwitheight", consensus.SegwitHeight);
|
||||
if (height < 0 || height >= std::numeric_limits<int>::max()) {
|
||||
throw std::runtime_error(strprintf("Activation height %ld for segwit is out of valid range.", height));
|
||||
}
|
||||
consensus.SegwitHeight = static_cast<int>(height);
|
||||
}
|
||||
MaybeUpdateHeights(args, consensus);
|
||||
|
||||
if (!args.IsArgSet("-vbparams")) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue