Skip to content

Commit

Permalink
Merge pull request #2959 from halseth/err-router-shutting-down
Browse files Browse the repository at this point in the history
[trivial] routing/router: define ErrRouterShuttingDown
  • Loading branch information
halseth authored Apr 16, 2019
2 parents 74a4286 + 2b9efcb commit 58ec9ef
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions routing/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand All @@ -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
}
}

Expand All @@ -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
}
}

Expand Down

0 comments on commit 58ec9ef

Please sign in to comment.