-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { LoadTestSettingsFromEnv } from "../services/main/settings.js" | ||
import { BitcoinCoreWrapper } from "./bitcoinCore.js" | ||
import LND from '../services/lnd/lnd.js' | ||
export const prepareNetwork = async () => { | ||
|
||
const settings = LoadTestSettingsFromEnv() | ||
const core = new BitcoinCoreWrapper(settings) | ||
await core.InitAddress() | ||
await core.Mine(1) | ||
const lnd = new LND(settings.lndSettings, () => { }, () => { }, () => { }, () => { }) | ||
for (let i = 0; i < 10; i++) { | ||
try { | ||
const info = await lnd.GetInfo() | ||
if (!info.syncedToChain) { | ||
throw new Error("not synced to chain") | ||
} | ||
if (!info.syncedToGraph) { | ||
throw new Error("not synced to graph") | ||
} | ||
return | ||
} catch (e) { | ||
console.log("waiting for lnd to be ready") | ||
await new Promise(resolve => setTimeout(resolve, 1000)) | ||
} | ||
} | ||
throw new Error("lnd is not ready after 10 seconds") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters