aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-09-18 11:48:41 +1000
committerWladimir J. van der Laan <laanwj@gmail.com>2013-11-28 07:59:54 +0100
commit1ca8a75cb4d916bf225f2879f2722649f509c92d (patch)
treed757ae857ba97ad328f217a4a79498de88311cb9
parent5c029630f91c4cad7b8f781a0324ff54c36163d3 (diff)
downloadbitcoin-1ca8a75cb4d916bf225f2879f2722649f509c92d.tar.xz
Remove CENT-output free transaction rule when relaying
Remove the (relay/mempool) rule that all outputs of free transactions must be greater than 0.01 XBT. Dust spam is now taken care of by making dusty outputs non-standard.
-rw-r--r--src/main.cpp6
-rw-r--r--src/wallet.cpp7
2 files changed, 8 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5dcd378a77..52e89acc26 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -623,8 +623,10 @@ int64 CTransaction::GetMinFee(unsigned int nBlockSize, bool fAllowFree,
}
}
- // To limit dust spam, require base fee if any output is less than 0.01
- if (nMinFee < nBaseFee)
+ // This code can be removed after enough miners have upgraded to version 0.9.
+ // Until then, be safe when sending and require a fee if any output
+ // is less than CENT:
+ if (nMinFee < nBaseFee && mode == GMF_SEND)
{
BOOST_FOREACH(const CTxOut& txout, vout)
if (txout.nValue < CENT)
diff --git a/src/wallet.cpp b/src/wallet.cpp
index c70ea20e88..73de759b5e 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -1204,9 +1204,10 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend,
}
int64 nChange = nValueIn - nValue - nFeeRet;
- // if sub-cent change is required, the fee must be raised to at least nMinTxFee
- // or until nChange becomes zero
- // NOTE: this depends on the exact behaviour of GetMinFee
+ // The following if statement should be removed once enough miners
+ // have upgraded to the 0.9 GetMinFee() rules. Until then, this avoids
+ // creating free transactions that have change outputs less than
+ // CENT bitcoins.
if (nFeeRet < CTransaction::nMinTxFee && nChange > 0 && nChange < CENT)
{
int64 nMoveToFee = min(nChange, CTransaction::nMinTxFee - nFeeRet);