Skip to content

Commit fa584cb

Browse files
committed
[p2p] add TxDownloadOptions bool to make TxRequestTracker deterministic
Forward this bool to the TxRequestTracker ctor. This is needed for stablity in TxDownloadManager fuzzers
1 parent f803c8c commit fa584cb

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ PeerManagerImpl::PeerManagerImpl(CConnman& connman, AddrMan& addrman,
18891889
m_banman(banman),
18901890
m_chainman(chainman),
18911891
m_mempool(pool),
1892-
m_txdownloadman(node::TxDownloadOptions{pool, m_rng, opts.max_orphan_txs}),
1892+
m_txdownloadman(node::TxDownloadOptions{pool, m_rng, opts.max_orphan_txs, opts.deterministic_rng}),
18931893
m_warnings{warnings},
18941894
m_opts{opts}
18951895
{

src/node/txdownloadman.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ struct TxDownloadOptions {
4343
FastRandomContext& m_rng;
4444
/** Maximum number of transactions allowed in orphanage. */
4545
const uint32_t m_max_orphan_txs;
46+
/** Instantiate TxRequestTracker as deterministic (used for tests). */
47+
bool m_deterministic_txrequest{false};
4648
};
4749
struct TxDownloadConnectionInfo {
4850
/** Whether this peer is preferred for transaction download. */

src/node/txdownloadman_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class TxDownloadManagerImpl {
128128
return *m_lazy_recent_confirmed_transactions;
129129
}
130130

131-
TxDownloadManagerImpl(const TxDownloadOptions& options) : m_opts{options} {}
131+
TxDownloadManagerImpl(const TxDownloadOptions& options) : m_opts{options}, m_txrequest{options.m_deterministic_txrequest} {}
132132

133133
struct PeerInfo {
134134
/** Information relevant to scheduling tx requests. */

0 commit comments

Comments
 (0)