Skip to content

Commit ff63832

Browse files
committed
test, bumpfee: Check that psbtbumpfee can bump txs with external inputs
1 parent 1bc8106 commit ff63832

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

test/functional/wallet_bumpfee.py

+21-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def run_test(self):
8686
self.test_invalid_parameters(rbf_node, peer_node, dest_address)
8787
test_segwit_bumpfee_succeeds(self, rbf_node, dest_address)
8888
test_nonrbf_bumpfee_fails(self, peer_node, dest_address)
89-
test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address)
89+
test_notmine_bumpfee(self, rbf_node, peer_node, dest_address)
9090
test_bumpfee_with_descendant_fails(self, rbf_node, rbf_node_address, dest_address)
9191
test_dust_to_fee(self, rbf_node, dest_address)
9292
test_watchonly_psbt(self, peer_node, rbf_node, dest_address)
@@ -232,7 +232,7 @@ def test_nonrbf_bumpfee_fails(self, peer_node, dest_address):
232232
self.clear_mempool()
233233

234234

235-
def test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address):
235+
def test_notmine_bumpfee(self, rbf_node, peer_node, dest_address):
236236
self.log.info('Test that it cannot bump fee if non-owned inputs are included')
237237
# here, the rbftx has a peer_node coin and then adds a rbf_node input
238238
# Note that this test depends upon the RPC code checking input ownership prior to change outputs
@@ -250,8 +250,27 @@ def test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address):
250250
signedtx = rbf_node.signrawtransactionwithwallet(rawtx)
251251
signedtx = peer_node.signrawtransactionwithwallet(signedtx["hex"])
252252
rbfid = rbf_node.sendrawtransaction(signedtx["hex"])
253+
entry = rbf_node.getmempoolentry(rbfid)
254+
old_fee = entry["fees"]["base"]
255+
old_feerate = int(old_fee / entry["vsize"] * Decimal(1e8))
253256
assert_raises_rpc_error(-4, "Transaction contains inputs that don't belong to this wallet",
254257
rbf_node.bumpfee, rbfid)
258+
259+
def finish_psbtbumpfee(psbt):
260+
psbt = rbf_node.walletprocesspsbt(psbt)
261+
psbt = peer_node.walletprocesspsbt(psbt["psbt"])
262+
final = rbf_node.finalizepsbt(psbt["psbt"])
263+
res = rbf_node.testmempoolaccept([final["hex"]])
264+
assert res[0]["allowed"]
265+
assert_greater_than(res[0]["fees"]["base"], old_fee)
266+
267+
self.log.info("Test that psbtbumpfee works for non-owned inputs")
268+
psbt = rbf_node.psbtbumpfee(txid=rbfid)
269+
finish_psbtbumpfee(psbt["psbt"])
270+
271+
psbt = rbf_node.psbtbumpfee(txid=rbfid, options={"fee_rate": old_feerate + 10})
272+
finish_psbtbumpfee(psbt["psbt"])
273+
255274
self.clear_mempool()
256275

257276

0 commit comments

Comments
 (0)