aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorGregory Sanders <gsanders87@gmail.com>2019-07-31 13:21:00 -0400
committerGregory Sanders <gsanders87@gmail.com>2019-10-03 14:03:27 -0400
commit8e59af55aaf1b196575084bce2448af02d97d745 (patch)
tree066de49201c9a95482cc601fbe385195c991752c /src/net_processing.cpp
parenta689c119076c7b8dc5b4dea4539e4cbf5adfb72f (diff)
feefilter: Compute the absolute fee rather than stored rate to match mempool acceptance logic
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index e345af604c..9aa0294c27 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -3847,10 +3847,10 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
if (fSendTrickle && pto->m_tx_relay->fSendMempool) {
auto vtxinfo = mempool.infoAll();
pto->m_tx_relay->fSendMempool = false;
- CAmount filterrate = 0;
+ CFeeRate filterrate;
{
LOCK(pto->m_tx_relay->cs_feeFilter);
- filterrate = pto->m_tx_relay->minFeeFilter;
+ filterrate = CFeeRate(pto->m_tx_relay->minFeeFilter);
}
LOCK(pto->m_tx_relay->cs_filter);
@@ -3859,9 +3859,9 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
const uint256& hash = txinfo.tx->GetHash();
CInv inv(MSG_TX, hash);
pto->m_tx_relay->setInventoryTxToSend.erase(hash);
- if (filterrate) {
- if (txinfo.feeRate.GetFeePerK() < filterrate)
- continue;
+ // Don't send transactions that peers will not put into their mempool
+ if (txinfo.fee < filterrate.GetFee(txinfo.vsize)) {
+ continue;
}
if (pto->m_tx_relay->pfilter) {
if (!pto->m_tx_relay->pfilter->IsRelevantAndUpdate(*txinfo.tx)) continue;
@@ -3884,10 +3884,10 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
for (std::set<uint256>::iterator it = pto->m_tx_relay->setInventoryTxToSend.begin(); it != pto->m_tx_relay->setInventoryTxToSend.end(); it++) {
vInvTx.push_back(it);
}
- CAmount filterrate = 0;
+ CFeeRate filterrate;
{
LOCK(pto->m_tx_relay->cs_feeFilter);
- filterrate = pto->m_tx_relay->minFeeFilter;
+ filterrate = CFeeRate(pto->m_tx_relay->minFeeFilter);
}
// Topologically and fee-rate sort the inventory we send for privacy and priority reasons.
// A heap is used so that not all items need sorting if only a few are being sent.
@@ -3914,7 +3914,8 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
if (!txinfo.tx) {
continue;
}
- if (filterrate && txinfo.feeRate.GetFeePerK() < filterrate) {
+ // Peer told you to not send transactions at that feerate? Don't bother sending it.
+ if (txinfo.fee < filterrate.GetFee(txinfo.vsize)) {
continue;
}
if (pto->m_tx_relay->pfilter && !pto->m_tx_relay->pfilter->IsRelevantAndUpdate(*txinfo.tx)) continue;