diff --git a/htlcswitch/interfaces.go b/htlcswitch/interfaces.go index 8614dfaf..c0b273fe 100644 --- a/htlcswitch/interfaces.go +++ b/htlcswitch/interfaces.go @@ -1,6 +1,7 @@ package htlcswitch import ( + "github.com/btcsuite/btcd/wire" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/lnpeer" "github.com/lightningnetwork/lnd/lntypes" @@ -58,6 +59,9 @@ type ChannelLink interface { // possible). HandleChannelUpdate(lnwire.Message) + // ChannelPoint returns the channel outpoint for the channel link. + ChannelPoint() *wire.OutPoint + // ChanID returns the channel ID for the channel link. The channel ID // is a more compact representation of a channel's full outpoint. ChanID() lnwire.ChannelID diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 87b4ebe5..a6ebe502 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -9,6 +9,7 @@ import ( "sync/atomic" "time" + "github.com/btcsuite/btcd/wire" "github.com/davecgh/go-spew/spew" "github.com/go-errors/errors" "github.com/lightningnetwork/lnd/channeldb" @@ -1743,6 +1744,12 @@ func (l *channelLink) Peer() lnpeer.Peer { return l.cfg.Peer } +// ChannelPoint returns the channel outpoint for the channel link. +// NOTE: Part of the ChannelLink interface. +func (l *channelLink) ChannelPoint() *wire.OutPoint { + return l.channel.ChannelPoint() +} + // ShortChanID returns the short channel ID for the channel link. The short // channel ID encodes the exact location in the main chain that the original // funding output can be found. diff --git a/htlcswitch/mock.go b/htlcswitch/mock.go index c9b44d5c..4ac8c947 100644 --- a/htlcswitch/mock.go +++ b/htlcswitch/mock.go @@ -673,6 +673,7 @@ func (f *mockChannelLink) ChanID() lnwire.ChannelID { return func (f *mockChannelLink) ShortChanID() lnwire.ShortChannelID { return f.shortChanID } func (f *mockChannelLink) Bandwidth() lnwire.MilliSatoshi { return 99999999 } func (f *mockChannelLink) Peer() lnpeer.Peer { return f.peer } +func (f *mockChannelLink) ChannelPoint() *wire.OutPoint { return &wire.OutPoint{} } func (f *mockChannelLink) Stop() {} func (f *mockChannelLink) EligibleToForward() bool { return f.eligible } func (f *mockChannelLink) setLiveShortChanID(sid lnwire.ShortChannelID) { f.shortChanID = sid }