aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2018-11-26 09:16:12 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 20:54:27 +0800
commit8b0b015937c02207df440eee6e4c96eec846fae6 (patch)
treebc3b5d083a5877bc6987b63181ea40e64370c9b6
parente66378fba05e590fac8fafd4ac8026aedd2869b7 (diff)
downloaddexon-8b0b015937c02207df440eee6e4c96eec846fae6.tar
dexon-8b0b015937c02207df440eee6e4c96eec846fae6.tar.gz
dexon-8b0b015937c02207df440eee6e4c96eec846fae6.tar.bz2
dexon-8b0b015937c02207df440eee6e4c96eec846fae6.tar.lz
dexon-8b0b015937c02207df440eee6e4c96eec846fae6.tar.xz
dexon-8b0b015937c02207df440eee6e4c96eec846fae6.tar.zst
dexon-8b0b015937c02207df440eee6e4c96eec846fae6.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)