@@ -4392,10 +4392,21 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
4392
4392
!pto->HasPermission (PF_FORCERELAY)) {
4393
4393
CAmount currentFilter = m_mempool.GetMinFee (gArgs .GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ).GetFeePerK ();
4394
4394
int64_t timeNow = GetTimeMicros ();
4395
+ static FeeFilterRounder g_filter_rounder{CFeeRate{DEFAULT_MIN_RELAY_TX_FEE}};
4396
+ if (m_chainman.ActiveChainstate ().IsInitialBlockDownload ()) {
4397
+ // Received tx-inv messages are discarded when the active
4398
+ // chainstate is in IBD, so tell the peer to not send them.
4399
+ currentFilter = MAX_MONEY;
4400
+ } else {
4401
+ static const CAmount MAX_FILTER{g_filter_rounder.round (MAX_MONEY)};
4402
+ if (pto->m_tx_relay ->lastSentFeeFilter == MAX_FILTER) {
4403
+ // Send the current filter if we sent MAX_FILTER previously
4404
+ // and made it out of IBD.
4405
+ pto->m_tx_relay ->nextSendTimeFeeFilter = timeNow - 1 ;
4406
+ }
4407
+ }
4395
4408
if (timeNow > pto->m_tx_relay ->nextSendTimeFeeFilter ) {
4396
- static CFeeRate default_feerate (DEFAULT_MIN_RELAY_TX_FEE);
4397
- static FeeFilterRounder filterRounder (default_feerate);
4398
- CAmount filterToSend = filterRounder.round (currentFilter);
4409
+ CAmount filterToSend = g_filter_rounder.round (currentFilter);
4399
4410
// We always have a fee filter of at least minRelayTxFee
4400
4411
filterToSend = std::max (filterToSend, ::minRelayTxFee.GetFeePerK ());
4401
4412
if (filterToSend != pto->m_tx_relay ->lastSentFeeFilter ) {
0 commit comments