core: fix the nonce check one more time

The block nonce verification was effectively disabled by a typo.
This time, there is an actual test for it.
This commit is contained in:
Felix Lange
2015-06-08 02:19:39 +02:00
parent 43ceb0f5c7
commit 0b493910d3
3 changed files with 73 additions and 3 deletions

View File

@ -551,12 +551,12 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
bstart := time.Now()
// Wait for block i's nonce to be verified before processing
// its state transition.
for nonceChecked[i] {
for !nonceChecked[i] {
r := <-nonceDone
nonceChecked[r.i] = true
if !r.valid {
block := chain[i]
return i, ValidationError("Block (#%v / %x) nonce is invalid (= %x)", block.Number(), block.Hash(), block.Nonce)
block := chain[r.i]
return r.i, &BlockNonceErr{Hash: block.Hash(), Number: block.Number(), Nonce: block.Nonce()}
}
}