From f8493a7522451e5ce32d2556127f1479dbd43748 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 24 Nov 2020 14:15:12 +0100 Subject: [PATCH] routing: define errShardHandlerExiting --- routing/payment_lifecycle.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/routing/payment_lifecycle.go b/routing/payment_lifecycle.go index 30a07668..aaebc5bf 100644 --- a/routing/payment_lifecycle.go +++ b/routing/payment_lifecycle.go @@ -14,6 +14,9 @@ import ( "github.com/lightningnetwork/lnd/routing/route" ) +// errShardHandlerExiting is returned from the shardHandler when it exits. +var errShardHandlerExiting = fmt.Errorf("shard handler exiting") + // paymentLifecycle holds all information about the current state of a payment // needed to resume if from any point. type paymentLifecycle struct { @@ -308,7 +311,7 @@ func (p *shardHandler) waitForShard() error { return err case <-p.quit: - return fmt.Errorf("shard handler quitting") + return errShardHandlerExiting case <-p.router.quit: return ErrRouterShuttingDown @@ -326,7 +329,7 @@ func (p *shardHandler) checkShards() error { } case <-p.quit: - return fmt.Errorf("shard handler quitting") + return errShardHandlerExiting case <-p.router.quit: return ErrRouterShuttingDown @@ -421,7 +424,8 @@ func (p *shardHandler) collectResultAsync(attempt *channeldb.HTLCAttemptInfo) { result, err := p.collectResult(attempt) if err != nil { if err != ErrRouterShuttingDown && - err != htlcswitch.ErrSwitchExiting { + err != htlcswitch.ErrSwitchExiting && + err != errShardHandlerExiting { log.Errorf("Error collecting result for "+ "shard %v for payment %v: %v", @@ -531,7 +535,7 @@ func (p *shardHandler) collectResult(attempt *channeldb.HTLCAttemptInfo) ( return nil, ErrRouterShuttingDown case <-p.quit: - return nil, fmt.Errorf("shard handler exiting") + return nil, errShardHandlerExiting } // In case of a payment failure, fail the attempt with the control