mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-21 14:22:38 +02:00
[net processing] Move -blockreconstructionextratxn to PeerManager::Options
This commit is contained in:
parent
567c4e0b6a
commit
bd59bda26b
@ -1649,13 +1649,12 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) c
|
||||
|
||||
void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef& tx)
|
||||
{
|
||||
size_t max_extra_txn = gArgs.GetIntArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN);
|
||||
if (max_extra_txn <= 0)
|
||||
if (m_opts.max_extra_txs <= 0)
|
||||
return;
|
||||
if (!vExtraTxnForCompact.size())
|
||||
vExtraTxnForCompact.resize(max_extra_txn);
|
||||
vExtraTxnForCompact.resize(m_opts.max_extra_txs);
|
||||
vExtraTxnForCompact[vExtraTxnForCompactIt] = std::make_pair(tx->GetWitnessHash(), tx);
|
||||
vExtraTxnForCompactIt = (vExtraTxnForCompactIt + 1) % max_extra_txn;
|
||||
vExtraTxnForCompactIt = (vExtraTxnForCompactIt + 1) % m_opts.max_extra_txs;
|
||||
}
|
||||
|
||||
void PeerManagerImpl::Misbehaving(Peer& peer, int howmuch, const std::string& message)
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
bool ignore_incoming_txs{DEFAULT_BLOCKSONLY};
|
||||
bool reconcile_txs{DEFAULT_TXRECONCILIATION_ENABLE};
|
||||
uint32_t max_orphan_txs{DEFAULT_MAX_ORPHAN_TRANSACTIONS};
|
||||
size_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};
|
||||
};
|
||||
|
||||
static std::unique_ptr<PeerManager> make(CConnman& connman, AddrMan& addrman,
|
||||
|
@ -12,6 +12,10 @@ void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& optio
|
||||
if (auto value{argsman.GetIntArg("-maxorphantx")}) {
|
||||
options.max_orphan_txs = uint32_t(std::max(int64_t{0}, *value));
|
||||
}
|
||||
|
||||
if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) {
|
||||
options.max_extra_txs = size_t(std::max(int64_t{0}, *value));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
|
Loading…
x
Reference in New Issue
Block a user