@@ -64,6 +64,7 @@ impl AnchorDescriptor {
6464 chan_utils:: get_keyed_anchor_redeemscript (
6565 & channel_params. broadcaster_pubkeys ( ) . funding_pubkey ,
6666 )
67+ . to_p2wsh ( )
6768 } else {
6869 assert ! ( tx_params. channel_type_features. supports_anchor_zero_fee_commitments( ) ) ;
6970 shared_anchor_script_pubkey ( )
@@ -1031,4 +1032,27 @@ mod tests {
10311032 1 /* witness items */ + 1 /* schnorr sig len */ + 64 /* schnorr sig */
10321033 ) ;
10331034 }
1035+
1036+ #[ test]
1037+ fn test_anchor_descriptor_previous_utxo_script_pubkey_uses_p2wsh ( ) {
1038+ let mut transaction_parameters = ChannelTransactionParameters :: test_dummy ( 42_000_000 ) ;
1039+ transaction_parameters. channel_type_features =
1040+ ChannelTypeFeatures :: anchors_zero_htlc_fee_and_dependencies ( ) ;
1041+
1042+ let funding_pubkey = transaction_parameters. holder_pubkeys . funding_pubkey ;
1043+ let expected_script_pubkey =
1044+ chan_utils:: get_keyed_anchor_redeemscript ( & funding_pubkey) . to_p2wsh ( ) ;
1045+
1046+ let anchor_descriptor = AnchorDescriptor {
1047+ channel_derivation_parameters : ChannelDerivationParameters {
1048+ value_satoshis : 42_000_000 ,
1049+ keys_id : [ 42 ; 32 ] ,
1050+ transaction_parameters,
1051+ } ,
1052+ outpoint : OutPoint :: null ( ) ,
1053+ value : Amount :: from_sat ( ANCHOR_OUTPUT_VALUE_SATOSHI ) ,
1054+ } ;
1055+
1056+ assert_eq ! ( anchor_descriptor. previous_utxo( ) . script_pubkey, expected_script_pubkey) ;
1057+ }
10341058}
0 commit comments