diff --git a/configure.ac b/configure.ac index 6338f6380a..ec2b59a234 100644 --- a/configure.ac +++ b/configure.ac @@ -1461,11 +1461,14 @@ fi if test x$use_boost = xyes; then dnl Check for Boost headers -AX_BOOST_BASE([1.64.0],[],[AC_MSG_ERROR([Boost is not available!])]) +AX_BOOST_BASE([1.73.0],[],[AC_MSG_ERROR([Boost is not available!])]) if test x$want_boost = xno; then AC_MSG_ERROR([[only libdashconsensus can be built without boost]]) fi + dnl we don't use multi_index serialization + BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION" + dnl Prevent use of std::unary_function, which was removed in C++17, dnl and will generate warnings with newer compilers for Boost dnl older than 1.80. diff --git a/doc/dependencies.md b/doc/dependencies.md index f27487d158..38893d8f1c 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -6,7 +6,7 @@ These are the dependencies currently used by Dash Core. You can find instruction | Dependency | Version used | Minimum required | CVEs | Shared | [Bundled Qt library](https://doc.qt.io/qt-5/configure-options.html#third-party-libraries) | | --- | --- | --- | --- | --- | --- | | Berkeley DB | [4.8.30](https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 4.8.x | No | | | -| Boost | [1.81.0](https://www.boost.org/users/download/) | [1.64.0](https://github.com/bitcoin/bitcoin/pull/22320) | No | | | +| Boost | [1.81.0](https://www.boost.org/users/download/) | [1.73.0](https://github.com/bitcoin/bitcoin/pull/29066) | No | | | | Clang[ \* ](#note1) | | [5.0+](https://releases.llvm.org/download.html) (C++17 support) | | | | | fontconfig | [2.12.1](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | | | FreeType | [2.11.0](https://download.savannah.gnu.org/releases/freetype) | | No | | [Yes](https://github.com/dashpay/dash/blob/develop/depends/packages/qt.mk) (Android only) | diff --git a/src/miner.h b/src/miner.h index a7012e7126..287d06eb88 100644 --- a/src/miner.h +++ b/src/miner.h @@ -13,8 +13,11 @@ #include #include -#include +#include +#include #include +#include +#include class BlockManager; class CBlockIndex; diff --git a/src/test/block_reward_reallocation_tests.cpp b/src/test/block_reward_reallocation_tests.cpp index e4747613ca..3c78438bf9 100644 --- a/src/test/block_reward_reallocation_tests.cpp +++ b/src/test/block_reward_reallocation_tests.cpp @@ -71,7 +71,7 @@ static std::vector 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); diff --git a/src/test/evo_deterministicmns_tests.cpp b/src/test/evo_deterministicmns_tests.cpp index 20ebfeea1f..5677b71a48 100644 --- a/src/test/evo_deterministicmns_tests.cpp +++ b/src/test/evo_deterministicmns_tests.cpp @@ -58,7 +58,7 @@ static std::vector 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 static CMutableTransaction MalleateProTxPayout(const CMutableTransaction& tx) { auto opt_protx = GetTxPayload(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(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(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(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 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(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(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(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(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(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(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(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) diff --git a/src/test/evo_simplifiedmns_tests.cpp b/src/test/evo_simplifiedmns_tests.cpp index 5a5c8a5cda..fa833dbb1b 100644 --- a/src/test/evo_simplifiedmns_tests.cpp +++ b/src/test/evo_simplifiedmns_tests.cpp @@ -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 vecBytes{static_cast(i)}; diff --git a/src/test/llmq_dkg_tests.cpp b/src/test/llmq_dkg_tests.cpp index 15b3242eea..fe2cb23d94 100644 --- a/src/test/llmq_dkg_tests.cpp +++ b/src/test/llmq_dkg_tests.cpp @@ -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); } diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 9f917bd7ea..72dbd153bc 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -441,13 +441,13 @@ CBlock TestChainSetup::CreateBlock( if (block.vtx[0]->nType == TRANSACTION_COINBASE) { LOCK(cs_main); auto cbTx = GetTxPayload(*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); diff --git a/src/txmempool.h b/src/txmempool.h index 6067ec8ed3..13f2b964d2 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -31,8 +31,11 @@ #include #include +#include +#include #include #include +#include #include class CBlockIndex; diff --git a/src/wallet/test/coinjoin_tests.cpp b/src/wallet/test/coinjoin_tests.cpp index 45afe2bba5..0615943b4e 100644 --- a/src/wallet/test/coinjoin_tests.cpp +++ b/src/wallet/test/coinjoin_tests.cpp @@ -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); diff --git a/test/lint/lint-includes.sh b/test/lint/lint-includes.sh index 61da0726ed..a2aa3f47ec 100755 --- a/test/lint/lint-includes.sh +++ b/test/lint/lint-includes.sh @@ -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