contractcourt+lnwallet: move aux close finalization to chain watcher

We now execute the aux chan closer finalization within the chain
watcher. This is better as we don't need to rely on the remote party
being online and sending us a message. Instead we do the finalization
once the on-chain transaction has been confirmed.
This commit is contained in:
George Tsagkarelis committed 2025-12-04 12:18:14 +01:00
1 parent fd772d45b8
commit 9a88999c41
2 files changed
+79 -27

No files matched your search

-27
View File
@@ -974,33 +974,6 @@ func (c *ChanCloser) ReceiveClosingSigned( //nolint:funlen
}
c.closingTx = closeTx
// If there's an aux chan closer, then we'll finalize with it
// before we write to disk.
err = fn.MapOptionZ(
c.cfg.AuxCloser, func(aux AuxChanCloser) error {
channel := c.cfg.Channel
//nolint:ll
req := types.AuxShutdownReq{
ChanPoint: c.chanPoint,
ShortChanID: c.cfg.Channel.ShortChanID(),
InternalKey: c.localInternalKey,
Initiator: channel.IsInitiator(),
CommitBlob: channel.LocalCommitmentBlob(),
FundingBlob: channel.FundingBlob(),
}
desc := types.AuxCloseDesc{
AuxShutdownReq: req,
LocalCloseOutput: c.localCloseOutput,
RemoteCloseOutput: c.remoteCloseOutput,
}
return aux.FinalizeClose(desc, closeTx)
},
)
if err != nil {
return noClosing, err
}
// Before publishing the closing tx, we persist it to the
// database, such that it can be republished if something goes
// wrong.