@@ -978,17 +978,22 @@ def test_psbt_input_keys(psbt_input, keys):
978
978
test_psbt_input_keys (decoded ['inputs' ][0 ], ['witness_utxo' , 'non_witness_utxo' ])
979
979
980
980
# Test that the psbt is not finalized and does not have bip32_derivs unless specified
981
- psbt = self .nodes [2 ].descriptorprocesspsbt (psbt = psbt , descriptors = [descriptor ], sighashtype = "ALL" , bip32derivs = True , finalize = False )[ "psbt" ]
982
- decoded = self .nodes [2 ].decodepsbt (psbt )
981
+ processed_psbt = self .nodes [2 ].descriptorprocesspsbt (psbt = psbt , descriptors = [descriptor ], sighashtype = "ALL" , bip32derivs = True , finalize = False )
982
+ decoded = self .nodes [2 ].decodepsbt (processed_psbt [ ' psbt' ] )
983
983
test_psbt_input_keys (decoded ['inputs' ][0 ], ['witness_utxo' , 'non_witness_utxo' , 'partial_signatures' , 'bip32_derivs' ])
984
984
985
- psbt = self .nodes [2 ].descriptorprocesspsbt (psbt = psbt , descriptors = [descriptor ], sighashtype = "ALL" , bip32derivs = False , finalize = True )["psbt" ]
986
- decoded = self .nodes [2 ].decodepsbt (psbt )
985
+ # If psbt not finalized, test that result does not have hex
986
+ assert "hex" not in processed_psbt
987
+
988
+ processed_psbt = self .nodes [2 ].descriptorprocesspsbt (psbt = psbt , descriptors = [descriptor ], sighashtype = "ALL" , bip32derivs = False , finalize = True )
989
+ decoded = self .nodes [2 ].decodepsbt (processed_psbt ['psbt' ])
987
990
test_psbt_input_keys (decoded ['inputs' ][0 ], ['witness_utxo' , 'non_witness_utxo' , 'final_scriptwitness' ])
988
991
992
+ # Test psbt is complete
993
+ assert_equal (processed_psbt ['complete' ], True )
994
+
989
995
# Broadcast transaction
990
- rawtx = self .nodes [2 ].finalizepsbt (psbt )["hex" ]
991
- self .nodes [2 ].sendrawtransaction (rawtx )
996
+ self .nodes [2 ].sendrawtransaction (processed_psbt ['hex' ])
992
997
993
998
self .log .info ("Test descriptorprocesspsbt raises if an invalid sighashtype is passed" )
994
999
assert_raises_rpc_error (- 8 , "all is not a valid sighash parameter." , self .nodes [2 ].descriptorprocesspsbt , psbt , [descriptor ], sighashtype = "all" )
0 commit comments