Attempt to fix #32461 and #31944
In the estimatesmartfee RPC, we return the maximum of the following: the feerate estimate for the target, minrelaytxfee, and mempoolminfee.
The test test_feerate_mempoolminfee, originally introduced in https://github.com/bitcoin/bitcoin/commit/ea31caf6b4c182c6f10f136548f84e603800511c, is incorrect.
It should calculate the fee rate ceiling by taking the maximum of the custom minrelaytxfee, mempoolminfee, and the highest fee rate observed during the test (check_smart_estimates). This is necessary because:
- There is no guarantee that the generated fee rates will exceed both
minrelaytxfeeandmempoolminfee. - Users can start a node with custom fee settings.
Due to the non-deterministic nature of the feature_fee_estimation.py test, it often passes by chance. The randomly generated fees typically include a value higher than the custom minrelaytxfee, inadvertently hiding the issue.
Issue #32461 identified a random seeds that consistently fails the test because the generated fees never exceed the custom minrelaytxfee:
e.g
0build/test/functional/feature_fee_estimation.py --random=3450808900320758527
This PR has two commits which :
- Correctly fixes the test by calculating the fee rate ceiling as the maximum of the node
minrelaytxfee,mempoolminfee, and the highest seen fee rate, when verifying smart fee estimates. - Improves the subtest name and comment for clarity.
- Restores the original test behavior by appending 4000 WU to the custom
blockmaxweight.
It also fixes #31944
Before this PR we shrank the blocks by 4000, reducing the number of txs that are mined, which effectively causes the long stats to not have insufficient data. See #31944 (comment)
Increasing the weight by 4000 (matching the original test block weight) allows for more transactions to be mined and the long stats to have enough data.
credits to maflcko for noticing the test no longer fails after this #31944 (comment)