Page MenuHomePhabricator

D12037.diff
No OneTemporary

D12037.diff

diff --git a/src/consensus/activation.h b/src/consensus/activation.h
--- a/src/consensus/activation.h
+++ b/src/consensus/activation.h
@@ -43,4 +43,8 @@
bool IsGluonEnabled(const Consensus::Params &params,
const CBlockIndex *pindexPrev);
+/** Check if May 15th, 2023 protocol upgrade has activated. */
+bool IsWellingtonEnabled(const Consensus::Params &params,
+ const CBlockIndex *pindexPrev);
+
#endif // BITCOIN_CONSENSUS_ACTIVATION_H
diff --git a/src/consensus/activation.cpp b/src/consensus/activation.cpp
--- a/src/consensus/activation.cpp
+++ b/src/consensus/activation.cpp
@@ -100,3 +100,14 @@
return IsGluonEnabled(params, pindexPrev->nHeight);
}
+
+bool IsWellingtonEnabled(const Consensus::Params &params,
+ const CBlockIndex *pindexPrev) {
+ if (pindexPrev == nullptr) {
+ return false;
+ }
+
+ return pindexPrev->GetMedianTimePast() >=
+ gArgs.GetIntArg("-wellingtonactivationtime",
+ params.wellingtonActivationTime);
+}
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -427,6 +427,8 @@
"-rootcertificates=<file>",
"-splash",
"-uiplatform",
+ // TODO remove after the May 2023 upgrade
+ "-wellingtonactivationtime",
};
// Set all of the args and their help
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -272,9 +272,8 @@
"--catch_system_errors=no"
--
"-testsuitename=Bitcoin ABC unit tests with next upgrade activated"
- # TODO This needs to be updated to match next upgrade
- # Dec. 1st, 2019 at 00:00:00
- # -gluonactivationtime=1644922800
+ # Sep. 20th, 2022 at 12:00:00
+ -wellingtonactivationtime=1663675200
)
endforeach()
endfunction()
diff --git a/src/test/activation_tests.cpp b/src/test/activation_tests.cpp
--- a/src/test/activation_tests.cpp
+++ b/src/test/activation_tests.cpp
@@ -52,4 +52,28 @@
testPastActivation(IsGluonEnabled, consensus, consensus.gluonHeight);
}
+BOOST_AUTO_TEST_CASE(iswellingtonenabled) {
+ const Consensus::Params &params = Params().GetConsensus();
+ const auto activation = gArgs.GetIntArg("-wellingtonactivationtime",
+ params.wellingtonActivationTime);
+ SetMockTime(activation - 1000000);
+
+ BOOST_CHECK(!IsWellingtonEnabled(params, nullptr));
+
+ std::array<CBlockIndex, 12> blocks;
+ for (size_t i = 1; i < blocks.size(); ++i) {
+ blocks[i].pprev = &blocks[i - 1];
+ }
+ BOOST_CHECK(!IsWellingtonEnabled(params, &blocks.back()));
+
+ SetMTP(blocks, activation - 1);
+ BOOST_CHECK(!IsWellingtonEnabled(params, &blocks.back()));
+
+ SetMTP(blocks, activation);
+ BOOST_CHECK(IsWellingtonEnabled(params, &blocks.back()));
+
+ SetMTP(blocks, activation + 1);
+ BOOST_CHECK(IsWellingtonEnabled(params, &blocks.back()));
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -103,14 +103,14 @@
add_functional_test_check(check-functional-upgrade-activated
"functional tests with the next upgrade activated"
- --with-gluonactivation
+ --with-wellingtonactivation
)
add_dependencies(check-upgrade-activated check-functional-upgrade-activated)
add_functional_test_check(check-functional-upgrade-activated-extended
"extended functional tests with the next upgrade activated"
--extended
- --with-gluonactivation
+ --with-wellingtonactivation
)
add_dependencies(check-upgrade-activated-extended check-functional-upgrade-activated-extended)
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -45,8 +45,8 @@
TEST_EXIT_FAILED = 1
TEST_EXIT_SKIPPED = 77
-# Timestamp is Feb. 15th, 2022 at 12:00:00
-TIMESTAMP_IN_THE_PAST = 1644922800
+# Timestamp is Sep. 20th, 2022 at 12:00:00
+TIMESTAMP_IN_THE_PAST = 1663675200
TMPDIR_PREFIX = "bitcoin_func_test_"
@@ -184,8 +184,8 @@
help="set a random seed for deterministically reproducing a previous test run")
parser.add_argument("--descriptors", default=False, action="store_true",
help="Run test using a descriptor wallet")
- parser.add_argument("--with-gluonactivation", dest="gluonactivation", default=False, action="store_true",
- help="Activate gluon update on timestamp {}".format(TIMESTAMP_IN_THE_PAST))
+ parser.add_argument("--with-wellingtonactivation", dest="wellingtonactivation", default=False, action="store_true",
+ help="Activate wellington update on timestamp {}".format(TIMESTAMP_IN_THE_PAST))
parser.add_argument(
'--timeout-factor',
dest="timeout_factor",
@@ -468,10 +468,9 @@
descriptors=self.options.descriptors,
))
- # TODO This needs to be updated to match the next upgrade
- # if self.options.gluonactivation:
- # self.nodes[i].extend_default_args(
- # ["-gluonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)])
+ if self.options.wellingtonactivation:
+ self.nodes[i].extend_default_args(
+ ["-wellingtonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)])
def start_node(self, i, *args, **kwargs):
"""Start a bitcoind"""
@@ -750,10 +749,9 @@
emulator=self.options.emulator,
))
- # TODO This needs to be updated to match the next upgrade
- # if self.options.gluonactivation:
- # self.nodes[CACHE_NODE_ID].extend_default_args(
- # ["-gluonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)])
+ if self.options.wellingtonactivation:
+ self.nodes[CACHE_NODE_ID].extend_default_args(
+ ["-wellingtonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)])
self.start_node(CACHE_NODE_ID)
cache_node = self.nodes[CACHE_NODE_ID]
diff --git a/test/lint/check-doc.py b/test/lint/check-doc.py
--- a/test/lint/check-doc.py
+++ b/test/lint/check-doc.py
@@ -54,6 +54,8 @@
# Removed arguments that now just print a helpful error message
'-zapwallettxes',
'-replayprotectionactivationtime',
+ # Remove after May 2023 upgrade
+ '-wellingtonactivationtime',
])

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 26, 11:35 (16 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573416
Default Alt Text
D12037.diff (6 KB)

Event Timeline