@@ -91,19 +91,20 @@ def check_smart_estimates(node, fees_seen):
91
91
"""Call estimatesmartfee and verify that the estimates meet certain invariants."""
92
92
93
93
delta = 1.0e-6 # account for rounding error
94
- last_feerate = float (max (fees_seen ))
95
94
all_smart_estimates = [node .estimatesmartfee (i ) for i in range (1 , 26 )]
96
95
mempoolMinFee = node .getmempoolinfo ()["mempoolminfee" ]
97
96
minRelaytxFee = node .getmempoolinfo ()["minrelaytxfee" ]
97
+ feerate_ceiling = max (max (fees_seen ), float (mempoolMinFee ), float (minRelaytxFee ))
98
+ last_feerate = feerate_ceiling
98
99
for i , e in enumerate (all_smart_estimates ): # estimate is for i+1
99
100
feerate = float (e ["feerate" ])
100
101
assert_greater_than (feerate , 0 )
101
102
assert_greater_than_or_equal (feerate , float (mempoolMinFee ))
102
103
assert_greater_than_or_equal (feerate , float (minRelaytxFee ))
103
104
104
- if feerate + delta < min (fees_seen ) or feerate - delta > max ( fees_seen ) :
105
+ if feerate + delta < min (fees_seen ) or feerate - delta > feerate_ceiling :
105
106
raise AssertionError (
106
- f"Estimated fee ({ feerate } ) out of range ({ min (fees_seen )} ,{ max ( fees_seen ) } )"
107
+ f"Estimated fee ({ feerate } ) out of range ({ min (fees_seen )} ,{ feerate_ceiling } )"
107
108
)
108
109
if feerate - delta > last_feerate :
109
110
raise AssertionError (
@@ -238,10 +239,10 @@ def sanity_check_estimates_range(self):
238
239
self .log .info ("Final estimates after emptying mempools" )
239
240
check_estimates (self .nodes [1 ], self .fees_per_kb )
240
241
241
- def test_feerate_mempoolminfee (self ):
242
- high_val = 3 * self .nodes [1 ].estimatesmartfee (1 )["feerate" ]
242
+ def test_estimates_with_highminrelaytxfee (self ):
243
+ high_val = 3 * self .nodes [1 ].estimatesmartfee (2 )["feerate" ]
243
244
self .restart_node (1 , extra_args = [f"-minrelaytxfee={ high_val } " ])
244
- check_estimates (self .nodes [1 ], self .fees_per_kb )
245
+ check_smart_estimates (self .nodes [1 ], self .fees_per_kb )
245
246
self .restart_node (1 )
246
247
247
248
def sanity_check_rbf_estimates (self , utxos ):
@@ -452,11 +453,11 @@ def run_test(self):
452
453
self .log .info ("Test fee_estimates.dat is flushed periodically" )
453
454
self .test_estimate_dat_is_flushed_periodically ()
454
455
455
- # check that the effective feerate is greater than or equal to the mempoolminfee even for high mempoolminfee
456
+ # check that estimatesmartfee feerate is greater than or equal to maximum of mempoolminfee and minrelaytxfee
456
457
self .log .info (
457
- "Test fee rate estimation after restarting node with high MempoolMinFee "
458
+ "Test fee rate estimation after restarting node with high minrelaytxfee "
458
459
)
459
- self .test_feerate_mempoolminfee ()
460
+ self .test_estimates_with_highminrelaytxfee ()
460
461
461
462
self .log .info ("Test acceptstalefeeestimates option" )
462
463
self .test_acceptstalefeeestimates_option ()
0 commit comments