mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-29 03:01:52 +01:00
discovery: add isLocal bool to msgWithSenders
This lets us keep track of which messages we created ourselves vs the messages that originated remotely from a peer.
This commit is contained in:
parent
adb239300f
commit
e8177ea427
@ -826,6 +826,11 @@ type msgWithSenders struct {
|
|||||||
// msg is the wire message itself.
|
// msg is the wire message itself.
|
||||||
msg lnwire.Message
|
msg lnwire.Message
|
||||||
|
|
||||||
|
// isLocal is true if this was a message that originated locally. We'll
|
||||||
|
// use this to bypass our normal checks to ensure we prioritize sending
|
||||||
|
// out our own updates.
|
||||||
|
isLocal bool
|
||||||
|
|
||||||
// sender is the set of peers that sent us this message.
|
// sender is the set of peers that sent us this message.
|
||||||
senders map[route.Vertex]struct{}
|
senders map[route.Vertex]struct{}
|
||||||
}
|
}
|
||||||
@ -903,6 +908,7 @@ func (d *deDupedAnnouncements) addMsg(message networkMsg) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
mws = msgWithSenders{
|
mws = msgWithSenders{
|
||||||
msg: msg,
|
msg: msg,
|
||||||
|
isLocal: !message.isRemote,
|
||||||
senders: make(map[route.Vertex]struct{}),
|
senders: make(map[route.Vertex]struct{}),
|
||||||
}
|
}
|
||||||
mws.senders[sender] = struct{}{}
|
mws.senders[sender] = struct{}{}
|
||||||
@ -949,6 +955,7 @@ func (d *deDupedAnnouncements) addMsg(message networkMsg) {
|
|||||||
if oldTimestamp < msg.Timestamp {
|
if oldTimestamp < msg.Timestamp {
|
||||||
mws = msgWithSenders{
|
mws = msgWithSenders{
|
||||||
msg: msg,
|
msg: msg,
|
||||||
|
isLocal: !message.isRemote,
|
||||||
senders: make(map[route.Vertex]struct{}),
|
senders: make(map[route.Vertex]struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,6 +999,7 @@ func (d *deDupedAnnouncements) addMsg(message networkMsg) {
|
|||||||
if oldTimestamp < msg.Timestamp {
|
if oldTimestamp < msg.Timestamp {
|
||||||
mws = msgWithSenders{
|
mws = msgWithSenders{
|
||||||
msg: msg,
|
msg: msg,
|
||||||
|
isLocal: !message.isRemote,
|
||||||
senders: make(map[route.Vertex]struct{}),
|
senders: make(map[route.Vertex]struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2949,6 +2957,7 @@ func (d *AuthenticatedGossiper) handleAnnSig(nMsg *networkMsg,
|
|||||||
} else {
|
} else {
|
||||||
remotePubKey = chanInfo.NodeKey1Bytes
|
remotePubKey = chanInfo.NodeKey1Bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since the remote peer might not be online we'll call a
|
// Since the remote peer might not be online we'll call a
|
||||||
// method that will attempt to deliver the proof when it comes
|
// method that will attempt to deliver the proof when it comes
|
||||||
// online.
|
// online.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user