@@ -3694,10 +3694,10 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
36943694 if (fSendTrickle && pto->fSendMempool ) {
36953695 auto vtxinfo = mempool.infoAll ();
36963696 pto->fSendMempool = false ;
3697- CAmount filterrate = 0 ;
3697+ CFeeRate filterrate ;
36983698 {
36993699 LOCK (pto->cs_feeFilter );
3700- filterrate = pto->minFeeFilter ;
3700+ filterrate = CFeeRate ( pto->minFeeFilter ) ;
37013701 }
37023702
37033703 LOCK (pto->cs_filter );
@@ -3706,9 +3706,9 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
37063706 const uint256& hash = txinfo.tx ->GetHash ();
37073707 CInv inv (MSG_TX, hash);
37083708 pto->setInventoryTxToSend .erase (hash);
3709- if (filterrate) {
3710- if (txinfo.feeRate . GetFeePerK () < filterrate)
3711- continue ;
3709+ // Don't send transactions that peers will not put into their mempool
3710+ if (txinfo.fee < filterrate. GetFee (txinfo. vsize )) {
3711+ continue ;
37123712 }
37133713 if (pto->pfilter ) {
37143714 if (!pto->pfilter ->IsRelevantAndUpdate (*txinfo.tx )) continue ;
@@ -3731,10 +3731,10 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
37313731 for (std::set<uint256>::iterator it = pto->setInventoryTxToSend .begin (); it != pto->setInventoryTxToSend .end (); it++) {
37323732 vInvTx.push_back (it);
37333733 }
3734- CAmount filterrate = 0 ;
3734+ CFeeRate filterrate;
37353735 {
37363736 LOCK (pto->cs_feeFilter );
3737- filterrate = pto->minFeeFilter ;
3737+ filterrate = CFeeRate ( pto->minFeeFilter ) ;
37383738 }
37393739 // Topologically and fee-rate sort the inventory we send for privacy and priority reasons.
37403740 // A heap is used so that not all items need sorting if only a few are being sent.
@@ -3761,7 +3761,8 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
37613761 if (!txinfo.tx ) {
37623762 continue ;
37633763 }
3764- if (filterrate && txinfo.feeRate .GetFeePerK () < filterrate) {
3764+ // Peer told you to not send transactions at that feerate? Don't bother sending it.
3765+ if (txinfo.fee < filterrate.GetFee (txinfo.vsize )) {
37653766 continue ;
37663767 }
37673768 if (pto->pfilter && !pto->pfilter ->IsRelevantAndUpdate (*txinfo.tx )) continue ;
0 commit comments