integration/rpctest: check quit in solveBlock()'s solver() closure

This commit is contained in:
Alex 2017-10-25 17:53:50 -06:00 committed by Olaoluwa Osuntokun
parent 6cea610774
commit e2f65acf02

View file

@ -45,12 +45,20 @@ func solveBlock(header *wire.BlockHeader, targetDifficulty *big.Int) bool {
hdr.Nonce = i
hash := hdr.BlockHash()
if blockchain.HashToBig(&hash).Cmp(targetDifficulty) <= 0 {
results <- sbResult{true, i}
return
select {
case results <- sbResult{true, i}:
return
case <-quit:
return
}
}
}
}
results <- sbResult{false, 0}
select {
case results <- sbResult{false, 0}:
case <-quit:
return
}
}
startNonce := uint32(0)