Skip to content

Commit e07dd5f

Browse files
committed
test: fix bumpfee 'spend_one_input' occasional failure
Most of the subtests in wallet_bumpfee.py expect to find spendable UTXOs of 0.001 btc in the rbf wallet (they use the 'spend_one_input()' method that tries to spend one of them and if it doesn't find any, it throws an exception). The sporadic failure comes from the recently added 'test_feerate_checks_replaced_outputs' subtest that can spend all them. Leaving the next subtests with no 0.001 UTXOs to spend. To solve it, this PR moves the recently added case into a "context independent subtests" section. Which is placed at the end to not affect other cases.
1 parent b22c275 commit e07dd5f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/functional/wallet_bumpfee.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ def run_test(self):
101101
test_change_script_match(self, rbf_node, dest_address)
102102
test_settxfee(self, rbf_node, dest_address)
103103
test_maxtxfee_fails(self, rbf_node, dest_address)
104-
test_feerate_checks_replaced_outputs(self, rbf_node)
105104
# These tests wipe out a number of utxos that are expected in other tests
106105
test_small_output_with_feerate_succeeds(self, rbf_node, dest_address)
107106
test_no_more_inputs_fails(self, rbf_node, dest_address)
108107

108+
# Context independent tests
109+
test_feerate_checks_replaced_outputs(self, rbf_node, peer_node)
110+
109111
def test_invalid_parameters(self, rbf_node, peer_node, dest_address):
110112
self.log.info('Test invalid parameters')
111113
rbfid = spend_one_input(rbf_node, dest_address)
@@ -670,7 +672,11 @@ def test_no_more_inputs_fails(self, rbf_node, dest_address):
670672
self.clear_mempool()
671673

672674

673-
def test_feerate_checks_replaced_outputs(self, rbf_node):
675+
def test_feerate_checks_replaced_outputs(self, rbf_node, peer_node):
676+
# Make sure there is enough balance
677+
peer_node.sendtoaddress(rbf_node.getnewaddress(), 60)
678+
self.generate(peer_node, 1)
679+
674680
self.log.info("Test that feerate checks use replaced outputs")
675681
outputs = []
676682
for i in range(50):
@@ -693,6 +699,7 @@ def test_feerate_checks_replaced_outputs(self, rbf_node):
693699

694700
# Bumpfee and replace all outputs with a single one using the minimum feerate
695701
rbf_node.bumpfee(tx_res["txid"], {"fee_rate": min_fee_rate, "outputs": new_outputs})
702+
self.clear_mempool()
696703

697704

698705
if __name__ == "__main__":

0 commit comments

Comments
 (0)