aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-01-07 13:01:30 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-01-07 13:01:56 +0100
commitd79adc1ab18f897ab02da93e48c74ee2f44dce7a (patch)
tree11fe5030abbe0ce8bb50756bafb70691c1390ce6 /src/main.cpp
parent729ba317498bf644c62975dbde07da5ab9ef0043 (diff)
parent1c52aad540ec1370db60fd68fc3485413e3cb8e1 (diff)
downloadbitcoin-d79adc1ab18f897ab02da93e48c74ee2f44dce7a.tar.xz
Merge pull request #5535
1c52aad Require sufficent priority for relay of free transactions (Pieter Wuille)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0067e9a2b2..fa2b561489 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1030,6 +1030,11 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
hash.ToString(), nFees, txMinFee),
REJECT_INSUFFICIENTFEE, "insufficient fee");
+ // Require that free transactions have sufficient priority to be mined in the next block.
+ if (GetBoolArg("-relaypriority", true) && nFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(view.GetPriority(tx, chainActive.Height() + 1))) {
+ return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority");
+ }
+
// Continuously rate-limit free (really, very-low-fee) transactions
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
// be annoying or make others' transactions take longer to confirm.
@@ -1049,7 +1054,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// At default rate it would take over a month to fill 1GB
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
return state.DoS(0, error("AcceptToMemoryPool : free transaction rejected by rate limiter"),
- REJECT_INSUFFICIENTFEE, "insufficient priority");
+ REJECT_INSUFFICIENTFEE, "rate limited free transaction");
LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
dFreeCount += nSize;
}