Skip to content

Commit

Permalink
Handle trongrid error
Browse files Browse the repository at this point in the history
  • Loading branch information
lok52 committed Jan 13, 2024
1 parent 415308b commit 11f15f5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions zp-relayer/services/network/tron/TronTxManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,21 @@ export class TronTxManager implements TransactionManager<Network.Tron> {
const txObject = await this.tronWeb.transactionBuilder.triggerSmartContract(txDesc.to, txDesc.func, options, [])
const signedTx = await this.tronWeb.trx.sign(txObject.transaction, this.pk)

let info
let info = null
const res = await this.tronWeb.trx.sendRawTransaction(signedTx)
const txHash = res.transaction.txID
await onSend(txHash)

while (1) {
await sleep(1000)
info = await this.confirmTx(txHash)
await sleep(5000)

try {
info = await this.confirmTx(txHash)
} catch (e) {
logger.error('Failed to fetch transaction info, waiting...:', e)
continue
}

if (info === null) {
logger.info('Tx not included, waiting...')
continue
Expand Down

0 comments on commit 11f15f5

Please sign in to comment.