@@ -3708,41 +3708,38 @@ impl<SP: SignerProvider> ChannelContext<SP> {
37083708
37093709 if config.channel_handshake_config.our_to_self_delay < BREAKDOWN_TIMEOUT {
37103710 return Err(ChannelError::close(format!(
3711- "Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks. It must be greater than {}",
3712- config.channel_handshake_config.our_to_self_delay, BREAKDOWN_TIMEOUT
3711+ "Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks. It must be greater than {BREAKDOWN_TIMEOUT }",
3712+ config.channel_handshake_config.our_to_self_delay
37133713 )));
37143714 }
37153715
37163716 if channel_value_satoshis >= TOTAL_BITCOIN_SUPPLY_SATOSHIS {
37173717 return Err(ChannelError::close(format!(
3718- "Funding must be smaller than the total bitcoin supply. It was {}",
3719- channel_value_satoshis
3718+ "Funding must be smaller than the total bitcoin supply. It was {channel_value_satoshis}"
37203719 )));
37213720 }
37223721 if msg_channel_reserve_satoshis > channel_value_satoshis {
37233722 return Err(ChannelError::close(format!(
3724- "Bogus channel_reserve_satoshis ({}). Must be no greater than channel_value_satoshis: {}",
3725- msg_channel_reserve_satoshis, channel_value_satoshis
3723+ "Bogus channel_reserve_satoshis ({msg_channel_reserve_satoshis}). Must be no greater than channel_value_satoshis: {channel_value_satoshis}"
37263724 )));
37273725 }
37283726 let full_channel_value_msat =
37293727 (channel_value_satoshis - msg_channel_reserve_satoshis) * 1000;
37303728 if msg_push_msat > full_channel_value_msat {
37313729 return Err(ChannelError::close(format!(
3732- "push_msat {} was larger than channel amount minus reserve ({})",
3733- msg_push_msat, full_channel_value_msat
3730+ "push_msat {msg_push_msat} was larger than channel amount minus reserve ({full_channel_value_msat})"
37343731 )));
37353732 }
37363733 if open_channel_fields.dust_limit_satoshis > channel_value_satoshis {
37373734 return Err(ChannelError::close(format!(
3738- "dust_limit_satoshis {} was larger than channel_value_satoshis {}. Peer never wants payout outputs?",
3739- open_channel_fields.dust_limit_satoshis, channel_value_satoshis
3735+ "dust_limit_satoshis {} was larger than channel_value_satoshis {channel_value_satoshis }. Peer never wants payout outputs?",
3736+ open_channel_fields.dust_limit_satoshis
37403737 )));
37413738 }
37423739 if open_channel_fields.htlc_minimum_msat >= full_channel_value_msat {
37433740 return Err(ChannelError::close(format!(
3744- "Minimum htlc value ({}) was larger than full channel value ({})",
3745- open_channel_fields.htlc_minimum_msat, full_channel_value_msat
3741+ "Minimum htlc value ({}) was larger than full channel value ({full_channel_value_msat })",
3742+ open_channel_fields.htlc_minimum_msat
37463743 )));
37473744 }
37483745 FundedChannel::<SP>::check_remote_fee(
@@ -3759,8 +3756,8 @@ impl<SP: SignerProvider> ChannelContext<SP> {
37593756 );
37603757 if open_channel_fields.to_self_delay > max_counterparty_selected_contest_delay {
37613758 return Err(ChannelError::close(format!(
3762- "They wanted our payments to be delayed by a needlessly long period. Upper limit: {}. Actual: {}",
3763- max_counterparty_selected_contest_delay, open_channel_fields.to_self_delay
3759+ "They wanted our payments to be delayed by a needlessly long period. Upper limit: {max_counterparty_selected_contest_delay }. Actual: {}",
3760+ open_channel_fields.to_self_delay
37643761 )));
37653762 }
37663763 if open_channel_fields.max_accepted_htlcs < 1 {
@@ -3779,8 +3776,8 @@ impl<SP: SignerProvider> ChannelContext<SP> {
37793776 // Now check against optional parameters as set by config...
37803777 if channel_value_satoshis < config.channel_handshake_limits.min_funding_satoshis {
37813778 return Err(ChannelError::close(format!(
3782- "Funding satoshis ({}) is less than the user specified limit ({})",
3783- channel_value_satoshis, config.channel_handshake_limits.min_funding_satoshis
3779+ "Funding satoshis ({channel_value_satoshis }) is less than the user specified limit ({})",
3780+ config.channel_handshake_limits.min_funding_satoshis
37843781 )));
37853782 }
37863783 if open_channel_fields.htlc_minimum_msat
@@ -3805,8 +3802,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
38053802 > config.channel_handshake_limits.max_channel_reserve_satoshis
38063803 {
38073804 return Err(ChannelError::close(format!(
3808- "channel_reserve_satoshis ({}) is higher than the user specified limit ({})",
3809- msg_channel_reserve_satoshis,
3805+ "channel_reserve_satoshis ({msg_channel_reserve_satoshis}) is higher than the user specified limit ({})",
38103806 config.channel_handshake_limits.max_channel_reserve_satoshis
38113807 )));
38123808 }
@@ -3821,8 +3817,8 @@ impl<SP: SignerProvider> ChannelContext<SP> {
38213817 }
38223818 if open_channel_fields.dust_limit_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS {
38233819 return Err(ChannelError::close(format!(
3824- "dust_limit_satoshis ({}) is less than the implementation limit ({})",
3825- open_channel_fields.dust_limit_satoshis, MIN_CHAN_DUST_LIMIT_SATOSHIS
3820+ "dust_limit_satoshis ({}) is less than the implementation limit ({MIN_CHAN_DUST_LIMIT_SATOSHIS })",
3821+ open_channel_fields.dust_limit_satoshis
38263822 )));
38273823 }
38283824
@@ -3835,8 +3831,8 @@ impl<SP: SignerProvider> ChannelContext<SP> {
38353831 };
38363832 if open_channel_fields.dust_limit_satoshis > max_chan_dust_limit_satoshis {
38373833 return Err(ChannelError::close(format!(
3838- "dust_limit_satoshis ({}) is greater than the implementation limit ({})",
3839- open_channel_fields.dust_limit_satoshis, max_chan_dust_limit_satoshis
3834+ "dust_limit_satoshis ({}) is greater than the implementation limit ({max_chan_dust_limit_satoshis })",
3835+ open_channel_fields.dust_limit_satoshis
38403836 )));
38413837 }
38423838
@@ -3856,29 +3852,27 @@ impl<SP: SignerProvider> ChannelContext<SP> {
38563852 // Protocol level safety check in place, although it should never happen because
38573853 // of `MIN_THEIR_CHAN_RESERVE_SATOSHIS`
38583854 return Err(ChannelError::close(format!(
3859- "Suitable channel reserve not found. remote_channel_reserve was ({}). dust_limit_satoshis is ({}).",
3860- holder_selected_channel_reserve_satoshis, MIN_CHAN_DUST_LIMIT_SATOSHIS
3855+ "Suitable channel reserve not found. remote_channel_reserve was ({holder_selected_channel_reserve_satoshis}). dust_limit_satoshis is ({MIN_CHAN_DUST_LIMIT_SATOSHIS})."
38613856 )));
38623857 }
38633858 if holder_selected_channel_reserve_satoshis * 1000 >= full_channel_value_msat {
38643859 return Err(ChannelError::close(format!(
3865- "Suitable channel reserve not found. remote_channel_reserve was ({})msats. Channel value is ({} - {})msats.",
3866- holder_selected_channel_reserve_satoshis * 1000, full_channel_value_msat, msg_push_msat
3860+ "Suitable channel reserve not found. remote_channel_reserve was ({})msats. Channel value is ({full_channel_value_msat } - {msg_push_msat })msats.",
3861+ holder_selected_channel_reserve_satoshis * 1000
38673862 )));
38683863 }
38693864 if msg_channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS {
38703865 log_debug!(
38713866 logger,
3872- "channel_reserve_satoshis ({}) is smaller than our dust limit ({}). We can broadcast \
3873- stale states without any risk, implying this channel is very insecure for our counterparty.",
3874- msg_channel_reserve_satoshis, MIN_CHAN_DUST_LIMIT_SATOSHIS);
3867+ "channel_reserve_satoshis ({msg_channel_reserve_satoshis}) is smaller than our dust limit ({MIN_CHAN_DUST_LIMIT_SATOSHIS}). We can broadcast \
3868+ stale states without any risk, implying this channel is very insecure for our counterparty.");
38753869 }
38763870 if holder_selected_channel_reserve_satoshis < open_channel_fields.dust_limit_satoshis
38773871 && holder_selected_channel_reserve_satoshis != 0
38783872 {
38793873 return Err(ChannelError::close(format!(
3880- "Dust limit ({}) too high for the channel reserve we require the remote to keep ({})",
3881- open_channel_fields.dust_limit_satoshis, holder_selected_channel_reserve_satoshis
3874+ "Dust limit ({}) too high for the channel reserve we require the remote to keep ({holder_selected_channel_reserve_satoshis })",
3875+ open_channel_fields.dust_limit_satoshis
38823876 )));
38833877 }
38843878
@@ -3896,8 +3890,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
38963890 } else {
38973891 if !script::is_bolt2_compliant(&script, their_features) {
38983892 return Err(ChannelError::close(format!(
3899- "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {}",
3900- script
3893+ "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {script}"
39013894 )));
39023895 }
39033896 Some(script.clone())
@@ -3931,8 +3924,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
39313924 if let Some(shutdown_scriptpubkey) = &shutdown_scriptpubkey {
39323925 if !shutdown_scriptpubkey.is_compatible(&their_features) {
39333926 return Err(ChannelError::close(format!(
3934- "Provided a scriptpubkey format not accepted by peer: {}",
3935- shutdown_scriptpubkey
3927+ "Provided a scriptpubkey format not accepted by peer: {shutdown_scriptpubkey}"
39363928 )));
39373929 }
39383930 }
@@ -4187,33 +4179,29 @@ impl<SP: SignerProvider> ChannelContext<SP> {
41874179 {
41884180 return Err(APIError::APIMisuseError {
41894181 err: format!(
4190- "funding_value must not exceed {}, it was {}",
4191- MAX_FUNDING_SATOSHIS_NO_WUMBO, channel_value_satoshis
4182+ "funding_value must not exceed {MAX_FUNDING_SATOSHIS_NO_WUMBO}, it was {channel_value_satoshis}"
41924183 ),
41934184 });
41944185 }
41954186 if channel_value_satoshis >= TOTAL_BITCOIN_SUPPLY_SATOSHIS {
41964187 return Err(APIError::APIMisuseError {
41974188 err: format!(
4198- "funding_value must be smaller than the total bitcoin supply, it was {}",
4199- channel_value_satoshis
4189+ "funding_value must be smaller than the total bitcoin supply, it was {channel_value_satoshis}"
42004190 ),
42014191 });
42024192 }
42034193 let channel_value_msat = channel_value_satoshis * 1000;
42044194 if push_msat > channel_value_msat {
42054195 return Err(APIError::APIMisuseError {
42064196 err: format!(
4207- "Push value ({}) was larger than channel_value ({})",
4208- push_msat, channel_value_msat
4197+ "Push value ({push_msat}) was larger than channel_value ({channel_value_msat})"
42094198 ),
42104199 });
42114200 }
42124201 if holder_selected_contest_delay < BREAKDOWN_TIMEOUT {
42134202 return Err(APIError::APIMisuseError {
42144203 err: format!(
4215- "Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks",
4216- holder_selected_contest_delay
4204+ "Configured with an unreasonable our_to_self_delay ({holder_selected_contest_delay}) putting user funds at risks"
42174205 ),
42184206 });
42194207 }
@@ -4720,8 +4708,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
47204708 }
47214709 if channel_reserve_satoshis > funding.get_value_satoshis() {
47224710 return Err(ChannelError::close(format!(
4723- "Bogus channel_reserve_satoshis ({}). Must not be greater than ({})",
4724- channel_reserve_satoshis,
4711+ "Bogus channel_reserve_satoshis ({channel_reserve_satoshis}). Must not be greater than ({})",
47254712 funding.get_value_satoshis()
47264713 )));
47274714 }
@@ -4737,25 +4724,24 @@ impl<SP: SignerProvider> ChannelContext<SP> {
47374724 > funding.get_value_satoshis() - funding.holder_selected_channel_reserve_satoshis
47384725 {
47394726 return Err(ChannelError::close(format!(
4740- "Bogus channel_reserve_satoshis ({}). Must not be greater than channel value minus our reserve ({})",
4741- channel_reserve_satoshis,
4727+ "Bogus channel_reserve_satoshis ({channel_reserve_satoshis}). Must not be greater than channel value minus our reserve ({})",
47424728 funding.get_value_satoshis() - funding.holder_selected_channel_reserve_satoshis
47434729 )));
47444730 }
47454731 let full_channel_value_msat =
47464732 (funding.get_value_satoshis() - channel_reserve_satoshis) * 1000;
47474733 if common_fields.htlc_minimum_msat >= full_channel_value_msat {
47484734 return Err(ChannelError::close(format!(
4749- "Minimum htlc value ({}) is full channel value ({})",
4750- common_fields.htlc_minimum_msat, full_channel_value_msat
4735+ "Minimum htlc value ({}) is full channel value ({full_channel_value_msat })",
4736+ common_fields.htlc_minimum_msat
47514737 )));
47524738 }
47534739 let max_delay_acceptable =
47544740 u16::min(peer_limits.their_to_self_delay, MAX_LOCAL_BREAKDOWN_TIMEOUT);
47554741 if common_fields.to_self_delay > max_delay_acceptable {
47564742 return Err(ChannelError::close(format!(
4757- "They wanted our payments to be delayed by a needlessly long period. Upper limit: {}. Actual: {}",
4758- max_delay_acceptable, common_fields.to_self_delay
4743+ "They wanted our payments to be delayed by a needlessly long period. Upper limit: {max_delay_acceptable }. Actual: {}",
4744+ common_fields.to_self_delay
47594745 )));
47604746 }
47614747 if common_fields.max_accepted_htlcs < 1 {
@@ -4791,8 +4777,8 @@ impl<SP: SignerProvider> ChannelContext<SP> {
47914777 }
47924778 if channel_reserve_satoshis > peer_limits.max_channel_reserve_satoshis {
47934779 return Err(ChannelError::close(format!(
4794- "channel_reserve_satoshis ({}) is higher than the user specified limit ({})",
4795- channel_reserve_satoshis, peer_limits.max_channel_reserve_satoshis
4780+ "channel_reserve_satoshis ({channel_reserve_satoshis }) is higher than the user specified limit ({})",
4781+ peer_limits.max_channel_reserve_satoshis
47964782 )));
47974783 }
47984784 if common_fields.max_accepted_htlcs < peer_limits.min_max_accepted_htlcs {
@@ -4803,8 +4789,8 @@ impl<SP: SignerProvider> ChannelContext<SP> {
48034789 }
48044790 if common_fields.dust_limit_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS {
48054791 return Err(ChannelError::close(format!(
4806- "dust_limit_satoshis ({}) is less than the implementation limit ({})",
4807- common_fields.dust_limit_satoshis, MIN_CHAN_DUST_LIMIT_SATOSHIS
4792+ "dust_limit_satoshis ({}) is less than the implementation limit ({MIN_CHAN_DUST_LIMIT_SATOSHIS })",
4793+ common_fields.dust_limit_satoshis
48084794 )));
48094795 }
48104796
@@ -4817,8 +4803,8 @@ impl<SP: SignerProvider> ChannelContext<SP> {
48174803 };
48184804 if common_fields.dust_limit_satoshis > max_chan_dust_limit_satoshis {
48194805 return Err(ChannelError::close(format!(
4820- "dust_limit_satoshis ({}) is greater than the implementation limit ({})",
4821- common_fields.dust_limit_satoshis, max_chan_dust_limit_satoshis
4806+ "dust_limit_satoshis ({}) is greater than the implementation limit ({max_chan_dust_limit_satoshis })",
4807+ common_fields.dust_limit_satoshis
48224808 )));
48234809 }
48244810 if common_fields.minimum_depth > peer_limits.max_minimum_depth {
@@ -4838,8 +4824,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
48384824 } else {
48394825 if !script::is_bolt2_compliant(&script, their_features) {
48404826 return Err(ChannelError::close(format!(
4841- "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {}",
4842- script
4827+ "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {script}"
48434828 )));
48444829 }
48454830 Some(script.clone())
@@ -14163,8 +14148,7 @@ impl<SP: SignerProvider> OutboundV1Channel<SP> {
1416314148 // of `MIN_THEIR_CHAN_RESERVE_SATOSHIS`
1416414149 return Err(APIError::APIMisuseError {
1416514150 err: format!(
14166- "Holder selected channel reserve below implementation limit dust_limit_satoshis {}",
14167- holder_selected_channel_reserve_satoshis,
14151+ "Holder selected channel reserve below implementation limit dust_limit_satoshis {holder_selected_channel_reserve_satoshis}"
1416814152 ),
1416914153 });
1417014154 }
0 commit comments