aboutsummaryrefslogtreecommitdiffstats
path: root/core/state_transition.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/state_transition.go')
-rw-r--r--core/state_transition.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/state_transition.go b/core/state_transition.go
index bab4540be..e7a068589 100644
--- a/core/state_transition.go
+++ b/core/state_transition.go
@@ -18,7 +18,6 @@ package core
import (
"errors"
- "fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
@@ -197,8 +196,11 @@ func (st *StateTransition) preCheck() error {
// Make sure this transaction's nonce is correct
if msg.CheckNonce() {
- if n := st.state.GetNonce(sender.Address()); n != msg.Nonce() {
- return fmt.Errorf("invalid nonce: have %d, expected %d", msg.Nonce(), n)
+ nonce := st.state.GetNonce(sender.Address())
+ if nonce < msg.Nonce() {
+ return ErrNonceTooHigh
+ } else if nonce > msg.Nonce() {
+ return ErrNonceTooLow
}
}
return st.buyGas()