aboutsummaryrefslogtreecommitdiffstats
path: root/dex/app.go
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2018-11-26 09:16:12 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit82d138debeac23029d3640ee7bc31c4ed093ff28 (patch)
treee905fc680b618c44e44be3efbc75e4bf626b82a3 /dex/app.go
parentc4e8d9e1778aacbcc170a39e4b60c1f2ed60b6ee (diff)
downloadgo-tangerine-82d138debeac23029d3640ee7bc31c4ed093ff28.tar
go-tangerine-82d138debeac23029d3640ee7bc31c4ed093ff28.tar.gz
go-tangerine-82d138debeac23029d3640ee7bc31c4ed093ff28.tar.bz2
go-tangerine-82d138debeac23029d3640ee7bc31c4ed093ff28.tar.lz
go-tangerine-82d138debeac23029d3640ee7bc31c4ed093ff28.tar.xz
go-tangerine-82d138debeac23029d3640ee7bc31c4ed093ff28.tar.zst
go-tangerine-82d138debeac23029d3640ee7bc31c4ed093ff28.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/app.go')
-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)