aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSamuel Dobson <dobsonsa68@gmail.com>2021-09-29 10:43:18 +1300
committerSamuel Dobson <dobsonsa68@gmail.com>2021-09-29 10:55:29 +1300
commitb55232a337fae4200085cf6229712549488656fa (patch)
tree1001294f6771eba1630343e6f5a33bf88fd5aab5 /test
parentd6492d4ed053e2b9088a9666dc55c7417c7d4c70 (diff)
parentea31caf6b4c182c6f10f136548f84e603800511c (diff)
downloadbitcoin-b55232a337fae4200085cf6229712549488656fa.tar.xz
Merge bitcoin/bitcoin#22722: rpc: update estimatesmartfee to return max of CBlockPolicyEstimator::estimateSmartFee, mempoolMinFee and minRelayTxFee
ea31caf6b4c182c6f10f136548f84e603800511c update estimatesmartfee rpc to return max of estimateSmartFee, mempoolMinFee and minRelayTxFee. (pranabp-bit) Pull request description: This PR is in response to the issue [#19699](https://github.com/bitcoin/bitcoin/issues/19699). Based on the discussion in the comments of PR [#22673](https://github.com/bitcoin/bitcoin/pull/22673) changes have been made in the `estimatesmartfee` itself such that it takes into account `mempoolMinFee` and `relayMinFee` . Hence it provides a fee estimate that is most likely to be paid by the user in an actual transaction, preventing issues such as [#16072](https://github.com/bitcoin/bitcoin/issues/16072). The test file test/functional/feature_fee_estimation.py has also been updated to check this functionality. ACKs for top commit: meshcollider: re-utACK ea31caf6b4c182c6f10f136548f84e603800511c Tree-SHA512: 8f36153a07cbd552c5c13d11d9c6e987a7a555ea4cc83f2573c0c92dd97c706d90c30a7248671437c2f3a836d3272f8fad53d15a5fa6efaa0409ae8009b0a18d
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_fee_estimation.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py
index c4610f98bd..9c225dc687 100755
--- a/test/functional/feature_fee_estimation.py
+++ b/test/functional/feature_fee_estimation.py
@@ -132,9 +132,13 @@ def check_smart_estimates(node, fees_seen):
delta = 1.0e-6 # account for rounding error
last_feerate = float(max(fees_seen))
all_smart_estimates = [node.estimatesmartfee(i) for i in range(1, 26)]
+ mempoolMinFee = node.getmempoolinfo()['mempoolminfee']
+ minRelaytxFee = node.getmempoolinfo()['minrelaytxfee']
for i, e in enumerate(all_smart_estimates): # estimate is for i+1
feerate = float(e["feerate"])
assert_greater_than(feerate, 0)
+ assert_greater_than_or_equal(feerate, float(mempoolMinFee))
+ assert_greater_than_or_equal(feerate, float(minRelaytxFee))
if feerate + delta < min(fees_seen) or feerate - delta > max(fees_seen):
raise AssertionError(f"Estimated fee ({feerate}) out of range ({min(fees_seen)},{max(fees_seen)})")
@@ -275,6 +279,12 @@ class EstimateFeeTest(BitcoinTestFramework):
self.log.info("Final estimates after emptying mempools")
check_estimates(self.nodes[1], self.fees_per_kb)
+ # check that the effective feerate is greater than or equal to the mempoolminfee even for high mempoolminfee
+ self.log.info("Test fee rate estimation after restarting node with high MempoolMinFee")
+ high_val = 3*self.nodes[1].estimatesmartfee(1)['feerate']
+ self.restart_node(1, extra_args=[f'-minrelaytxfee={high_val}'])
+ check_estimates(self.nodes[1], self.fees_per_kb)
+
self.log.info("Testing that fee estimation is disabled in blocksonly.")
self.restart_node(0, ["-blocksonly"])
assert_raises_rpc_error(-32603, "Fee estimation disabled",