aboutsummaryrefslogtreecommitdiffstats
path: root/core/error.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/error.go
parent43ceb0f5c73dfde8540693a920e144fa67ffcd46 (diff)
downloadgo-tangerine-0b493910d38c4f6ed25a196b0e8071dc2afd1fd6.tar.gz
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/error.go')
-rw-r--r--core/error.go17
1 files changed, 17 insertions, 0 deletions
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
}