aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorptschip <peter.tschipper@gmail.com>2015-10-16 18:18:16 -0700
committerptschip <peter.tschipper@gmail.com>2016-01-06 10:15:00 -0800
commit2dfeaa1ad03e7768fb28bfde7f929ac57dfff120 (patch)
tree3c7d6bf3ec77dd2dfd919c3d7bf8da3e3dc44f87 /src/main.cpp
parent7a5040155ed59f8c9c51734bb2ee29f1593eaa6a (diff)
limitfreerelay edge case bugfix:
If a new transaction will cause limitfreerelay to be exceeded it should not be accepted into the memory pool and the byte counter should be updated only after the fact.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 41fc0b8098..08a95aff2b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1016,7 +1016,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
nLastTime = nNow;
// -limitfreerelay unit is thousand-bytes-per-minute
// At default rate it would take over a month to fill 1GB
- if (dFreeCount >= GetArg("-limitfreerelay", DEFAULT_LIMITFREERELAY) * 10 * 1000)
+ if (dFreeCount + nSize >= GetArg("-limitfreerelay", DEFAULT_LIMITFREERELAY) * 10 * 1000)
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "rate limited free transaction");
LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
dFreeCount += nSize;