diff options
author | bojie <bojie@dexon.org> | 2018-11-26 09:16:12 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 13:49:57 +0800 |
commit | 7d3d9d7e6167327d86ba58009b3bb00c857c1b0e (patch) | |
tree | 28fbd4f3514f7aecd9a25a197650be6179c128e6 /dex | |
parent | 14f931e2f6d7aa849ceccb0d0e7fd5ff160f3feb (diff) | |
download | dexon-7d3d9d7e6167327d86ba58009b3bb00c857c1b0e.tar dexon-7d3d9d7e6167327d86ba58009b3bb00c857c1b0e.tar.gz dexon-7d3d9d7e6167327d86ba58009b3bb00c857c1b0e.tar.bz2 dexon-7d3d9d7e6167327d86ba58009b3bb00c857c1b0e.tar.lz dexon-7d3d9d7e6167327d86ba58009b3bb00c857c1b0e.tar.xz dexon-7d3d9d7e6167327d86ba58009b3bb00c857c1b0e.tar.zst dexon-7d3d9d7e6167327d86ba58009b3bb00c857c1b0e.zip |
app: skip tx which has been confirmed (#45)
* app: skip tx which has been confirmed
* fixup! app: skip tx which has been confirmed
Diffstat (limited to 'dex')
-rw-r--r-- | dex/app.go | 17 |
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) |