Skip to content

Commit 6a60bfc

Browse files
author
MarcoFalke
committed
Merge #18765: test: Fix wallet_bumpfee intermittent error
fa301fe test: Fix wallet_bumpfee intermittent error (MarcoFalke) Pull request description: Remove incorrect and undocumented `connect_nodes(self.nodes[0], 1)`. Issue is that transactions are re-relayed (going full circle) between the two nodes, that have two connections between each other. https://travis-ci.org/github/bitcoin/bitcoin/jobs/679201559#L6992 Also fix some pep8 while touching the file This bug has been introduced by accident in c1dde3a ACKs for top commit: achow101: ACK fa301fe Tree-SHA512: a6565ca30dbe44b02e3f58f159d2515c2ea4a74030118fafc1a3391ce980a4b6d4505dcf51315fda24843f72550a7dea7407b877b3b796883dd73d3b6f009e6f
2 parents a483ffd + fa301fe commit 6a60bfc

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

test/functional/wallet_bumpfee.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
assert_equal,
2424
assert_greater_than,
2525
assert_raises_rpc_error,
26-
connect_nodes,
2726
hex_str_to_bytes,
2827
)
2928

@@ -37,6 +36,7 @@
3736
HIGH = 0.00500000
3837
TOO_HIGH = 1.00000000
3938

39+
4040
class BumpFeeTest(BitcoinTestFramework):
4141
def set_test_params(self):
4242
self.num_nodes = 2
@@ -55,9 +55,6 @@ def run_test(self):
5555
self.nodes[1].encryptwallet(WALLET_PASSPHRASE)
5656
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
5757

58-
connect_nodes(self.nodes[0], 1)
59-
self.sync_all()
60-
6158
peer_node, rbf_node = self.nodes
6259
rbf_node_address = rbf_node.getnewaddress()
6360

@@ -94,7 +91,6 @@ def run_test(self):
9491
# These tests wipe out a number of utxos that are expected in other tests
9592
test_small_output_with_feerate_succeeds(self, rbf_node, dest_address)
9693
test_no_more_inputs_fails(self, rbf_node, dest_address)
97-
self.log.info("Success")
9894

9995

10096
def test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address):
@@ -124,6 +120,7 @@ def test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address):
124120
assert_equal(oldwtx["replaced_by_txid"], bumped_tx["txid"])
125121
assert_equal(bumpedwtx["replaces_txid"], rbfid)
126122

123+
127124
def test_feerate_args(self, rbf_node, peer_node, dest_address):
128125
self.log.info('Test fee_rate args')
129126
rbfid = spend_one_input(rbf_node, dest_address)
@@ -137,7 +134,7 @@ def test_feerate_args(self, rbf_node, peer_node, dest_address):
137134
# Bumping to just above minrelay should fail to increase total fee enough, at least
138135
assert_raises_rpc_error(-8, "Insufficient total fee", rbf_node.bumpfee, rbfid, {"fee_rate": INSUFFICIENT})
139136

140-
assert_raises_rpc_error(-3, "Amount out of range", rbf_node.bumpfee, rbfid, {"fee_rate":-1})
137+
assert_raises_rpc_error(-3, "Amount out of range", rbf_node.bumpfee, rbfid, {"fee_rate": -1})
141138

142139
assert_raises_rpc_error(-4, "is too high (cannot be higher than", rbf_node.bumpfee, rbfid, {"fee_rate": TOO_HIGH})
143140

@@ -209,6 +206,7 @@ def test_bumpfee_with_descendant_fails(self, rbf_node, rbf_node_address, dest_ad
209206
rbf_node.sendrawtransaction(tx["hex"])
210207
assert_raises_rpc_error(-8, "Transaction has descendants in the wallet", rbf_node.bumpfee, parent_id)
211208

209+
212210
def test_small_output_with_feerate_succeeds(self, rbf_node, dest_address):
213211
self.log.info('Testing small output with feerate bump succeeds')
214212

@@ -249,6 +247,7 @@ def test_small_output_with_feerate_succeeds(self, rbf_node, dest_address):
249247
rbf_node.generatetoaddress(1, rbf_node.getnewaddress())
250248
assert_equal(rbf_node.gettransaction(rbfid)["confirmations"], 1)
251249

250+
252251
def test_dust_to_fee(self, rbf_node, dest_address):
253252
self.log.info('Test that bumped output that is dust is dropped to fee')
254253
rbfid = spend_one_input(rbf_node, dest_address)
@@ -305,6 +304,7 @@ def test_maxtxfee_fails(self, rbf_node, dest_address):
305304
self.restart_node(1, self.extra_args[1])
306305
rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
307306

307+
308308
def test_watchonly_psbt(self, peer_node, rbf_node, dest_address):
309309
self.log.info('Test that PSBT is returned for bumpfee in watchonly wallets')
310310
priv_rec_desc = "wpkh([00000001/84'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0/*)#rweraev0"
@@ -339,12 +339,11 @@ def test_watchonly_psbt(self, peer_node, rbf_node, dest_address):
339339
result = watcher.importmulti([{
340340
"desc": pub_rec_desc,
341341
"timestamp": 0,
342-
"range": [0,10],
342+
"range": [0, 10],
343343
"internal": False,
344344
"keypool": True,
345345
"watchonly": True
346-
},
347-
{
346+
}, {
348347
"desc": pub_change_desc,
349348
"timestamp": 0,
350349
"range": [0, 10],
@@ -361,7 +360,7 @@ def test_watchonly_psbt(self, peer_node, rbf_node, dest_address):
361360
self.sync_all()
362361

363362
# Create single-input PSBT for transaction to be bumped
364-
psbt = watcher.walletcreatefundedpsbt([], {dest_address:0.0005}, 0, {"feeRate": 0.00001}, True)['psbt']
363+
psbt = watcher.walletcreatefundedpsbt([], {dest_address: 0.0005}, 0, {"feeRate": 0.00001}, True)['psbt']
365364
psbt_signed = signer.walletprocesspsbt(psbt=psbt, sign=True, sighashtype="ALL", bip32derivs=True)
366365
psbt_final = watcher.finalizepsbt(psbt_signed["psbt"])
367366
original_txid = watcher.sendrawtransaction(psbt_final["hex"])
@@ -387,6 +386,7 @@ def test_watchonly_psbt(self, peer_node, rbf_node, dest_address):
387386
rbf_node.unloadwallet("watcher")
388387
rbf_node.unloadwallet("signer")
389388

389+
390390
def test_rebumping(self, rbf_node, dest_address):
391391
self.log.info('Test that re-bumping the original tx fails, but bumping successor works')
392392
rbfid = spend_one_input(rbf_node, dest_address)
@@ -461,6 +461,7 @@ def test_locked_wallet_fails(self, rbf_node, dest_address):
461461
rbf_node.bumpfee, rbfid)
462462
rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
463463

464+
464465
def test_change_script_match(self, rbf_node, dest_address):
465466
self.log.info('Test that the same change addresses is used for the replacement transaction when possible')
466467

@@ -480,6 +481,7 @@ def get_change_address(tx):
480481
bumped_rate_tx = rbf_node.bumpfee(bumped_total_tx["txid"])
481482
assert_equal(change_addresses, get_change_address(bumped_rate_tx['txid']))
482483

484+
483485
def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")):
484486
tx_input = dict(
485487
sequence=BIP125_SEQUENCE_NUMBER, **next(u for u in node.listunspent() if u["amount"] == Decimal("0.00100000")))
@@ -491,6 +493,7 @@ def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")):
491493
txid = node.sendrawtransaction(signedtx["hex"])
492494
return txid
493495

496+
494497
def submit_block_with_tx(node, tx):
495498
ctx = CTransaction()
496499
ctx.deserialize(io.BytesIO(hex_str_to_bytes(tx)))
@@ -507,6 +510,7 @@ def submit_block_with_tx(node, tx):
507510
node.submitblock(block.serialize().hex())
508511
return block
509512

513+
510514
def test_no_more_inputs_fails(self, rbf_node, dest_address):
511515
self.log.info('Test that bumpfee fails when there are no available confirmed outputs')
512516
# feerate rbf requires confirmed outputs when change output doesn't exist or is insufficient

0 commit comments

Comments
 (0)