aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2022-12-20 15:19:39 -0500
committerAndrew Chow <github@achow101.com>2022-12-20 15:30:17 -0500
commitcbcad79eefd741fcfa0fb45615b6030575310f62 (patch)
tree0c1a655a2888d92b0c301e08cee89ce6f4e16c66 /test
parent497f26552b36a113f9312da557ad4b58e149524d (diff)
parent2c07cfacd1745844a1d3c57f2e8617549b9815d7 (diff)
downloadbitcoin-cbcad79eefd741fcfa0fb45615b6030575310f62.tar.xz
Merge bitcoin/bitcoin#21576: rpc, gui: bumpfee signer support
2c07cfacd1745844a1d3c57f2e8617549b9815d7 gui: bumpfee signer support (Sjors Provoost) 7e02a3329797211ed5d35e5f5e7b919c099b78ba rpc: bumpfee signer support (Sjors Provoost) 304ece994504220c355577170409b9200941f2af rpc: document bools in FillPSBT() calls (Sjors Provoost) Pull request description: The `bumpfee` RPC call and GUI fee bump interface now work with an external signer. ACKs for top commit: achow101: ACK 2c07cfacd1745844a1d3c57f2e8617549b9815d7 furszy: code review ACK 2c07cfac jarolrod: tACK 2c07cfa Tree-SHA512: 0c7b931f76fac67c9e33b9b935f29af6f69ac67a5ffcc586ed2f1676feac427735b1d971723b29ef332bb6fb5762949598ebbf728587e8f0ded95a9bfbb3e7a4
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_signer.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/functional/wallet_signer.py b/test/functional/wallet_signer.py
index 9ab7154424..0b63ba8491 100755
--- a/test/functional/wallet_signer.py
+++ b/test/functional/wallet_signer.py
@@ -13,6 +13,7 @@ import platform
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
+ assert_greater_than,
assert_raises_rpc_error,
)
@@ -169,7 +170,7 @@ class WalletSignerTest(BitcoinTestFramework):
assert_equal(result[1], {'success': True})
assert_equal(mock_wallet.getwalletinfo()["txcount"], 1)
dest = self.nodes[0].getnewaddress(address_type='bech32')
- mock_psbt = mock_wallet.walletcreatefundedpsbt([], {dest:0.5}, 0, {}, True)['psbt']
+ mock_psbt = mock_wallet.walletcreatefundedpsbt([], {dest:0.5}, 0, {'replaceable': True}, True)['psbt']
mock_psbt_signed = mock_wallet.walletprocesspsbt(psbt=mock_psbt, sign=True, sighashtype="ALL", bip32derivs=True)
mock_psbt_final = mock_wallet.finalizepsbt(mock_psbt_signed["psbt"])
mock_tx = mock_psbt_final["hex"]
@@ -209,6 +210,7 @@ class WalletSignerTest(BitcoinTestFramework):
self.log.info('Test send using hww1')
+ # Don't broadcast transaction yet so the RPC returns the raw hex
res = hww.send(outputs={dest:0.5},options={"add_to_wallet": False})
assert(res["complete"])
assert_equal(res["hex"], mock_tx)
@@ -218,6 +220,25 @@ class WalletSignerTest(BitcoinTestFramework):
res = hww.sendall(recipients=[{dest:0.5}, hww.getrawchangeaddress()],options={"add_to_wallet": False})
assert(res["complete"])
assert_equal(res["hex"], mock_tx)
+ # Broadcast transaction so we can bump the fee
+ hww.sendrawtransaction(res["hex"])
+
+ self.log.info('Prepare fee bumped mock PSBT')
+
+ # Now that the transaction is broadcast, bump fee in mock wallet:
+ orig_tx_id = res["txid"]
+ mock_psbt_bumped = mock_wallet.psbtbumpfee(orig_tx_id)["psbt"]
+ mock_psbt_bumped_signed = mock_wallet.walletprocesspsbt(psbt=mock_psbt_bumped, sign=True, sighashtype="ALL", bip32derivs=True)
+
+ with open(os.path.join(self.nodes[1].cwd, "mock_psbt"), "w", encoding="utf8") as f:
+ f.write(mock_psbt_bumped_signed["psbt"])
+
+ self.log.info('Test bumpfee using hww1')
+
+ # Bump fee
+ res = hww.bumpfee(orig_tx_id)
+ assert_greater_than(res["fee"], res["origfee"])
+ assert_equal(res["errors"], [])
# # Handle error thrown by script
# self.set_mock_result(self.nodes[4], "2")