@@ -48,19 +48,20 @@ fn main() {
4848 // transaction's inputs and outputs.
4949 let s = format ! (
5050 "tr({},{{pkh({}),{{multi_a(1,{},{}),and_v(v:pk({}),after(10))}}}})" ,
51- keys[ 0 ] , keys[ 1 ] , keys[ 2 ] , keys[ 3 ] , keys[ 4 ]
51+ keys[ 0 ] , // Key A
52+ keys[ 1 ] , // Key B
53+ keys[ 2 ] , // Key C
54+ keys[ 3 ] , // Key D
55+ keys[ 4 ] , // Key E
5256 ) ;
5357
54- let bridge_descriptor = Descriptor :: from_str ( & s) . expect ( "parse descriptor string" ) ;
55- assert ! ( bridge_descriptor . sanity_check( ) . is_ok( ) ) ;
58+ let descriptor = Descriptor :: from_str ( & s) . expect ( "parse descriptor string" ) ;
59+ assert ! ( descriptor . sanity_check( ) . is_ok( ) ) ;
5660
61+ println ! ( "Descriptor pubkey script: {}" , descriptor. script_pubkey( ) ) ;
5762 println ! (
58- "Bridge pubkey script: {}" ,
59- bridge_descriptor. script_pubkey( )
60- ) ;
61- println ! (
62- "Bridge address: {}" ,
63- bridge_descriptor. address( Network :: Regtest ) . unwrap( )
63+ "Descriptor address: {}" ,
64+ descriptor. address( Network :: Regtest ) . unwrap( )
6465 ) ;
6566
6667 let master_private_key_str = "KxQqtbUnMugSEbKHG3saknvVYux1cgFjFqWzMfwnFhLm8QrGq26v" ;
@@ -113,7 +114,7 @@ fn main() {
113114
114115 let amount = 100000000 ;
115116
116- let ( outpoint, witness_utxo) = get_vout ( & depo_tx, bridge_descriptor . script_pubkey ( ) ) ;
117+ let ( outpoint, witness_utxo) = get_vout ( & depo_tx, descriptor . script_pubkey ( ) ) ;
117118
118119 let all_assets = Descriptor :: < DescriptorPublicKey > :: from_str ( & s)
119120 . unwrap ( )
@@ -145,7 +146,7 @@ fn main() {
145146 } ) ;
146147
147148 psbt. unsigned_tx . output . push ( TxOut {
148- script_pubkey : bridge_descriptor . script_pubkey ( ) ,
149+ script_pubkey : descriptor . script_pubkey ( ) ,
149150 value : amount * 4 / 5 ,
150151 } ) ;
151152
@@ -157,16 +158,14 @@ fn main() {
157158 // We have to add the keys to `Asset` and then obtain plan with only available signatures if the descriptor can be satisfied.
158159
159160 // Obtain the Plan based on available Assets
160- let plan = bridge_descriptor . clone ( ) . plan ( & asset) . unwrap ( ) ;
161+ let plan = descriptor . clone ( ) . plan ( & asset) . unwrap ( ) ;
161162
162163 // Creating PSBT Input
163164 let mut input = psbt:: Input :: default ( ) ;
164165 plan. update_psbt_input ( & mut input) ;
165166
166167 // Update the PSBT input from the result which we have obtained from the Plan.
167- input
168- . update_with_descriptor_unchecked ( & bridge_descriptor)
169- . unwrap ( ) ;
168+ input. update_with_descriptor_unchecked ( & descriptor) . unwrap ( ) ;
170169 input. witness_utxo = Some ( witness_utxo. clone ( ) ) ;
171170
172171 // Push the PSBT Input and declare an PSBT Output Structure
0 commit comments