Skip to content

Commit 046e0ca

Browse files
authored
Merge pull request #296 from TheBlueMatt/2019-01-291-rebased
Wrote test to explicitly test BOLT 2 requirements for update_add_htlc
2 parents 7fd294d + a48fb84 commit 046e0ca

File tree

2 files changed

+333
-24
lines changed

2 files changed

+333
-24
lines changed

src/ln/channel.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ pub(super) struct Channel {
307307
pub(super) our_dust_limit_satoshis: u64,
308308
#[cfg(not(test))]
309309
our_dust_limit_satoshis: u64,
310+
#[cfg(test)]
311+
pub(super) their_max_htlc_value_in_flight_msat: u64,
312+
#[cfg(not(test))]
310313
their_max_htlc_value_in_flight_msat: u64,
311314
//get_our_max_htlc_value_in_flight_msat(): u64,
312315
/// minimum channel reserve for **self** to maintain - set by them.
@@ -316,6 +319,9 @@ pub(super) struct Channel {
316319
our_htlc_minimum_msat: u64,
317320
their_to_self_delay: u16,
318321
//implied by BREAKDOWN_TIMEOUT: our_to_self_delay: u16,
322+
#[cfg(test)]
323+
pub their_max_accepted_htlcs: u16,
324+
#[cfg(not(test))]
319325
their_max_accepted_htlcs: u16,
320326
//implied by OUR_MAX_HTLCS: our_max_accepted_htlcs: u16,
321327
minimum_depth: u32,
@@ -337,7 +343,7 @@ pub(super) struct Channel {
337343
logger: Arc<Logger>,
338344
}
339345

340-
const OUR_MAX_HTLCS: u16 = 50; //TODO
346+
pub const OUR_MAX_HTLCS: u16 = 50; //TODO
341347
/// Confirmation count threshold at which we close a channel. Ideally we'd keep the channel around
342348
/// on ice until the funding transaction gets more confirmations, but the LN protocol doesn't
343349
/// really allow for this, so instead we're stuck closing it out at that point.
@@ -1597,7 +1603,6 @@ impl Channel {
15971603
cltv_expiry: msg.cltv_expiry,
15981604
state: InboundHTLCState::RemoteAnnounced(pending_forward_state),
15991605
});
1600-
16011606
Ok(())
16021607
}
16031608

0 commit comments

Comments
 (0)