chanbackup: add new updateBackupFile method, write fresh backup on startup

In this commit, we modify the sub-swapper to update the set of backups
files time it's tarted. We do this to ensure that each time we start,
we're up to sync with the current set of open channels. This also ensure
that we'll create a new back up file if this is the first time we're
starting up with this new feature.
This commit is contained in:
Olaoluwa Osuntokun committed 2019-03-28 17:53:30 -07:00
1 parent 0b8131c3be
commit af1dfe176e
3 files changed
+67 -39

No files matched your search

+2
View File
@@ -76,6 +76,8 @@ func (b *MultiFile) UpdateAndSwap(newBackup PackedMulti) error {
return ErrNoBackupFileExists
}
log.Infof("Updating backup file at %v", b.fileName)
// If the old back up file still exists, then we'll delete it before
// proceeding.
if _, err := os.Stat(b.tempFileName); err == nil {