routing/router: prune zombies when either end is stale
This commit is contained in:
parent
672dbe39e7
commit
e3a8b3b0c4
@ -824,30 +824,23 @@ func (r *ChannelRouter) pruneZombieChans() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If *both* edges haven't been updated for a period of
|
||||
// If either edge hasn't been updated for a period of
|
||||
// chanExpiry, then we'll mark the channel itself as eligible
|
||||
// for graph pruning.
|
||||
var e1Zombie, e2Zombie bool
|
||||
if e1 != nil {
|
||||
e1Zombie = time.Since(e1.LastUpdate) >= chanExpiry
|
||||
if e1Zombie {
|
||||
log.Tracef("Edge #1 of ChannelID(%v) last "+
|
||||
"update: %v", info.ChannelID,
|
||||
e1.LastUpdate)
|
||||
}
|
||||
e1Zombie := e1 == nil || time.Since(e1.LastUpdate) >= chanExpiry
|
||||
e2Zombie := e2 == nil || time.Since(e2.LastUpdate) >= chanExpiry
|
||||
|
||||
if e1Zombie {
|
||||
log.Tracef("Node1 pubkey=%x of chan_id=%v is zombie",
|
||||
info.NodeKey1Bytes, info.ChannelID)
|
||||
}
|
||||
if e2 != nil {
|
||||
e2Zombie = time.Since(e2.LastUpdate) >= chanExpiry
|
||||
if e2Zombie {
|
||||
log.Tracef("Edge #2 of ChannelID(%v) last "+
|
||||
"update: %v", info.ChannelID,
|
||||
e2.LastUpdate)
|
||||
}
|
||||
if e2Zombie {
|
||||
log.Tracef("Node2 pubkey=%x of chan_id=%v is zombie",
|
||||
info.NodeKey2Bytes, info.ChannelID)
|
||||
}
|
||||
|
||||
// If the channel is not considered zombie, we can move on to
|
||||
// the next.
|
||||
if !e1Zombie || !e2Zombie {
|
||||
// Return early if both sides have a recent update.
|
||||
if !e1Zombie && !e2Zombie {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user