mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-25 16:31:29 +02:00
Make txid delay penalty also apply to fetches of orphan's parents
This commit is contained in:
parent
173a1d2d3f
commit
cc16fff3e4
@ -767,13 +767,13 @@ void PeerManager::AddTxAnnouncement(const CNode& node, const GenTxid& gtxid, std
|
|||||||
// - "preferred": if fPreferredDownload is set (= outbound, or PF_NOBAN permission)
|
// - "preferred": if fPreferredDownload is set (= outbound, or PF_NOBAN permission)
|
||||||
// - "reqtime": current time plus delays for:
|
// - "reqtime": current time plus delays for:
|
||||||
// - NONPREF_PEER_TX_DELAY for announcements from non-preferred connections
|
// - NONPREF_PEER_TX_DELAY for announcements from non-preferred connections
|
||||||
// - TXID_RELAY_DELAY for announcements from txid peers while wtxid peers are available
|
// - TXID_RELAY_DELAY for txid announcements while wtxid peers are available
|
||||||
// - OVERLOADED_PEER_TX_DELAY for announcements from peers which have at least
|
// - OVERLOADED_PEER_TX_DELAY for announcements from peers which have at least
|
||||||
// MAX_PEER_TX_REQUEST_IN_FLIGHT requests in flight (and don't have PF_RELAY).
|
// MAX_PEER_TX_REQUEST_IN_FLIGHT requests in flight (and don't have PF_RELAY).
|
||||||
auto delay = std::chrono::microseconds{0};
|
auto delay = std::chrono::microseconds{0};
|
||||||
const bool preferred = state->fPreferredDownload;
|
const bool preferred = state->fPreferredDownload;
|
||||||
if (!preferred) delay += NONPREF_PEER_TX_DELAY;
|
if (!preferred) delay += NONPREF_PEER_TX_DELAY;
|
||||||
if (!state->m_wtxid_relay && g_wtxid_relay_peers > 0) delay += TXID_RELAY_DELAY;
|
if (!gtxid.IsWtxid() && g_wtxid_relay_peers > 0) delay += TXID_RELAY_DELAY;
|
||||||
const bool overloaded = !node.HasPermission(PF_RELAY) &&
|
const bool overloaded = !node.HasPermission(PF_RELAY) &&
|
||||||
m_txrequest.CountInFlight(nodeid) >= MAX_PEER_TX_REQUEST_IN_FLIGHT;
|
m_txrequest.CountInFlight(nodeid) >= MAX_PEER_TX_REQUEST_IN_FLIGHT;
|
||||||
if (overloaded) delay += OVERLOADED_PEER_TX_DELAY;
|
if (overloaded) delay += OVERLOADED_PEER_TX_DELAY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user