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-Tag: v0.0.99~19^2~7 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=f4323d98b87cb1a6458c788dfea540d51c0c4130;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 6e05b5498..2003efc8f 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1026,19 +1026,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) @@ -1053,9 +1051,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); } @@ -1291,7 +1264,7 @@ impl PeerManager