diff --git a/LNUnit.Tests/AbcLightningFixture.cs b/LNUnit.Tests/AbcLightningFixture.cs index a95b194..1b7bbcf 100644 --- a/LNUnit.Tests/AbcLightningFixture.cs +++ b/LNUnit.Tests/AbcLightningFixture.cs @@ -17,6 +17,7 @@ using ServiceStack.Text; using Assert = NUnit.Framework.Assert; +namespace LNUnit.Fixtures; [TestFixture("postgres")] [TestFixture("boltdb")] @@ -75,13 +76,13 @@ public void Dispose() GC.SuppressFinalize(this); // Remove containers - _client.RemoveContainer(DbContainerName).Wait(); _client.RemoveContainer("miner").Wait(); _client.RemoveContainer("alice").Wait(); _client.RemoveContainer("bob").Wait(); _client.RemoveContainer("carol").Wait(); Builder?.Destroy(); + Builder?.Dispose(); _client.Dispose(); } diff --git a/LNUnit/Setup/LNUnitBuilder.cs b/LNUnit/Setup/LNUnitBuilder.cs index fc31360..3168cf1 100644 --- a/LNUnit/Setup/LNUnitBuilder.cs +++ b/LNUnit/Setup/LNUnitBuilder.cs @@ -26,7 +26,7 @@ public class LNUnitBuilder : IDisposable private readonly ILogger? _logger; private readonly IServiceProvider? _serviceProvider; private bool _loopLNDReady; - private int _waitForBitcoinNodeStartup = 30_000; //ms timeout + public int WaitForBitcoinNodeStartupTimeout { get; set; } = 30_000; //ms timeout public Dictionary ChannelHandlers = new(); public Dictionary InterceptorHandlers = new(); @@ -136,8 +136,9 @@ public async Task Build(bool setupNetwork = false, string lndRoot = "/home/lnd/. bitcoinNode = listContainers.First(x => x.ID == nodeContainer.ID); BitcoinRpcClient = new RPCClient("bitcoin:bitcoin", bitcoinNode.NetworkSettings.Networks.First().Value.IPAddress, Bitcoin.Instance.Regtest); - _waitForBitcoinNodeStartup = 10000; - BitcoinRpcClient.HttpClient.Timeout = TimeSpan.FromMilliseconds(_waitForBitcoinNodeStartup); //10s + WaitForBitcoinNodeStartupTimeout = 30000; + BitcoinRpcClient.HttpClient = new HttpClient() { Timeout = WaitForBitcoinNodeStartupTimeout }; + await BitcoinRpcClient.CreateWalletAsync("default", new CreateWalletOptions { LoadOnStartup = true }); var utxos = await BitcoinRpcClient.GenerateAsync(200); } @@ -838,7 +839,7 @@ public static LNUnitBuilder AddPolarLNDNode(this LNUnitBuilder b, string aliasHo List? channels = null, string bitcoinMinerHost = "miner", string rpcUser = "bitcoin", string rpcPass = "bitcoin", string imageName = "polarlightning/lnd", string tagName = "0.17.4-beta", bool acceptKeysend = true, bool pullImage = true, bool mapTotmp = false, - bool gcInvoiceOnStartup = false, bool gcInvoiceOnFly = false, string postgresDSN = null) + bool gcInvoiceOnStartup = false, bool gcInvoiceOnFly = false, string? postgresDSN = null) { var cmd = new List {