From c5ec5617b08cf2e9c8d55e16e70a382cfd07adac Mon Sep 17 00:00:00 2001 From: Schalk van Heerden Date: Wed, 26 Sep 2018 15:44:22 +0200 Subject: [PATCH] add documents and comments --- src/util/configurations.rs | 13 +++++++++---- src/util/mod.rs | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/util/configurations.rs b/src/util/configurations.rs index dab09b30f..0aa805426 100644 --- a/src/util/configurations.rs +++ b/src/util/configurations.rs @@ -1,17 +1,21 @@ +//! This is the config struct used to pass in configurations into the channel. This is kept by the channel manager +//! channel_limits is kept in an arc so that each channel can keep a reference to the parent one in channel manager +//! channel options is cloned into channel because those are all specified unique channel settings. It uses channel managers one as a base use std::sync::Arc; /// This is the main user configuration /// This struct should contain all user customizable options as this is passed to the channel to be accessed #[derive(Clone, Debug)] pub struct UserConfigurations{ - /// optional user spesefied channel limits - /// These are only used on startup of channels, and are referanced to a single instance + /// optional user specified channel limits + /// These are only used on startup of channels, and are referenced to a single instance pub channel_limits : Arc, /// Channel options can change afterwords and are unique to each channel pub channel_options : ChannelOptions, } impl UserConfigurations { + ///default constructor, calls ChannelOptions and ChannelLimits constructors pub fn new() -> Self{ UserConfigurations { channel_limits : Arc::new(ChannelLimits::new()), @@ -42,6 +46,7 @@ pub struct ChannelLimits{ impl ChannelLimits { //creating max and min possible values because if they are not set, means we should not check them. + ///default constructor creates limits so that they are not tested for pub fn new() -> Self{ ChannelLimits { funding_satoshis : 0, @@ -60,9 +65,9 @@ impl ChannelLimits { pub struct ChannelOptions{ /// Amount (in millionths of a satoshi) channel will charge per transferred satoshi. pub fee_proportional_millionths : u32, - ///Is this channel an annouced channe; + ///Is this channel an announced channel; pub announced_channel : bool, - ///do we force the incomming channel to match our announced channel preference + ///do we force the incoming channel to match our announced channel preference pub force_announced_channel_preference : bool, } impl ChannelOptions { diff --git a/src/util/mod.rs b/src/util/mod.rs index eb25dc7e8..be465103a 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -30,4 +30,5 @@ pub use self::rng::reset_rng_state; pub(crate) mod test_utils; pub use self::configurations::UserConfigurations; +//config struct pub mod configurations; \ No newline at end of file -- 2.39.5