Changeset View
Changeset View
Standalone View
Standalone View
src/test/policyestimator_tests.cpp
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(BlockPolicyEstimates) { | ||||
} | } | ||||
BOOST_CHECK(mpool.estimateFee(1) == CFeeRate(Amount(0))); | BOOST_CHECK(mpool.estimateFee(1) == CFeeRate(Amount(0))); | ||||
for (int i = 2; i < 10; i++) { | for (int i = 2; i < 10; i++) { | ||||
BOOST_CHECK(mpool.estimateFee(i).GetFeePerK() < | BOOST_CHECK(mpool.estimateFee(i).GetFeePerK() < | ||||
origFeeEst[i - 1] - deltaFee); | origFeeEst[i - 1] - deltaFee); | ||||
} | } | ||||
// Test that if the mempool is limited, estimateSmartFee won't return a | // Test that if the mempool is limited, estimateSmartFee won't return a | ||||
// value below the mempool min fee and that estimateSmartPriority returns | // value below the mempool min | ||||
// essentially an infinite value | |||||
mpool.addUnchecked( | mpool.addUnchecked( | ||||
tx.GetId(), | tx.GetId(), | ||||
entry.Fee(feeV[5]).Time(GetTime()).Priority(0).Height(blocknum).FromTx( | entry.Fee(feeV[5]).Time(GetTime()).Priority(0).Height(blocknum).FromTx( | ||||
tx, &mpool)); | tx, &mpool)); | ||||
// evict that transaction which should set a mempool min fee of | // evict that transaction which should set a mempool min fee of | ||||
// minRelayTxFee + feeV[5] | // minRelayTxFee + feeV[5] | ||||
mpool.TrimToSize(1); | mpool.TrimToSize(1); | ||||
BOOST_CHECK(mpool.GetMinFee(1).GetFeePerK() > feeV[5]); | BOOST_CHECK(mpool.GetMinFee(1).GetFeePerK() > feeV[5]); | ||||
for (int i = 1; i < 10; i++) { | for (int i = 1; i < 10; i++) { | ||||
BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= | BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= | ||||
mpool.estimateFee(i).GetFeePerK()); | mpool.estimateFee(i).GetFeePerK()); | ||||
BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= | BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= | ||||
mpool.GetMinFee(1).GetFeePerK()); | mpool.GetMinFee(1).GetFeePerK()); | ||||
BOOST_CHECK(mpool.estimateSmartPriority(i) == | |||||
double(INF_PRIORITY.GetSatoshis())); | |||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |