@@ -3917,32 +3917,33 @@ impl<SP: SignerProvider> ChannelContext<SP> {
39173917 debug_assert!(our_funding_satoshis == 0 || msg_push_msat == 0);
39183918 let value_to_self_msat = our_funding_satoshis * 1000 + msg_push_msat;
39193919
3920- let counterparty_shutdown_scriptpubkey =
3921- if their_features.supports_upfront_shutdown_script() {
3922- match &open_channel_fields.shutdown_scriptpubkey {
3923- &Some(ref script) => {
3924- // Peer is signaling upfront_shutdown and has opt-out with a 0-length script. We don't enforce anything
3925- if script.len() == 0 {
3926- None
3927- } else {
3928- if !script::is_bolt2_compliant(&script, their_features) {
3929- return Err(ChannelError::close(format!(
3920+ let counterparty_shutdown_scriptpubkey = if their_features
3921+ .supports_upfront_shutdown_script()
3922+ {
3923+ match &open_channel_fields.shutdown_scriptpubkey {
3924+ &Some(ref script) => {
3925+ // Peer is signaling upfront_shutdown and has opt-out with a 0-length script. We don't enforce anything
3926+ if script.len() == 0 {
3927+ None
3928+ } else {
3929+ if !script::is_bolt2_compliant(&script, their_features) {
3930+ return Err(ChannelError::close(format!(
39303931 "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {script}"
39313932 )));
3932- }
3933- Some(script.clone())
39343933 }
3935- },
3936- // Peer is signaling upfront shutdown but don't opt-out with correct mechanism (a.k.a 0-length script). Peer looks buggy, we fail the channel
3937- &None => {
3938- return Err(ChannelError::close(String::from(
3934+ Some(script.clone())
3935+ }
3936+ },
3937+ // Peer is signaling upfront shutdown but don't opt-out with correct mechanism (a.k.a 0-length script). Peer looks buggy, we fail the channel
3938+ &None => {
3939+ return Err(ChannelError::close(String::from(
39393940 "Peer is signaling upfront_shutdown but we don't get any script. Use 0-length script to opt-out"
39403941 )));
3941- },
3942- }
3943- } else {
3944- None
3945- };
3942+ },
3943+ }
3944+ } else {
3945+ None
3946+ };
39463947
39473948 let shutdown_scriptpubkey =
39483949 if config.channel_handshake_config.commit_upfront_shutdown_pubkey {
@@ -4853,32 +4854,33 @@ impl<SP: SignerProvider> ChannelContext<SP> {
48534854 )));
48544855 }
48554856
4856- let counterparty_shutdown_scriptpubkey =
4857- if their_features.supports_upfront_shutdown_script() {
4858- match &common_fields.shutdown_scriptpubkey {
4859- &Some(ref script) => {
4860- // Peer is signaling upfront_shutdown and has opt-out with a 0-length script. We don't enforce anything
4861- if script.len() == 0 {
4862- None
4863- } else {
4864- if !script::is_bolt2_compliant(&script, their_features) {
4865- return Err(ChannelError::close(format!(
4857+ let counterparty_shutdown_scriptpubkey = if their_features
4858+ .supports_upfront_shutdown_script()
4859+ {
4860+ match &common_fields.shutdown_scriptpubkey {
4861+ &Some(ref script) => {
4862+ // Peer is signaling upfront_shutdown and has opt-out with a 0-length script. We don't enforce anything
4863+ if script.len() == 0 {
4864+ None
4865+ } else {
4866+ if !script::is_bolt2_compliant(&script, their_features) {
4867+ return Err(ChannelError::close(format!(
48664868 "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {script}"
48674869 )));
4868- }
4869- Some(script.clone())
48704870 }
4871- },
4872- // Peer is signaling upfront shutdown but don't opt-out with correct mechanism (a.k.a 0-length script). Peer looks buggy, we fail the channel
4873- &None => {
4874- return Err(ChannelError::close(String::from(
4871+ Some(script.clone())
4872+ }
4873+ },
4874+ // Peer is signaling upfront shutdown but don't opt-out with correct mechanism (a.k.a 0-length script). Peer looks buggy, we fail the channel
4875+ &None => {
4876+ return Err(ChannelError::close(String::from(
48754877 "Peer is signaling upfront_shutdown but we don't get any script. Use 0-length script to opt-out"
48764878 )));
4877- },
4878- }
4879- } else {
4880- None
4881- };
4879+ },
4880+ }
4881+ } else {
4882+ None
4883+ };
48824884
48834885 self.counterparty_dust_limit_satoshis = common_fields.dust_limit_satoshis;
48844886 self.counterparty_max_htlc_value_in_flight_msat = cmp::min(
0 commit comments