[net processing] Move -blockreconstructionextratxn to PeerManager::Options

This commit is contained in:
dergoegge 2023-04-20 13:49:00 +02:00
parent 567c4e0b6a
commit bd59bda26b
3 changed files with 8 additions and 4 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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