X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fln%2Fchannel.rs;h=ddfb809ccdeaf6f7b542c0c08e2850f7646a80cf;hb=608cf1c89db01f9cf612516a88a3f77f1f48bc52;hp=64db97f008c3ea4c0f45f39f8d38c4515910a527;hpb=c220a5c5cf39c65268c2146d84129873ee20fa2d;p=rust-lightning diff --git a/src/ln/channel.rs b/src/ln/channel.rs index 64db97f0..ddfb809c 100644 --- a/src/ln/channel.rs +++ b/src/ln/channel.rs @@ -315,6 +315,9 @@ pub(super) struct Channel { funding_tx_confirmations: u64, their_dust_limit_satoshis: u64, + #[cfg(test)] + pub(super) our_dust_limit_satoshis: u64, + #[cfg(not(test))] our_dust_limit_satoshis: u64, their_max_htlc_value_in_flight_msat: u64, //get_our_max_htlc_value_in_flight_msat(): u64, @@ -346,7 +349,7 @@ pub(super) struct Channel { logger: Arc, } -const OUR_MAX_HTLCS: u16 = 5; //TODO +const OUR_MAX_HTLCS: u16 = 50; //TODO /// Confirmation count threshold at which we close a channel. Ideally we'd keep the channel around /// on ice until the funding transaction gets more confirmations, but the LN protocol doesn't /// really allow for this, so instead we're stuck closing it out at that point. @@ -1311,16 +1314,6 @@ impl Channel { })) } - pub fn get_update_fail_htlc_and_commit(&mut self, htlc_id: u64, err_packet: msgs::OnionErrorPacket) -> Result, ChannelError> { - match self.get_update_fail_htlc(htlc_id, err_packet)? { - Some(update_fail_htlc) => { - let (commitment, monitor_update) = self.send_commitment_no_status_check()?; - Ok(Some((update_fail_htlc, commitment, monitor_update))) - }, - None => Ok(None) - } - } - // Message handlers: pub fn accept_channel(&mut self, msg: &msgs::AcceptChannel, config: &UserConfig) -> Result<(), ChannelError> { @@ -3237,6 +3230,12 @@ impl Channel { } if have_updates { break; } } + for htlc in self.pending_inbound_htlcs.iter() { + if let InboundHTLCState::LocalRemoved(_) = htlc.state { + have_updates = true; + } + if have_updates { break; } + } if !have_updates { panic!("Cannot create commitment tx until we have some updates to send"); }