htlcswitch/link: don't mark channel borked on force close scanarios
Instead of marking the channel Borked in cases where we want to force close it, we immediately let the peer fail the link. The channel state will instead be updated by the channel arbitrator, which will transition to StateBroadcastCommit, marking the channel borked, then marking the commitment tx broadcasted right before publishing the force close tx. We do this to avoid the case where we would mark it Borked, but go down before being able to publish the closing tx. Storing the force close tx ensures it will be re-published on startup.
This commit is contained in:
parent
6e361d04cf
commit
9423fadf56
@ -922,12 +922,12 @@ func (l *channelLink) htlcManager() {
|
|||||||
// what they sent us before.
|
// what they sent us before.
|
||||||
// TODO(halseth): ban peer?
|
// TODO(halseth): ban peer?
|
||||||
case err == lnwallet.ErrInvalidLocalUnrevokedCommitPoint:
|
case err == lnwallet.ErrInvalidLocalUnrevokedCommitPoint:
|
||||||
err = l.channel.MarkBorked()
|
// We'll fail the link and tell the peer to
|
||||||
if err != nil {
|
// force close the channel. Note that the
|
||||||
log.Errorf("Unable to mark channel "+
|
// database state is not updated here, but will
|
||||||
"borked: %v", err)
|
// be updated when the close transaction is
|
||||||
}
|
// ready to avoid that we go down before
|
||||||
|
// storing the transaction in the db.
|
||||||
l.fail(
|
l.fail(
|
||||||
LinkFailureError{
|
LinkFailureError{
|
||||||
code: ErrSyncError,
|
code: ErrSyncError,
|
||||||
|
Loading…
Reference in New Issue
Block a user