aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2018-11-26 09:16:12 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commitb4f183ba63e3ab5dccc6371faaa57c77b61e967b (patch)
treea161847350c089d758345ef2bc3ca0478f283a15 /dex
parentd62dfb921dd1017ca5e14a6f66f4de093ed388f9 (diff)
downloaddexon-b4f183ba63e3ab5dccc6371faaa57c77b61e967b.tar.gz
dexon-b4f183ba63e3ab5dccc6371faaa57c77b61e967b.tar.zst
dexon-b4f183ba63e3ab5dccc6371faaa57c77b61e967b.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.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)