@@ -15,6 +15,7 @@ import (
1515 "github.com/lightningnetwork/lnd/htlcswitch"
1616 "github.com/lightningnetwork/lnd/input"
1717 "github.com/lightningnetwork/lnd/labels"
18+ "github.com/lightningnetwork/lnd/lntypes"
1819 "github.com/lightningnetwork/lnd/lnutils"
1920 "github.com/lightningnetwork/lnd/lnwallet"
2021 "github.com/lightningnetwork/lnd/lnwallet/chainfee"
@@ -207,8 +208,8 @@ type ChanCloser struct {
207208 // settled channel funds to.
208209 remoteDeliveryScript []byte
209210
210- // locallyInitiated is true if we initiated the channel close.
211- locallyInitiated bool
211+ // closer is ChannelParty who initiated the coop close
212+ closer lntypes. ChannelParty
212213
213214 // cachedClosingSigned is a cached copy of a received ClosingSigned that
214215 // we use to handle a specific race condition caused by the independent
@@ -267,7 +268,8 @@ func (d *SimpleCoopFeeEstimator) EstimateFee(chanType channeldb.ChannelType,
267268// be populated iff, we're the initiator of this closing request.
268269func NewChanCloser (cfg ChanCloseCfg , deliveryScript []byte ,
269270 idealFeePerKw chainfee.SatPerKWeight , negotiationHeight uint32 ,
270- closeReq * htlcswitch.ChanClose , locallyInitiated bool ) * ChanCloser {
271+ closeReq * htlcswitch.ChanClose ,
272+ closer lntypes.ChannelParty ) * ChanCloser {
271273
272274 chanPoint := cfg .Channel .ChannelPoint ()
273275 cid := lnwire .NewChanIDFromOutPoint (chanPoint )
@@ -283,7 +285,7 @@ func NewChanCloser(cfg ChanCloseCfg, deliveryScript []byte,
283285 priorFeeOffers : make (
284286 map [btcutil.Amount ]* lnwire.ClosingSigned ,
285287 ),
286- locallyInitiated : locallyInitiated ,
288+ closer : closer ,
287289 }
288290}
289291
@@ -366,7 +368,7 @@ func (c *ChanCloser) initChanShutdown() (*lnwire.Shutdown, error) {
366368 // message we are about to send in order to ensure that if a
367369 // re-establish occurs then we will re-send the same Shutdown message.
368370 shutdownInfo := channeldb .NewShutdownInfo (
369- c .localDeliveryScript , c .locallyInitiated ,
371+ c .localDeliveryScript , c .closer . IsLocal () ,
370372 )
371373 err := c .cfg .Channel .MarkShutdownSent (shutdownInfo )
372374 if err != nil {
@@ -650,7 +652,7 @@ func (c *ChanCloser) BeginNegotiation() (fn.Option[lnwire.ClosingSigned],
650652 // externally consistent, and reflect that the channel is being
651653 // shutdown by the time the closing request returns.
652654 err := c .cfg .Channel .MarkCoopBroadcasted (
653- nil , c .locallyInitiated ,
655+ nil , c .closer ,
654656 )
655657 if err != nil {
656658 return noClosingSigned , err
@@ -861,7 +863,7 @@ func (c *ChanCloser) ReceiveClosingSigned( //nolint:funlen
861863 // database, such that it can be republished if something goes
862864 // wrong.
863865 err = c .cfg .Channel .MarkCoopBroadcasted (
864- closeTx , c .locallyInitiated ,
866+ closeTx , c .closer ,
865867 )
866868 if err != nil {
867869 return noClosing , err
0 commit comments