|
|
@ -58,7 +58,7 @@ static std::vector<COutPoint> SelectUTXOs(const CChain& active_chain, SimpleUTXO
|
|
|
|
utoxs.erase(it);
|
|
|
|
utoxs.erase(it);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BOOST_ASSERT(found);
|
|
|
|
BOOST_REQUIRE(found);
|
|
|
|
if (selectedAmount >= amount) {
|
|
|
|
if (selectedAmount >= amount) {
|
|
|
|
changeRet = selectedAmount - amount;
|
|
|
|
changeRet = selectedAmount - amount;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -89,8 +89,8 @@ static void SignTransaction(const CTxMemPool& mempool, CMutableTransaction& tx,
|
|
|
|
for (size_t i = 0; i < tx.vin.size(); i++) {
|
|
|
|
for (size_t i = 0; i < tx.vin.size(); i++) {
|
|
|
|
uint256 hashBlock;
|
|
|
|
uint256 hashBlock;
|
|
|
|
CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, tx.vin[i].prevout.hash, Params().GetConsensus(), hashBlock);
|
|
|
|
CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, tx.vin[i].prevout.hash, Params().GetConsensus(), hashBlock);
|
|
|
|
BOOST_ASSERT(txFrom);
|
|
|
|
BOOST_REQUIRE(txFrom);
|
|
|
|
BOOST_ASSERT(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL));
|
|
|
|
BOOST_REQUIRE(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -182,7 +182,7 @@ template<typename ProTx>
|
|
|
|
static CMutableTransaction MalleateProTxPayout(const CMutableTransaction& tx)
|
|
|
|
static CMutableTransaction MalleateProTxPayout(const CMutableTransaction& tx)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto opt_protx = GetTxPayload<ProTx>(tx);
|
|
|
|
auto opt_protx = GetTxPayload<ProTx>(tx);
|
|
|
|
BOOST_ASSERT(opt_protx.has_value());
|
|
|
|
BOOST_REQUIRE(opt_protx.has_value());
|
|
|
|
auto& protx = *opt_protx;
|
|
|
|
auto& protx = *opt_protx;
|
|
|
|
|
|
|
|
|
|
|
|
CKey key;
|
|
|
|
CKey key;
|
|
|
@ -226,7 +226,7 @@ static bool CheckTransactionSignature(const CTxMemPool& mempool, const CMutableT
|
|
|
|
const auto& txin = tx.vin[i];
|
|
|
|
const auto& txin = tx.vin[i];
|
|
|
|
uint256 hashBlock;
|
|
|
|
uint256 hashBlock;
|
|
|
|
CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, txin.prevout.hash, Params().GetConsensus(), hashBlock);
|
|
|
|
CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, txin.prevout.hash, Params().GetConsensus(), hashBlock);
|
|
|
|
BOOST_ASSERT(txFrom);
|
|
|
|
BOOST_REQUIRE(txFrom);
|
|
|
|
|
|
|
|
|
|
|
|
CAmount amount = txFrom->vout[txin.prevout.n].nValue;
|
|
|
|
CAmount amount = txFrom->vout[txin.prevout.n].nValue;
|
|
|
|
if (!VerifyScript(txin.scriptSig, txFrom->vout[txin.prevout.n].scriptPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker(&tx, i, amount))) {
|
|
|
|
if (!VerifyScript(txin.scriptSig, txFrom->vout[txin.prevout.n].scriptPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker(&tx, i, amount))) {
|
|
|
@ -254,19 +254,19 @@ void FuncDIP3Activation(TestChainSetup& setup)
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock(txns, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock(txns, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
chainman.ProcessNewBlock(Params(), block, true, nullptr);
|
|
|
|
chainman.ProcessNewBlock(Params(), block, true, nullptr);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
BOOST_ASSERT(block->GetHash() != chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_REQUIRE(block->GetHash() != chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_ASSERT(!dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
|
|
|
|
BOOST_REQUIRE(!dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
|
|
|
|
|
|
|
|
|
|
|
|
// This block should activate DIP3
|
|
|
|
// This block should activate DIP3
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
// Mining a block with a DIP3 transaction should succeed now
|
|
|
|
// Mining a block with a DIP3 transaction should succeed now
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock(txns, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock(txns, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2);
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void FuncV19Activation(TestChainSetup& setup)
|
|
|
|
void FuncV19Activation(TestChainSetup& setup)
|
|
|
@ -274,7 +274,7 @@ void FuncV19Activation(TestChainSetup& setup)
|
|
|
|
auto& chainman = *Assert(setup.m_node.chainman.get());
|
|
|
|
auto& chainman = *Assert(setup.m_node.chainman.get());
|
|
|
|
auto& dmnman = *Assert(setup.m_node.dmnman);
|
|
|
|
auto& dmnman = *Assert(setup.m_node.dmnman);
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
|
|
|
|
|
|
|
|
// create
|
|
|
|
// create
|
|
|
|
auto utxos = BuildSimpleUtxoMap(setup.m_coinbase_txns);
|
|
|
|
auto utxos = BuildSimpleUtxoMap(setup.m_coinbase_txns);
|
|
|
@ -289,14 +289,14 @@ void FuncV19Activation(TestChainSetup& setup)
|
|
|
|
int nHeight = chainman.ActiveChain().Height();
|
|
|
|
int nHeight = chainman.ActiveChain().Height();
|
|
|
|
|
|
|
|
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock({tx_reg}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock({tx_reg}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
++nHeight;
|
|
|
|
++nHeight;
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
auto tip_list = dmnman.GetListAtChainTip();
|
|
|
|
auto tip_list = dmnman.GetListAtChainTip();
|
|
|
|
BOOST_ASSERT(tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(tip_list.HasMN(tx_reg_hash));
|
|
|
|
auto pindex_create = chainman.ActiveChain().Tip();
|
|
|
|
auto pindex_create = chainman.ActiveChain().Tip();
|
|
|
|
auto base_list = dmnman.GetListForBlock(pindex_create);
|
|
|
|
auto base_list = dmnman.GetListForBlock(pindex_create);
|
|
|
|
std::vector<CDeterministicMNListDiff> diffs;
|
|
|
|
std::vector<CDeterministicMNListDiff> diffs;
|
|
|
@ -307,14 +307,14 @@ void FuncV19Activation(TestChainSetup& setup)
|
|
|
|
auto tx_upreg = CreateProUpRegTx(chainman.ActiveChain(), *(setup.m_node.mempool), utxos, tx_reg_hash, owner_key, operator_key_new.GetPublicKey(), owner_key.GetPubKey().GetID(), collateralScript, setup.coinbaseKey);
|
|
|
|
auto tx_upreg = CreateProUpRegTx(chainman.ActiveChain(), *(setup.m_node.mempool), utxos, tx_reg_hash, owner_key, operator_key_new.GetPublicKey(), owner_key.GetPubKey().GetID(), collateralScript, setup.coinbaseKey);
|
|
|
|
|
|
|
|
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({tx_upreg}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({tx_upreg}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
++nHeight;
|
|
|
|
++nHeight;
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
BOOST_ASSERT(tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(tip_list.HasMN(tx_reg_hash));
|
|
|
|
diffs.push_back(base_list.BuildDiff(tip_list));
|
|
|
|
diffs.push_back(base_list.BuildDiff(tip_list));
|
|
|
|
|
|
|
|
|
|
|
|
// spend
|
|
|
|
// spend
|
|
|
@ -325,61 +325,62 @@ void FuncV19Activation(TestChainSetup& setup)
|
|
|
|
|
|
|
|
|
|
|
|
FillableSigningProvider signing_provider;
|
|
|
|
FillableSigningProvider signing_provider;
|
|
|
|
signing_provider.AddKeyPubKey(collateral_key, collateral_key.GetPubKey());
|
|
|
|
signing_provider.AddKeyPubKey(collateral_key, collateral_key.GetPubKey());
|
|
|
|
BOOST_ASSERT(SignSignature(signing_provider, CTransaction(tx_reg), tx_spend, 0, SIGHASH_ALL));
|
|
|
|
BOOST_REQUIRE(SignSignature(signing_provider, CTransaction(tx_reg), tx_spend, 0, SIGHASH_ALL));
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({tx_spend}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({tx_spend}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
++nHeight;
|
|
|
|
++nHeight;
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
|
|
|
|
|
|
|
|
// mine another block so that it's not the last one before V19
|
|
|
|
// mine another block so that it's not the last one before V19
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
++nHeight;
|
|
|
|
++nHeight;
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
|
|
|
|
|
|
|
|
// this block should activate V19
|
|
|
|
// this block should activate V19
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
BOOST_ASSERT(DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_REQUIRE(DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
++nHeight;
|
|
|
|
++nHeight;
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
|
|
|
|
|
|
|
|
// check mn list/diff
|
|
|
|
// check mn list/diff
|
|
|
|
CDeterministicMNListDiff dummy_diff = base_list.BuildDiff(tip_list);
|
|
|
|
CDeterministicMNListDiff dummy_diff = base_list.BuildDiff(tip_list);
|
|
|
|
CDeterministicMNList dummmy_list = base_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff);
|
|
|
|
CDeterministicMNList dummmy_list = base_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff);
|
|
|
|
// Lists should match
|
|
|
|
// Lists should match
|
|
|
|
BOOST_ASSERT(dummmy_list == tip_list);
|
|
|
|
BOOST_REQUIRE(dummmy_list == tip_list);
|
|
|
|
|
|
|
|
|
|
|
|
// mine 10 more blocks
|
|
|
|
// mine 10 more blocks
|
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
BOOST_ASSERT(DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_REQUIRE(
|
|
|
|
|
|
|
|
DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1 + i);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1 + i);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
dmnman.DoMaintenance();
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
tip_list = dmnman.GetListAtChainTip();
|
|
|
|
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash));
|
|
|
|
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// check mn list/diff
|
|
|
|
// check mn list/diff
|
|
|
@ -387,19 +388,19 @@ void FuncV19Activation(TestChainSetup& setup)
|
|
|
|
auto v19_list = dmnman.GetListForBlock(v19_index);
|
|
|
|
auto v19_list = dmnman.GetListForBlock(v19_index);
|
|
|
|
dummy_diff = v19_list.BuildDiff(tip_list);
|
|
|
|
dummy_diff = v19_list.BuildDiff(tip_list);
|
|
|
|
dummmy_list = v19_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff);
|
|
|
|
dummmy_list = v19_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff);
|
|
|
|
BOOST_ASSERT(dummmy_list == tip_list);
|
|
|
|
BOOST_REQUIRE(dummmy_list == tip_list);
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: this fails on v19/v19.1 with errors like:
|
|
|
|
// NOTE: this fails on v19/v19.1 with errors like:
|
|
|
|
// "RemoveMN: Can't delete a masternode ... with a pubKeyOperator=..."
|
|
|
|
// "RemoveMN: Can't delete a masternode ... with a pubKeyOperator=..."
|
|
|
|
dummy_diff = base_list.BuildDiff(tip_list);
|
|
|
|
dummy_diff = base_list.BuildDiff(tip_list);
|
|
|
|
dummmy_list = base_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff);
|
|
|
|
dummmy_list = base_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff);
|
|
|
|
BOOST_ASSERT(dummmy_list == tip_list);
|
|
|
|
BOOST_REQUIRE(dummmy_list == tip_list);
|
|
|
|
|
|
|
|
|
|
|
|
dummmy_list = base_list;
|
|
|
|
dummmy_list = base_list;
|
|
|
|
for (const auto& diff : diffs) {
|
|
|
|
for (const auto& diff : diffs) {
|
|
|
|
dummmy_list = dummmy_list.ApplyDiff(chainman.ActiveChain().Tip(), diff);
|
|
|
|
dummmy_list = dummmy_list.ApplyDiff(chainman.ActiveChain().Tip(), diff);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BOOST_ASSERT(dummmy_list == tip_list);
|
|
|
|
BOOST_REQUIRE(dummmy_list == tip_list);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
@ -439,18 +440,20 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
// Technically, the payload is still valid...
|
|
|
|
// Technically, the payload is still valid...
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LOCK(cs_main);
|
|
|
|
LOCK(cs_main);
|
|
|
|
BOOST_ASSERT(CheckProRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
BOOST_REQUIRE(CheckProRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state,
|
|
|
|
BOOST_ASSERT(CheckProRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
|
|
|
|
BOOST_REQUIRE(CheckProRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state,
|
|
|
|
|
|
|
|
chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// But the signature should not verify anymore
|
|
|
|
// But the signature should not verify anymore
|
|
|
|
BOOST_ASSERT(CheckTransactionSignature(*(setup.m_node.mempool), tx));
|
|
|
|
BOOST_REQUIRE(CheckTransactionSignature(*(setup.m_node.mempool), tx));
|
|
|
|
BOOST_ASSERT(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
|
|
|
|
BOOST_REQUIRE(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
|
|
|
|
|
|
|
|
|
|
|
|
setup.CreateAndProcessBlock({tx}, setup.coinbaseKey);
|
|
|
|
setup.CreateAndProcessBlock({tx}, setup.coinbaseKey);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
|
|
|
|
|
|
|
|
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -467,10 +470,10 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
|
|
|
|
|
|
|
|
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_ASSERT(!block.vtx.empty());
|
|
|
|
BOOST_REQUIRE(!block.vtx.empty());
|
|
|
|
|
|
|
|
|
|
|
|
auto dmnPayout = FindPayoutDmn(dmnman, block);
|
|
|
|
auto dmnPayout = FindPayoutDmn(dmnman, block);
|
|
|
|
BOOST_ASSERT(dmnPayout != nullptr);
|
|
|
|
BOOST_REQUIRE(dmnPayout != nullptr);
|
|
|
|
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
|
|
|
|
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
@ -493,7 +496,7 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t j = 0; j < 3; j++) {
|
|
|
|
for (size_t j = 0; j < 3; j++) {
|
|
|
|
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(txns[j].GetHash()));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(txns[j].GetHash()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
@ -507,7 +510,7 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
|
|
|
|
|
|
|
|
|
auto dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]);
|
|
|
|
auto dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]);
|
|
|
|
BOOST_ASSERT(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 1000);
|
|
|
|
BOOST_REQUIRE(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 1000);
|
|
|
|
|
|
|
|
|
|
|
|
// test ProUpRevTx
|
|
|
|
// test ProUpRevTx
|
|
|
|
tx = CreateProUpRevTx(chainman.ActiveChain(), *(setup.m_node.mempool), utxos, dmnHashes[0], operatorKeys[dmnHashes[0]], setup.coinbaseKey);
|
|
|
|
tx = CreateProUpRevTx(chainman.ActiveChain(), *(setup.m_node.mempool), utxos, dmnHashes[0], operatorKeys[dmnHashes[0]], setup.coinbaseKey);
|
|
|
@ -517,19 +520,19 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
|
|
|
|
|
|
|
|
|
dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]);
|
|
|
|
dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]);
|
|
|
|
BOOST_ASSERT(dmn != nullptr && dmn->pdmnState->GetBannedHeight() == nHeight);
|
|
|
|
BOOST_REQUIRE(dmn != nullptr && dmn->pdmnState->GetBannedHeight() == nHeight);
|
|
|
|
|
|
|
|
|
|
|
|
// test that the revoked MN does not get paid anymore
|
|
|
|
// test that the revoked MN does not get paid anymore
|
|
|
|
for (size_t i = 0; i < 20; i++) {
|
|
|
|
for (size_t i = 0; i < 20; i++) {
|
|
|
|
auto dmnExpectedPayee = dmnman.GetListAtChainTip().GetMNPayee(chainman.ActiveChain().Tip());
|
|
|
|
auto dmnExpectedPayee = dmnman.GetListAtChainTip().GetMNPayee(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_ASSERT(dmnExpectedPayee->proTxHash != dmnHashes[0]);
|
|
|
|
BOOST_REQUIRE(dmnExpectedPayee->proTxHash != dmnHashes[0]);
|
|
|
|
|
|
|
|
|
|
|
|
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_ASSERT(!block.vtx.empty());
|
|
|
|
BOOST_REQUIRE(!block.vtx.empty());
|
|
|
|
|
|
|
|
|
|
|
|
auto dmnPayout = FindPayoutDmn(dmnman, block);
|
|
|
|
auto dmnPayout = FindPayoutDmn(dmnman, block);
|
|
|
|
BOOST_ASSERT(dmnPayout != nullptr);
|
|
|
|
BOOST_REQUIRE(dmnPayout != nullptr);
|
|
|
|
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
|
|
|
|
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
@ -545,11 +548,13 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
TxValidationState dummy_state;
|
|
|
|
TxValidationState dummy_state;
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LOCK(cs_main);
|
|
|
|
LOCK(cs_main);
|
|
|
|
BOOST_ASSERT(CheckProUpRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
BOOST_REQUIRE(CheckProUpRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state,
|
|
|
|
BOOST_ASSERT(!CheckProUpRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
|
|
|
|
BOOST_REQUIRE(!CheckProUpRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state,
|
|
|
|
|
|
|
|
chainman.ActiveChainstate().CoinsTip(), true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BOOST_ASSERT(CheckTransactionSignature(*(setup.m_node.mempool), tx));
|
|
|
|
BOOST_REQUIRE(CheckTransactionSignature(*(setup.m_node.mempool), tx));
|
|
|
|
BOOST_ASSERT(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
|
|
|
|
BOOST_REQUIRE(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
|
|
|
|
// now process the block
|
|
|
|
// now process the block
|
|
|
|
setup.CreateAndProcessBlock({tx}, setup.coinbaseKey);
|
|
|
|
setup.CreateAndProcessBlock({tx}, setup.coinbaseKey);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
@ -563,8 +568,8 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
|
|
|
|
|
|
|
|
|
dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]);
|
|
|
|
dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]);
|
|
|
|
BOOST_ASSERT(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 100);
|
|
|
|
BOOST_REQUIRE(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 100);
|
|
|
|
BOOST_ASSERT(dmn != nullptr && !dmn->pdmnState->IsBanned());
|
|
|
|
BOOST_REQUIRE(dmn != nullptr && !dmn->pdmnState->IsBanned());
|
|
|
|
|
|
|
|
|
|
|
|
// test that the revived MN gets payments again
|
|
|
|
// test that the revived MN gets payments again
|
|
|
|
bool foundRevived = false;
|
|
|
|
bool foundRevived = false;
|
|
|
@ -576,15 +581,15 @@ void FuncDIP3Protx(TestChainSetup& setup)
|
|
|
|
|
|
|
|
|
|
|
|
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_ASSERT(!block.vtx.empty());
|
|
|
|
BOOST_REQUIRE(!block.vtx.empty());
|
|
|
|
|
|
|
|
|
|
|
|
auto dmnPayout = FindPayoutDmn(dmnman, block);
|
|
|
|
auto dmnPayout = FindPayoutDmn(dmnman, block);
|
|
|
|
BOOST_ASSERT(dmnPayout != nullptr);
|
|
|
|
BOOST_REQUIRE(dmnPayout != nullptr);
|
|
|
|
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
|
|
|
|
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
nHeight++;
|
|
|
|
nHeight++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BOOST_ASSERT(foundRevived);
|
|
|
|
BOOST_REQUIRE(foundRevived);
|
|
|
|
|
|
|
|
|
|
|
|
const_cast<Consensus::Params&>(Params().GetConsensus()).DIP0003EnforcementHeight = DIP0003EnforcementHeightBackup;
|
|
|
|
const_cast<Consensus::Params&>(Params().GetConsensus()).DIP0003EnforcementHeight = DIP0003EnforcementHeightBackup;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -615,7 +620,7 @@ void FuncTestMempoolReorg(TestChainSetup& setup)
|
|
|
|
SignTransaction(*(setup.m_node.mempool), tx_collateral, setup.coinbaseKey);
|
|
|
|
SignTransaction(*(setup.m_node.mempool), tx_collateral, setup.coinbaseKey);
|
|
|
|
|
|
|
|
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock({tx_collateral}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock({tx_collateral}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
setup.m_node.dmnman->UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
setup.m_node.dmnman->UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
@ -757,7 +762,7 @@ void FuncVerifyDB(TestChainSetup& setup)
|
|
|
|
SignTransaction(*(setup.m_node.mempool), tx_collateral, setup.coinbaseKey);
|
|
|
|
SignTransaction(*(setup.m_node.mempool), tx_collateral, setup.coinbaseKey);
|
|
|
|
|
|
|
|
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock({tx_collateral}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
auto block = std::make_shared<CBlock>(setup.CreateBlock({tx_collateral}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
@ -789,11 +794,11 @@ void FuncVerifyDB(TestChainSetup& setup)
|
|
|
|
auto tx_reg_hash = tx_reg.GetHash();
|
|
|
|
auto tx_reg_hash = tx_reg.GetHash();
|
|
|
|
|
|
|
|
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({tx_reg}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({tx_reg}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2);
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx_reg_hash));
|
|
|
|
|
|
|
|
|
|
|
|
// Now spend the collateral while updating the same MN
|
|
|
|
// Now spend the collateral while updating the same MN
|
|
|
|
SimpleUTXOMap collateral_utxos;
|
|
|
|
SimpleUTXOMap collateral_utxos;
|
|
|
@ -801,15 +806,16 @@ void FuncVerifyDB(TestChainSetup& setup)
|
|
|
|
auto proUpRevTx = CreateProUpRevTx(chainman.ActiveChain(), *(setup.m_node.mempool), collateral_utxos, tx_reg_hash, operatorKey, collateralKey);
|
|
|
|
auto proUpRevTx = CreateProUpRevTx(chainman.ActiveChain(), *(setup.m_node.mempool), collateral_utxos, tx_reg_hash, operatorKey, collateralKey);
|
|
|
|
|
|
|
|
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({proUpRevTx}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
block = std::make_shared<CBlock>(setup.CreateBlock({proUpRevTx}, setup.coinbaseKey, chainman.ActiveChainstate()));
|
|
|
|
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 3);
|
|
|
|
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 3);
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
|
|
|
|
BOOST_ASSERT(!dmnman.GetListAtChainTip().HasMN(tx_reg_hash));
|
|
|
|
BOOST_REQUIRE(!dmnman.GetListAtChainTip().HasMN(tx_reg_hash));
|
|
|
|
|
|
|
|
|
|
|
|
// Verify db consistency
|
|
|
|
// Verify db consistency
|
|
|
|
LOCK(cs_main);
|
|
|
|
LOCK(cs_main);
|
|
|
|
BOOST_ASSERT(CVerifyDB().VerifyDB(chainman.ActiveChainstate(), Params(), chainman.ActiveChainstate().CoinsTip(), *(setup.m_node.evodb), 4, 2));
|
|
|
|
BOOST_REQUIRE(CVerifyDB().VerifyDB(chainman.ActiveChainstate(), Params(), chainman.ActiveChainstate().CoinsTip(),
|
|
|
|
|
|
|
|
*(setup.m_node.evodb), 4, 2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(evo_dip3_activation_tests)
|
|
|
|
BOOST_AUTO_TEST_SUITE(evo_dip3_activation_tests)
|
|
|
|