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
Add configuration support for 'their_channel_reserve_proportion_millionth' [#1498][#1606]
It is proportion of the channel value to configure as the `their_channel_reserve_satoshis`
for both outbound and inbound channels.
`their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
on their side, at all times.
if holder_selected_contest_delay < BREAKDOWN_TIMEOUT{
913
924
returnErr(APIError::APIMisuseError{err:format!("Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks", holder_selected_contest_delay)});
914
925
}
915
-
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(channel_value_satoshis);
926
+
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(channel_value_satoshis, config);
916
927
if holder_selected_channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
928
+
// Protocol level safety check in place, although it should never happen because of `MIN_THEIR_CHAN_RESERVE_SATOSHIS`
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(msg.funding_satoshis);
1219
+
let holder_selected_channel_reserve_satoshis = Channel::<Signer>::get_holder_selected_channel_reserve_satoshis(msg.funding_satoshis, config);
1208
1220
if holder_selected_channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
1221
+
// Protocol level safety check in place, although it should never happen because of `MIN_THEIR_CHAN_RESERVE_SATOSHIS`
1209
1222
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
1223
}
1211
1224
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)));
1225
+
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
1226
}
1214
1227
if msg.channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
1215
1228
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.",
@@ -6106,7 +6119,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
6106
6119
// a different percentage of the channel value then 10%, which older versions of LDK used
6107
6120
// 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,100000,42,&outbound_node_config,0,42).unwrap();
7014
+
7015
+
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{
7023
+
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();
7024
+
7025
+
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);
7032
+
assert_eq!(true, result.is_err());
7033
+
}
7034
+
}
7035
+
6965
7036
#[test]
6966
7037
fnchannel_update(){
6967
7038
let feeest = LowerBoundedFeeEstimator::new(&TestFeeEstimator{fee_est:15000});
0 commit comments