Skip to content

Commit

Permalink
simulators/ethereum/engine: fix transaction replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Sep 28, 2023
1 parent 01d1559 commit 964f181
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion simulators/ethereum/engine/helper/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,11 @@ func (txSender *TransactionSender) GetLastNonce(ctx context.Context, node client
if txSender.nonceMap != nil {
txSender.nonceMapLock.Lock()
defer txSender.nonceMapLock.Unlock()
return txSender.nonceMap[sender.GetAddress()], nil
nextNonce := txSender.nonceMap[sender.GetAddress()]
if nextNonce > 0 {
return nextNonce - 1, nil
}
return 0, fmt.Errorf("no previous nonce found in map for %s", sender.GetAddress().Hex())
} else {
return node.GetLastAccountNonce(ctx, sender.GetAddress(), header)
}
Expand Down

0 comments on commit 964f181

Please sign in to comment.