From 0b493910d38c4f6ed25a196b0e8071dc2afd1fd6 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 8 Jun 2015 02:19:39 +0200 Subject: 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. --- core/chain_manager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/chain_manager.go') diff --git a/core/chain_manager.go b/core/chain_manager.go index 86d1c1454..291e411ae 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -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()} } } -- cgit