From 1341c8963da340708cbe905c831b8fc273231a70 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 1 Jul 2024 17:54:21 -0700 Subject: [PATCH] lnwallet: add short chan ID to AuxShutdownReq This allows implementations to obtain information related where the funding transaction confirmed in the mainchain. --- lnwallet/chancloser/aux_closer.go | 4 ++++ lnwallet/chancloser/chancloser.go | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lnwallet/chancloser/aux_closer.go b/lnwallet/chancloser/aux_closer.go index 443a1bb3a8..8b1c445ca3 100644 --- a/lnwallet/chancloser/aux_closer.go +++ b/lnwallet/chancloser/aux_closer.go @@ -34,6 +34,10 @@ type AuxShutdownReq struct { // down. ChanPoint wire.OutPoint + // ShortChanID is the short channel ID of the channel that is being + // closed. + ShortChanID lnwire.ShortChannelID + // Initiator is true if the local node is the initiator of the channel. Initiator bool diff --git a/lnwallet/chancloser/chancloser.go b/lnwallet/chancloser/chancloser.go index 16cb80b5c9..3a03d5cb9c 100644 --- a/lnwallet/chancloser/chancloser.go +++ b/lnwallet/chancloser/chancloser.go @@ -376,6 +376,7 @@ func (c *ChanCloser) initChanShutdown() (*lnwire.Shutdown, error) { err := fn.MapOptionZ(c.cfg.AuxCloser, func(a AuxChanCloser) error { shutdownCustomRecords, err := a.ShutdownBlob(AuxShutdownReq{ ChanPoint: c.chanPoint, + ShortChanID: c.cfg.Channel.ShortChanID(), Initiator: c.cfg.Channel.IsInitiator(), InternalKey: c.localInternalKey, CommitBlob: c.cfg.Channel.LocalCommitmentBlob(), @@ -979,7 +980,9 @@ func (c *ChanCloser) ReceiveClosingSigned( //nolint:funlen c.cfg.AuxCloser, func(aux AuxChanCloser) error { channel := c.cfg.Channel req := AuxShutdownReq{ - ChanPoint: c.chanPoint, + ChanPoint: c.chanPoint, + //nolint:lll + ShortChanID: c.cfg.Channel.ShortChanID(), InternalKey: c.localInternalKey, Initiator: channel.IsInitiator(), //nolint:lll @@ -1057,6 +1060,7 @@ func (c *ChanCloser) auxCloseOutputs( err := fn.MapOptionZ(c.cfg.AuxCloser, func(aux AuxChanCloser) error { req := AuxShutdownReq{ ChanPoint: c.chanPoint, + ShortChanID: c.cfg.Channel.ShortChanID(), InternalKey: c.localInternalKey, Initiator: c.cfg.Channel.IsInitiator(), CommitBlob: c.cfg.Channel.LocalCommitmentBlob(),