aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-07-12 21:07:15 +0800
committerGitHub <noreply@github.com>2016-07-12 21:07:15 +0800
commitf970610c0442a7a4582529c01fb67403cea8bcd6 (patch)
tree332e554e86c45fb116a8f4337877356e7f79a46d /core
parent68b48cc045c31a3ae321e923194007ad036cf3f0 (diff)
parent00787fe7818b7baaa95ef7928b5101df2d052dce (diff)
downloaddexon-f970610c0442a7a4582529c01fb67403cea8bcd6.tar
dexon-f970610c0442a7a4582529c01fb67403cea8bcd6.tar.gz
dexon-f970610c0442a7a4582529c01fb67403cea8bcd6.tar.bz2
dexon-f970610c0442a7a4582529c01fb67403cea8bcd6.tar.lz
dexon-f970610c0442a7a4582529c01fb67403cea8bcd6.tar.xz
dexon-f970610c0442a7a4582529c01fb67403cea8bcd6.tar.zst
dexon-f970610c0442a7a4582529c01fb67403cea8bcd6.zip
Merge pull request #2799 from zsfelfoldi/api-nonce-fix2
core: added CheckNonce() to Message interface
Diffstat (limited to 'core')
-rw-r--r--core/state_transition.go7
-rw-r--r--core/types/transaction.go1
2 files changed, 6 insertions, 2 deletions
diff --git a/core/state_transition.go b/core/state_transition.go
index c8160424b..9e6b2f567 100644
--- a/core/state_transition.go
+++ b/core/state_transition.go
@@ -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
diff --git a/core/types/transaction.go b/core/types/transaction.go
index b99d3a716..c71c98aa7 100644
--- a/core/types/transaction.go
+++ b/core/types/transaction.go
@@ -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 {