]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Log fee spike buffer violations.
authorValentine Wallace <vwallace@protonmail.com>
Mon, 22 Jun 2020 19:29:29 +0000 (15:29 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Mon, 22 Jun 2020 19:30:41 +0000 (15:30 -0400)
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs

index b4a24833919b96fa26b9037ecea1844d253d0e0e..95300f670c9558bac4b0549a03223e85f4d46653 100644 (file)
@@ -1755,8 +1755,8 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
                self.commit_tx_fee_msat(their_acked_htlcs + addl_htlcs)
        }
 
-       pub fn update_add_htlc<F>(&mut self, msg: &msgs::UpdateAddHTLC, mut pending_forward_status: PendingHTLCStatus, create_pending_htlc_status: F) -> Result<(), ChannelError>
-       where F: for<'a> Fn(&'a Self, PendingHTLCStatus, u16) -> PendingHTLCStatus {
+       pub fn update_add_htlc<F, L: Deref>(&mut self, msg: &msgs::UpdateAddHTLC, mut pending_forward_status: PendingHTLCStatus, create_pending_htlc_status: F, logger: &L) -> Result<(), ChannelError>
+       where F: for<'a> Fn(&'a Self, PendingHTLCStatus, u16) -> PendingHTLCStatus, L::Target: Logger {
                // We can't accept HTLCs sent after we've sent a shutdown.
                let local_sent_shutdown = (self.channel_state & (ChannelState::ChannelFunded as u32 | ChannelState::LocalShutdownSent as u32)) != (ChannelState::ChannelFunded as u32);
                if local_sent_shutdown {
@@ -1845,6 +1845,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
                        if pending_remote_value_msat - msg.amount_msat - chan_reserve_msat < remote_fee_cost_incl_stuck_buffer_msat {
                                // Note that if the pending_forward_status is not updated here, then it's because we're already failing
                                // the HTLC, i.e. its status is already set to failing.
+                               log_info!(logger, "Attempting to fail HTLC due to fee spike buffer violation");
                                pending_forward_status = create_pending_htlc_status(self, pending_forward_status, 0x1000|7);
                        }
                } else {
index c0bea87b064d2a165dc98bf2e2b113035e405826..6caed3ea563977a4afa2621dc4e51bbedc7b0160 100644 (file)
@@ -2519,7 +2519,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
                                                _ => pending_forward_info
                                        }
                                };
-                               try_chan_entry!(self, chan.get_mut().update_add_htlc(&msg, pending_forward_info, create_pending_htlc_status), channel_state, chan);
+                               try_chan_entry!(self, chan.get_mut().update_add_htlc(&msg, pending_forward_info, create_pending_htlc_status, &self.logger), channel_state, chan);
                        },
                        hash_map::Entry::Vacant(_) => return Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel", msg.channel_id))
                }