aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-11-19 23:37:05 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-11-19 23:37:05 +0000
commitf35e21e2e4fcc0aa52edd9f9b58bd19e347597da (patch)
tree673d0a6e46e902b95d208085f77567635c4ab67d /main.h
parent683bcb9154422011ef01e8c5677bad2c4b323436 (diff)
require some minimal priority for free transactions to slow down transaction spam
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@185 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'main.h')
-rw-r--r--main.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/main.h b/main.h
index d5734103c0..cc150e62b6 100644
--- a/main.h
+++ b/main.h
@@ -528,21 +528,24 @@ public:
return nValueOut;
}
- int64 GetMinFee(unsigned int nBlockSize=1) const
+ int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=true) const
{
// Base fee is 1 cent per kilobyte
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
unsigned int nNewBlockSize = nBlockSize + nBytes;
int64 nMinFee = (1 + (int64)nBytes / 1000) * CENT;
- // Transactions under 25K are free as long as block size is under 40K
- // (about 11,000bc if made of 50bc inputs)
- if (nBytes < 25000 && nNewBlockSize < 40000)
- nMinFee = 0;
-
- // Transactions under 3K are free as long as block size is under 50K
- if (nBytes < 3000 && nNewBlockSize < 50000)
- nMinFee = 0;
+ if (fAllowFree)
+ {
+ // Transactions under 25K are free as long as block size is under 40K
+ // (about 11,000bc if made of 50bc inputs)
+ if (nBytes < 25000 && nNewBlockSize < 40000)
+ nMinFee = 0;
+
+ // Transactions under 3K are free as long as block size is under 50K
+ if (nBytes < 3000 && nNewBlockSize < 50000)
+ nMinFee = 0;
+ }
// To limit dust spam, require a 0.01 fee if any output is less than 0.01
if (nMinFee < CENT)