Files
bitcoin/src/node/peerman_args.cpp
Anthony Towns 74a47a5207 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.
2026-07-12 09:12:27 +10:00

36 lines
1.1 KiB
C++

// Copyright (c) 2023-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://opensource.org/license/mit.
#include <node/peerman_args.h>
#include <common/args.h>
#include <net_processing.h>
#include <algorithm>
#include <limits>
namespace node {
void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& options)
{
if (auto value{argsman.GetBoolArg("-txreconciliation")}) options.reconcile_txs = *value;
if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) {
options.max_extra_txs = uint32_t((std::clamp<int64_t>(*value, 0, std::numeric_limits<uint32_t>::max())));
}
if (auto value{argsman.GetBoolArg("-capturemessages")}) options.capture_messages = *value;
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;
}
} // namespace node