|
|
@ -591,13 +591,12 @@ bool CTransaction::CheckTransaction(CValidationState &state) const |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int64 CTransaction::GetMinFee(unsigned int nBlockSize, bool fAllowFree, |
|
|
|
int64 GetMinFee(const CTransaction& tx, unsigned int nBlockSize, bool fAllowFree, enum GetMinFee_mode mode) |
|
|
|
enum GetMinFee_mode mode) const |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
// Base fee is either nMinTxFee or nMinRelayTxFee
|
|
|
|
// Base fee is either nMinTxFee or nMinRelayTxFee
|
|
|
|
int64 nBaseFee = (mode == GMF_RELAY) ? nMinRelayTxFee : nMinTxFee; |
|
|
|
int64 nBaseFee = (mode == GMF_RELAY) ? tx.nMinRelayTxFee : tx.nMinTxFee; |
|
|
|
|
|
|
|
|
|
|
|
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
unsigned int nBytes = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
unsigned int nNewBlockSize = nBlockSize + nBytes; |
|
|
|
unsigned int nNewBlockSize = nBlockSize + nBytes; |
|
|
|
int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee; |
|
|
|
int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee; |
|
|
|
|
|
|
|
|
|
|
@ -621,7 +620,7 @@ int64 CTransaction::GetMinFee(unsigned int nBlockSize, bool fAllowFree, |
|
|
|
// To limit dust spam, require base fee if any output is less than 0.01
|
|
|
|
// To limit dust spam, require base fee if any output is less than 0.01
|
|
|
|
if (nMinFee < nBaseFee) |
|
|
|
if (nMinFee < nBaseFee) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOOST_FOREACH(const CTxOut& txout, vout) |
|
|
|
BOOST_FOREACH(const CTxOut& txout, tx.vout) |
|
|
|
if (txout.nValue < CENT) |
|
|
|
if (txout.nValue < CENT) |
|
|
|
nMinFee = nBaseFee; |
|
|
|
nMinFee = nBaseFee; |
|
|
|
} |
|
|
|
} |
|
|
@ -757,7 +756,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn |
|
|
|
unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
|
|
|
|
|
|
|
|
// Don't accept it if it can't get into a block
|
|
|
|
// Don't accept it if it can't get into a block
|
|
|
|
int64 txMinFee = tx.GetMinFee(1000, true, GMF_RELAY); |
|
|
|
int64 txMinFee = GetMinFee(tx, 1000, true, GMF_RELAY); |
|
|
|
if (fLimitFree && nFees < txMinFee) |
|
|
|
if (fLimitFree && nFees < txMinFee) |
|
|
|
return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d, |
|
|
|
return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d, |
|
|
|
hash.ToString().c_str(), |
|
|
|
hash.ToString().c_str(), |
|
|
|