From 33771194d8aba092524b997c1c1afe4c652d88d8 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 16 Jun 2018 19:20:50 -0400 Subject: [PATCH] Work around lnd sending invalid messages --- src/ln/peer_handler.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 => { -- 2.39.5