aboutsummaryrefslogtreecommitdiffstats
path: root/core/transaction_pool.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-09-18 17:59:21 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-09-18 17:59:21 +0800
commitb60a27627b32dd0e76269732b834ece1fe7d5c3a (patch)
treee43414be9c8c3aa122ba9934cfece0ef4e730eb6 /core/transaction_pool.go
parent985b5f29ed18eac6a36d569edbde6dcfde8d1ab0 (diff)
downloaddexon-b60a27627b32dd0e76269732b834ece1fe7d5c3a.tar
dexon-b60a27627b32dd0e76269732b834ece1fe7d5c3a.tar.gz
dexon-b60a27627b32dd0e76269732b834ece1fe7d5c3a.tar.bz2
dexon-b60a27627b32dd0e76269732b834ece1fe7d5c3a.tar.lz
dexon-b60a27627b32dd0e76269732b834ece1fe7d5c3a.tar.xz
dexon-b60a27627b32dd0e76269732b834ece1fe7d5c3a.tar.zst
dexon-b60a27627b32dd0e76269732b834ece1fe7d5c3a.zip
core: transaction nonce recovery fix
When the transaction state recovery kicked in it assigned the last (incorrect) nonce to the pending state which caused transactions with the same nonce to occur. Added test for nonce recovery
Diffstat (limited to 'core/transaction_pool.go')
-rw-r--r--core/transaction_pool.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/transaction_pool.go b/core/transaction_pool.go
index 42e26b3b3..513600be3 100644
--- a/core/transaction_pool.go
+++ b/core/transaction_pool.go
@@ -121,8 +121,8 @@ func (pool *TxPool) resetState() {
if addr, err := tx.From(); err == nil {
// Set the nonce. Transaction nonce can never be lower
// than the state nonce; validatePool took care of that.
- if pool.pendingState.GetNonce(addr) < tx.Nonce() {
- pool.pendingState.SetNonce(addr, tx.Nonce())
+ if pool.pendingState.GetNonce(addr) <= tx.Nonce() {
+ pool.pendingState.SetNonce(addr, tx.Nonce()+1)
}
}
}