Skip to content

Commit cf6e969

Browse files
laanwjknst
authored andcommitted
Merge bitcoin#22539: Re-include RBF replacement txs in fee estimation
3b61372 Add release notes for fee est with replacement txs (Antoine Poinsot) 4556406 qa: test fee estimation with replacement transactions (Antoine Poinsot) 053415b qa: split run_test into smaller parts (Antoine Poinsot) 06c5ce9 Re-include RBF replacement txs in fee estimation (Antoine Poinsot) Pull request description: This effectively reverts bitcoin#9519. RBF is now largely in use on the network (signaled for by around 20% of all transactions on average) and replacement logic is implemented in most end-user wallets. The rate of replaced transactions is also expected to rise as fee-bumping techniques are being developed for pre-signed transaction ("L2") protocols. ACKs for top commit: prayank23: reACK bitcoin@3b61372 Zero-1729: re-ACK 3b61372 benthecarman: reACK 3b61372 glozow: ACK 3b61372 theStack: re-ACK 3b61372 🍪 Tree-SHA512: a6146d15c80ff4ba9249314b0ef953a66a15673e61b8f98979642814f1b169b5695e330e3ee069fa9a7e4d1f8aa10e1dcb7f9aa79181cea5a4c4dbcaf5483023 Revert "Merge bitcoin#22539: Re-include RBF replacement txs in fee estimation" This reverts commit 7f5fa3592fb7764a92313cd94de0e8447edfa621. qa: split run_test into smaller parts Let's not have run_test get into a giant function as we add more tests Signed-off-by: Antoine Poinsot <[email protected]>
1 parent 5c226da commit cf6e969

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

test/functional/feature_fee_estimation.py

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -215,48 +215,36 @@ def transact_and_mine(self, numblocks, mining_node):
215215
newmem.append(utx)
216216
self.memutxo = newmem
217217

218-
def run_test(self):
219-
self.log.info("This test is time consuming, please be patient")
220-
self.log.info("Splitting inputs so we can generate tx's")
221-
222-
# Start node0
223-
self.start_node(0)
218+
def initial_split(self, node):
219+
"""Split two coinbase UTxOs into many small coins"""
224220
self.txouts = []
225221
self.txouts2 = []
226222
# Split a coinbase into two transaction puzzle outputs
227-
split_inputs(self.nodes[0], self.nodes[0].listunspent(0), self.txouts, True)
223+
split_inputs(node, node.listunspent(0), self.txouts, True)
228224

229225
# Mine
230-
while len(self.nodes[0].getrawmempool()) > 0:
231-
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
226+
while len(node.getrawmempool()) > 0:
227+
self.generate(node, 1, sync_fun=self.no_op)
232228

233229
# Repeatedly split those 2 outputs, doubling twice for each rep
234230
# Use txouts to monitor the available utxo, since these won't be tracked in wallet
235231
reps = 0
236232
while reps < 5:
237233
# Double txouts to txouts2
238234
while len(self.txouts) > 0:
239-
split_inputs(self.nodes[0], self.txouts, self.txouts2)
240-
while len(self.nodes[0].getrawmempool()) > 0:
241-
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
235+
split_inputs(node, self.txouts, self.txouts2)
236+
while len(node.getrawmempool()) > 0:
237+
self.generate(node, 1, sync_fun=self.no_op)
242238
# Double txouts2 to txouts
243239
while len(self.txouts2) > 0:
244-
split_inputs(self.nodes[0], self.txouts2, self.txouts)
245-
while len(self.nodes[0].getrawmempool()) > 0:
246-
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
240+
split_inputs(node, self.txouts2, self.txouts)
241+
while len(node.getrawmempool()) > 0:
242+
self.generate(node, 1, sync_fun=self.no_op)
247243
reps += 1
248-
self.log.info("Finished splitting")
249-
250-
# Now we can connect the other nodes, didn't want to connect them earlier
251-
# so the estimates would not be affected by the splitting transactions
252-
self.start_node(1)
253-
self.start_node(2)
254-
self.connect_nodes(1, 0)
255-
self.connect_nodes(0, 2)
256-
self.connect_nodes(2, 1)
257-
258-
self.sync_all()
259244

245+
def sanity_check_estimates_range(self):
246+
"""Populate estimation buckets, assert estimates are in a sane range and
247+
are strictly increasing as the target decreases."""
260248
self.fees_per_kb = []
261249
self.memutxo = []
262250
self.confutxo = self.txouts # Start with the set of confirmed txouts after splitting
@@ -282,13 +270,37 @@ def run_test(self):
282270
self.log.info("Final estimates after emptying mempools")
283271
check_estimates(self.nodes[1], self.fees_per_kb)
284272

285-
# check that the effective feerate is greater than or equal to the mempoolminfee even for high mempoolminfee
286-
self.log.info("Test fee rate estimation after restarting node with high MempoolMinFee")
273+
def test_feerate_mempoolminfee(self):
287274
high_val = 3*self.nodes[1].estimatesmartfee(1)['feerate']
288275
self.restart_node(1, extra_args=[f'-minrelaytxfee={high_val}'])
289276
check_estimates(self.nodes[1], self.fees_per_kb)
290277
self.stop_node(1, expected_stderr="Warning: -minrelaytxfee is set very high! The wallet will avoid paying less than the minimum relay fee.")
291278

279+
def run_test(self):
280+
self.log.info("This test is time consuming, please be patient")
281+
self.log.info("Splitting inputs so we can generate tx's")
282+
283+
# Split two coinbases into many small utxos
284+
self.start_node(0)
285+
self.initial_split(self.nodes[0])
286+
self.log.info("Finished splitting")
287+
288+
# Now we can connect the other nodes, didn't want to connect them earlier
289+
# so the estimates would not be affected by the splitting transactions
290+
self.start_node(1)
291+
self.start_node(2)
292+
self.connect_nodes(1, 0)
293+
self.connect_nodes(0, 2)
294+
self.connect_nodes(2, 1)
295+
self.sync_all()
296+
297+
self.log.info("Testing estimates with single transactions.")
298+
self.sanity_check_estimates_range()
299+
300+
# check that the effective feerate is greater than or equal to the mempoolminfee even for high mempoolminfee
301+
self.log.info("Test fee rate estimation after restarting node with high MempoolMinFee")
302+
self.test_feerate_mempoolminfee()
303+
292304
self.log.info("Testing that fee estimation is disabled in blocksonly.")
293305
self.restart_node(0, ["-blocksonly"])
294306
assert_raises_rpc_error(-32603, "Fee estimation disabled",

0 commit comments

Comments
 (0)