mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 08:55:59 +01:00
Merge pull request #3050 from cfromknecht/break-router-rescans
routing/router: break rescans on router quit
This commit is contained in:
commit
8307ac89a4
1 changed files with 9 additions and 0 deletions
|
@ -584,6 +584,15 @@ func (r *ChannelRouter) syncGraphWithChain() error {
|
|||
// consumed by the channel graph.
|
||||
var numChansClosed uint32
|
||||
for nextHeight := pruneHeight + 1; nextHeight <= uint32(bestHeight); nextHeight++ {
|
||||
// Break out of the rescan early if a shutdown has been
|
||||
// requested, otherwise long rescans will block the daemon from
|
||||
// shutting down promptly.
|
||||
select {
|
||||
case <-r.quit:
|
||||
return ErrRouterShuttingDown
|
||||
default:
|
||||
}
|
||||
|
||||
// Using the next height, request a manual block pruning from
|
||||
// the chainview for the particular block hash.
|
||||
nextHash, err := r.cfg.Chain.GetBlockHash(int64(nextHeight))
|
||||
|
|
Loading…
Add table
Reference in a new issue