From 4832fa64dd9b24fe23f4688f89974f7843391659 Mon Sep 17 00:00:00 2001 From: charliec Date: Fri, 8 Sep 2023 15:08:17 -0500 Subject: [PATCH] skip old gabbage trackers to unblock EVM chain outbound cctxes --- zetaclient/evm_client.go | 11 +++++++++++ zetaclient/query.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index 5222d82dd2..d14a6784d4 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -406,6 +406,13 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co return false, false, nil } +// The lowest nonce we observe outTx for each chain +var lowestOutTxNonceToObserve = map[int64]uint64{ + 5: 70000, // Goerli + 97: 95000, // BSC testnet + 8001: 120000, // Matic +} + // FIXME: there's a chance that a txhash in OutTxChan may not deliver when Stop() is called // observeOutTx periodically checks all the txhash in potential outbound txs func (ob *EVMChainClient) observeOutTx() { @@ -434,8 +441,12 @@ func (ob *EVMChainClient) observeOutTx() { }) outTimeout := time.After(time.Duration(timeoutNonce) * time.Second) TRACKERLOOP: + // Skip old gabbage trackers as we spent too much time on querying them for _, tracker := range trackers { nonceInt := tracker.Nonce + if nonceInt < lowestOutTxNonceToObserve[ob.chain.ChainId] { + continue + } TXHASHLOOP: for _, txHash := range tracker.HashList { //inTimeout := time.After(3000 * time.Millisecond) diff --git a/zetaclient/query.go b/zetaclient/query.go index 8e4ab27329..9cbc54a207 100644 --- a/zetaclient/query.go +++ b/zetaclient/query.go @@ -259,7 +259,7 @@ func (b *ZetaCoreBridge) GetAllOutTxTrackerByChain(chain common.Chain, order Ord Pagination: &query.PageRequest{ Key: nil, Offset: 0, - Limit: 1000, + Limit: 2000, CountTotal: false, Reverse: false, },