Bitcoin ABC 0.30.7
P2P Digital Currency
peerman_args.cpp
Go to the documentation of this file.
1#include <node/peerman_args.h>
2
3#include <common/args.h>
4#include <net_processing.h>
5
6#include <algorithm>
7#include <limits>
8
9namespace node {
10
11void ApplyArgsManOptions(const ArgsManager &argsman,
12 PeerManager::Options &options) {
13 if (auto value{argsman.GetIntArg("-maxorphantx")}) {
14 options.max_orphan_txs = uint32_t(std::clamp<int64_t>(
15 *value, 0, std::numeric_limits<uint32_t>::max()));
16 }
17
18 if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) {
19 options.max_extra_txs = uint32_t(std::clamp<int64_t>(
20 *value, 0, std::numeric_limits<uint32_t>::max()));
21 }
22
23 if (auto value{argsman.GetBoolArg("-capturemessages")}) {
24 options.capture_messages = *value;
25 }
26
27 if (auto value{argsman.GetBoolArg("-blocksonly")}) {
28 options.ignore_incoming_txs = *value;
29 }
30
31 if (auto value{argsman.GetIntArg("-maxaddrtosend")}) {
32 options.max_addr_to_send = size_t(std::max(int64_t{0}, *value));
33 }
34
35 if (auto value{argsman.GetIntArg("-avacooldown")}) {
36 options.avalanche_cooldown = std::max(int64_t{0}, *value);
37 }
38
39 if (auto value{argsman.GetIntArg("-avalanchepeerreplacementcooldown")}) {
41 std::max(int64_t{0}, *value);
42 }
43
44 if (auto value{argsman.GetBoolArg("-avalanchepreconsensus")}) {
45 options.avalanche_preconsensus = *value;
46 }
47
48 if (auto value{argsman.GetBoolArg("-avalanchestakingpreconsensus")}) {
49 options.avalanche_staking_preconsensus = *value;
50 }
51}
52
53} // namespace node
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
Definition: args.cpp:526
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: args.cpp:556
Definition: init.h:28
std::optional< bilingual_str > ApplyArgsManOptions(const ArgsManager &args, BlockManager::Options &opts)
bool avalanche_staking_preconsensus
Whether this node has enabled avalanche staking rewards preconsensus.
int64_t avalanche_cooldown
Minimum time between two AVAPOLL messages.
size_t max_addr_to_send
Number of addresses a node may send in an ADDR message.
uint32_t max_extra_txs
Number of non-mempool transactions to keep around for block reconstruction.
uint32_t max_orphan_txs
Maximum number of orphan transactions kept in memory.
bool avalanche_preconsensus
Whether this node has enabled avalanche preconsensus.
int64_t avalanche_peer_replacement_cooldown
Minimum time before we will consider replacing a finalized proof with a conflicting one.
bool ignore_incoming_txs
Whether this node is running in -blocksonly mode.
bool capture_messages
Whether all P2P messages are captured to disk.