From 2dfeaa1ad03e7768fb28bfde7f929ac57dfff120 Mon Sep 17 00:00:00 2001 From: ptschip Date: Fri, 16 Oct 2015 18:18:16 -0700 Subject: [PATCH] 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. --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 41fc0b809..08a95aff2 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;