File tree 1 file changed +7
-3
lines changed
rust/basic_bitcoin/src/basic_bitcoin/src/bitcoin_wallet
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,17 @@ pub fn public_key_to_p2tr_script_spend_address(
41
41
42
42
fn p2tr_scipt_spend_info ( public_key : & [ u8 ] ) -> TaprootSpendInfo {
43
43
let spend_script = p2tr_script ( public_key) ;
44
- let dummy_random_secp256k1 = Secp256k1 :: new ( ) ;
45
- let schnorr_public_key = XOnlyPublicKey :: from ( PublicKey :: from_slice ( & public_key) . unwrap ( ) ) ;
44
+ let secp256k1_engine = Secp256k1 :: new ( ) ;
45
+ // This is the key used in the *tweaked* key path spending. Currently, this
46
+ // use case is not supported on the IC. But, once the IC supports this use
47
+ // case, the addresses constructed in this way will be able to use same key
48
+ // in both script and *tweaked* key path spending.
49
+ let internal_public_key = XOnlyPublicKey :: from ( PublicKey :: from_slice ( & public_key) . unwrap ( ) ) ;
46
50
47
51
TaprootBuilder :: new ( )
48
52
. add_leaf ( 0 , spend_script. clone ( ) )
49
53
. expect ( "adding leaf should work" )
50
- . finalize ( & dummy_random_secp256k1 , schnorr_public_key )
54
+ . finalize ( & secp256k1_engine , internal_public_key )
51
55
. expect ( "finalizing taproot builder should work" )
52
56
}
53
57
You can’t perform that action at this time.
0 commit comments