chore: move `checkBlockHeight` into block where it's used
This commit is contained in:
parent
6f6e5172d3
commit
627d91fb20
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue