From 9365706777c4f514884675157e04d47d0e8abbd2 Mon Sep 17 00:00:00 2001 From: Kukks Date: Wed, 16 Sep 2020 11:49:47 +0200 Subject: [PATCH] Add test --- BTCPayServer.Tests/UnitTest1.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index ab03e923d..ef8db1f9e 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -1459,6 +1459,35 @@ namespace BTCPayServer.Tests ); } } + + // [Fact(Timeout = TestTimeout)] + [Fact()] + [Trait("Integration", "Integration")] + public async Task CanSaveKeyPathForOnChainPayments() + { + using var tester = ServerTester.Create(); + await tester.StartAsync(); + var user = tester.NewAccount(); + await user.GrantAccessAsync(); + await user.RegisterDerivationSchemeAsync("BTC"); + + var invoice = await user.BitPay.CreateInvoiceAsync(new Invoice(0.01m, "BTC")); + await tester.WaitForEvent(async () => + { + var tx = await tester.ExplorerNode.SendToAddressAsync( + BitcoinAddress.Create(invoice.BitcoinAddress, Network.RegTest), + Money.Coins(0.01m)); + }); + + + + var payments = Assert.IsType( + Assert.IsType(await user.GetController().Invoice(invoice.Id)).Model) + .Payments; + Assert.Single(payments); + var paymentData = payments.First().GetCryptoPaymentData() as BitcoinLikePaymentData; + Assert.NotNull(paymentData.KeyPath); + } [Fact(Timeout = TestTimeout)] [Trait("Fast", "Fast")]