mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
peer+lnwire: move LinkUpdater to lnwire
The purpose of this interface is to distinguish messages that are bound to a particular channel_id from those that are not. There is no reason this ought to be a property of the peer package as it is entirely determined by the contents of the message itself. Therefore we move it to the lnwire package so it can be used without having import cycles elsewhere in the codebase.
This commit is contained in:
parent
3761912680
commit
f5f0286e34
@ -190,6 +190,14 @@ type Message interface {
|
||||
MsgType() MessageType
|
||||
}
|
||||
|
||||
// LinkUpdater is an interface implemented by most messages in BOLT 2 that are
|
||||
// allowed to update the channel state.
|
||||
type LinkUpdater interface {
|
||||
// TargetChanID returns the channel id of the link for which this
|
||||
// message is intended.
|
||||
TargetChanID() ChannelID
|
||||
}
|
||||
|
||||
// makeEmptyMessage creates a new empty message of the proper concrete type
|
||||
// based on the passed message type.
|
||||
func makeEmptyMessage(msgType MessageType) (Message, error) {
|
||||
|
@ -1750,7 +1750,7 @@ out:
|
||||
// will consider them as link updates and send them to
|
||||
// chanStream. These messages will be queued inside chanStream
|
||||
// if the channel is not active yet.
|
||||
case LinkUpdater:
|
||||
case lnwire.LinkUpdater:
|
||||
targetChan = msg.TargetChanID()
|
||||
isLinkUpdate = p.hasChannel(targetChan)
|
||||
|
||||
|
@ -34,14 +34,6 @@ type messageSwitch interface {
|
||||
error)
|
||||
}
|
||||
|
||||
// LinkUpdater is an interface implemented by most messages in BOLT 2 that are
|
||||
// allowed to update the channel state.
|
||||
type LinkUpdater interface {
|
||||
// TargetChanID returns the channel id of the link for which this message
|
||||
// is intended.
|
||||
TargetChanID() lnwire.ChannelID
|
||||
}
|
||||
|
||||
// MessageConn is an interface implemented by anything that delivers
|
||||
// an lnwire.Message using a net.Conn interface.
|
||||
type MessageConn interface {
|
||||
|
Loading…
Reference in New Issue
Block a user