mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Move fee policy out of core
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@@ -38,8 +38,6 @@ using namespace boost;
|
||||
|
||||
CCriticalSection cs_main;
|
||||
|
||||
CTxMemPool mempool;
|
||||
|
||||
map<uint256, CBlockIndex*> mapBlockIndex;
|
||||
CChain chainActive;
|
||||
int64_t nTimeBestReceived = 0;
|
||||
@@ -50,10 +48,10 @@ bool fBenchmark = false;
|
||||
bool fTxIndex = false;
|
||||
unsigned int nCoinCacheSize = 5000;
|
||||
|
||||
/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
|
||||
CFeeRate CTransaction::minTxFee = CFeeRate(10000); // Override with -mintxfee
|
||||
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying and mining) */
|
||||
CFeeRate CTransaction::minRelayTxFee = CFeeRate(1000);
|
||||
CFeeRate minRelayTxFee = CFeeRate(1000);
|
||||
|
||||
CTxMemPool mempool(::minRelayTxFee);
|
||||
|
||||
struct COrphanBlock {
|
||||
uint256 hashBlock;
|
||||
@@ -617,7 +615,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
|
||||
}
|
||||
if (whichType == TX_NULL_DATA)
|
||||
nDataOut++;
|
||||
else if (txout.IsDust(CTransaction::minRelayTxFee)) {
|
||||
else if (txout.IsDust(::minRelayTxFee)) {
|
||||
reason = "dust";
|
||||
return false;
|
||||
}
|
||||
@@ -870,7 +868,7 @@ int64_t GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t nMinFee = tx.minRelayTxFee.GetFee(nBytes);
|
||||
int64_t nMinFee = ::minRelayTxFee.GetFee(nBytes);
|
||||
|
||||
if (fAllowFree)
|
||||
{
|
||||
@@ -1009,7 +1007,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
// Continuously rate-limit free (really, very-low-fee)transactions
|
||||
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
|
||||
// be annoying or make others' transactions take longer to confirm.
|
||||
if (fLimitFree && nFees < CTransaction::minRelayTxFee.GetFee(nSize))
|
||||
if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize))
|
||||
{
|
||||
static double dFreeCount;
|
||||
static int64_t nLastFreeTime;
|
||||
@@ -1022,10 +1020,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
|
||||
}
|
||||
|
||||
if (fRejectInsaneFee && nFees > CTransaction::minRelayTxFee.GetFee(nSize) * 10000)
|
||||
if (fRejectInsaneFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000)
|
||||
return error("AcceptToMemoryPool: : insane fees %s, %d > %d",
|
||||
hash.ToString(),
|
||||
nFees, CTransaction::minRelayTxFee.GetFee(nSize) * 10000);
|
||||
nFees, ::minRelayTxFee.GetFee(nSize) * 10000);
|
||||
|
||||
// Check against previous transactions
|
||||
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
||||
|
||||
Reference in New Issue
Block a user