From e7d66e1dfd2c73e4fa422ae1a031f56ec7408cea Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 23 Mar 2018 15:49:25 -0700 Subject: [PATCH] peer: don't d/c peer if we encounter lnwire.ErrUnknownAddrType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this commit, we fix a minor deviation in our implementation from the specification. Before if we encountered an unknown error type, we would disconnect the peer. Instead, we’ll now just continue along parsing the remainder of the messages. This was flared up recently by some c-lightning related incompatibilities that emerged on main net. --- lnwire/lnwire.go | 2 +- peer.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lnwire/lnwire.go b/lnwire/lnwire.go index 6fd28538c..e83e218b4 100644 --- a/lnwire/lnwire.go +++ b/lnwire/lnwire.go @@ -677,7 +677,7 @@ func readElement(r io.Reader, element interface{}) error { continue default: - return fmt.Errorf("unknown address type: %v", aType) + return ErrUnknownAddrType{aType} } addresses = append(addresses, address) diff --git a/peer.go b/peer.go index 695419703..bfb5cf8f3 100644 --- a/peer.go +++ b/peer.go @@ -761,6 +761,14 @@ out: idleTimer.Reset(idleTimeout) continue + // If they sent us an address type that we don't yet + // know of, then this isn't a dire error, so we'll + // simply continue parsing the remainder of their + // messages. + case *lnwire.ErrUnknownAddrType: + idleTimer.Reset(idleTimeout) + continue + // If the error we encountered wasn't just a message we // didn't recognize, then we'll stop all processing s // this is a fatal error.