Skip to content

Commit

Permalink
skip old gabbage trackers to unblock EVM chain outbound cctxes
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Sep 8, 2023
1 parent d7a7e72 commit 4832fa6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions zetaclient/evm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit 4832fa6

Please sign in to comment.