Skip to content

Commit c262b1b

Browse files
authored
Merge pull request #8968 from ProofOfKeags/opening-party
[MICRO]: channeldb+lnwallet: add OpeningParty API
2 parents 4e5728f + a2b19af commit c262b1b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

channeldb/channel.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,18 @@ func (c *OpenChannel) String() string {
899899
)
900900
}
901901

902+
// Initiator returns the ChannelParty that originally opened this channel.
903+
func (c *OpenChannel) Initiator() lntypes.ChannelParty {
904+
c.RLock()
905+
defer c.RUnlock()
906+
907+
if c.IsInitiator {
908+
return lntypes.Local
909+
}
910+
911+
return lntypes.Remote
912+
}
913+
902914
// ShortChanID returns the current ShortChannelID of this channel.
903915
func (c *OpenChannel) ShortChanID() lnwire.ShortChannelID {
904916
c.RLock()

lnwallet/channel.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8709,6 +8709,14 @@ func (lc *LightningChannel) ChanType() channeldb.ChannelType {
87098709
return lc.channelState.ChanType
87108710
}
87118711

8712+
// Initiator returns the ChannelParty that originally opened this channel.
8713+
func (lc *LightningChannel) Initiator() lntypes.ChannelParty {
8714+
lc.RLock()
8715+
defer lc.RUnlock()
8716+
8717+
return lc.channelState.Initiator()
8718+
}
8719+
87128720
// FundingTxOut returns the funding output of the channel.
87138721
func (lc *LightningChannel) FundingTxOut() *wire.TxOut {
87148722
lc.RLock()

0 commit comments

Comments
 (0)