routing: define errShardHandlerExiting
This commit is contained in:
parent
4d645ef97f
commit
f8493a7522
@ -14,6 +14,9 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/routing/route"
|
"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
|
// paymentLifecycle holds all information about the current state of a payment
|
||||||
// needed to resume if from any point.
|
// needed to resume if from any point.
|
||||||
type paymentLifecycle struct {
|
type paymentLifecycle struct {
|
||||||
@ -308,7 +311,7 @@ func (p *shardHandler) waitForShard() error {
|
|||||||
return err
|
return err
|
||||||
|
|
||||||
case <-p.quit:
|
case <-p.quit:
|
||||||
return fmt.Errorf("shard handler quitting")
|
return errShardHandlerExiting
|
||||||
|
|
||||||
case <-p.router.quit:
|
case <-p.router.quit:
|
||||||
return ErrRouterShuttingDown
|
return ErrRouterShuttingDown
|
||||||
@ -326,7 +329,7 @@ func (p *shardHandler) checkShards() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case <-p.quit:
|
case <-p.quit:
|
||||||
return fmt.Errorf("shard handler quitting")
|
return errShardHandlerExiting
|
||||||
|
|
||||||
case <-p.router.quit:
|
case <-p.router.quit:
|
||||||
return ErrRouterShuttingDown
|
return ErrRouterShuttingDown
|
||||||
@ -421,7 +424,8 @@ func (p *shardHandler) collectResultAsync(attempt *channeldb.HTLCAttemptInfo) {
|
|||||||
result, err := p.collectResult(attempt)
|
result, err := p.collectResult(attempt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != ErrRouterShuttingDown &&
|
if err != ErrRouterShuttingDown &&
|
||||||
err != htlcswitch.ErrSwitchExiting {
|
err != htlcswitch.ErrSwitchExiting &&
|
||||||
|
err != errShardHandlerExiting {
|
||||||
|
|
||||||
log.Errorf("Error collecting result for "+
|
log.Errorf("Error collecting result for "+
|
||||||
"shard %v for payment %v: %v",
|
"shard %v for payment %v: %v",
|
||||||
@ -531,7 +535,7 @@ func (p *shardHandler) collectResult(attempt *channeldb.HTLCAttemptInfo) (
|
|||||||
return nil, ErrRouterShuttingDown
|
return nil, ErrRouterShuttingDown
|
||||||
|
|
||||||
case <-p.quit:
|
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
|
// In case of a payment failure, fail the attempt with the control
|
||||||
|
Loading…
Reference in New Issue
Block a user