lnwallet/channel: make ErrCommitSyncLocalDataLoss type

This commit converts the ErrCommitSyncLocalDataLoss error into a struct,
that also holds the received last unrevoked commit point from the remote
party.
This commit is contained in:
Johan T. Halseth committed 2019-09-25 14:04:43 +02:00
1 parent d75feeb953
commit f40f4620f7
3 files changed
+37 -14

No files matched your search

+6 -1
View File
@@ -895,6 +895,11 @@ func (l *channelLink) htlcManager() {
if l.cfg.SyncStates {
err := l.syncChanStates()
if err != nil {
log.Warnf("Error when syncing channel states: %v", err)
_, localDataLoss :=
err.(*lnwallet.ErrCommitSyncLocalDataLoss)
switch {
case err == ErrLinkShuttingDown:
log.Debugf("unable to sync channel states, " +
@@ -936,7 +941,7 @@ func (l *channelLink) htlcManager() {
// TODO(halseth): mark this, such that we prevent
// channel from being force closed by the user or
// contractcourt etc.
case err == lnwallet.ErrCommitSyncLocalDataLoss:
case localDataLoss:
// We determined the commit chains were not possible to
// sync. We cautiously fail the channel, but don't