chanbackup: disable channel backup for anchor types

This commit is contained in:
Johan T. Halseth 2020-03-06 16:11:48 +01:00
parent fd93c568ea
commit 7adb1bcbaa
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
2 changed files with 20 additions and 3 deletions

@ -62,6 +62,12 @@ func FetchBackupForChan(chanPoint wire.OutPoint,
return nil, fmt.Errorf("unable to find target channel")
}
// TODO(halseth): support chan backups for anchor types.
if targetChan.ChanType.HasAnchors() {
return nil, fmt.Errorf("channel type does not support " +
"backups yet")
}
// Once we have the target channel, we can assemble the backup using
// the source to obtain any extra information that we may need.
staticChanBackup, err := assembleChanBackup(chanSource, targetChan)
@ -85,14 +91,19 @@ func FetchStaticChanBackups(chanSource LiveChannelSource) ([]Single, error) {
// Now that we have all the channels, we'll use the chanSource to
// obtain any auxiliary information we need to craft a backup for each
// channel.
staticChanBackups := make([]Single, len(openChans))
for i, openChan := range openChans {
staticChanBackups := make([]Single, 0, len(openChans))
for _, openChan := range openChans {
// TODO(halseth): support chan backups for anchor types.
if openChan.ChanType.HasAnchors() {
continue
}
chanBackup, err := assembleChanBackup(chanSource, openChan)
if err != nil {
return nil, err
}
staticChanBackups[i] = *chanBackup
staticChanBackups = append(staticChanBackups, *chanBackup)
}
return staticChanBackups, nil

@ -213,6 +213,12 @@ func (s *SubSwapper) backupUpdater() {
// For all new open channels, we'll create a new SCB
// given the required information.
for _, newChan := range chanUpdate.NewChans {
// TODO(halseth): support chan backups for
// anchor types.
if newChan.ChanType.HasAnchors() {
continue
}
log.Debugf("Adding channel %v to backup state",
newChan.FundingOutpoint)