* Changing taproot start & timeout heights
* Minor version bits cleanup
This commit is contained in:
parent
3ed2e97ba8
commit
f1f22275de
@ -88,8 +88,8 @@ public:
|
||||
|
||||
// Deployment of Taproot (BIPs 340-342)
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartHeight = 2128896;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeoutHeight = 2322432;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartHeight = 2153088; // Early-to-mid November 2021
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeoutHeight = 2362752; // 364 days later
|
||||
|
||||
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000004e2a7117519981b028e");
|
||||
consensus.defaultAssumeValid = uint256S("0x90c346e4bd95b964cd09cd27f27f15dfed5b1a601b752371e45735cf55015af3"); // 1962809
|
||||
|
||||
@ -1217,30 +1217,30 @@ static void VBSoftForkDescPushBack(UniValue& softforks, const std::string &name,
|
||||
// Deployments that are never active are hidden.
|
||||
if (consensusParams.vDeployments[id].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) return;
|
||||
|
||||
UniValue bip9(UniValue::VOBJ);
|
||||
UniValue version_bits(UniValue::VOBJ);
|
||||
const ThresholdState thresholdState = VersionBitsTipState(consensusParams, id);
|
||||
switch (thresholdState) {
|
||||
case ThresholdState::DEFINED: bip9.pushKV("status", "defined"); break;
|
||||
case ThresholdState::STARTED: bip9.pushKV("status", "started"); break;
|
||||
case ThresholdState::LOCKED_IN: bip9.pushKV("status", "locked_in"); break;
|
||||
case ThresholdState::ACTIVE: bip9.pushKV("status", "active"); break;
|
||||
case ThresholdState::FAILED: bip9.pushKV("status", "failed"); break;
|
||||
case ThresholdState::DEFINED: version_bits.pushKV("status", "defined"); break;
|
||||
case ThresholdState::STARTED: version_bits.pushKV("status", "started"); break;
|
||||
case ThresholdState::LOCKED_IN: version_bits.pushKV("status", "locked_in"); break;
|
||||
case ThresholdState::ACTIVE: version_bits.pushKV("status", "active"); break;
|
||||
case ThresholdState::FAILED: version_bits.pushKV("status", "failed"); break;
|
||||
}
|
||||
if (ThresholdState::STARTED == thresholdState)
|
||||
{
|
||||
bip9.pushKV("bit", consensusParams.vDeployments[id].bit);
|
||||
version_bits.pushKV("bit", consensusParams.vDeployments[id].bit);
|
||||
}
|
||||
bool fHeightBased = consensusParams.vDeployments[id].nStartTime == 0 && consensusParams.vDeployments[id].nTimeout == 0;
|
||||
if (fHeightBased) {
|
||||
bip9.pushKV("start_height", consensusParams.vDeployments[id].nStartHeight);
|
||||
bip9.pushKV("timeout_height", consensusParams.vDeployments[id].nTimeoutHeight);
|
||||
version_bits.pushKV("start_height", consensusParams.vDeployments[id].nStartHeight);
|
||||
version_bits.pushKV("timeout_height", consensusParams.vDeployments[id].nTimeoutHeight);
|
||||
} else {
|
||||
bip9.pushKV("start_time", consensusParams.vDeployments[id].nStartTime);
|
||||
bip9.pushKV("timeout", consensusParams.vDeployments[id].nTimeout);
|
||||
version_bits.pushKV("start_time", consensusParams.vDeployments[id].nStartTime);
|
||||
version_bits.pushKV("timeout", consensusParams.vDeployments[id].nTimeout);
|
||||
}
|
||||
|
||||
int64_t since_height = VersionBitsTipStateSinceHeight(consensusParams, id);
|
||||
bip9.pushKV("since", since_height);
|
||||
version_bits.pushKV("since", since_height);
|
||||
if (ThresholdState::STARTED == thresholdState)
|
||||
{
|
||||
UniValue statsUV(UniValue::VOBJ);
|
||||
@ -1250,12 +1250,12 @@ static void VBSoftForkDescPushBack(UniValue& softforks, const std::string &name,
|
||||
statsUV.pushKV("elapsed", statsStruct.elapsed);
|
||||
statsUV.pushKV("count", statsStruct.count);
|
||||
statsUV.pushKV("possible", statsStruct.possible);
|
||||
bip9.pushKV("statistics", statsUV);
|
||||
version_bits.pushKV("statistics", statsUV);
|
||||
}
|
||||
|
||||
UniValue rv(UniValue::VOBJ);
|
||||
rv.pushKV("type", fHeightBased ? "bip8" : "bip9");
|
||||
rv.pushKV(fHeightBased ? "bip8" : "bip9", bip9);
|
||||
rv.pushKV(fHeightBased ? "bip8" : "bip9", version_bits);
|
||||
if (ThresholdState::ACTIVE == thresholdState) {
|
||||
rv.pushKV("height", since_height);
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ BOOST_FIXTURE_TEST_SUITE(versionbits_tests, TestingSetup)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(versionbits_test)
|
||||
{
|
||||
for (int i = 0; i < 1; i++) {
|
||||
for (int i = 0; i < 64; i++) {
|
||||
// DEFINED -> STARTED after timeout reached -> FAILED
|
||||
VersionBitsTester().TestDefined().TestStateSinceHeight(0)
|
||||
.Mine(1, TestTime(1), 0x100).TestDefined().TestStateSinceHeight(0)
|
||||
@ -293,7 +293,7 @@ BOOST_AUTO_TEST_CASE(versionbits_sanity)
|
||||
// Check start_height is 0 for ALWAYS_ACTIVE and never active deployments
|
||||
if (mainnetParams.vDeployments[i].nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE || mainnetParams.vDeployments[i].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) {
|
||||
BOOST_CHECK_EQUAL(mainnetParams.vDeployments[i].nStartHeight, 0);
|
||||
BOOST_CHECK_EQUAL(mainnetParams.vDeployments[i].nStartHeight, 0);
|
||||
BOOST_CHECK_EQUAL(mainnetParams.vDeployments[i].nTimeoutHeight, 0);
|
||||
}
|
||||
|
||||
// Verify that the deployment windows of different deployment using the
|
||||
|
||||
@ -38,8 +38,7 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
|
||||
cache[pindexPrev] = ThresholdState::DEFINED;
|
||||
break;
|
||||
}
|
||||
if ((fHeightBased && (pindexPrev->nHeight + 1) < nHeightStart) ||
|
||||
(!fHeightBased && pindexPrev->GetMedianTimePast() < nTimeStart)) {
|
||||
if (fHeightBased ? (pindexPrev->nHeight + 1) < nHeightStart : pindexPrev->GetMedianTimePast() < nTimeStart) {
|
||||
// Optimization: don't recompute down further, as we know every earlier block will be before the start time
|
||||
cache[pindexPrev] = ThresholdState::DEFINED;
|
||||
break;
|
||||
@ -59,9 +58,8 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
|
||||
vToCompute.pop_back();
|
||||
|
||||
switch (state) {
|
||||
case ThresholdState::DEFINED: {
|
||||
if ((fHeightBased && (pindexPrev->nHeight + 1) >= nHeightStart) ||
|
||||
(!fHeightBased && pindexPrev->GetMedianTimePast() >= nTimeStart)) {
|
||||
case ThresholdState::DEFINED: {
|
||||
if (fHeightBased ? (pindexPrev->nHeight + 1) >= nHeightStart : pindexPrev->GetMedianTimePast() >= nTimeStart) {
|
||||
stateNext = ThresholdState::STARTED;
|
||||
}
|
||||
break;
|
||||
@ -78,9 +76,8 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
|
||||
}
|
||||
if (count >= nThreshold) {
|
||||
stateNext = ThresholdState::LOCKED_IN;
|
||||
} else if((fHeightBased && (pindexPrev->nHeight + 1) >= nHeightTimeout) ||
|
||||
(!fHeightBased && pindexPrev->GetMedianTimePast() >= nTimeTimeout)) {
|
||||
stateNext = (fHeightBased == true) ? ThresholdState::LOCKED_IN : ThresholdState::FAILED;
|
||||
} else if (fHeightBased ? (pindexPrev->nHeight + 1) >= nHeightTimeout : pindexPrev->GetMedianTimePast() >= nTimeTimeout) {
|
||||
stateNext = fHeightBased ? ThresholdState::LOCKED_IN : ThresholdState::FAILED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ class ZMQTest (BitcoinTestFramework):
|
||||
raw_tx = self.nodes[0].getrawtransaction(orig_txid)
|
||||
bump_info = self.nodes[0].bumpfee(orig_txid)
|
||||
# Mine the pre-bump tx
|
||||
block = create_block(int(self.nodes[0].getbestblockhash(), 16), create_coinbase(self.nodes[0].getblockcount()+1))
|
||||
block = create_block(int(self.nodes[0].getbestblockhash(), 16), create_coinbase(self.nodes[0].getblockcount()+1), version=0x20000000)
|
||||
tx = FromHex(CTransaction(), raw_tx)
|
||||
block.vtx.append(tx)
|
||||
for txid in more_tx:
|
||||
|
||||
@ -775,7 +775,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
if not self.is_wallet_compiled():
|
||||
raise SkipTest("wallet has not been compiled.")
|
||||
if self.options.descriptors:
|
||||
self.skip_if_no_sqlite()
|
||||
raise SkipTest("descriptor wallets not supported.")
|
||||
|
||||
def skip_if_no_sqlite(self):
|
||||
"""Skip the running test if sqlite has not been compiled."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user