From b60a27627b32dd0e76269732b834ece1fe7d5c3a Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 18 Sep 2015 11:59:21 +0200 Subject: 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 --- core/transaction_pool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/transaction_pool.go') 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) } } } -- cgit v1.2.3