init: add -txsendrate configuration parameter

Adds a debug-only configuration option to set the target
transaction/second rate for relay to inbound connections. This is mostly
intended to be set to artificially low values to aid in testing behaviour
when a backlog occurs, but is also available in case the default 14tx/s
target is somehow too low in practice.
This commit is contained in:
Anthony Towns
2026-02-19 19:50:28 +10:00
parent 6307bd034b
commit 74a47a5207
5 changed files with 16 additions and 9 deletions

View File

@@ -24,6 +24,10 @@ void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& optio
if (auto value{argsman.GetBoolArg("-blocksonly")}) options.ignore_incoming_txs = *value;
if (auto value{argsman.GetIntArg("-txsendrate")}) {
options.tx_send_rate = uint32_t(std::clamp<int64_t>(*value, 1, 1000));
}
if (auto value{argsman.GetBoolArg("-privatebroadcast")}) options.private_broadcast = *value;
}

View File

@@ -25,7 +25,7 @@ class TxDownloadManagerImpl;
static constexpr int32_t MAX_PEER_TX_REQUEST_IN_FLIGHT = 100;
/** Maximum number of transactions to consider for requesting, per peer. It provides a reasonable DoS limit to
* per-peer memory usage spent on announcements, while covering peers continuously sending INVs at the maximum
* rate (by our own policy, see INVENTORY_BROADCAST_PER_SECOND) for several minutes, while not receiving
* rate (by our own policy, see DEFAULT_TX_SEND_RATE) for several minutes, while not receiving
* the actual transaction (from any peer) in response to requests for them. */
static constexpr int32_t MAX_PEER_TX_ANNOUNCEMENTS = 5000;
/** How long to delay requesting transactions via txids, if we have wtxid-relaying peers */