From 4728ac844a10690f70db9d023f46feec165c5452 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 18 Nov 2019 09:02:56 +0100 Subject: [PATCH] chanbackup: continue recovery if channel already exists --- chanbackup/recover.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chanbackup/recover.go b/chanbackup/recover.go index 89c09458..2340e977 100644 --- a/chanbackup/recover.go +++ b/chanbackup/recover.go @@ -5,6 +5,7 @@ import ( "github.com/btcsuite/btcd/btcec" "github.com/davecgh/go-spew/spew" + "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/keychain" ) @@ -47,6 +48,14 @@ func Recover(backups []Single, restorer ChannelRestorer, backup.FundingOutpoint) err := restorer.RestoreChansFromSingles(backup) + + // If a channel is already present in the channel DB, we can + // just continue. No reason to fail a whole set of multi backups + // for example. This allows resume of a restore in case another + // error happens. + if err == channeldb.ErrChanAlreadyExists { + continue + } if err != nil { return err }