@@ -35,22 +35,22 @@ fn main() {
35
35
// transaction's inputs and outputs.
36
36
let s = format ! (
37
37
"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
39
42
) ;
40
- let bridge_descriptor = Descriptor :: from_str ( & s) . expect ( "parse descriptor string" ) ;
43
+ let descriptor = Descriptor :: from_str ( & s) . expect ( "parse descriptor string" ) ;
41
44
42
- assert ! ( bridge_descriptor. sanity_check( ) . is_ok( ) ) ;
45
+ assert ! ( descriptor. sanity_check( ) . is_ok( ) ) ;
46
+ println ! ( "descriptor pubkey script: {}" , descriptor. script_pubkey( ) ) ;
43
47
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( )
50
50
) ;
51
51
println ! (
52
52
"Weight for witness satisfaction cost {}" ,
53
- bridge_descriptor . max_weight_to_satisfy( ) . unwrap( )
53
+ descriptor . max_weight_to_satisfy( ) . unwrap( )
54
54
) ;
55
55
56
56
let master_private_key_str = "cQhdvB3McbBJdx78VSSumqoHQiSXs75qwLptqwxSQBNBMDxafvaw" ;
@@ -105,7 +105,7 @@ fn main() {
105
105
106
106
let amount = 100000000 ;
107
107
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 ( ) ) ;
109
109
110
110
let all_assets = Descriptor :: < DescriptorPublicKey > :: from_str ( & s)
111
111
. unwrap ( )
@@ -137,7 +137,7 @@ fn main() {
137
137
} ) ;
138
138
139
139
psbt. unsigned_tx . output . push ( TxOut {
140
- script_pubkey : bridge_descriptor . script_pubkey ( ) ,
140
+ script_pubkey : descriptor . script_pubkey ( ) ,
141
141
value : amount * 4 / 5 ,
142
142
} ) ;
143
143
@@ -152,16 +152,14 @@ fn main() {
152
152
println ! ( "{:#?}" , asset) ;
153
153
154
154
// Obtain the Plan based on available Assets
155
- let plan = bridge_descriptor . clone ( ) . plan ( & asset) . unwrap ( ) ;
155
+ let plan = descriptor . clone ( ) . plan ( & asset) . unwrap ( ) ;
156
156
157
157
// Creating a PSBT Input
158
158
let mut input = psbt:: Input :: default ( ) ;
159
159
160
160
// Update the PSBT input from the result which we have obtained from the Plan.
161
161
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 ( ) ;
165
163
input. witness_utxo = Some ( witness_utxo. clone ( ) ) ;
166
164
167
165
// Push the PSBT Input and declare an PSBT Output Structure
0 commit comments