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/error.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/error.go') diff --git a/core/error.go b/core/error.go index 2bdad364f..3f3c350df 100644 --- a/core/error.go +++ b/core/error.go @@ -90,6 +90,23 @@ func IsNonceErr(err error) bool { return ok } +// BlockNonceErr indicates that a block's nonce is invalid. +type BlockNonceErr struct { + Number *big.Int + Hash common.Hash + Nonce uint64 +} + +func (err *BlockNonceErr) Error() string { + return fmt.Sprintf("block %d (%v) nonce is invalid (got %d)", err.Number, err.Hash, err.Nonce) +} + +// IsBlockNonceErr returns true for invalid block nonce errors. +func IsBlockNonceErr(err error) bool { + _, ok := err.(*BlockNonceErr) + return ok +} + type InvalidTxErr struct { Message string } -- cgit v1.2.3