routing: mark policy as stale if edge remains double disabled

To ensure we don't mark an edge as live again just because an update
with a fresh timestamp was received, we'll ensure that we reject any
new updates for zombie channels if they remain disabled when running
with AssumeChannelValid.
This commit is contained in:
Wilmer Paulino 2019-04-17 13:24:32 -07:00
parent f23c3b488e
commit 7eb720e535
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -2256,9 +2256,21 @@ func (r *ChannelRouter) IsStaleEdgePolicy(chanID lnwire.ShortChannelID,
}
// If we know of the edge as a zombie, then we'll check the timestamp of
// this message to determine whether it's fresh.
// If we know of the edge as a zombie, then we'll make some additional
// checks to determine if the new policy is fresh.
if isZombie {
// When running with AssumeChannelValid, we also prune channels
// if both of their edges are disabled. We'll mark the new
// policy as stale if it remains disabled.
if r.cfg.AssumeChannelValid {
isDisabled := flags&lnwire.ChanUpdateDisabled ==
lnwire.ChanUpdateDisabled
if isDisabled {
return true
}
}
// Otherwise, we'll fall back to our usual ChannelPruneExpiry.
return time.Since(timestamp) > r.cfg.ChannelPruneExpiry
}