@@ -1850,6 +1850,7 @@ mod tests {
18501850 use bitcoin:: hashes:: Hash ;
18511851 use bitcoin:: network:: constants:: Network ;
18521852 use bitcoin:: blockdata:: constants:: genesis_block;
1853+ use bitcoin:: blockdata:: script:: Script ;
18531854 use bitcoin:: blockdata:: transaction:: TxOut ;
18541855
18551856 use hex;
@@ -1939,6 +1940,13 @@ mod tests {
19391940 }
19401941 }
19411942
1943+ fn get_channel_script ( secp_ctx : & Secp256k1 < secp256k1:: All > ) -> Script {
1944+ let node_1_btckey = SecretKey :: from_slice ( & [ 40 ; 32 ] ) . unwrap ( ) ;
1945+ let node_2_btckey = SecretKey :: from_slice ( & [ 39 ; 32 ] ) . unwrap ( ) ;
1946+ make_funding_redeemscript ( & PublicKey :: from_secret_key ( secp_ctx, & node_1_btckey) ,
1947+ & PublicKey :: from_secret_key ( secp_ctx, & node_2_btckey) ) . to_v0_p2wsh ( )
1948+ }
1949+
19421950 fn get_signed_channel_update < F : Fn ( & mut UnsignedChannelUpdate ) > ( f : F , node_key : & SecretKey , secp_ctx : & Secp256k1 < secp256k1:: All > ) -> ChannelUpdate {
19431951 let mut unsigned_channel_update = UnsignedChannelUpdate {
19441952 chain_hash : genesis_block ( Network :: Testnet ) . header . block_hash ( ) ,
@@ -2028,8 +2036,7 @@ mod tests {
20282036 let node_1_privkey = & SecretKey :: from_slice ( & [ 42 ; 32 ] ) . unwrap ( ) ;
20292037 let node_2_privkey = & SecretKey :: from_slice ( & [ 41 ; 32 ] ) . unwrap ( ) ;
20302038
2031- let good_script = make_funding_redeemscript ( & PublicKey :: from_secret_key ( & secp_ctx, & node_1_privkey) ,
2032- & PublicKey :: from_secret_key ( & secp_ctx, & node_2_privkey) ) . to_v0_p2wsh ( ) ;
2039+ let good_script = get_channel_script ( & secp_ctx) ;
20332040 let valid_announcement = get_signed_channel_announcement ( |_| { } , node_1_privkey, node_2_privkey, & secp_ctx) ;
20342041
20352042 // Test if the UTXO lookups were not supported
@@ -2154,9 +2161,7 @@ mod tests {
21542161
21552162 {
21562163 // Announce a channel we will update
2157- let good_script = make_funding_redeemscript ( & PublicKey :: from_secret_key ( & secp_ctx, & node_1_privkey) ,
2158- & PublicKey :: from_secret_key ( & secp_ctx, & node_2_privkey) ) . to_v0_p2wsh ( ) ;
2159-
2164+ let good_script = get_channel_script ( & secp_ctx) ;
21602165 * chain_source. utxo_ret . lock ( ) . unwrap ( ) = Ok ( TxOut { value : amount_sats, script_pubkey : good_script. clone ( ) } ) ;
21612166
21622167 let valid_channel_announcement = get_signed_channel_announcement ( |_| { } , node_1_privkey, node_2_privkey, & secp_ctx) ;
0 commit comments