mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
chanfitness: refactor to store channels by peer
When dealing with online events, we actually need to track our events by peer, not by channel. All we need to track channels is to have a set of online events for a peer which at least contain those events. This change refactors chanfitness to track by peer.
This commit is contained in:
@ -3536,12 +3536,17 @@ func createRPCOpenChannel(r *rpcServer, graph *channeldb.ChannelGraph,
|
||||
return channel, nil
|
||||
}
|
||||
|
||||
peer, err := route.NewVertexFromBytes(nodePub.SerializeCompressed())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Query the event store for additional information about the channel.
|
||||
// Do not fail if it is not available, because there is a potential
|
||||
// race between a channel being added to our node and the event store
|
||||
// being notified of it.
|
||||
outpoint := dbChannel.FundingOutpoint
|
||||
info, err := r.server.chanEventStore.GetChanInfo(outpoint)
|
||||
info, err := r.server.chanEventStore.GetChanInfo(outpoint, peer)
|
||||
switch err {
|
||||
// If the store does not know about the channel, we just log it.
|
||||
case chanfitness.ErrChannelNotFound:
|
||||
|
Reference in New Issue
Block a user