From 338024033d0a85d8041ca07735176f65ed1524ff Mon Sep 17 00:00:00 2001 From: janniks Date: Thu, 1 Aug 2024 22:54:15 +0200 Subject: [PATCH] chore: more timeout --- src/helpers.ts | 11 +++++------ src/tests/regtest.test.ts | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index 4df92a8..5021545 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -276,21 +276,20 @@ export async function waitForBurnBlockHeight( burnBlockHeight: number, interval: number = ENV.POLL_INTERVAL ): Promise { - await timeout(100); // let the env catch up - let lastHeight = -1; let lastHeightTime = Date.now(); while (true) { const currentHeight = await getBurnBlockHeight(); - if (currentHeight >= burnBlockHeight) break; + if (currentHeight >= burnBlockHeight) { + console.log(`block height ${currentHeight} (reached)`); + break; + } if (currentHeight === lastHeight) { if (Date.now() - lastHeightTime > ENV.BITCOIN_TX_TIMEOUT) { - throw new Error( - `Burn block height hasn't changed for ${ENV.BITCOIN_TX_TIMEOUT / 1000} seconds` - ); + throw `Burn block height hasn't changed for ${ENV.BITCOIN_TX_TIMEOUT / 1000} seconds`; } } else { lastHeight = currentHeight; diff --git a/src/tests/regtest.test.ts b/src/tests/regtest.test.ts index e8bbfcf..6179205 100644 --- a/src/tests/regtest.test.ts +++ b/src/tests/regtest.test.ts @@ -139,7 +139,7 @@ describe('regtest-env pox-4', () => { if (ENV.SKIP_UNLOCK) return; await waitForBurnBlockHeight(info.details.unlock_height + 2); - await timeout(200); + await timeout(400); info = await client.getStatus(); expect(info.stacked).toBeFalsy();