@@ -25,8 +25,8 @@ use bitcoin::hashes::hex::{FromHex, ToHex};
25
25
use bitcoin:: hashes:: Hash ;
26
26
use bitcoin:: secp256k1;
27
27
use bitcoin:: {
28
- Address , Amount , PackedLockTime , Network , OutPoint , PrivateKey , Script , EcdsaSighashType , SignedAmount ,
29
- Sequence , Transaction , TxIn , TxOut , Txid , Witness ,
28
+ Address , Amount , EcdsaSighashType , Network , OutPoint , PackedLockTime , PrivateKey , Script ,
29
+ Sequence , SignedAmount , Transaction , TxIn , TxOut , Txid , Witness ,
30
30
} ;
31
31
use bitcoincore_rpc:: bitcoincore_rpc_json:: {
32
32
GetBlockTemplateModes , GetBlockTemplateRules , ScanTxOutRequest ,
@@ -172,6 +172,7 @@ fn main() {
172
172
test_test_mempool_accept ( & cl) ;
173
173
test_wallet_create_funded_psbt ( & cl) ;
174
174
test_wallet_process_psbt ( & cl) ;
175
+ test_join_psbt ( & cl) ;
175
176
test_combine_psbt ( & cl) ;
176
177
test_finalize_psbt ( & cl) ;
177
178
test_list_received_by_address ( & cl) ;
@@ -782,6 +783,40 @@ fn test_wallet_process_psbt(cl: &Client) {
782
783
assert ! ( res. complete) ;
783
784
}
784
785
786
+ fn test_join_psbt ( cl : & Client ) {
787
+ let options = json:: ListUnspentQueryOptions {
788
+ minimum_amount : Some ( btc ( 2 ) ) ,
789
+ ..Default :: default ( )
790
+ } ;
791
+ let unspent = cl. list_unspent ( Some ( 6 ) , None , None , None , Some ( options) ) . unwrap ( ) ;
792
+ let unspent1 = unspent[ 0 ] . clone ( ) ;
793
+ let input = json:: CreateRawTransactionInput {
794
+ txid : unspent1. txid ,
795
+ vout : unspent1. vout ,
796
+ sequence : None ,
797
+ } ;
798
+ let mut output = HashMap :: new ( ) ;
799
+ output. insert ( RANDOM_ADDRESS . to_string ( ) , btc ( 1 ) ) ;
800
+ let psbt1 = cl
801
+ . wallet_create_funded_psbt ( & [ input. clone ( ) ] , & output, Some ( 500_000 ) , None , Some ( true ) )
802
+ . unwrap ( ) ;
803
+
804
+ let unspent = unspent. into_iter ( ) . nth ( 1 ) . unwrap ( ) ;
805
+ let input2 = json:: CreateRawTransactionInput {
806
+ txid : unspent. txid ,
807
+ vout : unspent. vout ,
808
+ sequence : None ,
809
+ } ;
810
+ let mut output2 = HashMap :: new ( ) ;
811
+ output2. insert ( RANDOM_ADDRESS . to_string ( ) , btc ( 1 ) ) ;
812
+ let psbt2 = cl
813
+ . wallet_create_funded_psbt ( & [ input2. clone ( ) ] , & output, Some ( 500_000 ) , None , Some ( true ) )
814
+ . unwrap ( ) ;
815
+
816
+ let psbt = cl. join_psbt ( & [ psbt1. psbt , psbt2. psbt ] ) . unwrap ( ) ;
817
+ assert ! ( !psbt. is_empty( ) ) ;
818
+ }
819
+
785
820
fn test_combine_psbt ( cl : & Client ) {
786
821
let options = json:: ListUnspentQueryOptions {
787
822
minimum_amount : Some ( btc ( 2 ) ) ,
0 commit comments