@@ -35,22 +35,22 @@ fn main() {
3535 // transaction's inputs and outputs.
3636 let s = format ! (
3737 "wsh(t:or_c(pk({}),v:thresh(1,pkh({}),a:pkh({}),a:pkh({}))))" ,
38- keys[ 0 ] , keys[ 1 ] , keys[ 2 ] , keys[ 3 ]
38+ keys[ 0 ] , // key A
39+ keys[ 1 ] , // key B
40+ keys[ 2 ] , // key C
41+ keys[ 3 ] , // key D
3942 ) ;
40- let bridge_descriptor = Descriptor :: from_str ( & s) . expect ( "parse descriptor string" ) ;
43+ let descriptor = Descriptor :: from_str ( & s) . expect ( "parse descriptor string" ) ;
4144
42- assert ! ( bridge_descriptor. sanity_check( ) . is_ok( ) ) ;
45+ assert ! ( descriptor. sanity_check( ) . is_ok( ) ) ;
46+ println ! ( "descriptor pubkey script: {}" , descriptor. script_pubkey( ) ) ;
4347 println ! (
44- "Bridge pubkey script: {}" ,
45- bridge_descriptor. script_pubkey( )
46- ) ;
47- println ! (
48- "Bridge address: {}" ,
49- bridge_descriptor. address( Network :: Regtest ) . unwrap( )
48+ "descriptor address: {}" ,
49+ descriptor. address( Network :: Regtest ) . unwrap( )
5050 ) ;
5151 println ! (
5252 "Weight for witness satisfaction cost {}" ,
53- bridge_descriptor . max_weight_to_satisfy( ) . unwrap( )
53+ descriptor . max_weight_to_satisfy( ) . unwrap( )
5454 ) ;
5555
5656 let master_private_key_str = "cQhdvB3McbBJdx78VSSumqoHQiSXs75qwLptqwxSQBNBMDxafvaw" ;
@@ -105,7 +105,7 @@ fn main() {
105105
106106 let amount = 100000000 ;
107107
108- let ( outpoint, witness_utxo) = get_vout ( & depo_tx, & bridge_descriptor . script_pubkey ( ) ) ;
108+ let ( outpoint, witness_utxo) = get_vout ( & depo_tx, & descriptor . script_pubkey ( ) ) ;
109109
110110 let all_assets = Descriptor :: < DescriptorPublicKey > :: from_str ( & s)
111111 . unwrap ( )
@@ -137,7 +137,7 @@ fn main() {
137137 } ) ;
138138
139139 psbt. unsigned_tx . output . push ( TxOut {
140- script_pubkey : bridge_descriptor . script_pubkey ( ) ,
140+ script_pubkey : descriptor . script_pubkey ( ) ,
141141 value : amount * 4 / 5 ,
142142 } ) ;
143143
@@ -152,16 +152,14 @@ fn main() {
152152 println ! ( "{:#?}" , asset) ;
153153
154154 // Obtain the Plan based on available Assets
155- let plan = bridge_descriptor . clone ( ) . plan ( & asset) . unwrap ( ) ;
155+ let plan = descriptor . clone ( ) . plan ( & asset) . unwrap ( ) ;
156156
157157 // Creating a PSBT Input
158158 let mut input = psbt:: Input :: default ( ) ;
159159
160160 // Update the PSBT input from the result which we have obtained from the Plan.
161161 plan. update_psbt_input ( & mut input) ;
162- input
163- . update_with_descriptor_unchecked ( & bridge_descriptor)
164- . unwrap ( ) ;
162+ input. update_with_descriptor_unchecked ( & descriptor) . unwrap ( ) ;
165163 input. witness_utxo = Some ( witness_utxo. clone ( ) ) ;
166164
167165 // Push the PSBT Input and declare an PSBT Output Structure
0 commit comments