Skip to content

Commit 3f9dc5b

Browse files
committed
Added minimum�m depth checking to accept message
1 parent 5396fd5 commit 3f9dc5b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/ln/channel.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,10 @@ impl Channel {
12641264
if msg.max_accepted_htlcs > 483 {
12651265
return_error_message!("max_accpted_htlcs > 483");
12661266
}
1267-
1267+
//Optional user definined limits
1268+
if msg.minimum_depth > self.config.channel_limits.minimum_depth {
1269+
return_error_message!("We consider the minimum depth to be unreasonably large");
1270+
}
12681271
self.channel_monitor.set_their_base_keys(&msg.htlc_basepoint, &msg.delayed_payment_basepoint);
12691272

12701273
self.their_dust_limit_satoshis = msg.dust_limit_satoshis;

src/util/configurations.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub struct ChannelLimits{
3434
pub max_accepted_htlcs : u16,
3535
/// min allowed dust_limit_satashis
3636
pub dust_limit_satoshis : u64,
37+
///minimum depth to a number of blocks that is considered reasonable to avoid double-spending of the funding transaction
38+
pub minimum_depth : u32,
3739
}
3840

3941
impl ChannelLimits {
@@ -46,6 +48,7 @@ impl ChannelLimits {
4648
channel_reserve_satoshis : <u64>::max_value(),
4749
max_accepted_htlcs : 0,
4850
dust_limit_satoshis : 0,
51+
minimum_depth : <u32>::max_value(),
4952
}
5053
}
5154
}

0 commit comments

Comments
 (0)