peer: don't d/c peer if we encounter lnwire.ErrUnknownAddrType

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.
This commit is contained in:
Olaoluwa Osuntokun 2018-03-23 15:49:25 -07:00
parent 00240c6221
commit e7d66e1dfd
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
2 changed files with 9 additions and 1 deletions

@ -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)

@ -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.