|
10 | 10 | #include <chain.h>
|
11 | 11 | #include <chainparams.h>
|
12 | 12 | #include <coins.h>
|
| 13 | +#include <consensus/params.h> |
13 | 14 | #include <consensus/validation.h>
|
14 | 15 | #include <core_io.h>
|
| 16 | +#include <deploymentinfo.h> |
15 | 17 | #include <deploymentstatus.h>
|
16 | 18 | #include <hash.h>
|
17 | 19 | #include <index/blockfilterindex.h>
|
|
38 | 40 | #include <util/translation.h>
|
39 | 41 | #include <validation.h>
|
40 | 42 | #include <validationinterface.h>
|
| 43 | +#include <versionbits.h> |
41 | 44 | #include <warnings.h>
|
42 | 45 |
|
43 | 46 | #include <stdint.h>
|
@@ -1344,25 +1347,25 @@ static RPCHelpMan verifychain()
|
1344 | 1347 | };
|
1345 | 1348 | }
|
1346 | 1349 |
|
1347 |
| -static void BuriedForkDescPushBack(UniValue& softforks, const std::string &name, int softfork_height, int tip_height) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| 1350 | +static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue& softforks, const Consensus::Params& params, Consensus::BuriedDeployment dep) |
1348 | 1351 | {
|
1349 | 1352 | // For buried deployments.
|
1350 | 1353 | // A buried deployment is one where the height of the activation has been hardcoded into
|
1351 | 1354 | // the client implementation long after the consensus change has activated. See BIP 90.
|
1352 | 1355 | // Buried deployments with activation height value of
|
1353 | 1356 | // std::numeric_limits<int>::max() are disabled and thus hidden.
|
1354 |
| - if (softfork_height == std::numeric_limits<int>::max()) return; |
| 1357 | + if (!DeploymentEnabled(params, dep)) return; |
1355 | 1358 |
|
1356 | 1359 | UniValue rv(UniValue::VOBJ);
|
1357 | 1360 | rv.pushKV("type", "buried");
|
1358 | 1361 | // getblockchaininfo reports the softfork as active from when the chain height is
|
1359 | 1362 | // one below the activation height
|
1360 |
| - rv.pushKV("active", tip_height + 1 >= softfork_height); |
1361 |
| - rv.pushKV("height", softfork_height); |
1362 |
| - softforks.pushKV(name, rv); |
| 1363 | + rv.pushKV("active", DeploymentActiveAfter(active_chain_tip, params, dep)); |
| 1364 | + rv.pushKV("height", params.DeploymentHeight(dep)); |
| 1365 | + softforks.pushKV(DeploymentName(dep), rv); |
1363 | 1366 | }
|
1364 | 1367 |
|
1365 |
| -static void BIP9SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue& softforks, const std::string &name, const Consensus::Params& consensusParams, Consensus::DeploymentPos id) |
| 1368 | +static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue& softforks, const Consensus::Params& consensusParams, Consensus::DeploymentPos id) |
1366 | 1369 | {
|
1367 | 1370 | // For BIP9 deployments.
|
1368 | 1371 | // Deployments that are never active are hidden.
|
@@ -1406,7 +1409,7 @@ static void BIP9SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniVal
|
1406 | 1409 | }
|
1407 | 1410 | rv.pushKV("active", ThresholdState::ACTIVE == thresholdState);
|
1408 | 1411 |
|
1409 |
| - softforks.pushKV(name, rv); |
| 1412 | + softforks.pushKV(DeploymentName(id), rv); |
1410 | 1413 | }
|
1411 | 1414 |
|
1412 | 1415 | RPCHelpMan getblockchaininfo()
|
@@ -1503,14 +1506,14 @@ RPCHelpMan getblockchaininfo()
|
1503 | 1506 |
|
1504 | 1507 | const Consensus::Params& consensusParams = Params().GetConsensus();
|
1505 | 1508 | UniValue softforks(UniValue::VOBJ);
|
1506 |
| - BuriedForkDescPushBack(softforks, "bip34", consensusParams.BIP34Height, height); |
1507 |
| - BuriedForkDescPushBack(softforks, "bip66", consensusParams.BIP66Height, height); |
1508 |
| - BuriedForkDescPushBack(softforks, "bip65", consensusParams.BIP65Height, height); |
1509 |
| - BuriedForkDescPushBack(softforks, "csv", consensusParams.CSVHeight, height); |
1510 |
| - BuriedForkDescPushBack(softforks, "segwit", consensusParams.SegwitHeight, height); |
1511 |
| - BIP9SoftForkDescPushBack(tip, softforks, "testdummy", consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); |
1512 |
| - BIP9SoftForkDescPushBack(tip, softforks, "taproot", consensusParams, Consensus::DEPLOYMENT_TAPROOT); |
1513 |
| - obj.pushKV("softforks", softforks); |
| 1509 | + SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_HEIGHTINCB); |
| 1510 | + SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_DERSIG); |
| 1511 | + SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_CLTV); |
| 1512 | + SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_CSV); |
| 1513 | + SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_SEGWIT); |
| 1514 | + SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); |
| 1515 | + SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_TAPROOT); |
| 1516 | + obj.pushKV("softforks", softforks); |
1514 | 1517 |
|
1515 | 1518 | obj.pushKV("warnings", GetWarnings(false).original);
|
1516 | 1519 | return obj;
|
|
0 commit comments