diff --git a/offchain-modules/src/packages/handlers/ckb.ts b/offchain-modules/src/packages/handlers/ckb.ts index 9ca41ca7..4686dff9 100644 --- a/offchain-modules/src/packages/handlers/ckb.ts +++ b/offchain-modules/src/packages/handlers/ckb.ts @@ -181,7 +181,7 @@ export class CkbHandler { const firstInputLock = txPrevious.transaction.outputs[Number(tx.inputs[0].previousOutput.index)].lock; const firstInputLockHash = this.ckb.utils.scriptToHash(firstInputLock); - logger.debug( + logger.info( `CkbHandler isMintTx tx ${tx.hash} sender lock hash is ${firstInputLockHash}. first output type code hash is ${firstOutputTypeCodeHash}.`, ); return firstInputLockHash === committeeLockHash; @@ -281,12 +281,23 @@ export class CkbHandler { const rawTx = await generator.mint(await account.getLockscript(), records); const signedTx = this.ckb.signTransaction(this.PRI_KEY)(rawTx); const mintTxHash = await this.ckb.rpc.sendTransaction(signedTx); - mintRecords.map((r) => { - r.mintHash = mintTxHash; - }); logger.info( `CkbHandler handleMintRecords Mint Transaction has been sent, ckbTxHash ${mintTxHash}, mintIds:${mintIds}`, ); + const txStatus = await this.waitUntilCommitted(mintTxHash, 200); + if (txStatus.txStatus.status === 'committed') { + mintRecords.map((r) => { + r.status = 'success'; + r.mintHash = mintTxHash; + }); + } else { + mintRecords.map((r) => { + r.mintHash = mintTxHash; + }); + logger.error( + `CkbHandler handleMintRecords mint execute failed txStatus:${txStatus.txStatus.status}, mintIds:${mintIds}`, + ); + } await this.db.updateCkbMint(mintRecords); logger.info('CkbHandler handleMintRecords mint execute completed, mintIds:', mintIds); } catch (e) { diff --git a/offchain-modules/src/scripts/integration-test/tron.ts b/offchain-modules/src/scripts/integration-test/tron.ts index 80f414ab..7b4fc266 100644 --- a/offchain-modules/src/scripts/integration-test/tron.ts +++ b/offchain-modules/src/scripts/integration-test/tron.ts @@ -239,7 +239,7 @@ async function main() { //await checkEffect(trc20TxHash, 'TVWvkCasxAJUyzPKMQ2Rus1NtmBwrkVyBR', 'trc20'); } catch (e) { - logger.warn(`The tron component integration not pass yet. i:${i} error:${e.toString()}`); + logger.warn(`The tron component integration not pass yet. i:${i} error:`, e); continue; } logger.info('The tron component integration test pass!');