core: make txpool operate on immutable state
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user