Merge pull request #3050 from cfromknecht/break-router-rescans

routing/router: break rescans on router quit
This commit is contained in:
Olaoluwa Osuntokun 2019-05-06 16:21:35 -07:00 committed by GitHub
commit 8307ac89a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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))