diff options
author | Gleb <naumenko.gs@gmail.com> | 2018-05-21 12:02:40 -0700 |
---|---|---|
committer | User <naumenko.gs@gmail.com> | 2018-07-13 23:14:35 -0700 |
commit | d45b344ffd46b0226449cbd46cdaff9577402cf0 (patch) | |
tree | 0b23b028d113acce4c57faf3d8f931deba5436d9 /src/net_processing.cpp | |
parent | 287e4edc2fd2514a0095273f01fe66b85ce10856 (diff) |
Bucket for inbound when scheduling invs to hide tx time
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ed9debc95a..473a4b8c55 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -71,6 +71,21 @@ static const int STALE_RELAY_AGE_LIMIT = 30 * 24 * 60 * 60; /// limiting block relay. Set to one week, denominated in seconds. static const int HISTORICAL_BLOCK_AGE = 7 * 24 * 60 * 60; +/** Average delay between local address broadcasts in seconds. */ +static constexpr unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 60 * 60; +/** Average delay between peer address broadcasts in seconds. */ +static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30; +/** Average delay between trickled inventory transmissions in seconds. + * Blocks and whitelisted receivers bypass this, outbound peers get half this delay. */ +static const unsigned int INVENTORY_BROADCAST_INTERVAL = 5; +/** Maximum number of inventory items to send per transmission. + * Limits the impact of low-fee transaction floods. */ +static constexpr unsigned int INVENTORY_BROADCAST_MAX = 7 * INVENTORY_BROADCAST_INTERVAL; +/** Average delay between feefilter broadcasts in seconds. */ +static constexpr unsigned int AVG_FEEFILTER_BROADCAST_INTERVAL = 10 * 60; +/** Maximum feefilter broadcast delay after significant change. */ +static constexpr unsigned int MAX_FEEFILTER_CHANGE_DELAY = 5 * 60; + // Internal stuff namespace { /** Number of nodes with fSyncStarted. */ @@ -3496,8 +3511,12 @@ bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic<bool>& interruptM bool fSendTrickle = pto->fWhitelisted; if (pto->nNextInvSend < nNow) { fSendTrickle = true; - // Use half the delay for outbound peers, as there is less privacy concern for them. - pto->nNextInvSend = PoissonNextSend(nNow, INVENTORY_BROADCAST_INTERVAL >> !pto->fInbound); + if (pto->fInbound) { + pto->nNextInvSend = connman->PoissonNextSendInbound(nNow, INVENTORY_BROADCAST_INTERVAL); + } else { + // Use half the delay for outbound peers, as there is less privacy concern for them. + pto->nNextInvSend = PoissonNextSend(nNow, INVENTORY_BROADCAST_INTERVAL >> 1); + } } // Time to send but the peer has requested we not relay transactions. |