@@ -25,6 +25,7 @@ import (
2525 "github.com/lightningnetwork/lnd/input"
2626 "github.com/lightningnetwork/lnd/keychain"
2727 "github.com/lightningnetwork/lnd/kvdb"
28+ "github.com/lightningnetwork/lnd/lntypes"
2829 "github.com/lightningnetwork/lnd/lnwire"
2930 "github.com/lightningnetwork/lnd/shachain"
3031 "github.com/lightningnetwork/lnd/tlv"
@@ -1690,11 +1691,11 @@ func (c *OpenChannel) isBorked(chanBucket kvdb.RBucket) (bool, error) {
16901691// republish this tx at startup to ensure propagation, and we should still
16911692// handle the case where a different tx actually hits the chain.
16921693func (c * OpenChannel ) MarkCommitmentBroadcasted (closeTx * wire.MsgTx ,
1693- locallyInitiated bool ) error {
1694+ closer lntypes. ChannelParty ) error {
16941695
16951696 return c .markBroadcasted (
16961697 ChanStatusCommitBroadcasted , forceCloseTxKey , closeTx ,
1697- locallyInitiated ,
1698+ closer ,
16981699 )
16991700}
17001701
@@ -1706,11 +1707,11 @@ func (c *OpenChannel) MarkCommitmentBroadcasted(closeTx *wire.MsgTx,
17061707// ensure propagation, and we should still handle the case where a different tx
17071708// actually hits the chain.
17081709func (c * OpenChannel ) MarkCoopBroadcasted (closeTx * wire.MsgTx ,
1709- locallyInitiated bool ) error {
1710+ closer lntypes. ChannelParty ) error {
17101711
17111712 return c .markBroadcasted (
17121713 ChanStatusCoopBroadcasted , coopCloseTxKey , closeTx ,
1713- locallyInitiated ,
1714+ closer ,
17141715 )
17151716}
17161717
@@ -1719,7 +1720,7 @@ func (c *OpenChannel) MarkCoopBroadcasted(closeTx *wire.MsgTx,
17191720// which should specify either a coop or force close. It adds a status which
17201721// indicates the party that initiated the channel close.
17211722func (c * OpenChannel ) markBroadcasted (status ChannelStatus , key []byte ,
1722- closeTx * wire.MsgTx , locallyInitiated bool ) error {
1723+ closeTx * wire.MsgTx , closer lntypes. ChannelParty ) error {
17231724
17241725 c .Lock ()
17251726 defer c .Unlock ()
@@ -1741,7 +1742,7 @@ func (c *OpenChannel) markBroadcasted(status ChannelStatus, key []byte,
17411742 // Add the initiator status to the status provided. These statuses are
17421743 // set in addition to the broadcast status so that we do not need to
17431744 // migrate the original logic which does not store initiator.
1744- if locallyInitiated {
1745+ if closer . IsLocal () {
17451746 status |= ChanStatusLocalCloseInitiator
17461747 } else {
17471748 status |= ChanStatusRemoteCloseInitiator
@@ -4486,6 +4487,15 @@ func NewShutdownInfo(deliveryScript lnwire.DeliveryAddress,
44864487 }
44874488}
44884489
4490+ // Closer identifies the ChannelParty that initiated the coop-closure process.
4491+ func (s ShutdownInfo ) Closer () lntypes.ChannelParty {
4492+ if s .LocalInitiator .Val {
4493+ return lntypes .Local
4494+ }
4495+
4496+ return lntypes .Remote
4497+ }
4498+
44894499// encode serialises the ShutdownInfo to the given io.Writer.
44904500func (s * ShutdownInfo ) encode (w io.Writer ) error {
44914501 records := []tlv.Record {
0 commit comments