You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if holder_selected_contest_delay < BREAKDOWN_TIMEOUT{
913
925
returnErr(APIError::APIMisuseError{err:format!("Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks", holder_selected_contest_delay)});
914
926
}
915
-
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(channel_value_satoshis);
927
+
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(channel_value_satoshis, config);
916
928
if holder_selected_channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
929
+
// Protocol level safety check in place, although it should never happen because
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(msg.funding_satoshis);
1221
+
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(msg.funding_satoshis, config);
1208
1222
if holder_selected_channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
1223
+
// Protocol level safety check in place, although it should never happen because
1224
+
// of `MIN_THEIR_CHAN_RESERVE_SATOSHIS`
1209
1225
returnErr(ChannelError::Close(format!("Suitable channel reserve not found. remote_channel_reserve was ({}). dust_limit_satoshis is ({}).", holder_selected_channel_reserve_satoshis,MIN_CHAN_DUST_LIMIT_SATOSHIS)));
1210
1226
}
1211
1227
if holder_selected_channel_reserve_satoshis *1000 >= full_channel_value_msat {
1212
-
returnErr(ChannelError::Close(format!("Suitable channel reserve not found. remote_channel_reserve was ({}). Channel value is ({} - {}).", holder_selected_channel_reserve_satoshis, full_channel_value_msat, msg.push_msat)));
1228
+
returnErr(ChannelError::Close(format!("Suitable channel reserve not found. remote_channel_reserve was ({})msats. Channel value is ({} - {})msats.", holder_selected_channel_reserve_satoshis*1000, full_channel_value_msat, msg.push_msat)));
1213
1229
}
1214
1230
if msg.channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
1215
1231
log_debug!(logger,"channel_reserve_satoshis ({}) is smaller than our dust limit ({}). We can broadcast stale states without any risk, implying this channel is very insecure for our counterparty.",
@@ -6107,7 +6123,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
6107
6123
// a different percentage of the channel value then 10%, which older versions of LDK used
6108
6124
// to set it to before the percentage was made configurable.
let chan = Channel::<EnforcingSigner>::new_outbound(&&fee_est,&&keys_provider, outbound_node_id,&InitFeatures::known(), channel_value_satoshis,100_000,42,&outbound_node_config,0,42).unwrap();
7021
+
7022
+
let expected_outbound_selected_chan_reserve = cmp::max(MIN_THEIR_CHAN_RESERVE_SATOSHIS,(chan.channel_value_satoshisasf64* outbound_selected_channel_reserve_perc)asu64);
if outbound_selected_channel_reserve_perc + inbound_selected_channel_reserve_perc < 1.0{
7030
+
let chan_inbound_node = Channel::<EnforcingSigner>::new_from_req(&&fee_est,&&keys_provider, inbound_node_id,&InitFeatures::known(),&chan_open_channel_msg,7,&inbound_node_config,0,&&logger,42).unwrap();
7031
+
7032
+
let expected_inbound_selected_chan_reserve = cmp::max(MIN_THEIR_CHAN_RESERVE_SATOSHIS,(chan.channel_value_satoshisasf64* inbound_selected_channel_reserve_perc)asu64);
let result = Channel::<EnforcingSigner>::new_from_req(&&fee_est,&&keys_provider, inbound_node_id,&InitFeatures::known(),&chan_open_channel_msg,7,&inbound_node_config,0,&&logger,42);
7039
+
assert!(result.is_err());
7040
+
}
7041
+
}
7042
+
6968
7043
#[test]
6969
7044
fnchannel_update(){
6970
7045
let feeest = LowerBoundedFeeEstimator::new(&TestFeeEstimator{fee_est:15000});
0 commit comments