peer: check LocalUnrevokedCommitPoint for nil-ness as it's optional

In this commit, we modify the logWireMessage function to ensure that we
don't attempt to nil out the LocalUnrevokedCommitPoint.Curve field
unless it's actually set. We need to do this as the field as actually
optional, and we may be reading a message from a node that doesn't
support the option.

Fixes #461.
This commit is contained in:
Olaoluwa Osuntokun 2017-12-07 13:11:23 -08:00
parent 7a3116f8a9
commit ce6dee6ee4
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
1 changed files with 3 additions and 1 deletions

View File

@ -927,7 +927,9 @@ func (p *peer) logWireMessage(msg lnwire.Message, read bool) {
switch m := msg.(type) {
case *lnwire.ChannelReestablish:
m.LocalUnrevokedCommitPoint.Curve = nil
if m.LocalUnrevokedCommitPoint != nil {
m.LocalUnrevokedCommitPoint.Curve = nil
}
case *lnwire.RevokeAndAck:
m.NextRevocationKey.Curve = nil
case *lnwire.NodeAnnouncement: