routing/router: define ErrRouterShuttingDown

This commit is contained in:
Johan T. Halseth 2019-04-05 17:36:11 +02:00
parent c0141a7bc1
commit 2b9efcbaeb
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -44,6 +44,10 @@ var (
// construct a new sphinx packet, but provides an empty set of hops for
// each route.
ErrNoRouteHopsProvided = fmt.Errorf("empty route hops provided")
// ErrRouterShuttingDown is returned if the router is in the process of
// shutting down.
ErrRouterShuttingDown = fmt.Errorf("router shutting down")
)
// ChannelGraphSource represents the source of information about the topology
@ -1686,7 +1690,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
)
case <-r.quit:
return [32]byte{}, nil, fmt.Errorf("router shutting down")
return [32]byte{}, nil, ErrRouterShuttingDown
default:
// Fall through if we haven't hit our time limit, or
@ -2108,10 +2112,10 @@ func (r *ChannelRouter) AddNode(node *channeldb.LightningNode) error {
case err := <-rMsg.err:
return err
case <-r.quit:
return errors.New("router has been shut down")
return ErrRouterShuttingDown
}
case <-r.quit:
return errors.New("router has been shut down")
return ErrRouterShuttingDown
}
}
@ -2132,10 +2136,10 @@ func (r *ChannelRouter) AddEdge(edge *channeldb.ChannelEdgeInfo) error {
case err := <-rMsg.err:
return err
case <-r.quit:
return errors.New("router has been shut down")
return ErrRouterShuttingDown
}
case <-r.quit:
return errors.New("router has been shut down")
return ErrRouterShuttingDown
}
}
@ -2155,10 +2159,10 @@ func (r *ChannelRouter) UpdateEdge(update *channeldb.ChannelEdgePolicy) error {
case err := <-rMsg.err:
return err
case <-r.quit:
return errors.New("router has been shut down")
return ErrRouterShuttingDown
}
case <-r.quit:
return errors.New("router has been shut down")
return ErrRouterShuttingDown
}
}