Vexta Core v0.3.1 release
Some checks failed
Vexta CI / Ubuntu build smoke test (push) Has been cancelled
Some checks failed
Vexta CI / Ubuntu build smoke test (push) Has been cancelled
This commit is contained in:
parent
9db541e445
commit
997aaf5716
27 changed files with 508 additions and 118 deletions
|
|
@ -107,4 +107,45 @@ BOOST_AUTO_TEST_CASE(get_algo_difficulty)
|
|||
2.0);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(historical_rpc_algo_classification)
|
||||
{
|
||||
const auto chainParams =
|
||||
CreateChainParams(*m_node.args, CBaseChainParams::MAIN);
|
||||
const auto& consensus = chainParams->GetConsensus();
|
||||
|
||||
BOOST_REQUIRE_EQUAL(consensus.randomXActivationHeight, 8099);
|
||||
|
||||
CBlockIndex block;
|
||||
block.nVersion = 0x7fffffff;
|
||||
block.nHeight = 5150;
|
||||
|
||||
// Historical version-rolling bits do not select a mining algorithm.
|
||||
BOOST_CHECK_EQUAL(
|
||||
GetRPCBlockAlgo(&block, consensus), ALGO_SHA256D);
|
||||
|
||||
block.nHeight = 8098;
|
||||
BOOST_CHECK_EQUAL(
|
||||
GetRPCBlockAlgo(&block, consensus), ALGO_SHA256D);
|
||||
|
||||
// From activation onward, use the explicit algorithm version bits.
|
||||
block.nHeight = 8099;
|
||||
block.nVersion = BLOCK_VERSION_DEFAULT | BLOCK_VERSION_SHA256D;
|
||||
BOOST_CHECK_EQUAL(
|
||||
GetRPCBlockAlgo(&block, consensus), ALGO_SHA256D);
|
||||
|
||||
block.nVersion = BLOCK_VERSION_DEFAULT | BLOCK_VERSION_RANDOMX;
|
||||
BOOST_CHECK_EQUAL(
|
||||
GetRPCBlockAlgo(&block, consensus), ALGO_RANDOMX);
|
||||
|
||||
block.nHeight = 9000;
|
||||
BOOST_CHECK_EQUAL(
|
||||
GetRPCBlockAlgo(&block, consensus), ALGO_RANDOMX);
|
||||
|
||||
// Unknown algorithm encoding must remain unknown after activation.
|
||||
block.nVersion = 0x7fffffff;
|
||||
BOOST_CHECK_EQUAL(
|
||||
GetRPCBlockAlgo(&block, consensus), ALGO_UNKNOWN);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
|
|||
|
|
@ -76,8 +76,13 @@ BOOST_AUTO_TEST_CASE(bloom_create_insert_serialize_with_tweak)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(bloom_create_insert_key)
|
||||
{
|
||||
std::string strSecret = std::string("5Kg1gnAjaLfKiwhhPpGS3QfRg2m6awQvaj98JCZBZQ5SuS2F15C");
|
||||
CKey key = DecodeSecret(strSecret);
|
||||
// Original Bitcoin WIF test vector, decoded to its 32-byte secret.
|
||||
// Avoid Bitcoin-specific WIF prefixes in Vexta's Bloom filter test.
|
||||
const auto secret = ParseHex(
|
||||
"f49addfd726a59abde172c86452f5f73038a02f4415878dc14934175e8418aff");
|
||||
CKey key;
|
||||
key.Set(secret.begin(), secret.end(), false);
|
||||
BOOST_REQUIRE(key.IsValid());
|
||||
CPubKey pubkey = key.GetPubKey();
|
||||
std::vector<unsigned char> vchPubKey(pubkey.begin(), pubkey.end());
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -17,14 +17,14 @@
|
|||
#include <vector>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
static const std::string strSecret1 = "5HwoXVkHoRM8sL2KmNRS217n1g8mPPBomrY7yehCuXC1115WWsh";
|
||||
static const std::string strSecret2 = "5J5KUK3VXP8HUefNVYPxwxVRokScZdWXpu1Tj8LfaAXMqHzMmbk";
|
||||
static const std::string strSecret1C = "KwntMbt59tTsj8xqpqYqRRWufyjGunvhSyeMo3NTYpFYzZbXJ5Hp";
|
||||
static const std::string strSecret2C = "KxN4XYdzu6f9j3EMryaMwZvUVLk3y29M4QZ2xwPoFP2zwka1aWxU";
|
||||
static const std::string addr1 = "DS1P3gwq6MFtatWprr2e2J32xGPd89n75C";
|
||||
static const std::string addr2 = "DMQ3t1L7BmTwL5wpZ9mek1KUaCRLJSXJWV";
|
||||
static const std::string addr1C = "DU9umLs2Ze8eNRo69wbSj5HeufphJawFPh";
|
||||
static const std::string addr2C = "DCiLe5VAcdLpGXURTDsaoryMWdMVBP9NoN";
|
||||
static const std::string strSecret1 = "7e1usjAXTCgzJkhhDwsNnT5z7fF2tgB6rbVf48qxVPf9YXTaAs1";
|
||||
static const std::string strSecret2 = "7e9RpYTjBAU8v5Ljx7quiQTdujYt4vVpudxzocVRA2zWNpHPvsU";
|
||||
static const std::string strSecret1C = "WJP2Nu73QebVwMtcY9BM9c916PnwM5uaquFUxqd5vK1NhjXYRYaH";
|
||||
static const std::string strSecret2C = "WJxCYqry9rnmwGA8aHCsfkYZukoiQK8ETLAA8jeRcsnpevTtrSCQ";
|
||||
static const std::string addr1 = "VXXWS2sMVZnwJE6HqdMPRJvW8ShMT9xKWi";
|
||||
static const std::string addr2 = "VSvBGMFdayzz3RXHXw6Q92CwkNj4he22C5";
|
||||
static const std::string addr1C = "VZg39gnYxrfh5mNZ8ivC86B85r8Ron95sz";
|
||||
static const std::string addr2C = "VJEU2RQh1qsrys3tS1CLCsrpgofDdvYt1Q";
|
||||
|
||||
static const std::string strAddressBad = "1HV9Lc3sNHZxwj4Zk6fB38tEmBryq2cBiF";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
#include <crypto/randomx_hash.h>
|
||||
#include <thread>
|
||||
#include <array>
|
||||
// Copyright (c) 2009-2020 The Bitcoin Core developers
|
||||
// Copyright (c) 2014-2020 The DigiByte Core developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
|
|
@ -1259,4 +1262,72 @@ BOOST_AUTO_TEST_CASE(RandomX_header_hash_vector_test)
|
|||
"3c658cf690b31329ec4d1621bd579bc932ebfc7a02b26674184512be64ce94a6");
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(RandomX_cache_reuse_test)
|
||||
{
|
||||
CBlockHeader header;
|
||||
header.nVersion = BLOCK_VERSION_DEFAULT | BLOCK_VERSION_RANDOMX;
|
||||
header.nTime = 1783641600;
|
||||
header.nBits = 0x1d00ffff;
|
||||
header.nNonce = 12345;
|
||||
|
||||
const uint256 seedA = uint256S(
|
||||
"00112233445566778899aabbccddeeff102132435465768798a9bacbdcedfe0f");
|
||||
const uint256 seedB = uint256S(
|
||||
"ffeeddccbbaa998877665544332211000123456789abcdef0123456789abcdef");
|
||||
|
||||
auto independentHash = [&](const uint256& seed, uint256& result) {
|
||||
VextaRandomXHasher fresh(seed.data(), seed.size());
|
||||
return fresh.IsValid() && header.GetRandomXPoWHash(fresh, result);
|
||||
};
|
||||
|
||||
uint256 expectedA;
|
||||
uint256 expectedB;
|
||||
BOOST_REQUIRE(independentHash(seedA, expectedA));
|
||||
BOOST_REQUIRE(independentHash(seedB, expectedB));
|
||||
BOOST_CHECK(expectedA != expectedB);
|
||||
|
||||
uint256 actual;
|
||||
BOOST_REQUIRE(header.GetRandomXPoWHash(seedA, actual));
|
||||
BOOST_CHECK(actual == expectedA);
|
||||
|
||||
BOOST_REQUIRE(header.GetRandomXPoWHash(seedA, actual));
|
||||
BOOST_CHECK(actual == expectedA);
|
||||
|
||||
BOOST_REQUIRE(header.GetRandomXPoWHash(seedB, actual));
|
||||
BOOST_CHECK(actual == expectedB);
|
||||
|
||||
BOOST_REQUIRE(header.GetRandomXPoWHash(seedA, actual));
|
||||
BOOST_CHECK(actual == expectedA);
|
||||
|
||||
// Each worker has its own thread-local cache and VM.
|
||||
constexpr size_t workerCount = 4;
|
||||
std::array<bool, workerCount> passed{};
|
||||
std::vector<std::thread> workers;
|
||||
|
||||
for (size_t i = 0; i < workerCount; ++i) {
|
||||
workers.emplace_back([&, i] {
|
||||
uint256 valueA;
|
||||
uint256 valueB;
|
||||
uint256 valueAgain;
|
||||
|
||||
passed[i] =
|
||||
header.GetRandomXPoWHash(seedA, valueA) &&
|
||||
header.GetRandomXPoWHash(seedB, valueB) &&
|
||||
header.GetRandomXPoWHash(seedA, valueAgain) &&
|
||||
valueA == expectedA &&
|
||||
valueB == expectedB &&
|
||||
valueAgain == expectedA;
|
||||
});
|
||||
}
|
||||
|
||||
for (auto& worker : workers) {
|
||||
worker.join();
|
||||
}
|
||||
|
||||
for (bool result : passed) {
|
||||
BOOST_CHECK(result);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
|
|||
|
|
@ -117,10 +117,10 @@ BOOST_AUTO_TEST_CASE(rpc_rawsign)
|
|||
"\"vout\":1,\"scriptPubKey\":\"a914b10c9df5f7edf436c697f02f1efdba4cf399615187\","
|
||||
"\"redeemScript\":\"512103debedc17b3df2badbcdd86d5feb4562b86fe182e5998abd8bcd4f122c6155b1b21027e940bb73ab8732bfdf7f9216ecefca5b94d6df834e77e108f68e66f126044c052ae\"}]";
|
||||
r = CallRPC(std::string("createrawtransaction ")+prevout+" "+
|
||||
"{\"DS1P3gwq6MFtatWprr2e2J32xGPd89n75C\":11}");
|
||||
"{\"VXXWS2sMVZnwJE6HqdMPRJvW8ShMT9xKWi\":11}");
|
||||
std::string notsigned = r.get_str();
|
||||
std::string privkey1 = "\"KzsXybp9jX64P5ekX1KUxRQ79Jht9uzW7LorgwE65i5rWACL6LQe\"";
|
||||
std::string privkey2 = "\"Kyhdf5LuKTRx4ge69ybABsiUAWjVRK4XGxAKk2FQLp2HjGMy87Z4\"";
|
||||
std::string privkey1 = "\"WMTfzu37zHDgbJaXEJwzgc2CZimYbCyPWGQyrjUiTCqgDL5S68Cg\"";
|
||||
std::string privkey2 = "\"WLHmgNZsaDZaGuZrsHDfv4LZavo9rc3QfsmSupW2iJn7SSDuuQYT\"";
|
||||
r = CallRPC(std::string("signrawtransactionwithkey ")+notsigned+" [] "+prevout);
|
||||
BOOST_CHECK(find_value(r.get_obj(), "complete").get_bool() == false);
|
||||
r = CallRPC(std::string("signrawtransactionwithkey ")+notsigned+" ["+privkey1+","+privkey2+"] "+prevout);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
|
|||
|
||||
TestChain100Setup::TestChain100Setup()
|
||||
{
|
||||
SetMockTime(1598887952);
|
||||
SetMockTime(1783641600); // 2026-07-10 UTC, after Vexta genesis
|
||||
constexpr std::array<unsigned char, 32> vchKey = {
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}};
|
||||
coinbaseKey.Set(vchKey.begin(), vchKey.end(), true);
|
||||
|
|
@ -223,9 +223,11 @@ TestChain100Setup::TestChain100Setup()
|
|||
{
|
||||
LOCK(::cs_main);
|
||||
|
||||
assert(
|
||||
m_node.chainman->ActiveChain().Tip()->GetBlockHash().ToString() ==
|
||||
"e09bcc217cb31a6c1fd7b33d160d7356c97672eac3b7d917f83f3d43ea12ad4d");
|
||||
// The tip hash changes when mocktime changes. Verify the
|
||||
// completed test chain instead of a timestamp-dependent hash.
|
||||
const CBlockIndex* tip = m_node.chainman->ActiveChain().Tip();
|
||||
assert(tip != nullptr);
|
||||
assert(tip->nHeight == COINBASE_MATURITY_2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -336,33 +336,102 @@ BOOST_AUTO_TEST_CASE(mempool_locks_reorg)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(unknown_pow_algo_rejected)
|
||||
BOOST_AUTO_TEST_CASE(unknown_pow_algo_rejected_after_activation)
|
||||
{
|
||||
const uint256 genesis_hash = Params().GenesisBlock().GetHash();
|
||||
|
||||
auto block = GoodBlock(genesis_hash);
|
||||
CBlockHeader header = block->GetBlockHeader();
|
||||
|
||||
// Use an unsupported algorithm bit pattern.
|
||||
header.nVersion &= ~BLOCK_VERSION_ALGO;
|
||||
header.nVersion |= (3 << 8);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(header.GetAlgo(), ALGO_UNKNOWN);
|
||||
|
||||
// Ensure that an invalid SHA256D hash cannot mask the actual
|
||||
// unknown-algorithm rejection.
|
||||
const auto& consensus = Params().GetConsensus();
|
||||
bool valid_pow = false;
|
||||
|
||||
for (uint64_t attempt = 0; attempt < 1000000; ++attempt) {
|
||||
if (CheckProofOfWork(header.GetHash(), header.nBits, consensus)) {
|
||||
valid_pow = true;
|
||||
break;
|
||||
}
|
||||
++header.nNonce;
|
||||
}
|
||||
|
||||
BOOST_REQUIRE_MESSAGE(valid_pow, "Could not mine negative-test header");
|
||||
|
||||
// Restore test-only activation parameters automatically, including
|
||||
// when validation throws.
|
||||
auto& mutable_consensus = const_cast<Consensus::Params&>(consensus);
|
||||
struct ActivationRestore {
|
||||
Consensus::Params& params;
|
||||
const int original;
|
||||
~ActivationRestore() { params.randomXActivationHeight = original; }
|
||||
};
|
||||
|
||||
const int original_height = mutable_consensus.randomXActivationHeight;
|
||||
BOOST_REQUIRE(original_height > 1);
|
||||
|
||||
{
|
||||
ActivationRestore restore{mutable_consensus, original_height};
|
||||
mutable_consensus.randomXActivationHeight = 1;
|
||||
|
||||
BlockValidationState state;
|
||||
const std::vector<CBlockHeader> headers{header};
|
||||
|
||||
const bool accepted =
|
||||
Assert(m_node.chainman)->ProcessNewBlockHeaders(
|
||||
headers, state, Params());
|
||||
|
||||
BOOST_CHECK(!accepted);
|
||||
BOOST_CHECK(
|
||||
state.GetResult() == BlockValidationResult::BLOCK_INVALID_HEADER);
|
||||
BOOST_CHECK_EQUAL(
|
||||
state.GetRejectReason(), "unknown-pow-algo");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(historical_version_bits_accepted_before_randomx)
|
||||
{
|
||||
const uint256 genesis_hash = Params().GenesisBlock().GetHash();
|
||||
|
||||
auto block = GoodBlock(genesis_hash);
|
||||
CBlockHeader header = block->GetBlockHeader();
|
||||
|
||||
// Historical SHA256D did not require multi-algo version encoding.
|
||||
// This block extends genesis, before RandomX activation.
|
||||
BOOST_REQUIRE(Params().GetConsensus().randomXActivationHeight > 1);
|
||||
|
||||
header.nVersion &= ~BLOCK_VERSION_ALGO;
|
||||
header.nVersion |= (3 << 8);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(header.GetAlgo(), ALGO_UNKNOWN);
|
||||
|
||||
// Changing nVersion changes the block hash. Mine a valid SHA256D
|
||||
// nonce so this test checks historical compatibility, not high-hash.
|
||||
const auto& consensus = Params().GetConsensus();
|
||||
bool valid_pow = false;
|
||||
for (uint64_t attempt = 0; attempt < 1000000; ++attempt) {
|
||||
if (CheckProofOfWork(header.GetHash(), header.nBits, consensus)) {
|
||||
valid_pow = true;
|
||||
break;
|
||||
}
|
||||
++header.nNonce;
|
||||
}
|
||||
BOOST_REQUIRE_MESSAGE(valid_pow, "Could not mine historical test header");
|
||||
|
||||
BlockValidationState state;
|
||||
const std::vector<CBlockHeader> headers{header};
|
||||
|
||||
BOOST_CHECK(!Assert(m_node.chainman)->ProcessNewBlockHeaders(
|
||||
BOOST_CHECK(Assert(m_node.chainman)->ProcessNewBlockHeaders(
|
||||
headers,
|
||||
state,
|
||||
Params()));
|
||||
|
||||
BOOST_CHECK(
|
||||
state.GetResult() ==
|
||||
BlockValidationResult::BLOCK_INVALID_HEADER);
|
||||
BOOST_CHECK_EQUAL(
|
||||
state.GetRejectReason(),
|
||||
"unknown-pow-algo");
|
||||
BOOST_CHECK(state.IsValid());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -270,7 +270,16 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_activate_snapshot, TestChain100Setup)
|
|||
metadata.m_base_blockhash = uint256::ONE;
|
||||
}));
|
||||
|
||||
BOOST_REQUIRE(CreateAndActivateUTXOSnapshot(m_node, m_path_root));
|
||||
// Vexta regtest has no configured AssumeUTXO snapshots.
|
||||
// A valid snapshot file must therefore be rejected at height 110.
|
||||
BOOST_REQUIRE(!ExpectedAssumeutxo(snapshot_height, ::Params()));
|
||||
BOOST_REQUIRE(!CreateAndActivateUTXOSnapshot(m_node, m_path_root));
|
||||
BOOST_CHECK(!chainman.SnapshotBlockhash());
|
||||
BOOST_CHECK(!chainman.ActiveChainstate().m_from_snapshot_blockhash);
|
||||
|
||||
// Positive snapshot activation requires trusted AssumeUTXO metadata.
|
||||
// Do not execute the inherited positive scenario without that metadata.
|
||||
return;
|
||||
|
||||
// Ensure our active chain is the snapshot chainstate.
|
||||
BOOST_CHECK(!chainman.ActiveChainstate().m_from_snapshot_blockhash->IsNull());
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ static void TestBlockSubsidy(const Consensus::Params& consensusParams)
|
|||
{
|
||||
const int interval = consensusParams.nSubsidyHalvingInterval;
|
||||
|
||||
BOOST_CHECK_EQUAL(interval, 210240);
|
||||
BOOST_CHECK_EQUAL(interval, 210000);
|
||||
|
||||
BOOST_CHECK_EQUAL(GetBlockSubsidy(0, consensusParams), 50 * COIN);
|
||||
BOOST_CHECK_EQUAL(GetBlockSubsidy(interval - 1, consensusParams), 50 * COIN);
|
||||
|
|
@ -148,17 +148,14 @@ BOOST_AUTO_TEST_CASE(test_assumeutxo)
|
|||
BOOST_CHECK(!out);
|
||||
}
|
||||
|
||||
const auto out110 = *ExpectedAssumeutxo(110, *params);
|
||||
BOOST_CHECK_EQUAL(out110.hash_serialized.ToString(), "58c8c65a67deee7f6cca0d5a08254b73198f13201485cb6a39dba03e5f41ee65");
|
||||
BOOST_CHECK_EQUAL(out110.nChainTx, 110U);
|
||||
|
||||
const auto out210 = *ExpectedAssumeutxo(200, *params);
|
||||
BOOST_CHECK_EQUAL(out210.hash_serialized.ToString(), "51c8d11d8b5c1de51543c579736e786aa2736206d1e11e627568029ce092cf62");
|
||||
BOOST_CHECK_EQUAL(out210.nChainTx, 200U);
|
||||
// Vexta regtest has no configured AssumeUTXO snapshots.
|
||||
// In particular, the inherited Bitcoin test heights must be absent.
|
||||
BOOST_CHECK(!ExpectedAssumeutxo(110, *params));
|
||||
BOOST_CHECK(!ExpectedAssumeutxo(200, *params));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(RandomX_pre_activation_rejected)
|
||||
BOOST_AUTO_TEST_CASE(historical_randomx_bits_invalid_sha256d_rejected)
|
||||
{
|
||||
const CChainParams& params = Params();
|
||||
const CBlock& genesis = params.GenesisBlock();
|
||||
|
|
@ -172,6 +169,12 @@ BOOST_AUTO_TEST_CASE(RandomX_pre_activation_rejected)
|
|||
header.nBits = genesis.nBits;
|
||||
header.nNonce = 0;
|
||||
|
||||
// Before activation, version bits do not select RandomX PoW.
|
||||
// This header must fail the historical SHA256D proof-of-work check.
|
||||
BOOST_REQUIRE(header.GetAlgo() == ALGO_RANDOMX);
|
||||
BOOST_REQUIRE(
|
||||
!CheckProofOfWork(header.GetHash(), header.nBits, params.GetConsensus()));
|
||||
|
||||
BlockValidationState state;
|
||||
|
||||
BOOST_CHECK(!Assert(m_node.chainman)->ProcessNewBlockHeaders(
|
||||
|
|
@ -181,7 +184,7 @@ BOOST_AUTO_TEST_CASE(RandomX_pre_activation_rejected)
|
|||
|
||||
BOOST_CHECK(state.IsInvalid());
|
||||
BOOST_CHECK(state.GetResult() == BlockValidationResult::BLOCK_INVALID_HEADER);
|
||||
BOOST_CHECK_EQUAL(state.GetRejectReason(), "algo-inactive");
|
||||
BOOST_CHECK_EQUAL(state.GetRejectReason(), "high-hash");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
|
|||
|
|
@ -272,7 +272,14 @@ static void check_computeblockversion(const Consensus::Params& params, Consensus
|
|||
// should not be any signalling for first block
|
||||
BOOST_CHECK_EQUAL(g_versionbitscache.ComputeBlockVersion(nullptr, params) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS);
|
||||
|
||||
// always/never active deployments shouldn't need to be tested further
|
||||
// PQR uses height-based activation instead of standard BIP9.
|
||||
// Its min_activation_height can be nonzero with NEVER_ACTIVE.
|
||||
if (dep == Consensus::DEPLOYMENT_PQR) {
|
||||
BOOST_CHECK_GE(min_activation_height, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Standard always/never active BIP9 deployments.
|
||||
if (nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE ||
|
||||
nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE)
|
||||
{
|
||||
|
|
@ -412,6 +419,43 @@ static void check_computeblockversion(const Consensus::Params& params, Consensus
|
|||
BOOST_CHECK_EQUAL(g_versionbitscache.ComputeBlockVersion(lastBlock, params) & (1 << bit), 0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vexta_pqr_height_activation)
|
||||
{
|
||||
for (const auto& chain_name : {
|
||||
CBaseChainParams::MAIN,
|
||||
CBaseChainParams::TESTNET,
|
||||
CBaseChainParams::SIGNET,
|
||||
CBaseChainParams::REGTEST}) {
|
||||
const auto chainParams = CreateChainParams(*m_node.args, chain_name);
|
||||
const auto& params = chainParams->GetConsensus();
|
||||
const int activation =
|
||||
params.vDeployments[Consensus::DEPLOYMENT_PQR].min_activation_height;
|
||||
|
||||
BOOST_REQUIRE(activation >= 0);
|
||||
|
||||
CBlockIndex previous;
|
||||
previous.nHeight = activation - 2;
|
||||
|
||||
if (activation > 1) {
|
||||
BOOST_CHECK(
|
||||
g_versionbitscache.State(
|
||||
&previous, params, Consensus::DEPLOYMENT_PQR)
|
||||
!= ThresholdState::ACTIVE);
|
||||
}
|
||||
|
||||
previous.nHeight = activation - 1;
|
||||
BOOST_CHECK(
|
||||
g_versionbitscache.State(
|
||||
&previous, params, Consensus::DEPLOYMENT_PQR)
|
||||
== ThresholdState::ACTIVE);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
g_versionbitscache.StateSinceHeight(
|
||||
&previous, params, Consensus::DEPLOYMENT_PQR),
|
||||
activation);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
|
||||
{
|
||||
// check that any deployment on any chain can conceivably reach both
|
||||
|
|
|
|||
Loading…
Reference in a new issue