Skip to content

Commit

Permalink
Eclair-related updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisreimann committed Dec 14, 2022
1 parent 9ed88c7 commit d9efec3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/BTCPayServer.Lightning.Eclair/EclairClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
using System.Threading.Tasks;
using BTCPayServer.Lightning.Eclair.Models;
using NBitcoin;
using NBitcoin.Protocol;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;

namespace BTCPayServer.Lightning.Eclair
{
Expand All @@ -21,7 +19,7 @@ public class EclairClient
private readonly string _username;
private readonly string _password;
private readonly HttpClient _httpClient;
private static readonly HttpClient SharedClient = new HttpClient();
private static readonly HttpClient SharedClient = new ();

public Network Network { get; }

Expand Down
2 changes: 1 addition & 1 deletion src/BTCPayServer.Lightning.Eclair/EclairLightningClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public async Task<LightningNodeBalance> GetBalance(CancellationToken cancellatio
{
Opening =
global.Offchain.WaitForFundingConfirmed +
global.Offchain.WaitForFundingLocked +
global.Offchain.WaitForChannelReady +
global.Offchain.WaitForPublishFutureCommitment,
Local = global.Offchain.Normal.ToLocal,
Remote = usable.Sum(channel => channel.CanReceive),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class GlobalOffchainBalance
[JsonConverter(typeof(LightMoneyJsonConverter))]
public LightMoney WaitForFundingConfirmed { get; set; }

[JsonProperty("waitForFundingLocked")]
[JsonProperty("waitForChannelReady")]
[JsonConverter(typeof(LightMoneyJsonConverter))]
public LightMoney WaitForFundingLocked { get; set; }
public LightMoney WaitForChannelReady { get; set; }

[JsonProperty("waitForPublishFutureCommitment")]
[JsonConverter(typeof(LightMoneyJsonConverter))]
Expand Down
6 changes: 5 additions & 1 deletion tests/CommonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public async Task CanCreateInvoice()
retrievedInvoice = await client.Client.GetInvoice("lol");
Assert.Null(retrievedInvoice);

await Task.Delay(1000);

var invoices = await client.Client.ListInvoices();
Assert.Contains(invoices, invoice => invoice.Id == createdInvoice.Id);

Expand Down Expand Up @@ -290,7 +292,7 @@ public async Task CanGetBalance()
Assert.InRange(balance.OffchainBalance.Remote, lowerBound, upperBound);
Assert.Equal(LightMoney.Zero, balance.OffchainBalance.Closing);
Logs.Tester.LogInformation($"{test.Name}: {Pretty(balance)}");
if (!(client is EclairLightningClient))
if (client is not EclairLightningClient)
{
// make sure we catch msat/sat bugs
// Eclair can't check this, because it uses the same wallet as bitcoin core
Expand Down Expand Up @@ -502,6 +504,8 @@ public async Task CanPayInvoiceAndReceive()
Assert.Equal(amount, paidInvoice.Amount);
Assert.Equal(amount, paidInvoice.AmountReceived);

await Task.Delay(1000);

// check invoices lists: not present in pending, but in general list
var onlyPending = new ListInvoicesParams { PendingOnly = true };
var invoices = await test.Merchant.ListInvoices(onlyPending);
Expand Down
4 changes: 2 additions & 2 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ services:
eclair:
restart: unless-stopped
stop_signal: SIGKILL
image: acinq/eclair:latest
image: acinq/eclair:release-0.8.0
environment:
JAVA_OPTS: |
-Xmx256m
Expand Down Expand Up @@ -223,7 +223,7 @@ services:
eclair_dest:
restart: unless-stopped
stop_signal: SIGKILL
image: acinq/eclair:latest
image: acinq/eclair:release-0.8.0
environment:
JAVA_OPTS: |
-Xmx256m
Expand Down

0 comments on commit d9efec3

Please sign in to comment.