lnd: [lncli] unable to restore chan backups: rpc error: code = Unknown desc = unable to unpack chan backup: unable to derive shachain root key: unable to derive private key issue
Background
I had a db corruption issue and trying to recover from my SCB. Using the same seed and recovered the on-chain funds successfully. When attempting to restore off-chain via lncli create or restorechanbackup I get:
[lncli] unable to restore chan backups: rpc error: code = Unknown desc = unable to unpack chan backup: unable to derive shachain root key: unable to derive private key issue.
I found https://github.com/lightningnetwork/lnd/issues/3583 and I seem to be having a similar problem. It starts saving some of the channels back to disk but fails around the 5th one with that error and can’t continue. I’ve noticed that the channel point it fails on is a channel from 2018 - I’m curious if there are some backwards compatibility issues.
Any advice on where to go from here? Is there a way for me to edit my channel.backup and remove the old channels to see if that helps?
Your environment
- version of
lnd: 0.8.2-beta - which operating system (
uname -aon *Nix): Ubuntu 18.04 - version of
btcd,bitcoind, or other backend: bitcoind 0.19.0.1 - any other relevant environment details
Steps to reproduce
Try to recover channels from channel.backup on same seed using lncli create or restorechanbackup.
Expected behaviour
Recover channel.backup successfully.
Actual behaviour
[lncli] unable to restore chan backups: rpc error: code = Unknown desc = unable to unpack chan backup: unable to derive shachain root key: unable to derive private key issue.
2019-12-28 19:22:46.769 [INF] CHBU: Restoring ChannelPoint(removed) to disk: 2019-12-28 19:22:46.827 [INF] LTND: Inserting 1 SCB channel shells into DB 2019-12-28 19:22:46.827 [INF] CHBU: Restoring ChannelPoint(removed) to disk: 2019-12-28 19:22:46.899 [INF] LTND: Inserting 1 SCB channel shells into DB 2019-12-28 19:22:46.899 [INF] CHBU: Restoring ChannelPoint(removed) to disk: 2019-12-28 19:22:46.965 [INF] LTND: Inserting 1 SCB channel shells into DB 2019-12-28 19:22:46.965 [INF] CHBU: Restoring ChannelPoint(removed) to disk: 2019-12-28 19:22:47.023 [INF] LTND: Inserting 1 SCB channel shells into DB 2019-12-28 19:22:47.023 [INF] CHBU: Restoring ChannelPoint(removed) to disk: 2019-12-28 19:22:47.082 [INF] LTND: Inserting 1 SCB channel shells into DB 2019-12-28 19:22:47.083 [INF] CHBU: Restoring ChannelPoint(cb2a5f78d093234b9c3d6b9227b70573bb7cb0b1b2d3c369278c09a4198683cb:0) to disk:
And then I receive the previous error.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 16
I think I found the problem. We changed how the
ShaChainRootDescis created in https://github.com/lightningnetwork/lnd/pull/769, which was released with versionv0.4-beta. If you created the channel with versionv0.3-betaor earlier, this would explain the behavior.But as far as I know the SHA chain root is not really used if an SCB is restored since lnd initiates DLP and the remote party force-closes and hands over their
per_commit_point. So I’m going to write a command that fixes this old channel by just writing any valid public key into theShaChainRootDesc.I’ve added a new
derivekeycommand to the channel tool. Could you please run the following command (replacexprv...with your root key):This will take a few minutes depending on the speed of your machine. After it finishes, there will be a file
keys.txtwith the first 20k public keys. Could you check if02faff90e2d7eb7dcd8c5ca5856179812d100ed25902042706a84c3b32ed6304f6is in that list? And if so, at what line number? Thank you very much in advance!