diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 08f01b3fb..271eaa000 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -761,7 +761,7 @@ namespace BTCPayServer.Tests await user.GrantAccessAsync(); await user.RegisterDerivationSchemeAsync("BTC"); await user.RegisterLightningNodeAsync("BTC", LightningConnectionType.CLightning); - + user.SetNetworkFeeMode(NetworkFeeMode.Never); var invoice = await user.BitPay.CreateInvoiceAsync(new Invoice(0.01m, "BTC")); await tester.WaitForEvent(async () => { @@ -769,9 +769,27 @@ namespace BTCPayServer.Tests BitcoinAddress.Create(invoice.BitcoinAddress, Network.RegTest), Money.Coins(0.005m)); }); - var localInvoice = await user.BitPay.GetInvoiceAsync(invoice.Id); - Assert.NotEqual(invoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11, - localInvoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11); + var 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)); + var evt = await tester.WaitForEvent(async () => + { + await tester.SendLightningPaymentAsync(newInvoice); + }); + Assert.Equal(evt.InvoiceId, invoice.Id); + Assert.Equal(InvoiceStatus.Complete, evt.State.Status); + Assert.Equal(InvoiceExceptionStatus.None, evt.State.ExceptionStatus); + + evt = await tester.WaitForEvent(async () => + { + await tester.SendLightningPaymentAsync(invoice); + }); + + Assert.Equal(evt.InvoiceId, invoice.Id); + Assert.Equal(InvoiceStatus.Invalid, evt.State.Status); + Assert.Equal(InvoiceExceptionStatus.PaidOver, evt.State.ExceptionStatus); } [Fact(Timeout = 60 * 2 * 1000)]