Skip to content

Commit 26a8e5f

Browse files
committed
added more comments
1 parent 34c98f0 commit 26a8e5f

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/ln/channel.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ impl Channel {
444444
}
445445

446446
/// Returns a minimum channel reserve value **they** need to maintain
447-
///
448447
/// Guaranteed to return a value no larger than channel_value_satoshis
449448
fn get_our_channel_reserve_satoshis(channel_value_satoshis: u64) -> u64 {
450449
let (q, _) = channel_value_satoshis.overflowing_div(100);

src/util/configurations.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
/// It wraps the ChannelHandshakeLimits struct and ChannelConfig struct into a single one for channel manager.
88
#[derive(Clone, Debug)]
99
pub struct UserConfig{
10-
/// optional user specified channel limits
10+
/// optional user specified channel limits, this hold information regarding handshakes of channels.
1111
pub channel_limits : ChannelHandshakeLimits,
12-
/// channel specific options
12+
/// channel specific options and settings egis channel announced or not
1313
pub channel_options : ChannelConfig,
1414
}
1515

1616
impl UserConfig {
17-
///default constructor, calls ChannelOptions and ChannelLimits constructors
17+
///default constructor, calls default ChannelOptions and default ChannelLimits constructors
1818
pub fn new() -> Self{
1919
UserConfig {
2020
channel_limits : ChannelHandshakeLimits::new(),
@@ -24,33 +24,36 @@ impl UserConfig {
2424
}
2525

2626
/// This struct contains all the optional channel limits. If these limits are breached the new channel will be denied
27-
/// If the user wants to check a value, the value needs to be filled in, as by default they are not checked
27+
/// If the user wants to check a value, the value needs to be filled in, as by default most are not checked
2828
#[derive(Copy, Clone, Debug)]
2929
pub struct ChannelHandshakeLimits{
30-
/// minimum allowed satishis when funding a channel.
30+
/// minimum allowed satoshis when a channel is funded, this is supplied by the sender.
3131
pub min_funding_satoshis :u64,
32-
/// maximum allowed min HTLC that will be accepted.
32+
/// maximum allowed smallest HTLC that will be accepted by us.
3333
pub max_htlc_minimum_msat : u64,
34-
/// min allowed cap on outstanding HTLC, used to limit exposure.
34+
/// min allowed cap on outstanding HTLC. This is used to limit exposure to HTLCs.
3535
pub min_max_htlc_value_in_flight_msat : u64,
36-
/// max allowed satoshis that may be used as a direct payment.
36+
/// max allowed satoshis that may be used as a direct payment by the peer.
3737
pub max_channel_reserve_satoshis : u64,
3838
/// min allowed max outstanding HTLC that can be offered.
3939
pub min_max_accepted_htlcs : u16,
4040
/// min allowed threshold below which outputs should not be generated.
41+
/// These outputs are either commitment or HTLC transactions.
42+
/// HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
43+
/// This reflects the reality that tiny outputs are not considered standard transactions and will not propagate through the Bitcoin network
4144
pub min_dust_limit_satoshis : u64,
4245
/// max allowed threshold above which outputs should not be generated. Bolt 2 mentions channel_reserve_satoshis as upper limit, but this can be a lower limit
4346
pub max_dust_limit_satoshis : u64,
44-
///minimum depth to a number of blocks that is considered reasonable to avoid double-spending of the funding transaction
47+
/// minimum depth to a number of blocks that is considered reasonable to avoid double-spending of the funding transaction
4548
pub minimum_depth : u32,
46-
///do we force the incoming channel to match our announced channel preference
49+
/// do we force the incoming channel to match our announced channel preference
4750
pub force_announced_channel_preference : bool,
4851
}
4952

5053
impl ChannelHandshakeLimits {
5154
//creating max and min possible values because if they are not set, means we should not check them.
5255
///default constructor creates limits so that they are not tested for
53-
/// min_dust_limit_satoshis is set to the network default of 546
56+
///min_dust_limit_satoshis is set to the network default of 546
5457
pub fn new() -> Self{
5558
ChannelHandshakeLimits {
5659
min_funding_satoshis : 0,
@@ -69,15 +72,17 @@ impl ChannelHandshakeLimits {
6972
/// This struct contains all the custom channel options.
7073
#[derive(Copy, Clone, Debug)]
7174
pub struct ChannelConfig{
72-
/// Amount (in millionths of a satoshi) channel will charge per transferred satoshi.
75+
/// Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
76+
/// This must be updated as the channel updates and can change in runtime.
7377
pub fee_proportional_millionths : u32,
7478
//TODO enforce non-mutability when config can change at runtime
75-
///Is this channel an announced channel, cannot change after channel creation
79+
///Is this channel publicly announced channel or not.
80+
///This cannot change after channel creation.
7681
pub announced_channel : bool,
7782
}
7883
impl ChannelConfig {
79-
/// creating a struct with values.
80-
/// fee_proportional_millionths should be changed afterwords
84+
/// creating a struct with default values.
85+
/// fee_proportional_millionths should be changed and updated afterwords
8186
pub fn new() -> Self{
8287
ChannelConfig {
8388
fee_proportional_millionths : 0,

0 commit comments

Comments
 (0)