diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-09-05 03:35:00 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-09-05 18:34:41 +0800 |
commit | da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3 (patch) | |
tree | 01b0266516f76b69ab7d93b0c78e396b3e712600 /core/state_transition.go | |
parent | e7408b5552002df7c3ba6a2351f14c533dfc5a36 (diff) | |
download | go-tangerine-da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3.tar go-tangerine-da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3.tar.gz go-tangerine-da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3.tar.bz2 go-tangerine-da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3.tar.lz go-tangerine-da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3.tar.xz go-tangerine-da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3.tar.zst go-tangerine-da7d57e07c04dcbb7cc20b35f6606ef3f4c400e3.zip |
core: make txpool operate on immutable state
Diffstat (limited to 'core/state_transition.go')
-rw-r--r-- | core/state_transition.go | 8 |
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() |