Merge #9367: If we don't allow free txs, always send a fee filter (take 2)

fa16b8f If we don't allow free txs, always send a fee filter (take 2) (MarcoFalke)
This commit is contained in:
Wladimir J. van der Laan 2016-12-16 17:09:31 +01:00 committed by Alexander Block
parent bf3cc9ff90
commit 8fa6680c5e

View File

@ -2952,6 +2952,9 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
int64_t timeNow = GetTimeMicros(); int64_t timeNow = GetTimeMicros();
if (timeNow > pto->nextSendTimeFeeFilter) { if (timeNow > pto->nextSendTimeFeeFilter) {
CAmount filterToSend = filterRounder.round(currentFilter); CAmount filterToSend = filterRounder.round(currentFilter);
// If we don't allow free transactions, then we always have a fee filter of at least minRelayTxFee
if (GetArg("-limitfreerelay", DEFAULT_LIMITFREERELAY) <= 0)
filterToSend = std::max(filterToSend, ::minRelayTxFee.GetFeePerK());
if (filterToSend != pto->lastSentFeeFilter) { if (filterToSend != pto->lastSentFeeFilter) {
connman.PushMessage(pto, msgMaker.Make(NetMsgType::FEEFILTER, filterToSend)); connman.PushMessage(pto, msgMaker.Make(NetMsgType::FEEFILTER, filterToSend));
pto->lastSentFeeFilter = filterToSend; pto->lastSentFeeFilter = filterToSend;