Skip to content

Commit 3522a36

Browse files
committed
Added minimum�m depth checking to accept message
1 parent 622dc0a commit 3522a36

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
@@ -1263,7 +1263,10 @@ impl Channel {
12631263
if msg.max_accepted_htlcs > 483 {
12641264
return_error_message!("max_accpted_htlcs > 483");
12651265
}
1266-
1266+
//Optional user definined limits
1267+
if msg.minimum_depth > self.config.channel_limits.minimum_depth {
1268+
return_error_message!("We consider the minimum depth to be unreasonably large");
1269+
}
12671270
self.channel_monitor.set_their_base_keys(&msg.htlc_basepoint, &msg.delayed_payment_basepoint);
12681271

12691272
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)