Skip to content

Commit 3ce7b27

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26930: fuzz: Actually use mocked mempool in tx_pool target
9ab62d7 [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 9ab62d7 Tree-SHA512: fe9af3dbdd13cb569fdc2ddbb4290b5ce94206ae83d94267c6365ed0ee9bbe072fcfe7fd632a1a8522dce44608e89aba2f398c1e20bd250484bbadb78143320c
2 parents f1b5d6b + 9ab62d7 commit 3ce7b27

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/test/fuzz/tx_pool.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ FUZZ_TARGET_INIT(tx_pool, initialize_tx_pool)
311311
{
312312
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
313313
const auto& node = g_setup->m_node;
314-
auto& chainstate = node.chainman->ActiveChainstate();
314+
auto& chainstate{static_cast<DummyChainState&>(node.chainman->ActiveChainstate())};
315315

316316
MockTime(fuzzed_data_provider, chainstate);
317317

@@ -329,6 +329,8 @@ FUZZ_TARGET_INIT(tx_pool, initialize_tx_pool)
329329
CTxMemPool tx_pool_{MakeMempool(fuzzed_data_provider, node)};
330330
MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
331331

332+
chainstate.SetMempool(&tx_pool);
333+
332334
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300)
333335
{
334336
const auto mut_tx = ConsumeTransaction(fuzzed_data_provider, txids);

0 commit comments

Comments
 (0)