bugfix: give TxDownloadManager its own RNG

TxDownloadManagerImpl retains a reference to PeerManagerImpl::m_rng,
which is non-thread-safe and guarded by g_msgproc_mutex.

BlockConnected runs on the validation background thread while holding
only m_tx_download_mutex. Reconsidering an orphan with multiple
announcers could therefore use m_rng concurrently with message
processing.

Regression introduced in 9cc7dc50bd
This commit is contained in:
Greg Sanders
2026-08-25 08:30:33 -04:00
parent 794a753958
commit 80eaa6cabf
6 changed files with 18 additions and 17 deletions

View File

@@ -174,8 +174,7 @@ FUZZ_TARGET(txdownloadman, .init = initialize)
// Initialize txdownloadman
bilingual_str error;
CTxMemPool pool{MemPoolOptionsForTest(g_setup->m_node), error};
FastRandomContext det_rand{true};
node::TxDownloadManager txdownloadman{node::TxDownloadOptions{pool, det_rand, true}};
node::TxDownloadManager txdownloadman{node::TxDownloadOptions{.m_mempool = pool, .m_deterministic_txrequest = true}};
std::chrono::microseconds time{244466666};
@@ -298,8 +297,7 @@ FUZZ_TARGET(txdownloadman_impl, .init = initialize)
// Initialize a TxDownloadManagerImpl
bilingual_str error;
CTxMemPool pool{MemPoolOptionsForTest(g_setup->m_node), error};
FastRandomContext det_rand{true};
node::TxDownloadManagerImpl txdownload_impl{node::TxDownloadOptions{pool, det_rand, true}};
node::TxDownloadManagerImpl txdownload_impl{node::TxDownloadOptions{.m_mempool = pool, .m_deterministic_txrequest = true}};
std::chrono::microseconds time{244466666};