@@ -276,6 +276,33 @@ def sendall_fails_on_high_fee(self):
276
276
recipients = [self .remainder_target ],
277
277
fee_rate = 100000 )
278
278
279
+ @cleanup
280
+ def sendall_watchonly_specific_inputs (self ):
281
+ self .log .info ("Test sendall with a subset of UTXO pool in a watchonly wallet" )
282
+ self .add_utxos ([17 , 4 ])
283
+ utxo = self .wallet .listunspent ()[0 ]
284
+
285
+ self .nodes [0 ].createwallet (wallet_name = "watching" , disable_private_keys = True )
286
+ watchonly = self .nodes [0 ].get_wallet_rpc ("watching" )
287
+
288
+ import_req = [{
289
+ "desc" : utxo ["desc" ],
290
+ "timestamp" : 0 ,
291
+ }]
292
+ if self .options .descriptors :
293
+ watchonly .importdescriptors (import_req )
294
+ else :
295
+ watchonly .importmulti (import_req )
296
+
297
+ sendall_tx_receipt = watchonly .sendall (recipients = [self .remainder_target ], options = {"inputs" : [utxo ]})
298
+ psbt = sendall_tx_receipt ["psbt" ]
299
+ decoded = self .nodes [0 ].decodepsbt (psbt )
300
+ assert_equal (len (decoded ["inputs" ]), 1 )
301
+ assert_equal (len (decoded ["outputs" ]), 1 )
302
+ assert_equal (decoded ["tx" ]["vin" ][0 ]["txid" ], utxo ["txid" ])
303
+ assert_equal (decoded ["tx" ]["vin" ][0 ]["vout" ], utxo ["vout" ])
304
+ assert_equal (decoded ["tx" ]["vout" ][0 ]["scriptPubKey" ]["address" ], self .remainder_target )
305
+
279
306
# This tests needs to be the last one otherwise @cleanup will fail with "Transaction too large" error
280
307
def sendall_fails_with_transaction_too_large (self ):
281
308
self .log .info ("Test that sendall fails if resulting transaction is too large" )
@@ -341,6 +368,9 @@ def run_test(self):
341
368
# Sendall fails when providing a fee that is too high
342
369
self .sendall_fails_on_high_fee ()
343
370
371
+ # Sendall succeeds with watchonly wallets spending specific UTXOs
372
+ self .sendall_watchonly_specific_inputs ()
373
+
344
374
# Sendall fails when many inputs result to too large transaction
345
375
self .sendall_fails_with_transaction_too_large ()
346
376
0 commit comments