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

@ -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
}