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.
This commit is contained in:
parent
6a4179e224
commit
9804caca6d
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user