From 9804caca6d51c35385ed1185232c9236a30c5e40 Mon Sep 17 00:00:00 2001 From: nsa Date: Sun, 30 Jun 2019 12:42:36 -0400 Subject: [PATCH] chanrestore: return error instead of nil if failed derivation This commit fixes a bug in the openChannelShell function where, instead of properly returning an error when failing to derive the shachain root's private key, nil was returned instead. This would lead to a panic as the channel shell was then referenced further down in the callstack. An error is now properly returned. --- chanrestore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chanrestore.go b/chanrestore.go index cf3bdf5b6..f771f91ba 100644 --- a/chanrestore.go +++ b/chanrestore.go @@ -41,7 +41,7 @@ func (c *chanDBRestorer) openChannelShell(backup chanbackup.Single) ( // shachain... privKey, err := c.secretKeys.DerivePrivKey(backup.ShaChainRootDesc) if err != nil { - return nil, nil + return nil, fmt.Errorf("unable to derive shachain root key: %v", err) } revRoot, err := chainhash.NewHash(privKey.Serialize()) if err != nil {