@ -634,30 +634,23 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
return true ;
}
int64 GetMinFee ( const CTransaction & tx , unsigned int nBlockSize , bool fAllowFree , enum GetMinFee_mode mode )
int64 GetMinFee ( const CTransaction & tx , bool fAllowFree , enum GetMinFee_mode mode )
{
// Base fee is either nMinTxFee or nMinRelayTxFee
int64 nBaseFee = ( mode = = GMF_RELAY ) ? tx . nMinRelayTxFee : tx . nMinTxFee ;
unsigned int nBytes = : : GetSerializeSize ( tx , SER_NETWORK , PROTOCOL_VERSION ) ;
unsigned int nNewBlockSize = nBlockSize + nBytes ;
int64 nMinFee = ( 1 + ( int64 ) nBytes / 1000 ) * nBaseFee ;
if ( fAllowFree )
{
if ( nBlockSize = = 1 )
{
// Transactions under 10K are free
// (about 4500 BTC if made of 50 BTC inputs)
if ( nBytes < 10000 )
nMinFee = 0 ;
}
else
{
// Free transaction area
if ( nNewBlockSize < 27000 )
nMinFee = 0 ;
}
// There is a free transaction area in blocks created by most miners,
// * If we are relaying we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 1000
// to be considered to fall into this category
// * If we are creating a transaction we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 17000
// (= 10000) to be considered safe and assume they can likely make it into this section
if ( nBytes < ( mode = = GMF_SEND ? ( DEFAULT_BLOCK_PRIORITY_SIZE - 17000 ) : ( DEFAULT_BLOCK_PRIORITY_SIZE - 1000 ) ) )
nMinFee = 0 ;
}
// To limit dust spam, require base fee if any output is less than 0.01
@ -668,14 +661,6 @@ int64 GetMinFee(const CTransaction& tx, unsigned int nBlockSize, bool fAllowFree
nMinFee = nBaseFee ;
}
// Raise the price as the block approaches full
if ( nBlockSize ! = 1 & & nNewBlockSize > = MAX_BLOCK_SIZE_GEN / 2 )
{
if ( nNewBlockSize > = MAX_BLOCK_SIZE_GEN )
return MAX_MONEY ;
nMinFee * = MAX_BLOCK_SIZE_GEN / ( MAX_BLOCK_SIZE_GEN - nNewBlockSize ) ;
}
if ( ! MoneyRange ( nMinFee ) )
nMinFee = MAX_MONEY ;
return nMinFee ;
@ -799,7 +784,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn
unsigned int nSize = : : GetSerializeSize ( tx , SER_NETWORK , PROTOCOL_VERSION ) ;
// Don't accept it if it can't get into a block
int64 txMinFee = GetMinFee ( tx , 1000 , true , GMF_RELAY ) ;
int64 txMinFee = GetMinFee ( tx , true , GMF_RELAY ) ;
if ( fLimitFree & & nFees < txMinFee )
return error ( " CTxMemPool::accept() : not enough fees %s, % " PRI64d " < % " PRI64d ,
hash . ToString ( ) . c_str ( ) ,
@ -4187,7 +4172,7 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey)
// How much of the block should be dedicated to high-priority transactions,
// included regardless of the fees they pay
unsigned int nBlockPrioritySize = GetArg ( " -blockprioritysize " , 27000 ) ;
unsigned int nBlockPrioritySize = GetArg ( " -blockprioritysize " , DEFAULT_BLOCK_PRIORITY_SIZE ) ;
nBlockPrioritySize = std : : min ( nBlockMaxSize , nBlockPrioritySize ) ;
// Minimum block size you want to create; block will be filled with free transactions
@ -4315,7 +4300,7 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey)
// Prioritize by fee once past the priority size or we run out of high-priority
// transactions:
if ( ! fSortedByFee & &
( ( nBlockSize + nTxSize > = nBlockPrioritySize ) | | ( dPriority < COIN * 144 / 250 ) ) )
( ( nBlockSize + nTxSize > = nBlockPrioritySize ) | | ! AllowFree ( dPriority ) ) )
{
fSortedByFee = true ;
comparer = TxPriorityCompare ( fSortedByFee ) ;