Changeset View
Changeset View
Standalone View
Standalone View
src/test/mempool_tests.cpp
| Show First 20 Lines • Show All 591 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(remove_for_finalized_block) { | ||||
| for (size_t i = 0; i < 100; i++) { | for (size_t i = 0; i < 100; i++) { | ||||
| CTransactionRef tx = make_tx({int64_t(i + 1) * COIN}); | CTransactionRef tx = make_tx({int64_t(i + 1) * COIN}); | ||||
| const TxId &txid = tx->GetId(); | const TxId &txid = tx->GetId(); | ||||
| auto mempoolEntry = entry.FromTx(tx); | auto mempoolEntry = entry.FromTx(tx); | ||||
| pool.addUnchecked(mempoolEntry); | pool.addUnchecked(mempoolEntry); | ||||
| BOOST_CHECK(pool.exists(txid)); | BOOST_CHECK(pool.exists(txid)); | ||||
| BOOST_CHECK(pool.setAvalancheFinalized(mempoolEntry)); | std::vector<TxId> finalizedTxIds; | ||||
| BOOST_CHECK(pool.setAvalancheFinalized(mempoolEntry, finalizedTxIds)); | |||||
| BOOST_CHECK(pool.isAvalancheFinalized(txid)); | BOOST_CHECK(pool.isAvalancheFinalized(txid)); | ||||
| BOOST_CHECK_EQUAL(finalizedTxIds.size(), 1); | |||||
| BOOST_CHECK_EQUAL(finalizedTxIds[0], txid); | |||||
| txs.push_back(std::move(tx)); | txs.push_back(std::move(tx)); | ||||
| } | } | ||||
| std::vector<CTransactionRef> minedTxs(txs.begin(), txs.begin() + 50); | std::vector<CTransactionRef> minedTxs(txs.begin(), txs.begin() + 50); | ||||
| pool.removeForFinalizedBlock(minedTxs); | pool.removeForFinalizedBlock(minedTxs); | ||||
| for (const auto &tx : minedTxs) { | for (const auto &tx : minedTxs) { | ||||
| Show All 28 Lines | |||||