Skip to content

Commit e304432

Browse files
committed
Pass reference to estimateSmartFee and cleanup whitespace
1 parent 56106a3 commit e304432

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

src/policy/fees.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ CFeeRate CBlockPolicyEstimator::estimateFee(int confTarget)
505505
return CFeeRate(median);
506506
}
507507

508-
CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool)
508+
CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool)
509509
{
510510
if (answerFoundAtTarget)
511511
*answerFoundAtTarget = confTarget;
@@ -522,7 +522,7 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoun
522522
*answerFoundAtTarget = confTarget - 1;
523523

524524
// If mempool is limiting txs , return at least the min fee from the mempool
525-
CAmount minPoolFee = pool->GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
525+
CAmount minPoolFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
526526
if (minPoolFee > 0 && minPoolFee > median)
527527
return CFeeRate(minPoolFee);
528528

@@ -541,7 +541,7 @@ double CBlockPolicyEstimator::estimatePriority(int confTarget)
541541
return priStats.EstimateMedianVal(confTarget, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT, true, nBestSeenHeight);
542542
}
543543

544-
double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool)
544+
double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool)
545545
{
546546
if (answerFoundAtTarget)
547547
*answerFoundAtTarget = confTarget;
@@ -550,7 +550,7 @@ double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerF
550550
return -1;
551551

552552
// If mempool is limiting txs, no priority txs are allowed
553-
CAmount minPoolFee = pool->GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
553+
CAmount minPoolFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
554554
if (minPoolFee > 0)
555555
return INF_PRIORITY;
556556

@@ -562,7 +562,6 @@ double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerF
562562
if (answerFoundAtTarget)
563563
*answerFoundAtTarget = confTarget - 1;
564564

565-
566565
return median;
567566
}
568567

src/policy/fees.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class CBlockPolicyEstimator
247247
* confTarget blocks. If no answer can be given at confTarget, return an
248248
* estimate at the lowest target where one can be given.
249249
*/
250-
CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool);
250+
CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
251251

252252
/** Return a priority estimate */
253253
double estimatePriority(int confTarget);
@@ -256,7 +256,7 @@ class CBlockPolicyEstimator
256256
* confTarget blocks. If no answer can be given at confTarget, return an
257257
* estimate at the lowest target where one can be given.
258258
*/
259-
double estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool *pool);
259+
double estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
260260

261261
/** Write estimation data to a file */
262262
void Write(CAutoFile& fileout);

src/txmempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ CFeeRate CTxMemPool::estimateFee(int nBlocks) const
704704
CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, int *answerFoundAtBlocks) const
705705
{
706706
LOCK(cs);
707-
return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, this);
707+
return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, *this);
708708
}
709709
double CTxMemPool::estimatePriority(int nBlocks) const
710710
{
@@ -714,7 +714,7 @@ double CTxMemPool::estimatePriority(int nBlocks) const
714714
double CTxMemPool::estimateSmartPriority(int nBlocks, int *answerFoundAtBlocks) const
715715
{
716716
LOCK(cs);
717-
return minerPolicyEstimator->estimateSmartPriority(nBlocks, answerFoundAtBlocks, this);
717+
return minerPolicyEstimator->estimateSmartPriority(nBlocks, answerFoundAtBlocks, *this);
718718
}
719719

720720
bool

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
20362036
double dPriorityNeeded = mempool.estimateSmartPriority(nTxConfirmTarget);
20372037
// Require at least hard-coded AllowFree.
20382038
if (dPriority >= dPriorityNeeded && AllowFree(dPriority))
2039-
break;
2039+
break;
20402040
}
20412041

20422042
CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool);

0 commit comments

Comments
 (0)