@@ -317,8 +317,10 @@ def do_test_psbt(self, comment, pattern, privmap, treefn, keys_pay, keys_change)
317
317
wallet_uuid = uuid .uuid4 ().hex
318
318
self .nodes [0 ].createwallet (wallet_name = f"psbt_online_{ wallet_uuid } " , descriptors = True , disable_private_keys = True , blank = True )
319
319
self .nodes [1 ].createwallet (wallet_name = f"psbt_offline_{ wallet_uuid } " , descriptors = True , blank = True )
320
+ self .nodes [1 ].createwallet (f"key_only_wallet_{ wallet_uuid } " , descriptors = True , blank = True )
320
321
psbt_online = self .nodes [0 ].get_wallet_rpc (f"psbt_online_{ wallet_uuid } " )
321
322
psbt_offline = self .nodes [1 ].get_wallet_rpc (f"psbt_offline_{ wallet_uuid } " )
323
+ key_only_wallet = self .nodes [1 ].get_wallet_rpc (f"key_only_wallet_{ wallet_uuid } " )
322
324
323
325
desc_pay = self .make_desc (pattern , privmap , keys_pay , False )
324
326
desc_change = self .make_desc (pattern , privmap , keys_change , False )
@@ -334,6 +336,9 @@ def do_test_psbt(self, comment, pattern, privmap, treefn, keys_pay, keys_change)
334
336
assert (result [0 ]['success' ])
335
337
result = psbt_offline .importdescriptors ([{"desc" : desc_change , "active" : True , "timestamp" : "now" , "internal" : True }])
336
338
assert (result [0 ]['success' ])
339
+ for key in keys_pay + keys_change :
340
+ result = key_only_wallet .importdescriptors ([{"desc" : descsum_create (f"wpkh({ key ['xprv' ]} /*)" ), "timestamp" :"now" }])
341
+ assert (result [0 ]["success" ])
337
342
address_type = "bech32m" if "tr" in pattern else "bech32"
338
343
for i in range (4 ):
339
344
addr_g = psbt_online .getnewaddress (address_type = address_type )
@@ -349,20 +354,25 @@ def do_test_psbt(self, comment, pattern, privmap, treefn, keys_pay, keys_change)
349
354
# Increase fee_rate to compensate for the wallet's inability to estimate fees for script path spends.
350
355
psbt = psbt_online .walletcreatefundedpsbt ([], [{self .boring .getnewaddress (): Decimal (ret_amnt ) / 100000000 }], None , {"subtractFeeFromOutputs" :[0 ], "fee_rate" : 200 , "change_type" : address_type })['psbt' ]
351
356
res = psbt_offline .walletprocesspsbt (psbt = psbt , finalize = False )
357
+ for wallet in [psbt_offline , key_only_wallet ]:
358
+ res = wallet .walletprocesspsbt (psbt = psbt , finalize = False )
359
+
360
+ decoded = wallet .decodepsbt (res ["psbt" ])
361
+ if pattern .startswith ("tr(" ):
362
+ for psbtin in decoded ["inputs" ]:
363
+ assert "non_witness_utxo" not in psbtin
364
+ assert "witness_utxo" in psbtin
365
+ assert "taproot_internal_key" in psbtin
366
+ assert "taproot_bip32_derivs" in psbtin
367
+ assert "taproot_key_path_sig" in psbtin or "taproot_script_path_sigs" in psbtin
368
+ if "taproot_script_path_sigs" in psbtin :
369
+ assert "taproot_merkle_root" in psbtin
370
+ assert "taproot_scripts" in psbtin
371
+
372
+ rawtx = self .nodes [0 ].finalizepsbt (res ['psbt' ])['hex' ]
373
+ res = self .nodes [0 ].testmempoolaccept ([rawtx ])
374
+ assert res [0 ]["allowed" ]
352
375
353
- decoded = psbt_offline .decodepsbt (res ["psbt" ])
354
- if pattern .startswith ("tr(" ):
355
- for psbtin in decoded ["inputs" ]:
356
- assert "non_witness_utxo" not in psbtin
357
- assert "witness_utxo" in psbtin
358
- assert "taproot_internal_key" in psbtin
359
- assert "taproot_bip32_derivs" in psbtin
360
- assert "taproot_key_path_sig" in psbtin or "taproot_script_path_sigs" in psbtin
361
- if "taproot_script_path_sigs" in psbtin :
362
- assert "taproot_merkle_root" in psbtin
363
- assert "taproot_scripts" in psbtin
364
-
365
- rawtx = self .nodes [0 ].finalizepsbt (res ['psbt' ])['hex' ]
366
376
txid = self .nodes [0 ].sendrawtransaction (rawtx )
367
377
self .generatetoaddress (self .nodes [0 ], 1 , self .boring .getnewaddress (), sync_fun = self .no_op )
368
378
assert (psbt_online .gettransaction (txid )['confirmations' ] > 0 )
0 commit comments