mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
scripted-diff: test: Use CTxMemPool in TestingSetup
After this commit, there should be no explicit instantiation of
CTxMemPool in src/test other than those in fuzz/ and setup_common
-BEGIN VERIFY SCRIPT-
find_regex="CTxMemPool\s+([^;({]+)(|\(\)|\{\});" \
&& git grep -l -E "$find_regex" -- src/test \
| grep -v -e "^src/test/util/setup_common.cpp$" \
-e "^src/test/fuzz/" \
| xargs sed -i -E "s@$find_regex@CTxMemPool\& \1 = *Assert(m_node.mempool);@g"
-END VERIFY SCRIPT-
This commit is contained in:
@@ -54,7 +54,7 @@ constexpr long SHARED_TX_OFFSET{3};
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
|
BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
|
||||||
{
|
{
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
CBlock block(BuildBlockTestCase());
|
CBlock block(BuildBlockTestCase());
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
|
BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
|
||||||
{
|
{
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
CBlock block(BuildBlockTestCase());
|
CBlock block(BuildBlockTestCase());
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
|
BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
|
||||||
{
|
{
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
CBlock block(BuildBlockTestCase());
|
CBlock block(BuildBlockTestCase());
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest)
|
BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest)
|
||||||
{
|
{
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
CMutableTransaction coinbase;
|
CMutableTransaction coinbase;
|
||||||
coinbase.vin.resize(1);
|
coinbase.vin.resize(1);
|
||||||
coinbase.vin[0].scriptSig.resize(10);
|
coinbase.vin[0].scriptSig.resize(10);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CTxMemPool testPool;
|
CTxMemPool& testPool = *Assert(m_node.mempool);
|
||||||
LOCK2(cs_main, testPool.cs);
|
LOCK2(cs_main, testPool.cs);
|
||||||
|
|
||||||
// Nothing in pool, remove should do nothing:
|
// Nothing in pool, remove should do nothing:
|
||||||
@@ -121,7 +121,7 @@ static void CheckSort(CTxMemPool& pool, std::vector<std::string>& sortedOrder) E
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
|
BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
|
||||||
{
|
{
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
LOCK2(cs_main, pool.cs);
|
LOCK2(cs_main, pool.cs);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
|
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
|
||||||
{
|
{
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
LOCK2(cs_main, pool.cs);
|
LOCK2(cs_main, pool.cs);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
|
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
|
||||||
{
|
{
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
LOCK2(cs_main, pool.cs);
|
LOCK2(cs_main, pool.cs);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
|
|
||||||
@@ -594,7 +594,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
|||||||
{
|
{
|
||||||
size_t ancestors, descendants;
|
size_t ancestors, descendants;
|
||||||
|
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
LOCK2(cs_main, pool.cs);
|
LOCK2(cs_main, pool.cs);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
|
|
||||||
@@ -753,7 +753,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTestsDiamond)
|
|||||||
{
|
{
|
||||||
size_t ancestors, descendants;
|
size_t ancestors, descendants;
|
||||||
|
|
||||||
CTxMemPool pool;
|
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||||
LOCK2(::cs_main, pool.cs);
|
LOCK2(::cs_main, pool.cs);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(validation_chainstate_resize_caches)
|
|||||||
ChainstateManager manager{chainman_opts};
|
ChainstateManager manager{chainman_opts};
|
||||||
|
|
||||||
WITH_LOCK(::cs_main, manager.m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(1 << 20, true));
|
WITH_LOCK(::cs_main, manager.m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(1 << 20, true));
|
||||||
CTxMemPool mempool;
|
CTxMemPool& mempool = *Assert(m_node.mempool);
|
||||||
|
|
||||||
//! Create and add a Coin with DynamicMemoryUsage of 80 bytes to the given view.
|
//! Create and add a Coin with DynamicMemoryUsage of 80 bytes to the given view.
|
||||||
auto add_coin = [](CCoinsViewCache& coins_view) -> COutPoint {
|
auto add_coin = [](CCoinsViewCache& coins_view) -> COutPoint {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ BOOST_FIXTURE_TEST_SUITE(validation_flush_tests, ChainTestingSetup)
|
|||||||
//!
|
//!
|
||||||
BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
|
BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
|
||||||
{
|
{
|
||||||
CTxMemPool mempool;
|
CTxMemPool& mempool = *Assert(m_node.mempool);
|
||||||
BlockManager blockman{};
|
BlockManager blockman{};
|
||||||
CChainState chainstate{&mempool, blockman, *Assert(m_node.chainman)};
|
CChainState chainstate{&mempool, blockman, *Assert(m_node.chainman)};
|
||||||
chainstate.InitCoinsDB(/*cache_size_bytes=*/1 << 10, /*in_memory=*/true, /*should_wipe=*/false);
|
chainstate.InitCoinsDB(/*cache_size_bytes=*/1 << 10, /*in_memory=*/true, /*should_wipe=*/false);
|
||||||
|
|||||||
Reference in New Issue
Block a user