mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 01:43:50 +01:00
attempt EnsureNewLightningInvoiceOnPartialPayment test fix
This commit is contained in:
parent
d1ea4e4fa4
commit
119ab7b2c0
@ -95,9 +95,9 @@ namespace BTCPayServer.Tests
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task EventuallyAsync(Func<Task> act)
|
||||
public static async Task EventuallyAsync(Func<Task> act, int delay = 20000)
|
||||
{
|
||||
CancellationTokenSource cts = new CancellationTokenSource(20000);
|
||||
CancellationTokenSource cts = new CancellationTokenSource(delay);
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
@ -107,7 +107,7 @@ namespace BTCPayServer.Tests
|
||||
}
|
||||
catch (XunitException) when (!cts.Token.IsCancellationRequested)
|
||||
{
|
||||
await Task.Delay(500);
|
||||
await Task.Delay(500, cts.Token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1020,16 +1020,16 @@ namespace BTCPayServer.Tests
|
||||
}, e => e.InvoiceId == invoice.Id && e.PaymentMethodId.PaymentType == LightningPaymentType.Instance );
|
||||
await tester.ExplorerNode.GenerateAsync(1);
|
||||
Invoice newInvoice = null;
|
||||
await Task.Delay(100); // wait a bit for payment to process before fetching new invoice
|
||||
await TestUtils.EventuallyAsync(async () =>
|
||||
{
|
||||
await Task.Delay(1000); // wait a bit for payment to process before fetching new invoice
|
||||
newInvoice = await user.BitPay.GetInvoiceAsync(invoice.Id);
|
||||
var newBolt11 = newInvoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
||||
var oldBolt11 = invoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
||||
Assert.NotEqual(newBolt11, oldBolt11);
|
||||
Assert.Equal(newInvoice.BtcDue.GetValue(),
|
||||
BOLT11PaymentRequest.Parse(newBolt11, Network.RegTest).MinimumAmount.ToDecimal(LightMoneyUnit.BTC));
|
||||
});
|
||||
}, 40000);
|
||||
|
||||
Logs.Tester.LogInformation($"Paying invoice {newInvoice.Id} remaining due amount {newInvoice.BtcDue.GetValue()} via lightning");
|
||||
var evt = await tester.WaitForEvent<InvoiceDataChangedEvent>(async () =>
|
||||
|
Loading…
Reference in New Issue
Block a user