Skip to content

Commit

Permalink
bugfix: dropped tx for some special chains
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Nov 29, 2024
1 parent b0eb6d0 commit b20b2d8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/relayer/relayer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,9 @@ export class RelayerService implements OnModuleInit {
transactionInfo = await chainInfo.provider.checkPendingTransaction(
chainInfo.txHashCache
);
// may be query error
if (transactionInfo === null) {
// maybe query error
// if confirmedBlock always zero, maybe the tx dropped from the tx pool
if (transactionInfo === null || transactionInfo.confirmedBlock === 0) {
chainInfo.checkTimes += 1;
// if always query null, maybe reorg or replaced
if (chainInfo.checkTimes >= this.maxWaitingPendingTimes) {
Expand All @@ -557,6 +558,11 @@ export class RelayerService implements OnModuleInit {
chainInfo.txHashCache = null;
chainInfo.checkTimes = 0;
}
if (transactionInfo !== null) {
this.logger.log(
`the tx is pending, waiting for confirmed, txHash: ${chainInfo.txHashCache}, ${transactionInfo.confirmedBlock}, ${transactionInfo.nonce}`
);
}
return true;
} else {
chainInfo.checkTimes = 0;
Expand All @@ -577,11 +583,6 @@ export class RelayerService implements OnModuleInit {
chainInfo.txHashCache = null;
return false;
}
} else {
this.logger.log(
`the tx is pending, waiting for confirmed, txHash: ${chainInfo.txHashCache}, ${transactionInfo.confirmedBlock}, ${transactionInfo.nonce}`
);
return true;
}
}
return false;
Expand Down

0 comments on commit b20b2d8

Please sign in to comment.