chanfitness: save initial online event for channels with online peers
This commit adds an initial peer online event for channels that have peers that are online when they are created. This addresses a race between the peer coming online and an existing channel being added to the event store; if the peer comes online first, the existing channel will not have its initial online event added.
This commit is contained in:
2 files changed
+55
-11
No files matched your search
@@ -210,6 +210,12 @@ func (c *ChannelEventStore) addChannel(channelPoint wire.OutPoint,
|
||||
// Create an event log for the channel.
|
||||
eventLog := newEventLog(channelPoint, peer, time.Now)
|
||||
|
||||
// If the peer is already online, add a peer online event to record
|
||||
// the starting state of the peer.
|
||||
if c.peers[peer] {
|
||||
eventLog.add(peerOnlineEvent)
|
||||
}
|
||||
|
||||
c.channels[channelPoint] = eventLog
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user