Uh oh!
There was an error while loading. Please reload this page.
Further decouple ChannelManager from Channel state somewhat - #3539
Conversation
| /// Should be called when the peer is disconnected. Returns true if the channel can be resumed | ||
| /// when the peer reconnects (via [`Self::peer_connected_get_handshake`]). If not, the channel | ||
| /// must be immediately closed. | ||
| pub fn peer_disconnected_is_resumable<L: Deref>(&mut self, logger: &L) -> bool where L::Target: Logger { |
There was a problem hiding this comment.
How about naming this is_disconnected_peer_resumable?
There was a problem hiding this comment.
Its not stateless, though, I wanted to communicate that its a "this peer has disconnected" notification, plus "should i discard the channel". Not sure how best to communicate it, this name is a bit awkward.
Uh oh!
There was an error while loading. Please reload this page.
wpaulino
commented
Jan 16, 2025
LGTM once the logging context is restored |
e25da14 to
2abe846CompareTheBlueMatt
commented
Jan 24, 2025
Sorry for the delay, fixed the logger issue: $ git diff-tree -U2 e25da1455 2abe8469b
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index fcc11ca05..16599f126 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -9455,6 +9455,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
// Returns whether we should remove this channel as it's just been closed.
let unblock_chan = |phase: &mut Channel<SP>, pending_msg_events: &mut Vec<MessageSendEvent>| -> Option<ShutdownResult> {
+ let logger = WithChannelContext::from(&self.logger, &phase.context(), None);
let node_id = phase.context().get_counterparty_node_id();
- if let Some(msgs) = phase.signer_maybe_unblocked(self.chain_hash, &self.logger) {+ if let Some(msgs) = phase.signer_maybe_unblocked(self.chain_hash, &&logger) {
if let Some(msg) = msgs.open_channel {
pending_msg_events.push(events::MessageSendEvent::SendOpenChannel {
@@ -9513,7 +9514,4 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
}
if let Some(broadcast_tx) = msgs.signed_closing_tx {
- let channel_id = chan.context.channel_id();- let counterparty_node_id = chan.context.get_counterparty_node_id();- let logger = WithContext::from(&self.logger, Some(counterparty_node_id), Some(channel_id), None);
log_info!(logger, "Broadcasting closing tx {}", log_tx!(broadcast_tx));
self.tx_broadcaster.broadcast_transactions(&[&broadcast_tx]); |
jkczyz
commented
Jan 27, 2025
FYI, this will conflict with #3550. May be easier to get that in first, but either way is fine by me. |
After lightningdevkit#3513 we have a bit more encapsulation of channel logic in channel.rs with channelmanager.rs needing a bit less knowledge of which specific state a channel is in. This continues that trend slightly when unblocking the signer.
TheBlueMatt
commented
Jan 27, 2025
Rebased. |
2abe846 to
6852e8aCompareUh oh!
There was an error while loading. Please reload this page.
After lightningdevkit#3513 we have a bit more encapsulation of channel logic in channel.rs with channelmanager.rs needing a bit less knowledge of which specific state a channel is in. This continues that trend slightly when a peer disconnects.
After lightningdevkit#3513 we have a bit more encapsulation of channel logic in channel.rs with channelmanager.rs needing a bit less knowledge of which specific state a channel is in. This continues that trend slightly when a peer reconnects.
6852e8a to
bece44cCompareTheBlueMatt
commented
Jan 28, 2025
Ugh, fixed the dangling link after the third commit. |
Just a few tiny followups to #3513 to keep moving towards ChannelManager caring less about the specific state the channel is in.