Skip to content

Commit

Permalink
fix(run.ts): commit transaction not included
Browse files Browse the repository at this point in the history
Fix the issue where the transaction was successfully committed and
a transaction hash was obtained, but the transaction was never included
in a block.

Add a wait mechanism to ensure the transaction is mined or log the
error reason if it fails.
  • Loading branch information
olgahaha committed Jun 14, 2023
1 parent 979e11f commit 60219be
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,14 @@ async function main() {
console.log(`Commit Tx: ${commitResult.hash}`);
console.log(`Commit Explorer: ${blockchain.explorerBaseUrl}/${commitResult.hash}`);

try {
// Wait for the transaction to be mined
const transactionReceipt = await commitResult.wait();
console.log(`Block Number: ${transactionReceipt.blockNumber}`);
} catch (error) {
console.error(`Transaction error: ${error}`);
}

// Reset stage
await setWorkingAssetCid("");

Expand Down

0 comments on commit 60219be

Please sign in to comment.