From 55f89be10f0a3a29240a78b2c2db33b250e6636e Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 14 Jan 2017 19:44:21 -0800 Subject: [PATCH] lnwallet+lnd: ensure curve parameters are set to avoid panics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a bug introduced by the past attempt to Make Logging Great Again. Since we unset the curve parameters when reading/writing the messages, if we have a lingering reference that’s active elsewhere in the daemon, then we’ll modify that reference. To fix this, we now explicitly set the Curve parameters in two areas. A similar commit has been pushed to lightning-onion. --- lnwallet/channel.go | 1 + server.go | 1 + 2 files changed, 2 insertions(+) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 98ea4d285..d9168bd77 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -1312,6 +1312,7 @@ func (lc *LightningChannel) ReceiveNewCommitment(rawSig []byte, // Ensure that the newly constructed commitment state has a valid // signature. + theirMultiSigKey.Curve = btcec.S256() sig, err := btcec.ParseSignature(rawSig, btcec.S256()) if err != nil { return err diff --git a/server.go b/server.go index 8b9271063..a16b64397 100644 --- a/server.go +++ b/server.go @@ -90,6 +90,7 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier, if err != nil { return nil, err } + privKey.Curve = btcec.S256() listeners := make([]net.Listener, len(listenAddrs)) for i, addr := range listenAddrs {