Skip to content

Commit

Permalink
Don’t try to remove non-existent listener
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Mar 7, 2024
1 parent 5c6eb7e commit 2c98c1d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/submit-transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ async function submitTransaction(transactionData) {
const { transaction, outcome } = await new Promise((resolve, reject) => {
let blockCallback;
const subscribe = () => txEventEmitter.on('block', blockCallback);
const unsubscribe = () => (txEventEmitter.off('block', blockCallback), blockCallback = null);
setTimeout(() => blockCallback && (unsubscribe(), reject(new Error(`Taking more than ${SUBMIT_TOTAL_TIMEOUT}ms to submit transaction`))), SUBMIT_TOTAL_TIMEOUT);
const unsubscribe = () => blockCallback && (txEventEmitter.off('block', blockCallback), blockCallback = null);
setTimeout(() => (unsubscribe(), reject(new Error(`Taking more than ${SUBMIT_TOTAL_TIMEOUT}ms to submit transaction`))), SUBMIT_TOTAL_TIMEOUT);

// NOTE: This is necessary in case transaction already landed before but we don't know
setTimeout(async function checkStatus() {
Expand Down

0 comments on commit 2c98c1d

Please sign in to comment.