mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-07 03:06:01 +02:00
channeldb+lnwallet: define Initiator for OpenChannel and LightningChannel
This commit introduces a new API to return information on which party opened the channel using the new ChannelParty type. It does not change the underlying structure of how we store this information.
This commit is contained in:
@@ -889,6 +889,18 @@ func (c *OpenChannel) String() string {
|
||||
)
|
||||
}
|
||||
|
||||
// Initiator returns the ChannelParty that originally opened this channel.
|
||||
func (c *OpenChannel) Initiator() lntypes.ChannelParty {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
if c.IsInitiator {
|
||||
return lntypes.Local
|
||||
}
|
||||
|
||||
return lntypes.Remote
|
||||
}
|
||||
|
||||
// ShortChanID returns the current ShortChannelID of this channel.
|
||||
func (c *OpenChannel) ShortChanID() lnwire.ShortChannelID {
|
||||
c.RLock()
|
||||
|
Reference in New Issue
Block a user