chanfitness: only process online events for peers with channels

This commit is contained in:
yyforyongyu committed 2025-09-18 22:18:28 +08:00
1 parent b34fc964ba
commit 92de9424ce
1 file changed
+8 -5
+8 -5
View File
@@ -313,12 +313,15 @@ func (c *ChannelEventStore) closeChannel(channelPoint wire.OutPoint,
}
}
// peerEvent creates a peer monitor for a peer if we do not currently have
// one, and adds an online event to it.
// peerEvent adds an online event to a peer's monitor. If the peer is not
// yet known to the event store, the event is ignored. A peer is only known to
// the event store if we have an open channel with them.
func (c *ChannelEventStore) peerEvent(peer route.Vertex, online bool) {
peerMonitor, err := c.getPeerMonitor(peer)
if err != nil {
log.Error("could not create monitor: %v", err)
peerMonitor, ok := c.peers[peer]
if !ok {
log.Tracef("Ignore peer event (online=%v) from non-channel "+
"peer: %v", online, peer)
return
}