Browse Source

Replace CENT with new constant MIN_TX_FEE, where appropriate.

MIN_TX_FEE==CENT remains true (until next commit).
miguelfreitas
Jeff Garzik 14 years ago committed by Jeff Garzik
parent
commit
a630da6400
  1. 2
      src/main.cpp
  2. 9
      src/main.h
  3. 2
      src/ui.cpp

2
src/main.cpp

@ -741,7 +741,7 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
// Continuously rate-limit free transactions // Continuously rate-limit free transactions
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to // This mitigates 'penny-flooding' -- sending thousands of free transactions just to
// be annoying or make other's transactions take longer to confirm. // be annoying or make other's transactions take longer to confirm.
if (nFees < CENT) if (nFees < MIN_TX_FEE)
{ {
static CCriticalSection cs; static CCriticalSection cs;
static double dFreeCount; static double dFreeCount;

9
src/main.h

@ -19,6 +19,7 @@ static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
static const int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50; static const int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
static const int64 COIN = 100000000; static const int64 COIN = 100000000;
static const int64 CENT = 1000000; static const int64 CENT = 1000000;
static const int64 MIN_TX_FEE = CENT;
static const int64 MAX_MONEY = 21000000 * COIN; static const int64 MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
static const int COINBASE_MATURITY = 100; static const int COINBASE_MATURITY = 100;
@ -593,7 +594,7 @@ public:
// Base fee is 1 cent per kilobyte // Base fee is 1 cent per kilobyte
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK); unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
unsigned int nNewBlockSize = nBlockSize + nBytes; unsigned int nNewBlockSize = nBlockSize + nBytes;
int64 nMinFee = (1 + (int64)nBytes / 1000) * CENT; int64 nMinFee = (1 + (int64)nBytes / 1000) * MIN_TX_FEE;
if (fAllowFree) if (fAllowFree)
{ {
@ -612,11 +613,11 @@ public:
} }
} }
// To limit dust spam, require a 0.01 fee if any output is less than 0.01 // To limit dust spam, require MIN_TX_FEE if any output is less than 0.01
if (nMinFee < CENT) if (nMinFee < MIN_TX_FEE)
foreach(const CTxOut& txout, vout) foreach(const CTxOut& txout, vout)
if (txout.nValue < CENT) if (txout.nValue < CENT)
nMinFee = CENT; nMinFee = MIN_TX_FEE;
// Raise the price as the block approaches full // Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2) if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)

2
src/ui.cpp

@ -196,7 +196,7 @@ int ThreadSafeMessageBox(const string& message, const string& caption, int style
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent) bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
{ {
if (nFeeRequired < CENT || nFeeRequired <= nTransactionFee || fDaemon) if (nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon)
return true; return true;
string strMessage = strprintf( string strMessage = strprintf(
_("This transaction is over the size limit. You can still send it for a fee of %s, " _("This transaction is over the size limit. You can still send it for a fee of %s, "

Loading…
Cancel
Save