From: Matt Corallo Date: Thu, 10 Jun 2021 16:26:33 +0000 (+0000) Subject: Drop unused "peer gone" handling in get_peer_for_forwarding!() X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=5bf4cad92a97705dafe845ce998c7cdc84e8520f;p=rust-lightning Drop unused "peer gone" handling in get_peer_for_forwarding!() We can never assume that messages were reliably delivered whether we placed them in the socket or not, so there isn't a lot of use in explicitly handling the case that a peer was not connected when we went to send it a message. Two TODOs are left for the generation of a `FundingAbandoned` (or similar) event, though it ultimately belongs in `ChannelManager`. --- diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 33c4050b3..3cc52789a 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1027,19 +1027,17 @@ impl PeerManager { + ($node_id: expr) => { { let descriptor = match peers.node_id_to_descriptor.get($node_id) { Some(descriptor) => descriptor.clone(), None => { - $handle_no_such_peer; continue; }, }; match peers.peers.get_mut(&descriptor) { Some(peer) => { if peer.their_features.is_none() { - $handle_no_such_peer; continue; } (descriptor, peer) @@ -1054,9 +1052,7 @@ impl PeerManager PeerManager PeerManager PeerManager PeerManager PeerManager PeerManager PeerManager PeerManager PeerManager PeerManager PeerManager { - let (mut descriptor, peer) = get_peer_for_forwarding!(node_id, {}); + let (mut descriptor, peer) = get_peer_for_forwarding!(node_id); peer.pending_outbound_buffer.push_back(peer.channel_encryptor.encrypt_message(&encode_msg!(msg))); self.do_attempt_write_data(&mut descriptor, peer); }, MessageSendEvent::SendShortIdsQuery { ref node_id, ref msg } => { - let (mut descriptor, peer) = get_peer_for_forwarding!(node_id, {}); + let (mut descriptor, peer) = get_peer_for_forwarding!(node_id); peer.pending_outbound_buffer.push_back(peer.channel_encryptor.encrypt_message(&encode_msg!(msg))); self.do_attempt_write_data(&mut descriptor, peer); } @@ -1292,7 +1267,7 @@ impl PeerManager