13
13
from test_framework .test_framework import BitcoinTestFramework
14
14
from test_framework .util import (
15
15
assert_equal ,
16
+ assert_greater_than ,
16
17
assert_raises_rpc_error ,
17
18
)
18
19
@@ -150,7 +151,7 @@ def test_valid_signer(self):
150
151
assert_equal (result [1 ], {'success' : True })
151
152
assert_equal (mock_wallet .getwalletinfo ()["txcount" ], 1 )
152
153
dest = self .nodes [0 ].getnewaddress (address_type = 'bech32' )
153
- mock_psbt = mock_wallet .walletcreatefundedpsbt ([], {dest :0.5 }, 0 , {}, True )['psbt' ]
154
+ mock_psbt = mock_wallet .walletcreatefundedpsbt ([], {dest :0.5 }, 0 , {'replaceable' : True }, True )['psbt' ]
154
155
mock_psbt_signed = mock_wallet .walletprocesspsbt (psbt = mock_psbt , sign = True , sighashtype = "ALL" , bip32derivs = True )
155
156
mock_psbt_final = mock_wallet .finalizepsbt (mock_psbt_signed ["psbt" ])
156
157
mock_tx = mock_psbt_final ["hex" ]
@@ -190,6 +191,7 @@ def test_valid_signer(self):
190
191
191
192
self .log .info ('Test send using hww1' )
192
193
194
+ # Don't broadcast transaction yet so the RPC returns the raw hex
193
195
res = hww .send (outputs = {dest :0.5 },options = {"add_to_wallet" : False })
194
196
assert (res ["complete" ])
195
197
assert_equal (res ["hex" ], mock_tx )
@@ -199,6 +201,25 @@ def test_valid_signer(self):
199
201
res = hww .sendall (recipients = [{dest :0.5 }, hww .getrawchangeaddress ()],options = {"add_to_wallet" : False })
200
202
assert (res ["complete" ])
201
203
assert_equal (res ["hex" ], mock_tx )
204
+ # Broadcast transaction so we can bump the fee
205
+ hww .sendrawtransaction (res ["hex" ])
206
+
207
+ self .log .info ('Prepare fee bumped mock PSBT' )
208
+
209
+ # Now that the transaction is broadcast, bump fee in mock wallet:
210
+ orig_tx_id = res ["txid" ]
211
+ mock_psbt_bumped = mock_wallet .psbtbumpfee (orig_tx_id )["psbt" ]
212
+ mock_psbt_bumped_signed = mock_wallet .walletprocesspsbt (psbt = mock_psbt_bumped , sign = True , sighashtype = "ALL" , bip32derivs = True )
213
+
214
+ with open (os .path .join (self .nodes [1 ].cwd , "mock_psbt" ), "w" , encoding = "utf8" ) as f :
215
+ f .write (mock_psbt_bumped_signed ["psbt" ])
216
+
217
+ self .log .info ('Test bumpfee using hww1' )
218
+
219
+ # Bump fee
220
+ res = hww .bumpfee (orig_tx_id )
221
+ assert_greater_than (res ["fee" ], res ["origfee" ])
222
+ assert_equal (res ["errors" ], [])
202
223
203
224
# # Handle error thrown by script
204
225
# self.set_mock_result(self.nodes[4], "2")
0 commit comments