mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-10 13:35:38 +01:00
Include counterparty node id and channel id in shutdown log
This avoids an important shutdown log being about a channel but not having the channel metadata.
This commit is contained in:
parent
6b43153861
commit
f57295f9d9
2 changed files with 14 additions and 1 deletions
|
@ -599,6 +599,8 @@ pub(crate) struct ShutdownResult {
|
||||||
/// An unbroadcasted batch funding transaction id. The closure of this channel should be
|
/// An unbroadcasted batch funding transaction id. The closure of this channel should be
|
||||||
/// propagated to the remainder of the batch.
|
/// propagated to the remainder of the batch.
|
||||||
pub(crate) unbroadcasted_batch_funding_txid: Option<Txid>,
|
pub(crate) unbroadcasted_batch_funding_txid: Option<Txid>,
|
||||||
|
pub(crate) channel_id: ChannelId,
|
||||||
|
pub(crate) counterparty_node_id: PublicKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the majority of the channels funds are to the fundee and the initiator holds only just
|
/// If the majority of the channels funds are to the fundee and the initiator holds only just
|
||||||
|
@ -2164,6 +2166,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
|
||||||
monitor_update,
|
monitor_update,
|
||||||
dropped_outbound_htlcs,
|
dropped_outbound_htlcs,
|
||||||
unbroadcasted_batch_funding_txid,
|
unbroadcasted_batch_funding_txid,
|
||||||
|
channel_id: self.channel_id,
|
||||||
|
counterparty_node_id: self.counterparty_node_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4707,6 +4711,8 @@ impl<SP: Deref> Channel<SP> where
|
||||||
monitor_update: None,
|
monitor_update: None,
|
||||||
dropped_outbound_htlcs: Vec::new(),
|
dropped_outbound_htlcs: Vec::new(),
|
||||||
unbroadcasted_batch_funding_txid: self.context.unbroadcasted_batch_funding_txid(),
|
unbroadcasted_batch_funding_txid: self.context.unbroadcasted_batch_funding_txid(),
|
||||||
|
channel_id: self.context.channel_id,
|
||||||
|
counterparty_node_id: self.context.counterparty_node_id,
|
||||||
};
|
};
|
||||||
let tx = self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
|
let tx = self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
|
||||||
self.context.channel_state = ChannelState::ShutdownComplete as u32;
|
self.context.channel_state = ChannelState::ShutdownComplete as u32;
|
||||||
|
@ -4735,6 +4741,8 @@ impl<SP: Deref> Channel<SP> where
|
||||||
monitor_update: None,
|
monitor_update: None,
|
||||||
dropped_outbound_htlcs: Vec::new(),
|
dropped_outbound_htlcs: Vec::new(),
|
||||||
unbroadcasted_batch_funding_txid: self.context.unbroadcasted_batch_funding_txid(),
|
unbroadcasted_batch_funding_txid: self.context.unbroadcasted_batch_funding_txid(),
|
||||||
|
channel_id: self.context.channel_id,
|
||||||
|
counterparty_node_id: self.context.counterparty_node_id,
|
||||||
};
|
};
|
||||||
self.context.channel_state = ChannelState::ShutdownComplete as u32;
|
self.context.channel_state = ChannelState::ShutdownComplete as u32;
|
||||||
self.context.update_time_counter += 1;
|
self.context.update_time_counter += 1;
|
||||||
|
@ -5913,6 +5921,8 @@ impl<SP: Deref> Channel<SP> where
|
||||||
monitor_update: None,
|
monitor_update: None,
|
||||||
dropped_outbound_htlcs: Vec::new(),
|
dropped_outbound_htlcs: Vec::new(),
|
||||||
unbroadcasted_batch_funding_txid: self.context.unbroadcasted_batch_funding_txid(),
|
unbroadcasted_batch_funding_txid: self.context.unbroadcasted_batch_funding_txid(),
|
||||||
|
channel_id: self.context.channel_id,
|
||||||
|
counterparty_node_id: self.context.counterparty_node_id,
|
||||||
};
|
};
|
||||||
self.context.channel_state = ChannelState::ShutdownComplete as u32;
|
self.context.channel_state = ChannelState::ShutdownComplete as u32;
|
||||||
Some(shutdown_result)
|
Some(shutdown_result)
|
||||||
|
|
|
@ -2808,7 +2808,10 @@ where
|
||||||
debug_assert_ne!(peer.held_by_thread(), LockHeldState::HeldByThread);
|
debug_assert_ne!(peer.held_by_thread(), LockHeldState::HeldByThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug!(self.logger, "Finishing closure of channel with {} HTLCs to fail", shutdown_res.dropped_outbound_htlcs.len());
|
let logger = WithContext::from(
|
||||||
|
&self.logger, Some(shutdown_res.counterparty_node_id), Some(shutdown_res.channel_id),
|
||||||
|
);
|
||||||
|
log_debug!(logger, "Finishing closure of channel with {} HTLCs to fail", shutdown_res.dropped_outbound_htlcs.len());
|
||||||
for htlc_source in shutdown_res.dropped_outbound_htlcs.drain(..) {
|
for htlc_source in shutdown_res.dropped_outbound_htlcs.drain(..) {
|
||||||
let (source, payment_hash, counterparty_node_id, channel_id) = htlc_source;
|
let (source, payment_hash, counterparty_node_id, channel_id) = htlc_source;
|
||||||
let reason = HTLCFailReason::from_failure_code(0x4000 | 8);
|
let reason = HTLCFailReason::from_failure_code(0x4000 | 8);
|
||||||
|
|
Loading…
Add table
Reference in a new issue