Skip to content

Commit

Permalink
format and more waits
Browse files Browse the repository at this point in the history
  • Loading branch information
rsafier committed Mar 29, 2024
1 parent 4b69113 commit 1d14518
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion LNUnit.Tests/AbcLightningFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,9 @@ public async Task SendMany_Onchain()

alice.LightningClient.SendMany(sendManyRequest);

Builder.NewBlock(10); //fast forward in time
await Builder.NewBlock(10); //fast forward in time

await Builder.WaitUntilSyncedToChain("alice");
//verify last address got funds
var unspend = alice.LightningClient.ListUnspent(new ListUnspentRequest() { });
var confirmedAddresses = new List<string>();
Expand Down
9 changes: 7 additions & 2 deletions LNUnit/Setup/LNUnitBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ await GetTarStreamFromFS(n.DockerContainerId,
IsBuilt = true;
}

private static async Task WaitUntilSyncedToChain(LNDNodeConnection node)
public static async Task WaitUntilSyncedToChain(LNDNodeConnection node)
{
var info = new GetInfoResponse();
while (!info.SyncedToChain)
Expand All @@ -416,6 +416,10 @@ private static async Task WaitUntilSyncedToChain(LNDNodeConnection node)
}
}

public async Task WaitUntilSyncedToChain(string alias)
{
await WaitUntilSyncedToChain(await GetNodeFromAlias(alias));
}

public async Task<LNDSettings> GetLNDSettingsFromContainer(string containerId, string lndRoot = "/home/lnd/.lnd")
{
Expand Down Expand Up @@ -642,7 +646,8 @@ public async Task RestartByAlias(string alias, uint waitBeforeKillSeconds = 1, b
c.ChannelPoint = channelPoint;
//Move things along so it is confirmed
await BitcoinRpcClient.GenerateAsync(10);

await this.WaitUntilSyncedToChain(alias);
await this.WaitGraphReady(alias, this.LNDNodePool.TotalNodes);
//Set fees & htlcs, TLD
var policyUpdateResponse = await node.LightningClient.UpdateChannelPolicyAsync(
new PolicyUpdateRequest
Expand Down

0 comments on commit 1d14518

Please sign in to comment.