aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-24 12:53:00 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-24 12:54:48 +0100
commit3ce7b27124f1570195eb5d171bf5b7ca769e333f (patch)
tree3365b0972fc334e3aa50d2f96e6e9b009fd4567e /src/test/fuzz
parentf1b5d6be57e19799d5400215180af8cc5441e210 (diff)
parent9ab62d71fb1a54430ff5071bdb1120a414061288 (diff)
Merge bitcoin/bitcoin#26930: fuzz: Actually use mocked mempool in tx_pool target
9ab62d71fb1a54430ff5071bdb1120a414061288 [fuzz] Actually use mocked mempool in tx_pool target (dergoegge) Pull request description: The current tx_pool target uses the default mempool, making the target non-deterministic. This PR replaces the active chainstate's mempool (i.e. the node's default mempool) with the already present mocked mempool in the target. ACKs for top commit: fanquake: ACK 9ab62d71fb1a54430ff5071bdb1120a414061288 Tree-SHA512: fe9af3dbdd13cb569fdc2ddbb4290b5ce94206ae83d94267c6365ed0ee9bbe072fcfe7fd632a1a8522dce44608e89aba2f398c1e20bd250484bbadb78143320c
Diffstat (limited to 'src/test/fuzz')
-rw-r--r--src/test/fuzz/tx_pool.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/fuzz/tx_pool.cpp b/src/test/fuzz/tx_pool.cpp
index e933167341..0cabaf323b 100644
--- a/src/test/fuzz/tx_pool.cpp
+++ b/src/test/fuzz/tx_pool.cpp
@@ -311,7 +311,7 @@ FUZZ_TARGET_INIT(tx_pool, initialize_tx_pool)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
const auto& node = g_setup->m_node;
- auto& chainstate = node.chainman->ActiveChainstate();
+ auto& chainstate{static_cast<DummyChainState&>(node.chainman->ActiveChainstate())};
MockTime(fuzzed_data_provider, chainstate);
@@ -329,6 +329,8 @@ FUZZ_TARGET_INIT(tx_pool, initialize_tx_pool)
CTxMemPool tx_pool_{MakeMempool(fuzzed_data_provider, node)};
MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
+ chainstate.SetMempool(&tx_pool);
+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300)
{
const auto mut_tx = ConsumeTransaction(fuzzed_data_provider, txids);