@@ -79,16 +79,16 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
7979 // At this point we should need to combine 5 buckets to get enough data points
8080 // So estimateFee(1,2,3) should fail and estimateFee(4) should return somewhere around
8181 // 8*baserate. estimateFee(4) %'s are 100,100,100,100,90 = average 98%
82- BOOST_CHECK (mpool .estimateFee (1 ) == CFeeRate (0 ));
83- BOOST_CHECK (mpool .estimateFee (2 ) == CFeeRate (0 ));
84- BOOST_CHECK (mpool .estimateFee (3 ) == CFeeRate (0 ));
85- BOOST_CHECK (mpool .estimateFee (4 ).GetFeePerK () < 8 *baseRate.GetFeePerK () + deltaFee);
86- BOOST_CHECK (mpool .estimateFee (4 ).GetFeePerK () > 8 *baseRate.GetFeePerK () - deltaFee);
82+ BOOST_CHECK (feeEst .estimateFee (1 ) == CFeeRate (0 ));
83+ BOOST_CHECK (feeEst .estimateFee (2 ) == CFeeRate (0 ));
84+ BOOST_CHECK (feeEst .estimateFee (3 ) == CFeeRate (0 ));
85+ BOOST_CHECK (feeEst .estimateFee (4 ).GetFeePerK () < 8 *baseRate.GetFeePerK () + deltaFee);
86+ BOOST_CHECK (feeEst .estimateFee (4 ).GetFeePerK () > 8 *baseRate.GetFeePerK () - deltaFee);
8787 int answerFound;
88- BOOST_CHECK (mpool .estimateSmartFee (1 , &answerFound) == mpool .estimateFee (4 ) && answerFound == 4 );
89- BOOST_CHECK (mpool .estimateSmartFee (3 , &answerFound) == mpool .estimateFee (4 ) && answerFound == 4 );
90- BOOST_CHECK (mpool .estimateSmartFee (4 , &answerFound) == mpool .estimateFee (4 ) && answerFound == 4 );
91- BOOST_CHECK (mpool .estimateSmartFee (8 , &answerFound) == mpool .estimateFee (8 ) && answerFound == 8 );
88+ BOOST_CHECK (feeEst .estimateSmartFee (1 , &answerFound, mpool ) == feeEst .estimateFee (4 ) && answerFound == 4 );
89+ BOOST_CHECK (feeEst .estimateSmartFee (3 , &answerFound, mpool ) == feeEst .estimateFee (4 ) && answerFound == 4 );
90+ BOOST_CHECK (feeEst .estimateSmartFee (4 , &answerFound, mpool ) == feeEst .estimateFee (4 ) && answerFound == 4 );
91+ BOOST_CHECK (feeEst .estimateSmartFee (8 , &answerFound, mpool ) == feeEst .estimateFee (8 ) && answerFound == 8 );
9292 }
9393 }
9494
@@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
100100 // Second highest feerate has 100% chance of being included by 2 blocks,
101101 // so estimateFee(2) should return 9*baseRate etc...
102102 for (int i = 1 ; i < 10 ;i++) {
103- origFeeEst.push_back (mpool .estimateFee (i).GetFeePerK ());
103+ origFeeEst.push_back (feeEst .estimateFee (i).GetFeePerK ());
104104 if (i > 2 ) { // Fee estimates should be monotonically decreasing
105105 BOOST_CHECK (origFeeEst[i-1 ] <= origFeeEst[i-2 ]);
106106 }
@@ -119,10 +119,10 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
119119 while (blocknum < 250 )
120120 mpool.removeForBlock (block, ++blocknum);
121121
122- BOOST_CHECK (mpool .estimateFee (1 ) == CFeeRate (0 ));
122+ BOOST_CHECK (feeEst .estimateFee (1 ) == CFeeRate (0 ));
123123 for (int i = 2 ; i < 10 ;i++) {
124- BOOST_CHECK (mpool .estimateFee (i).GetFeePerK () < origFeeEst[i-1 ] + deltaFee);
125- BOOST_CHECK (mpool .estimateFee (i).GetFeePerK () > origFeeEst[i-1 ] - deltaFee);
124+ BOOST_CHECK (feeEst .estimateFee (i).GetFeePerK () < origFeeEst[i-1 ] + deltaFee);
125+ BOOST_CHECK (feeEst .estimateFee (i).GetFeePerK () > origFeeEst[i-1 ] - deltaFee);
126126 }
127127
128128
@@ -142,8 +142,8 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
142142
143143 int answerFound;
144144 for (int i = 1 ; i < 10 ;i++) {
145- BOOST_CHECK (mpool .estimateFee (i) == CFeeRate (0 ) || mpool .estimateFee (i).GetFeePerK () > origFeeEst[i-1 ] - deltaFee);
146- BOOST_CHECK (mpool .estimateSmartFee (i, &answerFound).GetFeePerK () > origFeeEst[answerFound-1 ] - deltaFee);
145+ BOOST_CHECK (feeEst .estimateFee (i) == CFeeRate (0 ) || feeEst .estimateFee (i).GetFeePerK () > origFeeEst[i-1 ] - deltaFee);
146+ BOOST_CHECK (feeEst .estimateSmartFee (i, &answerFound, mpool ).GetFeePerK () > origFeeEst[answerFound-1 ] - deltaFee);
147147 }
148148
149149 // Mine all those transactions
@@ -158,9 +158,9 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
158158 }
159159 mpool.removeForBlock (block, 265 );
160160 block.clear ();
161- BOOST_CHECK (mpool .estimateFee (1 ) == CFeeRate (0 ));
161+ BOOST_CHECK (feeEst .estimateFee (1 ) == CFeeRate (0 ));
162162 for (int i = 2 ; i < 10 ;i++) {
163- BOOST_CHECK (mpool .estimateFee (i).GetFeePerK () > origFeeEst[i-1 ] - deltaFee);
163+ BOOST_CHECK (feeEst .estimateFee (i).GetFeePerK () > origFeeEst[i-1 ] - deltaFee);
164164 }
165165
166166 // Mine 200 more blocks where everything is mined every block
@@ -180,9 +180,9 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
180180 mpool.removeForBlock (block, ++blocknum);
181181 block.clear ();
182182 }
183- BOOST_CHECK (mpool .estimateFee (1 ) == CFeeRate (0 ));
183+ BOOST_CHECK (feeEst .estimateFee (1 ) == CFeeRate (0 ));
184184 for (int i = 2 ; i < 10 ; i++) {
185- BOOST_CHECK (mpool .estimateFee (i).GetFeePerK () < origFeeEst[i-1 ] - deltaFee);
185+ BOOST_CHECK (feeEst .estimateFee (i).GetFeePerK () < origFeeEst[i-1 ] - deltaFee);
186186 }
187187
188188 // Test that if the mempool is limited, estimateSmartFee won't return a value below the mempool min fee
@@ -191,8 +191,8 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
191191 mpool.TrimToSize (1 );
192192 BOOST_CHECK (mpool.GetMinFee (1 ).GetFeePerK () > feeV[5 ]);
193193 for (int i = 1 ; i < 10 ; i++) {
194- BOOST_CHECK (mpool .estimateSmartFee (i).GetFeePerK () >= mpool .estimateFee (i).GetFeePerK ());
195- BOOST_CHECK (mpool .estimateSmartFee (i).GetFeePerK () >= mpool.GetMinFee (1 ).GetFeePerK ());
194+ BOOST_CHECK (feeEst .estimateSmartFee (i, NULL , mpool ).GetFeePerK () >= feeEst .estimateFee (i).GetFeePerK ());
195+ BOOST_CHECK (feeEst .estimateSmartFee (i, NULL , mpool ).GetFeePerK () >= mpool.GetMinFee (1 ).GetFeePerK ());
196196 }
197197}
198198
0 commit comments