core: added CheckNonce() to Message interface
This commit is contained in:
@ -71,6 +71,7 @@ type Message interface {
|
||||
Value() *big.Int
|
||||
|
||||
Nonce() uint64
|
||||
CheckNonce() bool
|
||||
Data() []byte
|
||||
}
|
||||
|
||||
@ -208,8 +209,10 @@ func (self *StateTransition) preCheck() (err error) {
|
||||
}
|
||||
|
||||
// Make sure this transaction's nonce is correct
|
||||
if n := self.state.GetNonce(sender.Address()); n != msg.Nonce() {
|
||||
return NonceError(msg.Nonce(), n)
|
||||
if msg.CheckNonce() {
|
||||
if n := self.state.GetNonce(sender.Address()); n != msg.Nonce() {
|
||||
return NonceError(msg.Nonce(), n)
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-pay gas
|
||||
|
@ -113,6 +113,7 @@ func (tx *Transaction) Gas() *big.Int { return new(big.Int).Set(tx.data.Gas
|
||||
func (tx *Transaction) GasPrice() *big.Int { return new(big.Int).Set(tx.data.Price) }
|
||||
func (tx *Transaction) Value() *big.Int { return new(big.Int).Set(tx.data.Amount) }
|
||||
func (tx *Transaction) Nonce() uint64 { return tx.data.AccountNonce }
|
||||
func (tx *Transaction) CheckNonce() bool { return true }
|
||||
|
||||
func (tx *Transaction) To() *common.Address {
|
||||
if tx.data.Recipient == nil {
|
||||
|
Reference in New Issue
Block a user