Browse Source

Pass reference to estimateSmartFee and cleanup whitespace

0.13
Suhas Daftuar 9 years ago
parent
commit
e30443244a
  1. 9
      src/policy/fees.cpp
  2. 4
      src/policy/fees.h
  3. 4
      src/txmempool.cpp

9
src/policy/fees.cpp

@ -505,7 +505,7 @@ CFeeRate CBlockPolicyEstimator::estimateFee(int confTarget)
return CFeeRate(median); return CFeeRate(median);
} }
CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool) CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool)
{ {
if (answerFoundAtTarget) if (answerFoundAtTarget)
*answerFoundAtTarget = confTarget; *answerFoundAtTarget = confTarget;
@ -522,7 +522,7 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoun
*answerFoundAtTarget = confTarget - 1; *answerFoundAtTarget = confTarget - 1;
// If mempool is limiting txs , return at least the min fee from the mempool // If mempool is limiting txs , return at least the min fee from the mempool
CAmount minPoolFee = pool->GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK(); CAmount minPoolFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
if (minPoolFee > 0 && minPoolFee > median) if (minPoolFee > 0 && minPoolFee > median)
return CFeeRate(minPoolFee); return CFeeRate(minPoolFee);
@ -541,7 +541,7 @@ double CBlockPolicyEstimator::estimatePriority(int confTarget)
return priStats.EstimateMedianVal(confTarget, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT, true, nBestSeenHeight); return priStats.EstimateMedianVal(confTarget, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT, true, nBestSeenHeight);
} }
double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool) double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool)
{ {
if (answerFoundAtTarget) if (answerFoundAtTarget)
*answerFoundAtTarget = confTarget; *answerFoundAtTarget = confTarget;
@ -550,7 +550,7 @@ double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerF
return -1; return -1;
// If mempool is limiting txs, no priority txs are allowed // If mempool is limiting txs, no priority txs are allowed
CAmount minPoolFee = pool->GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK(); CAmount minPoolFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
if (minPoolFee > 0) if (minPoolFee > 0)
return INF_PRIORITY; return INF_PRIORITY;
@ -562,7 +562,6 @@ double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerF
if (answerFoundAtTarget) if (answerFoundAtTarget)
*answerFoundAtTarget = confTarget - 1; *answerFoundAtTarget = confTarget - 1;
return median; return median;
} }

4
src/policy/fees.h

@ -247,7 +247,7 @@ public:
* confTarget blocks. If no answer can be given at confTarget, return an * confTarget blocks. If no answer can be given at confTarget, return an
* estimate at the lowest target where one can be given. * estimate at the lowest target where one can be given.
*/ */
CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool); CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
/** Return a priority estimate */ /** Return a priority estimate */
double estimatePriority(int confTarget); double estimatePriority(int confTarget);
@ -256,7 +256,7 @@ public:
* confTarget blocks. If no answer can be given at confTarget, return an * confTarget blocks. If no answer can be given at confTarget, return an
* estimate at the lowest target where one can be given. * estimate at the lowest target where one can be given.
*/ */
double estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool); double estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
/** Write estimation data to a file */ /** Write estimation data to a file */
void Write(CAutoFile& fileout); void Write(CAutoFile& fileout);

4
src/txmempool.cpp

@ -704,7 +704,7 @@ CFeeRate CTxMemPool::estimateFee(int nBlocks) const
CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, int *answerFoundAtBlocks) const CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, int *answerFoundAtBlocks) const
{ {
LOCK(cs); LOCK(cs);
return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, this); return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, *this);
} }
double CTxMemPool::estimatePriority(int nBlocks) const double CTxMemPool::estimatePriority(int nBlocks) const
{ {
@ -714,7 +714,7 @@ double CTxMemPool::estimatePriority(int nBlocks) const
double CTxMemPool::estimateSmartPriority(int nBlocks, int *answerFoundAtBlocks) const double CTxMemPool::estimateSmartPriority(int nBlocks, int *answerFoundAtBlocks) const
{ {
LOCK(cs); LOCK(cs);
return minerPolicyEstimator->estimateSmartPriority(nBlocks, answerFoundAtBlocks, this); return minerPolicyEstimator->estimateSmartPriority(nBlocks, answerFoundAtBlocks, *this);
} }
bool bool

Loading…
Cancel
Save