Skip to content

Commit f5f0286

Browse files
committed
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.
1 parent 3761912 commit f5f0286

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lnwire/message.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ type Message interface {
190190
MsgType() MessageType
191191
}
192192

193+
// LinkUpdater is an interface implemented by most messages in BOLT 2 that are
194+
// allowed to update the channel state.
195+
type LinkUpdater interface {
196+
// TargetChanID returns the channel id of the link for which this
197+
// message is intended.
198+
TargetChanID() ChannelID
199+
}
200+
193201
// makeEmptyMessage creates a new empty message of the proper concrete type
194202
// based on the passed message type.
195203
func makeEmptyMessage(msgType MessageType) (Message, error) {

peer/brontide.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@ out:
17501750
// will consider them as link updates and send them to
17511751
// chanStream. These messages will be queued inside chanStream
17521752
// if the channel is not active yet.
1753-
case LinkUpdater:
1753+
case lnwire.LinkUpdater:
17541754
targetChan = msg.TargetChanID()
17551755
isLinkUpdate = p.hasChannel(targetChan)
17561756

peer/interfaces.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ type messageSwitch interface {
3434
error)
3535
}
3636

37-
// LinkUpdater is an interface implemented by most messages in BOLT 2 that are
38-
// allowed to update the channel state.
39-
type LinkUpdater interface {
40-
// TargetChanID returns the channel id of the link for which this message
41-
// is intended.
42-
TargetChanID() lnwire.ChannelID
43-
}
44-
4537
// MessageConn is an interface implemented by anything that delivers
4638
// an lnwire.Message using a net.Conn interface.
4739
type MessageConn interface {

0 commit comments

Comments
 (0)