mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-04 08:22:36 +02:00
net processing: clamp -blockreconstructionextratxn to uint32_t bounds
Also changes max_extra_txs into a uint32_t to avoid platform-specific behaviour
This commit is contained in:
parent
e451d1e3c6
commit
547fa52443
@ -20,7 +20,7 @@ static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE{false};
|
|||||||
static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS{100};
|
static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS{100};
|
||||||
/** Default number of non-mempool transactions to keep around for block reconstruction. Includes
|
/** Default number of non-mempool transactions to keep around for block reconstruction. Includes
|
||||||
orphan, replaced, and rejected transactions. */
|
orphan, replaced, and rejected transactions. */
|
||||||
static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100;
|
static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN{100};
|
||||||
static const bool DEFAULT_PEERBLOOMFILTERS = false;
|
static const bool DEFAULT_PEERBLOOMFILTERS = false;
|
||||||
static const bool DEFAULT_PEERBLOCKFILTERS = false;
|
static const bool DEFAULT_PEERBLOCKFILTERS = false;
|
||||||
/** Threshold for marking a node to be discouraged, e.g. disconnected and added to the discouragement filter. */
|
/** Threshold for marking a node to be discouraged, e.g. disconnected and added to the discouragement filter. */
|
||||||
@ -55,7 +55,7 @@ public:
|
|||||||
uint32_t max_orphan_txs{DEFAULT_MAX_ORPHAN_TRANSACTIONS};
|
uint32_t max_orphan_txs{DEFAULT_MAX_ORPHAN_TRANSACTIONS};
|
||||||
//! Number of non-mempool transactions to keep around for block reconstruction. Includes
|
//! Number of non-mempool transactions to keep around for block reconstruction. Includes
|
||||||
//! orphan, replaced, and rejected transactions.
|
//! orphan, replaced, and rejected transactions.
|
||||||
size_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};
|
uint32_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};
|
||||||
//! Whether all P2P messages are captured to disk
|
//! Whether all P2P messages are captured to disk
|
||||||
bool capture_messages{false};
|
bool capture_messages{false};
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& optio
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) {
|
if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) {
|
||||||
options.max_extra_txs = size_t(std::max(int64_t{0}, *value));
|
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("-capturemessages")}) options.capture_messages = *value;
|
||||||
|
Loading…
Reference in New Issue
Block a user