aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2018-11-26 09:16:12 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:54 +0800
commitc11db35c2d3f5ca5f4b5749294e154f10ef6b1c1 (patch)
treeddab79958f33d9ee38ed0135d0ca557970017e54
parent3e84657f0688c9edfd9068915e318b6ba16e8bfa (diff)
downloaddexon-c11db35c2d3f5ca5f4b5749294e154f10ef6b1c1.tar.gz
dexon-c11db35c2d3f5ca5f4b5749294e154f10ef6b1c1.tar.zst
dexon-c11db35c2d3f5ca5f4b5749294e154f10ef6b1c1.zip
app: skip tx which has been confirmed (#45)
* app: skip tx which has been confirmed * fixup! app: skip tx which has been confirmed
-rw-r--r--dex/app.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/dex/app.go b/dex/app.go
index df76b2b7d..623bb8dff 100644
--- a/dex/app.go
+++ b/dex/app.go
@@ -200,16 +200,15 @@ addressMap:
expectNonce = lastConfirmedNonce + 1
}
- for _, tx := range txs {
- if expectNonce == tx.Nonce() {
- expectNonce++
- } else if expectNonce < tx.Nonce() {
- break
- } else if expectNonce > tx.Nonce() {
- log.Debug("Skipping tx with smaller nonce then expected", "expected", expectNonce, "nonce", tx.Nonce())
- continue
- }
+ if len(txs) == 0 {
+ continue
+ }
+
+ firstNonce := txs[0].Nonce()
+ startIndex := int(expectNonce - firstNonce)
+ for i := startIndex; i < len(txs); i++ {
+ tx := txs[i]
intrGas, err := core.IntrinsicGas(tx.Data(), tx.To() == nil, true)
if err != nil {
log.Error("Failed to calculate intrinsic gas", "error", err)