partial merge bitcoin/bitcoin#27783: Add public Boost headers explicitly

2484cacb7a6367b24e924dba0825c843b1dfc1c3 Add public Boost headers explicitly (Hennadii Stepanov)
fade2adb5bb4ce9753e7f25da5fb1521f2f503ec test: Avoid `BOOST_ASSERT` macro (Hennadii Stepanov)

Pull request description:

  To check symbols in the code base, run:
  ```
  git grep boost::multi_index::identity
  git grep boost::multi_index::indexed_by
  git grep boost::multi_index::tag
  git grep boost::make_tuple
  ```

  Hoping on the absence of conflicts with top-prio PRs :)

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 2484cacb7a6367b24e924dba0825c843b1dfc1c3
  TheCharlatan:
    ACK 2484cacb7a6367b24e924dba0825c843b1dfc1c3

Tree-SHA512: d122ab028eee76ee1c4609ed51ec8db0c8c768edcc2ff2c0e420a48e051aa71e99748cdb5d22985ae6d97c808c77c1a27561f0715f77b256f74c1c310b37694c
This commit is contained in:
fanquake 2024-10-05 02:28:12 +03:00 committed by pasta
parent 49fcd4ab64
commit c0154c0d8c
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
9 changed files with 97 additions and 81 deletions

View File

@ -13,8 +13,11 @@
#include <optional>
#include <stdint.h>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/indexed_by.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/tag.hpp>
#include <boost/multi_index_container.hpp>
class BlockManager;
class CBlockIndex;

View File

@ -71,7 +71,7 @@ static std::vector<COutPoint> SelectUTXOs(const CChain& active_chain, SimpleUTXO
utoxs.erase(it);
break;
}
BOOST_ASSERT(found);
BOOST_REQUIRE(found);
if (selectedAmount >= amount) {
changeRet = selectedAmount - amount;
break;
@ -102,8 +102,8 @@ static void SignTransaction(const CTxMemPool& mempool, CMutableTransaction& tx,
for (auto [i, input] : enumerate(tx.vin)) {
uint256 hashBlock;
CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, input.prevout.hash, Params().GetConsensus(), hashBlock);
BOOST_ASSERT(txFrom);
BOOST_ASSERT(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL));
BOOST_REQUIRE(txFrom);
BOOST_REQUIRE(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL));
}
}
@ -148,7 +148,8 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
CScript coinbasePubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
BOOST_ASSERT(DeploymentDIP0003Enforced(WITH_LOCK(cs_main, return m_node.chainman->ActiveChain().Height()), consensus_params));
BOOST_REQUIRE(DeploymentDIP0003Enforced(WITH_LOCK(cs_main, return m_node.chainman->ActiveChain().Height()),
consensus_params));
// Register one MN
CKey ownerKey;
@ -163,7 +164,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()};
dmnman.UpdatedBlockTip(tip);
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_CHECK_EQUAL(tip->nHeight, 498);
BOOST_CHECK(tip->nHeight < Params().GetConsensus().BRRHeight);
@ -176,7 +177,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()};
BOOST_CHECK_EQUAL(tip->nHeight, 499);
dmnman.UpdatedBlockTip(tip);
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_CHECK(tip->nHeight < Params().GetConsensus().BRRHeight);
// Creating blocks by different ways
const auto pblocktemplate = BlockAssembler(m_node.chainman->ActiveChainstate(), m_node, *m_node.mempool, Params()).CreateNewBlock(coinbasePubKey);
@ -195,7 +196,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()};
BOOST_CHECK_EQUAL(tip->nHeight, Params().GetConsensus().BRRHeight - 1);
dmnman.UpdatedBlockTip(tip);
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
}
{
@ -206,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()};
const bool isV20Active{DeploymentActiveAfter(tip, consensus_params, Consensus::DEPLOYMENT_V20)};
dmnman.UpdatedBlockTip(tip);
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
const CAmount block_subsidy = GetBlockSubsidyInner(tip->nBits, tip->nHeight, consensus_params, isV20Active);
const CAmount masternode_payment = GetMasternodePayment(tip->nHeight, block_subsidy, isV20Active);
const auto pblocktemplate = BlockAssembler(m_node.chainman->ActiveChainstate(), m_node, *m_node.mempool, Params()).CreateNewBlock(coinbasePubKey);

View File

@ -58,7 +58,7 @@ static std::vector<COutPoint> SelectUTXOs(const CChain& active_chain, SimpleUTXO
utoxs.erase(it);
break;
}
BOOST_ASSERT(found);
BOOST_REQUIRE(found);
if (selectedAmount >= amount) {
changeRet = selectedAmount - amount;
break;
@ -89,8 +89,8 @@ static void SignTransaction(const CTxMemPool& mempool, CMutableTransaction& tx,
for (size_t i = 0; i < tx.vin.size(); i++) {
uint256 hashBlock;
CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, tx.vin[i].prevout.hash, Params().GetConsensus(), hashBlock);
BOOST_ASSERT(txFrom);
BOOST_ASSERT(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL));
BOOST_REQUIRE(txFrom);
BOOST_REQUIRE(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL));
}
}
@ -182,7 +182,7 @@ template<typename ProTx>
static CMutableTransaction MalleateProTxPayout(const CMutableTransaction& tx)
{
auto opt_protx = GetTxPayload<ProTx>(tx);
BOOST_ASSERT(opt_protx.has_value());
BOOST_REQUIRE(opt_protx.has_value());
auto& protx = *opt_protx;
CKey key;
@ -226,7 +226,7 @@ static bool CheckTransactionSignature(const CTxMemPool& mempool, const CMutableT
const auto& txin = tx.vin[i];
uint256 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;
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()));
chainman.ProcessNewBlock(Params(), block, true, nullptr);
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
BOOST_ASSERT(block->GetHash() != chainman.ActiveChain().Tip()->GetBlockHash());
BOOST_ASSERT(!dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_REQUIRE(block->GetHash() != chainman.ActiveChain().Tip()->GetBlockHash());
BOOST_REQUIRE(!dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
// This block should activate DIP3
setup.CreateAndProcessBlock({}, setup.coinbaseKey);
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
// Mining a block with a DIP3 transaction should succeed now
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());
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2);
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)
@ -274,7 +274,7 @@ void FuncV19Activation(TestChainSetup& setup)
auto& chainman = *Assert(setup.m_node.chainman.get());
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
auto utxos = BuildSimpleUtxoMap(setup.m_coinbase_txns);
@ -289,14 +289,14 @@ void FuncV19Activation(TestChainSetup& setup)
int nHeight = chainman.ActiveChain().Height();
auto block = std::make_shared<CBlock>(setup.CreateBlock({tx_reg}, setup.coinbaseKey, chainman.ActiveChainstate()));
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
++nHeight;
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
dmnman.DoMaintenance();
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 base_list = dmnman.GetListForBlock(pindex_create);
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);
block = std::make_shared<CBlock>(setup.CreateBlock({tx_upreg}, setup.coinbaseKey, chainman.ActiveChainstate()));
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
++nHeight;
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
dmnman.DoMaintenance();
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));
// spend
@ -325,61 +325,62 @@ void FuncV19Activation(TestChainSetup& setup)
FillableSigningProvider signing_provider;
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()));
BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr));
BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr));
BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19));
++nHeight;
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
dmnman.DoMaintenance();
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
tip_list = dmnman.GetListAtChainTip();
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
BOOST_REQUIRE(!tip_list.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
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;
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
dmnman.DoMaintenance();
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
tip_list = dmnman.GetListAtChainTip();
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash));
BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
// this block should activate V19
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;
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
dmnman.DoMaintenance();
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
tip_list = dmnman.GetListAtChainTip();
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash));
BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
// check mn list/diff
CDeterministicMNListDiff dummy_diff = base_list.BuildDiff(tip_list);
CDeterministicMNList dummmy_list = base_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff);
// Lists should match
BOOST_ASSERT(dummmy_list == tip_list);
BOOST_REQUIRE(dummmy_list == tip_list);
// mine 10 more blocks
for (int i = 0; i < 10; ++i)
{
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);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
dmnman.DoMaintenance();
diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip()));
tip_list = dmnman.GetListAtChainTip();
BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash));
BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash));
BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash));
}
// check mn list/diff
@ -387,19 +388,19 @@ void FuncV19Activation(TestChainSetup& setup)
auto v19_list = dmnman.GetListForBlock(v19_index);
dummy_diff = v19_list.BuildDiff(tip_list);
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:
// "RemoveMN: Can't delete a masternode ... with a pubKeyOperator=..."
dummy_diff = base_list.BuildDiff(tip_list);
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;
for (const auto& diff : diffs) {
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)
@ -439,18 +440,20 @@ void FuncDIP3Protx(TestChainSetup& setup)
// Technically, the payload is still valid...
{
LOCK(cs_main);
BOOST_ASSERT(CheckProRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
BOOST_ASSERT(CheckProRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
BOOST_REQUIRE(CheckProRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state,
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
BOOST_ASSERT(CheckTransactionSignature(*(setup.m_node.mempool), tx));
BOOST_ASSERT(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
BOOST_REQUIRE(CheckTransactionSignature(*(setup.m_node.mempool), tx));
BOOST_REQUIRE(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
setup.CreateAndProcessBlock({tx}, setup.coinbaseKey);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash()));
nHeight++;
}
@ -467,10 +470,10 @@ void FuncDIP3Protx(TestChainSetup& setup)
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
BOOST_ASSERT(!block.vtx.empty());
BOOST_REQUIRE(!block.vtx.empty());
auto dmnPayout = FindPayoutDmn(dmnman, block);
BOOST_ASSERT(dmnPayout != nullptr);
BOOST_REQUIRE(dmnPayout != nullptr);
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
nHeight++;
@ -493,7 +496,7 @@ void FuncDIP3Protx(TestChainSetup& setup)
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
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++;
@ -507,7 +510,7 @@ void FuncDIP3Protx(TestChainSetup& setup)
nHeight++;
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
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++;
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
for (size_t i = 0; i < 20; i++) {
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);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
BOOST_ASSERT(!block.vtx.empty());
BOOST_REQUIRE(!block.vtx.empty());
auto dmnPayout = FindPayoutDmn(dmnman, block);
BOOST_ASSERT(dmnPayout != nullptr);
BOOST_REQUIRE(dmnPayout != nullptr);
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
nHeight++;
@ -545,11 +548,13 @@ void FuncDIP3Protx(TestChainSetup& setup)
TxValidationState dummy_state;
{
LOCK(cs_main);
BOOST_ASSERT(CheckProUpRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
BOOST_ASSERT(!CheckProUpRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true));
BOOST_REQUIRE(CheckProUpRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state,
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_ASSERT(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
BOOST_REQUIRE(CheckTransactionSignature(*(setup.m_node.mempool), tx));
BOOST_REQUIRE(!CheckTransactionSignature(*(setup.m_node.mempool), tx2));
// now process the block
setup.CreateAndProcessBlock({tx}, setup.coinbaseKey);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
@ -563,8 +568,8 @@ void FuncDIP3Protx(TestChainSetup& setup)
nHeight++;
dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]);
BOOST_ASSERT(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 100);
BOOST_ASSERT(dmn != nullptr && !dmn->pdmnState->IsBanned());
BOOST_REQUIRE(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 100);
BOOST_REQUIRE(dmn != nullptr && !dmn->pdmnState->IsBanned());
// test that the revived MN gets payments again
bool foundRevived = false;
@ -576,15 +581,15 @@ void FuncDIP3Protx(TestChainSetup& setup)
CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey);
dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip());
BOOST_ASSERT(!block.vtx.empty());
BOOST_REQUIRE(!block.vtx.empty());
auto dmnPayout = FindPayoutDmn(dmnman, block);
BOOST_ASSERT(dmnPayout != nullptr);
BOOST_REQUIRE(dmnPayout != nullptr);
BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString());
nHeight++;
}
BOOST_ASSERT(foundRevived);
BOOST_REQUIRE(foundRevived);
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);
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());
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
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);
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());
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1);
BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash());
@ -789,11 +794,11 @@ void FuncVerifyDB(TestChainSetup& setup)
auto tx_reg_hash = tx_reg.GetHash();
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());
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2);
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
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);
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());
BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 3);
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
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)

View File

@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(simplifiedmns_merkleroots)
if (auto service = Lookup(ip, i, false); service.has_value()) {
smle.service = service.value();
} else {
BOOST_ASSERT(false);
BOOST_REQUIRE(false);
}
std::vector<unsigned char> vecBytes{static_cast<unsigned char>(i)};

View File

@ -14,13 +14,13 @@ BOOST_AUTO_TEST_CASE(llmq_dkgerror)
{
using namespace llmq;
for (auto i : irange::range(ToUnderlying(llmq::DKGError::type::_COUNT))) {
BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 0.0);
BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 0.0);
SetSimulatedDKGErrorRate(llmq::DKGError::type(i), 1.0);
BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 1.0);
BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 1.0);
}
BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0);
BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0);
SetSimulatedDKGErrorRate(llmq::DKGError::type::_COUNT, 1.0);
BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0);
BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0);
}

View File

@ -441,13 +441,13 @@ CBlock TestChainSetup::CreateBlock(
if (block.vtx[0]->nType == TRANSACTION_COINBASE) {
LOCK(cs_main);
auto cbTx = GetTxPayload<CCbTx>(*block.vtx[0]);
BOOST_ASSERT(cbTx.has_value());
Assert(cbTx.has_value());
BlockValidationState state;
if (!CalcCbTxMerkleRootMNList(block, chainstate.m_chain.Tip(), cbTx->merkleRootMNList, *m_node.dmnman, state, chainstate.CoinsTip())) {
BOOST_ASSERT(false);
Assert(false);
}
if (!CalcCbTxMerkleRootQuorums(block, chainstate.m_chain.Tip(), *m_node.llmq_ctx->quorum_block_processor, cbTx->merkleRootQuorums, state)) {
BOOST_ASSERT(false);
Assert(false);
}
CMutableTransaction tmpTx{*block.vtx[0]};
SetTxPayload(tmpTx, *cbTx);

View File

@ -31,8 +31,11 @@
#include <util/hasher.h>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/indexed_by.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/tag.hpp>
#include <boost/multi_index_container.hpp>
class CBlockIndex;

View File

@ -209,7 +209,7 @@ public:
BOOST_FIXTURE_TEST_CASE(coinjoin_manager_start_stop_tests, CTransactionBuilderTestSetup)
{
CCoinJoinClientManager* cj_man = m_node.cj_ctx->walletman->Get("");
BOOST_ASSERT(cj_man != nullptr);
BOOST_REQUIRE(cj_man != nullptr);
BOOST_CHECK_EQUAL(cj_man->IsMixing(), false);
BOOST_CHECK_EQUAL(cj_man->StartMixing(), true);
BOOST_CHECK_EQUAL(cj_man->IsMixing(), true);

View File

@ -51,8 +51,11 @@ fi
EXPECTED_BOOST_INCLUDES=(
boost/date_time/posix_time/posix_time.hpp
boost/multi_index/hashed_index.hpp
boost/multi_index/identity.hpp
boost/multi_index/indexed_by.hpp
boost/multi_index/ordered_index.hpp
boost/multi_index/sequenced_index.hpp
boost/multi_index/tag.hpp
boost/multi_index_container.hpp
boost/pool/pool_alloc.hpp
boost/process.hpp