Skip to content

Dont treat a timer tick as no_connection_possible #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lightning/src/ln/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,10 +755,13 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where

// Unknown messages:
wire::Message::Unknown(msg_type) if msg_type.is_even() => {
log_debug!(self, "Received unknown even message of type {}, disconnecting peer!", msg_type);
// Fail the channel if message is an even, unknown type as per BOLT #1.
return Err(PeerHandleError{ no_connection_possible: true });
},
wire::Message::Unknown(_) => {},
wire::Message::Unknown(msg_type) => {
log_trace!(self, "Received unknown odd message of type {}, ignoring", msg_type);
},
}
}
}
Expand Down Expand Up @@ -1086,10 +1089,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
descriptors_needing_disconnect.push(descriptor.clone());
match peer.their_node_id {
Some(node_id) => {
log_trace!(self, "Disconnecting peer with id {} due to ping timeout", node_id);
node_id_to_descriptor.remove(&node_id);
self.message_handler.chan_handler.peer_disconnected(&node_id, true);
self.message_handler.chan_handler.peer_disconnected(&node_id, false);
}
None => {}
None => {
// This can't actually happen as we should have hit
// is_ready_for_encryption() previously on this same peer.
unreachable!();
},
}
return false;
}
Expand Down