routing+discovery: uniform error codes in routing

This commit is contained in:
yyforyongyu
2021-12-13 08:25:34 +08:00
parent c15c8a1f0b
commit dd74486b59
5 changed files with 45 additions and 32 deletions

View File

@@ -1113,8 +1113,11 @@ func (d *AuthenticatedGossiper) networkHandler() {
announcement.msg,
)
if err != nil {
if err != routing.ErrVBarrierShuttingDown &&
err != routing.ErrParentValidationFailed {
if !routing.IsError(
err,
routing.ErrVBarrierShuttingDown,
routing.ErrParentValidationFailed,
) {
log.Warnf("unexpected error "+
"during validation "+
"barrier shutdown: %v",
@@ -1658,15 +1661,13 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
log.Debugf("Adding node: %x got error: %v",
msg.NodeID, err)
switch {
case routing.IsError(err, routing.ErrOutdated,
routing.ErrIgnored):
case err == routing.ErrVBarrierShuttingDown:
default:
if !routing.IsError(
err,
routing.ErrOutdated,
routing.ErrIgnored,
routing.ErrVBarrierShuttingDown,
) {
log.Error(err)
}
nMsg.err <- err
@@ -2188,11 +2189,14 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
}
if err := d.cfg.Router.UpdateEdge(update, schedulerOp...); err != nil {
if routing.IsError(err, routing.ErrOutdated,
routing.ErrIgnored) {
if routing.IsError(
err, routing.ErrOutdated,
routing.ErrIgnored,
routing.ErrVBarrierShuttingDown,
) {
log.Debug(err)
} else if err != routing.ErrVBarrierShuttingDown {
} else {
key := newRejectCacheKey(
msg.ShortChannelID.ToUint64(),
nMsg.peer.PubKey(),