Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5fc85dc
versionbits: add expiry support to versionbit deployments
dathonohm Nov 18, 2025
eee1987
versionbits: add max_activation_height for mandatory BIP9 activation
dathonohm Nov 18, 2025
1d29cec
chainparams: support regtest vbparams for max_activation_height and a…
dathonohm Nov 19, 2025
646a7f8
test: add versionbits unit tests for max_activation_height and active…
dathonohm Jan 27, 2026
1ade1a4
chainparams: support regtest vbparams for per-deployment threshold
dathonohm Dec 29, 2025
3e51b51
versionbits: add mandatory signaling enforcement for max_activation_h…
dathonohm Nov 19, 2025
144e71e
test: add functional tests for modified BIP9 deployment features
dathonohm Mar 19, 2026
956cb1a
script: use TAPROOT_CONTROL_MAX_NODE_COUNT_REDUCED for non-consensus …
luke-jr Oct 3, 2025
809ea79
policy: enforce SCRIPT_VERIFY_REDUCED_DATA as a policy rule
luke-jr Oct 4, 2025
cd83e0a
script: Define SCRIPT_VERIFY_REDUCED_DATA verification flag (unused) …
luke-jr Oct 6, 2025
0095895
script: forbid Taproot annex with SCRIPT_VERIFY_REDUCED_DATA
luke-jr Oct 3, 2025
8e9f15a
script: Forbid OP_IF in Tapscript with SCRIPT_VERIFY_REDUCED_DATA (st…
luke-jr Oct 3, 2025
cc1056e
script: Limit Taproot control block to 257 bytes for SCRIPT_VERIFY_RE…
luke-jr Oct 3, 2025
4fc649b
script: require empty witness for P2A spends
dathonohm Feb 12, 2026
2fa1bf7
consensus: Add no-op flags to CheckTxInputs function
luke-jr Oct 3, 2025
a4f97dc
consensus: Define CheckTxInputsRules::OutputSizeLimit flag (unused) t…
luke-jr Oct 7, 2025
7bad1b2
consensus: When CheckTxInputsRules::OutputSizeLimit is enforced (stil…
luke-jr Oct 7, 2025
5d83816
chainparams: add DEPLOYMENT_REDUCED_DATA temporary BIP9 deployment
dathonohm Nov 19, 2025
6684173
consensus: Enforce SCRIPT_VERIFY_REDUCED_DATA if DEPLOYMENT_REDUCED_D…
luke-jr Oct 4, 2025
108bab0
consensus: Enforce CheckTxInputsRules::OutputSizeLimit when DEPLOYMEN…
luke-jr Oct 4, 2025
25cc6a2
consensus: apply output size limit to generation transactions
dathonohm Jan 14, 2026
b8a8e9f
consensus: Enforce SCRIPT_VERIFY_DISCOURAGE_{UPGRADABLE_WITNESS_PROGR…
luke-jr Oct 4, 2025
d523316
Refactor: Include all reduced_data verify flags in REDUCED_DATA_MANDA…
luke-jr Nov 3, 2025
1e3d874
validation: Extend CheckInputScripts to allow overriding script valid…
luke-jr Nov 3, 2025
c1bea71
validation: Exempt inputs spending UTXOs prior to reduced_data_start_…
luke-jr Nov 3, 2025
6253835
test: implement functional tests for ReducedData Spec
3c853b6299 Nov 5, 2025
4a6bb5a
test: Add UTXO height-based REDUCED_DATA enforcement test
dathonohm Nov 7, 2025
ecaf774
test: add functional tests for modified BIP9 temporary deployment
dathonohm Jan 14, 2026
ad59420
doc: add BIP-110 to bips.md
dathonohm Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/bips.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ BIPs that are implemented by Bitcoin Core:
* [`BIP 86`](https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki): Descriptor wallets by default use the Hierarchical Deterministic Wallet derivation proposed by BIP 86 since **v23.0** ([PR #22364](https://github.com/bitcoin/bitcoin/pull/22364)).
* [`BIP 90`](https://github.com/bitcoin/bips/blob/master/bip-0090.mediawiki): Trigger mechanism for activation of BIPs 34, 65, and 66 has been simplified to block height checks since **v0.14.0** ([PR #8391](https://github.com/bitcoin/bitcoin/pull/8391)).
* [`BIP 94`](https://github.com/bitcoin/bips/blob/master/bip-0094.mediawiki): Testnet 4 (`-testnet4`) supported as of **v28.0** ([PR #29775](https://github.com/bitcoin/bitcoin/pull/29775)).
* [`BIP 110`](https://github.com/bitcoin/bips/blob/master/bip-0110.mediawiki): ReducedData Temporary Softfork (RDTS) consensus rules are implemented as of **FIXME: update version** ([PR #238](https://github.com/bitcoinknots/bitcoin/pull/238)).
* [`BIP 111`](https://github.com/bitcoin/bips/blob/master/bip-0111.mediawiki): `NODE_BLOOM` service bit added, and enforced for all peer versions as of **v0.13.0** ([PR #6579](https://github.com/bitcoin/bitcoin/pull/6579) and [PR #6641](https://github.com/bitcoin/bitcoin/pull/6641)).
* [`BIP 112`](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki): The CHECKSEQUENCEVERIFY opcode has been implemented since **v0.12.1** ([PR #7524](https://github.com/bitcoin/bitcoin/pull/7524)), and has been *buried* since **v0.19.0** ([PR #16060](https://github.com/bitcoin/bitcoin/pull/16060)).
* [`BIP 113`](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki): Median time past lock-time calculations have been implemented since **v0.12.1** ([PR #6566](https://github.com/bitcoin/bitcoin/pull/6566)), and has been *buried* since **v0.19.0** ([PR #16060](https://github.com/bitcoin/bitcoin/pull/16060)).
Expand Down
33 changes: 29 additions & 4 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& opti

for (const std::string& strDeployment : args.GetArgs("-vbparams")) {
std::vector<std::string> vDeploymentParams = SplitString(strDeployment, ':');
if (vDeploymentParams.size() < 3 || 4 < vDeploymentParams.size()) {
throw std::runtime_error("Version bits parameters malformed, expecting deployment:start:end[:min_activation_height]");
if (vDeploymentParams.size() < 3 || 7 < vDeploymentParams.size()) {
throw std::runtime_error("Version bits parameters malformed, expecting deployment:start:end[:min_activation_height[:max_activation_height[:active_duration[:threshold]]]]");
}
CChainParams::VersionBitsParameters vbparams{};
const auto start_time{ToIntegral<int64_t>(vDeploymentParams[1])};
Expand All @@ -91,13 +91,38 @@ void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& opti
} else {
vbparams.min_activation_height = 0;
}
if (vDeploymentParams.size() >= 5) {
const auto max_activation_height{ToIntegral<int>(vDeploymentParams[4])};
if (!max_activation_height) {
throw std::runtime_error(strprintf("Invalid max_activation_height (%s)", vDeploymentParams[4]));
}
vbparams.max_activation_height = *max_activation_height;
}
if (vDeploymentParams.size() >= 6) {
const auto active_duration{ToIntegral<int>(vDeploymentParams[5])};
if (!active_duration) {
throw std::runtime_error(strprintf("Invalid active_duration (%s)", vDeploymentParams[5]));
}
vbparams.active_duration = *active_duration;
}
if (vDeploymentParams.size() >= 7) {
const auto threshold{ToIntegral<int>(vDeploymentParams[6])};
if (!threshold) {
throw std::runtime_error(strprintf("Invalid threshold (%s)", vDeploymentParams[6]));
}
vbparams.threshold = *threshold;
}
// Validate that timeout and max_activation_height are mutually exclusive
if (vbparams.timeout != Consensus::BIP9Deployment::NO_TIMEOUT && vbparams.max_activation_height < std::numeric_limits<int>::max()) {
throw std::runtime_error(strprintf("Cannot specify both timeout (%ld) and max_activation_height (%d) for deployment %s. Use timeout for BIP9 or max_activation_height for mandatory activation deadline, not both.", vbparams.timeout, vbparams.max_activation_height, vDeploymentParams[0]));
}
bool found = false;
for (int j=0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
options.version_bits_parameters[Consensus::DeploymentPos(j)] = vbparams;
found = true;
LogInfo("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d",
vDeploymentParams[0], vbparams.start_time, vbparams.timeout, vbparams.min_activation_height);
LogInfo("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d, max_activation_height=%d, active_duration=%d, threshold=%d",
vDeploymentParams[0], vbparams.start_time, vbparams.timeout, vbparams.min_activation_height, vbparams.max_activation_height, vbparams.active_duration, vbparams.threshold);
break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/consensus/consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ static constexpr unsigned int LOCKTIME_VERIFY_SEQUENCE = (1 << 0);
*/
static constexpr int64_t MAX_TIMEWARP = 600;

static constexpr unsigned int MAX_OUTPUT_SCRIPT_SIZE{34};
static constexpr unsigned int MAX_OUTPUT_DATA_SIZE{83};

#endif // BITCOIN_CONSENSUS_CONSENSUS_H
8 changes: 8 additions & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_
enum DeploymentPos : uint16_t {
DEPLOYMENT_TESTDUMMY,
DEPLOYMENT_TAPROOT, // Deployment of Schnorr/Taproot (BIPs 340-342)
DEPLOYMENT_REDUCED_DATA, // ReducedData Temporary Softfork (RDTS)
// NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp
MAX_VERSION_BITS_DEPLOYMENTS
};
Expand All @@ -54,6 +55,10 @@ struct BIP9Deployment {
* boundary.
*/
int min_activation_height{0};
/** Maximum height for activation. If less than INT_MAX, the deployment will activate
* at this height regardless of signaling (similar to BIP8 flag day).
* std::numeric_limits<int>::max() means no maximum (activation only via signaling). */
int max_activation_height{std::numeric_limits<int>::max()};
/** Period of blocks to check signalling in (usually retarget period, ie params.DifficultyAdjustmentInterval()) */
uint32_t period{2016};
/**
Expand All @@ -62,6 +67,9 @@ struct BIP9Deployment {
* Examples: 1916 for 95%, 1512 for testchains.
*/
uint32_t threshold{1916};
/** For temporary softforks: number of blocks the deployment remains active after activation.
* std::numeric_limits<int>::max() means permanent (never expires). */
int active_duration{std::numeric_limits<int>::max()};

/** Constant for nTimeout very far in the future. */
static constexpr int64_t NO_TIMEOUT = std::numeric_limits<int64_t>::max();
Expand Down
18 changes: 17 additions & 1 deletion src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,30 @@ int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& i
return nSigOps;
}

bool Consensus::CheckTxInputs(const CTransaction& tx, TxValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee)
bool Consensus::CheckOutputSizes(const CTransaction& tx, TxValidationState& state)
{
for (const auto& txout : tx.vout) {
if (txout.scriptPubKey.empty()) continue;
if (txout.scriptPubKey.size() > ((txout.scriptPubKey[0] == OP_RETURN) ? MAX_OUTPUT_DATA_SIZE : MAX_OUTPUT_SCRIPT_SIZE)) {
return state.Invalid(TxValidationResult::TX_PREMATURE_SPEND, "bad-txns-vout-script-toolarge");
}
}
return true;
}

bool Consensus::CheckTxInputs(const CTransaction& tx, TxValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee, const CheckTxInputsRules rules)
{
// are the actual inputs available?
if (!inputs.HaveInputs(tx)) {
return state.Invalid(TxValidationResult::TX_MISSING_INPUTS, "bad-txns-inputs-missingorspent",
strprintf("%s: inputs missing/spent", __func__));
}

// NOTE: CheckTransaction is arguably the more logical place to do this, but it's context-independent, so this is probably the next best place for now
if (rules.test(CheckTxInputsRules::OutputSizeLimit) && !CheckOutputSizes(tx, state)) {
return false;
}

CAmount nValueIn = 0;
for (unsigned int i = 0; i < tx.vin.size(); ++i) {
const COutPoint &prevout = tx.vin[i].prevout;
Expand Down
33 changes: 32 additions & 1 deletion src/consensus/tx_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,45 @@ class TxValidationState;

/** Transaction validation functions */

class CheckTxInputsRules {
using underlying_type = unsigned int;
underlying_type m_flags;
constexpr explicit CheckTxInputsRules(underlying_type flags) noexcept : m_flags(flags) {}

enum class Rule {
None = 0,
OutputSizeLimit = 1 << 0,
};

public:
using enum Rule;

constexpr CheckTxInputsRules(Rule rule) noexcept : m_flags(static_cast<underlying_type>(rule)) {}

[[nodiscard]] constexpr bool test(CheckTxInputsRules rules) const noexcept {
return (m_flags & rules.m_flags) == rules.m_flags;
}

[[nodiscard]] constexpr CheckTxInputsRules operator|(const CheckTxInputsRules other) const noexcept {
return CheckTxInputsRules{m_flags | other.m_flags};
}
};

namespace Consensus {
/**
* Check whether all outputs of this transaction satisfy size limits.
* Regular outputs must be <= MAX_OUTPUT_SCRIPT_SIZE (34 bytes).
* OP_RETURN outputs must be <= MAX_OUTPUT_DATA_SIZE (83 bytes).
*/
bool CheckOutputSizes(const CTransaction& tx, TxValidationState& state);

/**
* Check whether all inputs of this transaction are valid (no double spends and amounts)
* This does not modify the UTXO set. This does not check scripts and sigs.
* @param[out] txfee Set to the transaction fee if successful.
* Preconditions: tx.IsCoinBase() is false.
*/
[[nodiscard]] bool CheckTxInputs(const CTransaction& tx, TxValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee);
[[nodiscard]] bool CheckTxInputs(const CTransaction& tx, TxValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee, CheckTxInputsRules rules);
} // namespace Consensus

/** Auxiliary functions for transaction validation (ideally should not be exposed) */
Expand Down
4 changes: 4 additions & 0 deletions src/deploymentinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> Versi
.name = "taproot",
.gbt_optional_rule = true,
},
VBDeploymentInfo{
.name = "reduced_data",
.gbt_optional_rule = true,
},
};

std::string DeploymentName(Consensus::BuriedDeployment dep)
Expand Down
1 change: 1 addition & 0 deletions src/deploymentstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::Deploy
return params.vDeployments[dep].nStartTime != Consensus::BIP9Deployment::NEVER_ACTIVE;
}


#endif // BITCOIN_DEPLOYMENTSTATUS_H
41 changes: 41 additions & 0 deletions src/kernel/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <primitives/transaction.h>
#include <script/interpreter.h>
#include <script/script.h>
#include <tinyformat.h>
#include <uint256.h>
#include <util/chaintype.h>
#include <util/log.h>
Expand All @@ -29,6 +30,7 @@
#include <iterator>
#include <map>
#include <span>
#include <stdexcept>
#include <utility>

using namespace util::hex_literals;
Expand Down Expand Up @@ -113,6 +115,14 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 709632; // Approximately November 12th, 2021
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1815; // 90%
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
// ReducedData Temporary Softfork (RDTS)
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nStartTime = 1764547200; // December 1st, 2025
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].min_activation_height = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].max_activation_height = 965664; // ~September 1st, 2026
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].active_duration = 52416; // ~1 year
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].threshold = 1109; // 55% of 2016

consensus.nMinimumChainWork = uint256{"0000000000000000000000000000000000000001128750f82f4c366153a3a030"};
consensus.defaultAssumeValid = uint256{"00000000000000000000ccebd6d74d9194d8dcdc1d177c478e094bfad51ba5ac"}; // 938343
Expand Down Expand Up @@ -244,6 +254,13 @@ class CTestNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1512; // 75%
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
// ReducedData Temporary Softfork (RDTS)
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nStartTime = 1764547200; // December 1st, 2025
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].min_activation_height = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].active_duration = 52416; // ~1 year
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].threshold = 1109; // 55% of 2016

consensus.nMinimumChainWork = uint256{"0000000000000000000000000000000000000000000017dde1c649f3708d14b6"};
consensus.defaultAssumeValid = uint256{"000000007a61e4230b28ac5cb6b5e5a0130de37ac1faf2f8987d2fa6505b67f4"}; // 4842348
Expand Down Expand Up @@ -352,6 +369,13 @@ class CTestNet4Params : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1512; // 75%
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
// ReducedData Temporary Softfork (RDTS)
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nStartTime = 1764547200; // December 1st, 2025
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].min_activation_height = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].active_duration = 52416; // ~1 year
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].threshold = 1109; // 55% of 2016

consensus.nMinimumChainWork = uint256{"0000000000000000000000000000000000000000000009a0fe15d0177d086304"};
consensus.defaultAssumeValid = uint256{"0000000002368b1e4ee27e2e85676ae6f9f9e69579b29093e9a82c170bf7cf8a"}; // 123613
Expand Down Expand Up @@ -503,6 +527,10 @@ class SigNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1815; // 90%
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].min_activation_height = 0;

// message start is defined as the first 4 bytes of the sha256d of the block script
HashWriter h{};
Expand Down Expand Up @@ -592,6 +620,12 @@ class CRegTestParams : public CChainParams
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 108; // 75%
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 144;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].min_activation_height = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].period = 144;
consensus.vDeployments[Consensus::DEPLOYMENT_REDUCED_DATA].threshold = 108; // 75%

consensus.nMinimumChainWork = uint256{};
consensus.defaultAssumeValid = uint256{};
Expand Down Expand Up @@ -629,6 +663,13 @@ class CRegTestParams : public CChainParams
consensus.vDeployments[deployment_pos].nStartTime = version_bits_params.start_time;
consensus.vDeployments[deployment_pos].nTimeout = version_bits_params.timeout;
consensus.vDeployments[deployment_pos].min_activation_height = version_bits_params.min_activation_height;
consensus.vDeployments[deployment_pos].max_activation_height = version_bits_params.max_activation_height;
consensus.vDeployments[deployment_pos].active_duration = version_bits_params.active_duration;
// Validated here rather than in src/chainparams.cpp because period is not yet available at parse time
if (version_bits_params.active_duration != std::numeric_limits<int>::max() && version_bits_params.active_duration % consensus.vDeployments[deployment_pos].period != 0) {
throw std::runtime_error(strprintf("active_duration (%d) must be a multiple of period (%d)", version_bits_params.active_duration, consensus.vDeployments[deployment_pos].period));
}
consensus.vDeployments[deployment_pos].threshold = version_bits_params.threshold;
}

genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
Expand Down
4 changes: 4 additions & 0 deletions src/kernel/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <cstddef>
#include <cstdint>
#include <limits>
#include <memory>
#include <optional>
#include <string>
Expand Down Expand Up @@ -142,6 +143,9 @@ class CChainParams
int64_t start_time;
int64_t timeout;
int min_activation_height;
int max_activation_height{std::numeric_limits<int>::max()};
int active_duration{std::numeric_limits<int>::max()};
int threshold{108}; // regtest default: 75% of 144
};

/**
Expand Down
3 changes: 2 additions & 1 deletion src/policy/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ static constexpr script_verify_flags STANDARD_SCRIPT_VERIFY_FLAGS{MANDATORY_SCRI
SCRIPT_VERIFY_CONST_SCRIPTCODE |
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION |
SCRIPT_VERIFY_DISCOURAGE_OP_SUCCESS |
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_PUBKEYTYPE};
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_PUBKEYTYPE |
REDUCED_DATA_MANDATORY_VERIFY_FLAGS};

/** For convenience, standard but not mandatory verify flags. */
static constexpr script_verify_flags STANDARD_NOT_MANDATORY_VERIFY_FLAGS{STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS};
Expand Down
Loading