Skip to content

Commit

Permalink
test, bumpfee: Check that psbtbumpfee can bump txs with external inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Jan 25, 2022
1 parent 187d8f1 commit 1689110
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/functional/wallet_bumpfee.py
Expand Up @@ -86,7 +86,7 @@ def run_test(self):
self.test_invalid_parameters(rbf_node, peer_node, dest_address)
test_segwit_bumpfee_succeeds(self, rbf_node, dest_address)
test_nonrbf_bumpfee_fails(self, peer_node, dest_address)
test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address)
test_notmine_bumpfee(self, rbf_node, peer_node, dest_address)
test_bumpfee_with_descendant_fails(self, rbf_node, rbf_node_address, dest_address)
test_dust_to_fee(self, rbf_node, dest_address)
test_watchonly_psbt(self, peer_node, rbf_node, dest_address)
Expand Down Expand Up @@ -232,7 +232,7 @@ def test_nonrbf_bumpfee_fails(self, peer_node, dest_address):
self.clear_mempool()


def test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address):
def test_notmine_bumpfee(self, rbf_node, peer_node, dest_address):
self.log.info('Test that it cannot bump fee if non-owned inputs are included')
# here, the rbftx has a peer_node coin and then adds a rbf_node input
# Note that this test depends upon the RPC code checking input ownership prior to change outputs
Expand All @@ -250,8 +250,19 @@ def test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address):
signedtx = rbf_node.signrawtransactionwithwallet(rawtx)
signedtx = peer_node.signrawtransactionwithwallet(signedtx["hex"])
rbfid = rbf_node.sendrawtransaction(signedtx["hex"])
old_fee = rbf_node.getmempoolentry(rbfid)["fees"]["base"]
assert_raises_rpc_error(-4, "Transaction contains inputs that don't belong to this wallet",
rbf_node.bumpfee, rbfid)

self.log.info("Test that psbtbumpfee works for non-owned inputs")
psbt = rbf_node.psbtbumpfee(rbfid)
psbt = rbf_node.walletprocesspsbt(psbt["psbt"])
psbt = peer_node.walletprocesspsbt(psbt["psbt"])
final = rbf_node.finalizepsbt(psbt["psbt"])
res = rbf_node.testmempoolaccept([final["hex"]])
assert res[0]["allowed"]
assert_greater_than(res[0]["fees"]["base"], old_fee)

self.clear_mempool()


Expand Down

0 comments on commit 1689110

Please sign in to comment.