Skip to content

Commit 809a545

Browse files
MarcoFalkeajtowns
authored andcommitted
Remove taproot chain param
1 parent 5558d2f commit 809a545

File tree

7 files changed

+48
-45
lines changed

7 files changed

+48
-45
lines changed

doc/bips.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ BIPs that are implemented by Bitcoin Core (up-to-date up to **v23.0**):
5656
Validation rules for Taproot (including Schnorr signatures and Tapscript
5757
leaves) are implemented as of **v0.21.0** ([PR 19953](https://github.com/bitcoin/bitcoin/pull/19953)),
5858
with mainnet activation as of **v0.21.1** ([PR 21377](https://github.com/bitcoin/bitcoin/pull/21377),
59-
[PR 21686](https://github.com/bitcoin/bitcoin/pull/21686)).
59+
[PR 21686](https://github.com/bitcoin/bitcoin/pull/21686)),
60+
always active as of **v24.0** ([PR 23536](https://github.com/bitcoin/bitcoin/pull/23536)).
6061
* [`BIP 350`](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki): Addresses for native v1+ segregated Witness outputs use Bech32m instead of Bech32 as of **v22.0** ([PR 20861](https://github.com/bitcoin/bitcoin/pull/20861)).
6162
* [`BIP 380`](https://github.com/bitcoin/bips/blob/master/bip-0380.mediawiki)
6263
[`381`](https://github.com/bitcoin/bips/blob/master/bip-0381.mediawiki)

src/chainparams.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ class CMainParams : public CChainParams {
8787
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
8888
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
8989

90-
// Deployment of Taproot (BIPs 340-342)
91-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
92-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1619222400; // April 24th, 2021
93-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1628640000; // August 11th, 2021
94-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 709632; // Approximately November 12th, 2021
95-
9690
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000003404ba0801921119f903495e");
9791
consensus.defaultAssumeValid = uint256S("0x00000000000000000009c97098b5295f7e5f183ac811fb5d1534040adb93cabd"); // 751565
9892

@@ -207,12 +201,6 @@ class CTestNetParams : public CChainParams {
207201
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
208202
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
209203

210-
// Deployment of Taproot (BIPs 340-342)
211-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
212-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1619222400; // April 24th, 2021
213-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1628640000; // August 11th, 2021
214-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
215-
216204
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000076f6e7cbd0beade5d20");
217205
consensus.defaultAssumeValid = uint256S("0x0000000000000004877fa2d36316398528de4f347df2f8a96f76613a298ce060"); // 2344474
218206

@@ -345,12 +333,6 @@ class SigNetParams : public CChainParams {
345333
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
346334
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
347335

348-
// Activation of Taproot (BIPs 340-342)
349-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
350-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
351-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
352-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
353-
354336
// message start is defined as the first 4 bytes of the sha256d of the block script
355337
HashWriter h{};
356338
h << consensus.signet_challenge;
@@ -413,11 +395,6 @@ class CRegTestParams : public CChainParams {
413395
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
414396
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
415397

416-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
417-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
418-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
419-
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
420-
421398
consensus.nMinimumChainWork = uint256{};
422399
consensus.defaultAssumeValid = uint256{};
423400

src/consensus/params.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ enum BuriedDeployment : int16_t {
2525
DEPLOYMENT_DERSIG,
2626
DEPLOYMENT_CSV,
2727
DEPLOYMENT_SEGWIT,
28+
DEPLOYMENT_TAPROOT,
2829
};
29-
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_SEGWIT; }
30+
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_TAPROOT; }
3031

3132
enum DeploymentPos : uint16_t {
3233
DEPLOYMENT_TESTDUMMY,
33-
DEPLOYMENT_TAPROOT, // Deployment of Schnorr/Taproot (BIPs 340-342)
3434
// NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp
3535
MAX_VERSION_BITS_DEPLOYMENTS
3636
};
@@ -140,6 +140,8 @@ struct Params {
140140
return CSVHeight;
141141
case DEPLOYMENT_SEGWIT:
142142
return SegwitHeight;
143+
case DEPLOYMENT_TAPROOT:
144+
return 0;
143145
} // no default case, so the compiler can warn about missing cases
144146
return std::numeric_limits<int>::max();
145147
}

src/deploymentinfo.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
#include <deploymentinfo.h>
66

77
#include <consensus/params.h>
8+
#include <script/interpreter.h>
89

910
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
1011
{
1112
/*.name =*/ "testdummy",
1213
/*.gbt_force =*/ true,
1314
},
14-
{
15-
/*.name =*/ "taproot",
16-
/*.gbt_force =*/ true,
17-
},
1815
};
1916

2017
std::string DeploymentName(Consensus::BuriedDeployment dep)
@@ -31,6 +28,23 @@ std::string DeploymentName(Consensus::BuriedDeployment dep)
3128
return "csv";
3229
case Consensus::DEPLOYMENT_SEGWIT:
3330
return "segwit";
31+
case Consensus::DEPLOYMENT_TAPROOT:
32+
return "taproot";
3433
} // no default case, so the compiler can warn about missing cases
3534
return "";
3635
}
36+
37+
bool BuriedException(Consensus::BuriedDeployment dep, uint32_t flags)
38+
{
39+
switch (dep) {
40+
case Consensus::DEPLOYMENT_HEIGHTINCB:
41+
case Consensus::DEPLOYMENT_CLTV:
42+
case Consensus::DEPLOYMENT_DERSIG:
43+
case Consensus::DEPLOYMENT_CSV:
44+
case Consensus::DEPLOYMENT_SEGWIT:
45+
break;
46+
case Consensus::DEPLOYMENT_TAPROOT:
47+
return (flags & SCRIPT_VERIFY_TAPROOT) == 0;
48+
} // no default case, so the compiler can warn about missing cases
49+
return false;
50+
}

src/deploymentinfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ extern const VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_B
2020

2121
std::string DeploymentName(Consensus::BuriedDeployment dep);
2222

23+
bool BuriedException(Consensus::BuriedDeployment dep, uint32_t flags);
24+
2325
inline std::string DeploymentName(Consensus::DeploymentPos pos)
2426
{
2527
assert(Consensus::ValidDeployment(pos));

src/rpc/blockchain.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,19 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo
11201120

11211121
UniValue rv(UniValue::VOBJ);
11221122
rv.pushKV("type", "buried");
1123+
1124+
UniValue exceptions(UniValue::VARR);
1125+
for (const auto& [block, flags] : chainman.GetConsensus().script_flag_exceptions) {
1126+
if (BuriedException(dep, flags)) {
1127+
exceptions.push_back(block.ToString());
1128+
}
1129+
}
1130+
if (!exceptions.empty()) {
1131+
UniValue buried(UniValue::VOBJ);
1132+
buried.pushKV("exceptions", exceptions);
1133+
rv.pushKV("buried", buried);
1134+
}
1135+
11231136
// getdeploymentinfo reports the softfork as active from when the chain height is
11241137
// one below the activation height
11251138
rv.pushKV("active", DeploymentActiveAfter(blockindex, chainman, dep));
@@ -1272,6 +1285,13 @@ const std::vector<RPCResult> RPCHelpForDeployment{
12721285
{RPCResult::Type::STR, "type", "one of \"buried\", \"bip9\""},
12731286
{RPCResult::Type::NUM, "height", /*optional=*/true, "height of the first block which the rules are or will be enforced (only for \"buried\" type, or \"bip9\" type with \"active\" status)"},
12741287
{RPCResult::Type::BOOL, "active", "true if the rules are enforced for the mempool and the next block"},
1288+
{RPCResult::Type::OBJ, "buried", /*optional=*/true, "status of buried softforks (only for \"buried\" type)",
1289+
{
1290+
{RPCResult::Type::ARR, "exceptions", /*optional=*/true, "blocks exempted from this rule",
1291+
{
1292+
{RPCResult::Type::STR_HEX, "hash", "block hash"},
1293+
}},
1294+
}},
12751295
{RPCResult::Type::OBJ, "bip9", /*optional=*/true, "status of bip9 softforks (only for \"bip9\" type)",
12761296
{
12771297
{RPCResult::Type::NUM, "bit", /*optional=*/true, "the bit (0-28) in the block version field used to signal this softfork (only for \"started\" and \"locked_in\" status)"},
@@ -1340,7 +1360,6 @@ static RPCHelpMan getdeploymentinfo()
13401360
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
13411361
}
13421362
}
1343-
13441363
UniValue deploymentinfo(UniValue::VOBJ);
13451364
deploymentinfo.pushKV("hash", blockindex->GetBlockHash().ToString());
13461365
deploymentinfo.pushKV("height", blockindex->nHeight);

test/functional/rpc_blockchain.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ def check_signalling_deploymentinfo_result(self, gdi_result, height, blockhash,
193193
'bip65': {'type': 'buried', 'active': True, 'height': 4},
194194
'csv': {'type': 'buried', 'active': True, 'height': 5},
195195
'segwit': {'type': 'buried', 'active': True, 'height': 6},
196+
'taproot': {'type': 'buried', 'active': True, 'height': 0},
196197
'testdummy': {
197198
'type': 'bip9',
198199
'bip9': {
@@ -214,20 +215,7 @@ def check_signalling_deploymentinfo_result(self, gdi_result, height, blockhash,
214215
},
215216
'active': False
216217
},
217-
'taproot': {
218-
'type': 'bip9',
219-
'bip9': {
220-
'start_time': -1,
221-
'timeout': 9223372036854775807,
222-
'min_activation_height': 0,
223-
'status': 'active',
224-
'status_next': 'active',
225-
'since': 0,
226-
},
227-
'height': 0,
228-
'active': True
229-
}
230-
}
218+
},
231219
})
232220

233221
def _test_getdeploymentinfo(self):

0 commit comments

Comments
 (0)