From: Matt Corallo Date: Sat, 16 Jun 2018 23:20:50 +0000 (-0400) Subject: Work around lnd sending invalid messages X-Git-Tag: v0.0.12~403^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=33771194d8aba092524b997c1c1afe4c652d88d8;p=rust-lightning Work around lnd sending invalid messages --- diff --git a/src/ln/peer_handler.rs b/src/ln/peer_handler.rs index bccfe5a03..3c4196519 100644 --- a/src/ln/peer_handler.rs +++ b/src/ln/peer_handler.rs @@ -307,6 +307,18 @@ impl PeerManager { } } + macro_rules! try_ignore_potential_decodeerror { + ($thing: expr) => { + match $thing { + Ok(x) => x, + Err(_e) => { + println!("Error decoding message, ignoring due to lnd spec incompatibility. See https://github.com/lightningnetwork/lnd/issues/1407"); + continue; + } + }; + } + } + let next_step = peer.channel_encryptor.get_noise_step(); match next_step { NextNoiseStep::ActOne => { @@ -495,7 +507,7 @@ impl PeerManager { } }, 257 => { - let msg = try_potential_decodeerror!(msgs::NodeAnnouncement::decode(&msg_data[2..])); + let msg = try_ignore_potential_decodeerror!(msgs::NodeAnnouncement::decode(&msg_data[2..])); try_potential_handleerror!(self.message_handler.route_handler.handle_node_announcement(&msg)); }, 258 => {