Skip to content

Commit 68a8e45

Browse files
committed
stop ctx
1 parent ddd5bd7 commit 68a8e45

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/krypton/krypton-env.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,7 @@ export async function getKryptonContext(): Promise<KryptonContext> {
436436
});
437437
const api = await startApiServer({ datastore: db, writeDatastore: db, chainId: ChainID.Testnet });
438438
const client = new StacksCoreRpcClient({ host: 'localhost', port: 20443 });
439-
await standByForPoxToBeReady(client);
440-
441439
const stacksNetwork = new StacksTestnet({ url: `http://${client.endpoint}` });
442-
443440
const bitcoinRpcClient = new RPCClient({
444441
url: ENV.BTC_RPC_HOST,
445442
port: ENV.BTC_RPC_PORT,
@@ -458,6 +455,13 @@ export async function getKryptonContext(): Promise<KryptonContext> {
458455
api,
459456
};
460457

458+
try {
459+
await standByForPoxToBeReady(client);
460+
} catch (error) {
461+
await stopKryptonContext(testEnv);
462+
throw error;
463+
}
464+
461465
return testEnv;
462466
}
463467

0 commit comments

Comments
 (0)