Skip to content

Commit

Permalink
Merge branch 'mempool/rm_tachyonactivationtime' into 'master'
Browse files Browse the repository at this point in the history
Remove -tachyonactivationtime from CLI args & consensus rules

See merge request bitcoin-cash-node/bitcoin-cash-node!1213
  • Loading branch information
ftrader committed May 20, 2021
2 parents 55ac736 + 48ce9ee commit b5b5bdf
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 67 deletions.
20 changes: 2 additions & 18 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class CMainParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC protocol upgrade
consensus.tachyonActivationTime = 1621080000;
// May 15, 2021 12:00:00 UTC protocol upgrade was 1621080000, but since this upgrade was for relay rules only,
// we do not track this time (since it does not apply at all to the blockchain itself).

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;
Expand Down Expand Up @@ -345,10 +345,6 @@ class CTestNetParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down Expand Up @@ -519,10 +515,6 @@ class CTestNet4Params : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down Expand Up @@ -666,10 +658,6 @@ class CScaleNetParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down Expand Up @@ -797,10 +785,6 @@ class CRegTestParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down
10 changes: 0 additions & 10 deletions src/consensus/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,6 @@ bool IsAxionEnabled(const Consensus::Params &params,
gArgs.GetArg("-axionactivationtime", params.axionActivationTime);
}

bool IsTachyonEnabled(const Consensus::Params &params,
const CBlockIndex *pindexPrev) {
if (pindexPrev == nullptr) {
return false;
}

return pindexPrev->GetMedianTimePast() >=
gArgs.GetArg("-tachyonactivationtime", params.tachyonActivationTime);
}

bool IsUpgrade8Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev) {
if (pindexPrev == nullptr) {
return false;
Expand Down
5 changes: 2 additions & 3 deletions src/consensus/activation.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ bool IsPhononEnabled(const Consensus::Params &params,
bool IsAxionEnabled(const Consensus::Params &params,
const CBlockIndex *pindexPrev);

/** Check if May 15th, 2021 protocol upgrade has activated. */
bool IsTachyonEnabled(const Consensus::Params &params,
const CBlockIndex *pindexPrev);
/** Note: May 15th, 2021 protocol upgrade was relay-only, and has no on-chain rules.
* The function "IsTachyonEnabled" that used to live here has been removed. */

/** Check if tentative May 15th, 2022 protocol upgrade has activated. */
bool IsUpgrade8Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev);
Expand Down
6 changes: 4 additions & 2 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ struct Params {
int phononHeight;
/** Unix time used for MTP activation of 15 Nov 2020 12:00:00 UTC upgrade */
int axionActivationTime;
/** Unix time used for tentative MTP activation of 15 May 2021 12:00:00 UTC upgrade */
int tachyonActivationTime;

/** Note: Unix time used for MTP activation of the 15 May 2021 12:00:00 UTC upgrade was 1621080000, but since
* it was a relay-rules-only upgrade, so we no longer track this time for blockchain consensus. */

/** Unix time used for tentative MTP activation of 15 May 2022 12:00:00 UTC upgrade */
int64_t upgrade8ActivationTime;
/** Default blocksize limit -- can be overridden with the -excessiveblocksize= command-line switch */
Expand Down
7 changes: 0 additions & 7 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,6 @@ void SetupServerArgs() {
"default: %d). This option only has an effect on regtest or scalenet.",
defaultChainParams->GetConsensus().axionActivationTime),
true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg(
"-tachyonactivationtime=<n>",
strprintf("Activation time of the May 2021 Bitcoin Cash Network Upgrade "
"(<n> seconds since epoch, default: %d, non-mainnet: %d)",
defaultChainParams->GetConsensus().tachyonActivationTime,
testnetChainParams->GetConsensus().tachyonActivationTime),
true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg(
"-upgrade8activationtime=<n>",
strprintf("Activation time of the tentative May 2022 Bitcoin Cash Network Upgrade (<n> seconds since epoch, "
Expand Down
26 changes: 0 additions & 26 deletions src/test/activation_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,32 +104,6 @@ BOOST_AUTO_TEST_CASE(isaxionenabled) {
}
}

BOOST_AUTO_TEST_CASE(istachyonenabled) {
CBlockIndex prev;

const Consensus::Params &params = Params().GetConsensus();
const auto activation =
gArgs.GetArg("-tachyonctivationtime", params.tachyonActivationTime);
SetMockTime(activation - 1000000);

BOOST_CHECK(!IsTachyonEnabled(params, nullptr));

std::array<CBlockIndex, 12> blocks;
for (size_t i = 1; i < blocks.size(); ++i) {
blocks[i].pprev = &blocks[i - 1];
}
BOOST_CHECK(!IsTachyonEnabled(params, &blocks.back()));

SetMTP(blocks, activation - 1);
BOOST_CHECK(!IsTachyonEnabled(params, &blocks.back()));

SetMTP(blocks, activation);
BOOST_CHECK(IsTachyonEnabled(params, &blocks.back()));

SetMTP(blocks, activation + 1);
BOOST_CHECK(IsTachyonEnabled(params, &blocks.back()));
}

BOOST_AUTO_TEST_CASE(isupgrade8enabled) {
CBlockIndex prev;

Expand Down
1 change: 0 additions & 1 deletion src/test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct CustomArgumentsFixture {
const std::set<std::string> testArgs = {
testsuitename,
"-axionactivationtime",
"-tachyonactivationtime",
};

for (const auto &arg : testArgs) {
Expand Down

0 comments on commit b5b5bdf

Please sign in to comment.