chore: move `checkBlockHeight` into block where it's used

This commit is contained in:
steveluscher 2022-06-07 20:40:01 -07:00
parent 6f6e5172d3
commit 627d91fb20
1 changed files with 8 additions and 9 deletions

View File

@ -3051,15 +3051,6 @@ export class Connection {
} }
}); });
const checkBlockHeight = async () => {
try {
const blockHeight = await this.getBlockHeight(commitment);
return blockHeight;
} catch (_e) {
return -1;
}
};
const expiryPromise = new Promise< const expiryPromise = new Promise<
| {__type: TransactionStatus.BLOCKHEIGHT_EXCEEDED} | {__type: TransactionStatus.BLOCKHEIGHT_EXCEEDED}
| {__type: TransactionStatus.TIMED_OUT; timeoutMs: number} | {__type: TransactionStatus.TIMED_OUT; timeoutMs: number}
@ -3088,6 +3079,14 @@ export class Connection {
} else { } else {
let config = let config =
strategy as BlockheightBasedTransactionConfirmationStrategy; strategy as BlockheightBasedTransactionConfirmationStrategy;
const checkBlockHeight = async () => {
try {
const blockHeight = await this.getBlockHeight(commitment);
return blockHeight;
} catch (_e) {
return -1;
}
};
(async () => { (async () => {
let currentBlockHeight = await checkBlockHeight(); let currentBlockHeight = await checkBlockHeight();
if (done) return; if (done) return;