From 0e6d628acdd692860b9e238e65ee2027c9e6f0ed Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 11 Dec 2020 12:30:44 +0000 Subject: [PATCH] Fix deadlock (#1401) Co-authored-by: Alexey Sharp --- consensus/ethash/consensus.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index a8692aaa9..97b92d5b1 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -146,7 +146,11 @@ func (ethash *Ethash) VerifyHeaders(chain consensus.ChainHeaderReader, headers [ defer wg.Done() for index := range inputs { errors[index] = ethash.verifyHeaderWorker(chain, headers, seals, index) - done <- index + select { + case done <- index: + case <-abort: + return + } } }() }