Browse Source
Sanity checks for estimates
Require at least 11 samples before giving fee/priority estimates.
And have wallet-created transactions go throught the fee-sanity-check
code path.
pull/4/head
Gavin Andresen
10 years ago
No known key found for this signature in database
GPG Key ID: 7588242FBE38D3A8
3 changed files with
10 additions and
5 deletions
-
src/main.cpp
-
src/main.h
-
src/txmempool.cpp
|
|
@ -1129,10 +1129,10 @@ int CMerkleTx::GetBlocksToMaturity() const |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree) |
|
|
|
bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, bool fRejectInsaneFee) |
|
|
|
{ |
|
|
|
CValidationState state; |
|
|
|
return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL); |
|
|
|
return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, fRejectInsaneFee); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -452,7 +452,7 @@ public: |
|
|
|
int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); } |
|
|
|
bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; } |
|
|
|
int GetBlocksToMaturity() const; |
|
|
|
bool AcceptToMemoryPool(bool fLimitFree=true); |
|
|
|
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -251,8 +251,13 @@ public: |
|
|
|
std::sort(sortedFeeSamples.begin(), sortedFeeSamples.end(), |
|
|
|
std::greater<CFeeRate>()); |
|
|
|
} |
|
|
|
if (sortedFeeSamples.size() == 0) |
|
|
|
if (sortedFeeSamples.size() < 11) |
|
|
|
{ |
|
|
|
// Eleven is Gavin's Favorite Number
|
|
|
|
// ... but we also take a maximum of 10 samples per block so eleven means
|
|
|
|
// we're getting samples from at least two different blocks
|
|
|
|
return CFeeRate(0); |
|
|
|
} |
|
|
|
|
|
|
|
int nBucketSize = history.at(nBlocksToConfirm).FeeSamples(); |
|
|
|
|
|
|
@ -281,7 +286,7 @@ public: |
|
|
|
std::sort(sortedPrioritySamples.begin(), sortedPrioritySamples.end(), |
|
|
|
std::greater<double>()); |
|
|
|
} |
|
|
|
if (sortedPrioritySamples.size() == 0) |
|
|
|
if (sortedPrioritySamples.size() < 11) |
|
|
|
return -1.0; |
|
|
|
|
|
|
|
int nBucketSize = history.at(nBlocksToConfirm).PrioritySamples(); |
|
|
|