diff options
author | Carl Dong <contact@carldong.me> | 2022-05-17 14:45:18 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2022-07-15 12:26:00 -0400 |
commit | b857ac60d9a0433036519c26675378bbf56a1de1 (patch) | |
tree | c68426f9c01a42b17b8571a863e792ca81c2744d /src/test/fuzz/tx_pool.cpp | |
parent | b3267258b052557fc136b9a4dcb754afb9219470 (diff) | |
download | bitcoin-b857ac60d9a0433036519c26675378bbf56a1de1.tar.xz |
test/fuzz: Invoke LoadMempool via CChainState
Not only does this increase coverage, it is also more correct in that
when ::LoadMempool is called with a mempool and chainstate, it calls
AcceptToMemoryPool with just the chainstate.
AcceptToMemoryPool will then act on the chainstate's mempool via
CChainState::GetMempool, which may be different from the mempool
originally passed to ::LoadMempool. (In this fuzz test's case, it
definitely is different)
Also, move DummyChainstate to its own file since it's now used by the
validation_load_mempool fuzz test to replace CChainState's m_mempool.
Diffstat (limited to 'src/test/fuzz/tx_pool.cpp')
-rw-r--r-- | src/test/fuzz/tx_pool.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/test/fuzz/tx_pool.cpp b/src/test/fuzz/tx_pool.cpp index 2d88ee295b..63fbf0516a 100644 --- a/src/test/fuzz/tx_pool.cpp +++ b/src/test/fuzz/tx_pool.cpp @@ -8,6 +8,7 @@ #include <node/miner.h> #include <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> +#include <test/fuzz/mempool_utils.h> #include <test/fuzz/util.h> #include <test/util/mining.h> #include <test/util/script.h> @@ -34,15 +35,6 @@ struct MockedTxPool : public CTxMemPool { } }; -class DummyChainState final : public CChainState -{ -public: - void SetMempool(CTxMemPool* mempool) - { - m_mempool = mempool; - } -}; - void initialize_tx_pool() { static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(); |