Skip to content

Commit

Permalink
add TxDownloadOptions bool to make deterministic TxRequestTracker
Browse files Browse the repository at this point in the history
Forward this bool to the TxRequestTracker ctor. This is needed for
stablity in TxDownloadManager fuzzers
  • Loading branch information
glozow committed Sep 17, 2024
1 parent 60b3bbf commit 632e6a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1891,7 +1891,7 @@ PeerManagerImpl::PeerManagerImpl(CConnman& connman, AddrMan& addrman,
m_banman(banman),
m_chainman(chainman),
m_mempool(pool),
m_txdownloadman(node::TxDownloadOptions{pool, m_rng, opts.max_orphan_txs}),
m_txdownloadman(node::TxDownloadOptions{pool, m_rng, opts.max_orphan_txs, opts.deterministic_rng}),
m_warnings{warnings},
m_opts{opts}
{
Expand Down
2 changes: 2 additions & 0 deletions src/node/txdownloadman.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct TxDownloadOptions {
FastRandomContext& m_rng;
/** Maximum number of transactions allowed in orphanage. */
const uint32_t m_max_orphan_txs;
/** Instantiate TxRequestTracker as deterministic (used for tests). */
bool m_deterministic_txrequest{false};
};
struct TxDownloadConnectionInfo {
/** Whether this peer is preferred for transaction download. */
Expand Down
2 changes: 1 addition & 1 deletion src/node/txdownloadman_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class TxDownloadManagerImpl {
return *m_lazy_recent_confirmed_transactions;
}

TxDownloadManagerImpl(const TxDownloadOptions& options) : m_opts{options} {}
TxDownloadManagerImpl(const TxDownloadOptions& options) : m_opts{options}, m_txrequest{options.m_deterministic_txrequest} {}

struct PeerInfo {
/** Information relevant to scheduling tx requests. */
Expand Down

0 comments on commit 632e6a6

Please sign in to comment.