Skip to content

Commit

Permalink
Merge branch 'develop' into query-cctx-by-status
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD authored Nov 17, 2023
2 parents 9f5441b + 10308d1 commit ad721df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [1372](https://github.com/zeta-chain/node/pull/1372) - Include Event Index as part for inbound tx digest
* [1367](https://github.com/zeta-chain/node/pull/1367) - fix minRelayTxFee issue and check misuse of bitcoin mainnet/testnet addresses
* [1358](https://github.com/zeta-chain/node/pull/1358) - add a new thread to zetaclient which checks zeta supply in all connected chains in every block
* [1406](https://github.com/zeta-chain/node/pull/1406) - improve log prints and speed up evm outtx inclusion

### Refactoring

Expand Down
33 changes: 15 additions & 18 deletions zetaclient/evm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
common.CoinType_Cmd,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce)
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
return true, true, nil
Expand All @@ -345,7 +345,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
common.CoinType_Gas,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce)
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
return true, true, nil
Expand All @@ -365,7 +365,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
common.CoinType_Gas,
)
if err != nil {
logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash)
logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s cctx %s nonce %d", zetaTxHash, sendHash, nonce)
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce)
return true, true, nil
Expand Down Expand Up @@ -410,7 +410,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
common.CoinType_Zeta,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce)
continue
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
Expand Down Expand Up @@ -446,7 +446,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
common.CoinType_Zeta,
)
if err != nil {
logger.Err(err).Msg("error posting confirmation to meta core")
logger.Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce)
continue
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", metaHash, sendHash, nonce)
Expand Down Expand Up @@ -474,7 +474,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
common.CoinType_Zeta,
)
if err != nil {
logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash)
logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce)
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce)
return true, true, nil
Expand Down Expand Up @@ -512,7 +512,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
common.CoinType_ERC20,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce)
continue
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
Expand Down Expand Up @@ -588,35 +588,32 @@ func (ob *EVMChainClient) observeOutTx() {
if nonceInt < lowestOutTxNonceToObserve[ob.chain.ChainId] {
continue
}
TXHASHLOOP:
ob.Mu.Lock()
_, found := ob.outTXConfirmedReceipts[ob.GetTxID(nonceInt)]
ob.Mu.Unlock()
if found { // Go to next tracker if this one has already been confirmed
continue
}
for _, txHash := range tracker.HashList {
//inTimeout := time.After(3000 * time.Millisecond)
select {
case <-outTimeout:
ob.logger.ObserveOutTx.Warn().Msgf("observeOutTx timeout on chain %d nonce %d", ob.chain.ChainId, nonceInt)
break TRACKERLOOP
default:
ob.Mu.Lock()
_, found := ob.outTXConfirmedReceipts[ob.GetTxID(nonceInt)]
ob.Mu.Unlock()
if found {
continue
}

receipt, transaction, err := ob.queryTxByHash(txHash.TxHash, nonceInt)
time.Sleep(time.Duration(rpcRestTime) * time.Millisecond)
if err == nil && receipt != nil { // confirmed
ob.Mu.Lock()
ob.outTXConfirmedReceipts[ob.GetTxID(nonceInt)] = receipt
ob.outTXConfirmedTransaction[ob.GetTxID(nonceInt)] = transaction
ob.Mu.Unlock()
ob.logger.ObserveOutTx.Info().Msgf("observeOutTx confirmed outTx %s for chain %d nonce %d", txHash.TxHash, ob.chain.ChainId, nonceInt)

break TXHASHLOOP
break
}
if err != nil {
ob.logger.ObserveOutTx.Debug().Err(err).Msgf("error queryTxByHash: chain %s hash %s", ob.chain.String(), txHash.TxHash)
}
//<-inTimeout
}
}
}
Expand Down

0 comments on commit ad721df

Please sign in to comment.