mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
[cleanup] Remove estimatePriority and estimateSmartPriority
Unused everywhere now except one test.
This commit is contained in:
parent
400b15147c
commit
fe282acd76
@ -452,24 +452,6 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoun
|
|||||||
return CFeeRate(median);
|
return CFeeRate(median);
|
||||||
}
|
}
|
||||||
|
|
||||||
double CBlockPolicyEstimator::estimatePriority(int confTarget)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool)
|
|
||||||
{
|
|
||||||
if (answerFoundAtTarget)
|
|
||||||
*answerFoundAtTarget = confTarget;
|
|
||||||
|
|
||||||
// If mempool is limiting txs, no priority txs are allowed
|
|
||||||
CAmount minPoolFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
|
|
||||||
if (minPoolFee > 0)
|
|
||||||
return INF_PRIORITY;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBlockPolicyEstimator::Write(CAutoFile& fileout)
|
void CBlockPolicyEstimator::Write(CAutoFile& fileout)
|
||||||
{
|
{
|
||||||
fileout << nBestSeenHeight;
|
fileout << nBestSeenHeight;
|
||||||
|
@ -182,7 +182,6 @@ static const double SUFFICIENT_FEETXS = 1;
|
|||||||
static constexpr double MIN_FEERATE = 10;
|
static constexpr double MIN_FEERATE = 10;
|
||||||
static const double MAX_FEERATE = 1e7;
|
static const double MAX_FEERATE = 1e7;
|
||||||
static const double INF_FEERATE = MAX_MONEY;
|
static const double INF_FEERATE = MAX_MONEY;
|
||||||
static const double INF_PRIORITY = 1e9 * MAX_MONEY;
|
|
||||||
|
|
||||||
// We have to lump transactions into buckets based on feerate, but we want to be able
|
// We have to lump transactions into buckets based on feerate, but we want to be able
|
||||||
// to give accurate estimates over a large range of potential feerates
|
// to give accurate estimates over a large range of potential feerates
|
||||||
@ -223,20 +222,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
|
CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
|
||||||
|
|
||||||
/** Return a priority estimate.
|
|
||||||
* DEPRECATED
|
|
||||||
* Returns -1
|
|
||||||
*/
|
|
||||||
double estimatePriority(int confTarget);
|
|
||||||
|
|
||||||
/** Estimate priority needed to get be included in a block within
|
|
||||||
* confTarget blocks.
|
|
||||||
* DEPRECATED
|
|
||||||
* Returns -1 unless mempool is currently limited then returns INF_PRIORITY
|
|
||||||
* answerFoundAtTarget is set to confTarget
|
|
||||||
*/
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -185,7 +185,6 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test that if the mempool is limited, estimateSmartFee won't return a value below the mempool min fee
|
// Test that if the mempool is limited, estimateSmartFee won't return a value below the mempool min fee
|
||||||
// and that estimateSmartPriority returns essentially an infinite value
|
|
||||||
mpool.addUnchecked(tx.GetHash(), entry.Fee(feeV[5]).Time(GetTime()).Priority(0).Height(blocknum).FromTx(tx, &mpool));
|
mpool.addUnchecked(tx.GetHash(), entry.Fee(feeV[5]).Time(GetTime()).Priority(0).Height(blocknum).FromTx(tx, &mpool));
|
||||||
// evict that transaction which should set a mempool min fee of minRelayTxFee + feeV[5]
|
// evict that transaction which should set a mempool min fee of minRelayTxFee + feeV[5]
|
||||||
mpool.TrimToSize(1);
|
mpool.TrimToSize(1);
|
||||||
@ -193,7 +192,6 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
|
|||||||
for (int i = 1; i < 10; i++) {
|
for (int i = 1; i < 10; i++) {
|
||||||
BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= mpool.estimateFee(i).GetFeePerK());
|
BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= mpool.estimateFee(i).GetFeePerK());
|
||||||
BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= mpool.GetMinFee(1).GetFeePerK());
|
BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= mpool.GetMinFee(1).GetFeePerK());
|
||||||
BOOST_CHECK(mpool.estimateSmartPriority(i) == INF_PRIORITY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,16 +875,6 @@ CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, int *answerFoundAtBlocks) con
|
|||||||
LOCK(cs);
|
LOCK(cs);
|
||||||
return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, *this);
|
return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, *this);
|
||||||
}
|
}
|
||||||
double CTxMemPool::estimatePriority(int nBlocks) const
|
|
||||||
{
|
|
||||||
LOCK(cs);
|
|
||||||
return minerPolicyEstimator->estimatePriority(nBlocks);
|
|
||||||
}
|
|
||||||
double CTxMemPool::estimateSmartPriority(int nBlocks, int *answerFoundAtBlocks) const
|
|
||||||
{
|
|
||||||
LOCK(cs);
|
|
||||||
return minerPolicyEstimator->estimateSmartPriority(nBlocks, answerFoundAtBlocks, *this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const
|
CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const
|
||||||
|
@ -648,15 +648,6 @@ public:
|
|||||||
/** Estimate fee rate needed to get into the next nBlocks */
|
/** Estimate fee rate needed to get into the next nBlocks */
|
||||||
CFeeRate estimateFee(int nBlocks) const;
|
CFeeRate estimateFee(int nBlocks) const;
|
||||||
|
|
||||||
/** Estimate priority needed to get into the next nBlocks
|
|
||||||
* If no answer can be given at nBlocks, return an estimate
|
|
||||||
* at the lowest number of blocks where one can be given
|
|
||||||
*/
|
|
||||||
double estimateSmartPriority(int nBlocks, int *answerFoundAtBlocks = NULL) const;
|
|
||||||
|
|
||||||
/** Estimate priority needed to get into the next nBlocks */
|
|
||||||
double estimatePriority(int nBlocks) const;
|
|
||||||
|
|
||||||
/** Write/Read estimates to disk */
|
/** Write/Read estimates to disk */
|
||||||
bool WriteFeeEstimates(CAutoFile& fileout) const;
|
bool WriteFeeEstimates(CAutoFile& fileout) const;
|
||||||
bool ReadFeeEstimates(CAutoFile& filein);
|
bool ReadFeeEstimates(CAutoFile& filein);
|
||||||
|
Loading…
Reference in New Issue
Block a user