@@ -91,19 +91,20 @@ def check_smart_estimates(node, fees_seen):
9191 """Call estimatesmartfee and verify that the estimates meet certain invariants."""
9292
9393 delta = 1.0e-6 # account for rounding error
94- last_feerate = float (max (fees_seen ))
9594 all_smart_estimates = [node .estimatesmartfee (i ) for i in range (1 , 26 )]
9695 mempoolMinFee = node .getmempoolinfo ()["mempoolminfee" ]
9796 minRelaytxFee = node .getmempoolinfo ()["minrelaytxfee" ]
97+ feerate_ceiling = max (max (fees_seen ), float (mempoolMinFee ), float (minRelaytxFee ))
98+ last_feerate = feerate_ceiling
9899 for i , e in enumerate (all_smart_estimates ): # estimate is for i+1
99100 feerate = float (e ["feerate" ])
100101 assert_greater_than (feerate , 0 )
101102 assert_greater_than_or_equal (feerate , float (mempoolMinFee ))
102103 assert_greater_than_or_equal (feerate , float (minRelaytxFee ))
103104
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 :
105106 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 } )"
107108 )
108109 if feerate - delta > last_feerate :
109110 raise AssertionError (
@@ -238,10 +239,10 @@ def sanity_check_estimates_range(self):
238239 self .log .info ("Final estimates after emptying mempools" )
239240 check_estimates (self .nodes [1 ], self .fees_per_kb )
240241
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" ]
243244 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 )
245246 self .restart_node (1 )
246247
247248 def sanity_check_rbf_estimates (self , utxos ):
@@ -452,11 +453,11 @@ def run_test(self):
452453 self .log .info ("Test fee_estimates.dat is flushed periodically" )
453454 self .test_estimate_dat_is_flushed_periodically ()
454455
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
456457 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 "
458459 )
459- self .test_feerate_mempoolminfee ()
460+ self .test_estimates_with_highminrelaytxfee ()
460461
461462 self .log .info ("Test acceptstalefeeestimates option" )
462463 self .test_acceptstalefeeestimates_option ()
0 commit comments