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
Explicitly support counterparty setting 0 channel reserve
A peer providing a channel_reserve_satoshis of 0 (or less than our
dust limit) is insecure, but only for them. Because some LSPs do it
with some level of trust of the clients (for a substantial UX
improvement), we explicitly allow it. Because its unlikely to
happen often in normal testing, we test it explicitly here.
if msg.dust_limit_satoshis > msg.funding_satoshis{
871
882
returnErr(ChannelError::Close(format!("dust_limit_satoshis {} was larger than funding_satoshis {}. Peer never wants payout outputs?", msg.dust_limit_satoshis, msg.funding_satoshis)));
872
883
}
873
-
if msg.dust_limit_satoshis > msg.channel_reserve_satoshis{
874
-
returnErr(ChannelError::Close(format!("Bogus; channel reserve ({}) is less than dust limit ({})", msg.channel_reserve_satoshis, msg.dust_limit_satoshis)));
875
-
}
876
884
let full_channel_value_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis)*1000;
877
885
if msg.htlc_minimum_msat >= full_channel_value_msat {
878
886
returnErr(ChannelError::Close(format!("Minimum htlc value ({}) was larger than full channel value ({})", msg.htlc_minimum_msat, full_channel_value_msat)));
if holder_selected_channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
929
937
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)));
930
938
}
931
-
if msg.channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS{
932
-
returnErr(ChannelError::Close(format!("channel_reserve_satoshis ({}) is smaller than our dust limit ({})", msg.channel_reserve_satoshis,MIN_CHAN_DUST_LIMIT_SATOSHIS)));
933
-
}
934
939
if holder_selected_channel_reserve_satoshis < msg.dust_limit_satoshis{
935
940
returnErr(ChannelError::Close(format!("Dust limit ({}) too high for the channel reserve we require the remote to keep ({})", msg.dust_limit_satoshis, holder_selected_channel_reserve_satoshis)));
Copy file name to clipboardExpand all lines: lightning/src/ln/functional_tests.rs
+62-3
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ use chain::channelmonitor::{ChannelMonitor, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PER
18
18
use chain::transaction::OutPoint;
19
19
use chain::keysinterface::BaseSign;
20
20
use ln::{PaymentPreimage,PaymentSecret,PaymentHash};
21
-
use ln::channel::{COMMITMENT_TX_BASE_WEIGHT,COMMITMENT_TX_WEIGHT_PER_HTLC};
21
+
use ln::channel::{COMMITMENT_TX_BASE_WEIGHT,COMMITMENT_TX_WEIGHT_PER_HTLC,FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE};
22
22
use ln::channelmanager::{ChannelManager,ChannelManagerReadArgs,PaymentId,RAACommitmentOrder,PaymentSendFailure,BREAKDOWN_TIMEOUT,MIN_CLTV_EXPIRY_DELTA};
insane_open_helper(r"Bogus; channel reserve \(\d+\) is less than dust limit \(\d+\)", |mut msg| { msg.dust_limit_satoshis = msg.channel_reserve_satoshis + 1; msg });
112
-
113
111
insane_open_helper(r"Minimum htlc value \(\d+\) was larger than full channel value \(\d+\)", |mut msg| { msg.htlc_minimum_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis)*1000; msg });
114
112
115
113
insane_open_helper("They wanted our payments to be delayed by a needlessly long period", |mut msg| { msg.to_self_delay = MAX_LOCAL_BREAKDOWN_TIMEOUT + 1; msg });
0 commit comments