aboutsummaryrefslogtreecommitdiffstats
path: root/core/chain_manager.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-06-08 08:19:39 +0800
committerFelix Lange <fjl@twurst.com>2015-06-08 08:19:39 +0800
commit0b493910d38c4f6ed25a196b0e8071dc2afd1fd6 (patch)
treecb2eb3de483d8e01bdf6fb72789b057a212e3eb7 /core/chain_manager.go
parent43ceb0f5c73dfde8540693a920e144fa67ffcd46 (diff)
downloadgo-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.tar
go-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.tar.gz
go-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.tar.bz2
go-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.tar.lz
go-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.tar.xz
go-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.tar.zst
go-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.zip
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.
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r--core/chain_manager.go6
1 files changed, 3 insertions, 3 deletions
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()}
}
}