Compare commits

...

2 Commits

Author SHA1 Message Date
a1c965aff4 Update BTCPayServer.Tests/UnitTest1.cs
Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
2023-05-18 16:39:46 +09:00
877adf7d99 Do not generate new address when a new payment is detected 2023-05-18 13:44:08 +09:00
2 changed files with 1 additions and 15 deletions

View File

@ -2154,7 +2154,7 @@ namespace BTCPayServer.Tests
txFee = localInvoice.BtcDue - invoice.BtcDue;
Assert.Equal("paidPartial", localInvoice.ExceptionStatus.ToString());
Assert.Equal(1, localInvoice.CryptoInfo[0].TxCount);
Assert.NotEqual(localInvoice.BitcoinAddress, invoice.BitcoinAddress); //New address
Assert.Equal(localInvoice.BitcoinAddress, invoice.BitcoinAddress); //Same address
Assert.True(IsMapped(invoice, ctx));
Assert.True(IsMapped(localInvoice, ctx));

View File

@ -414,20 +414,6 @@ namespace BTCPayServer.Payments.Bitcoin
if (invoice == null)
return null;
var paymentMethod = invoice.GetPaymentMethod(wallet.Network, PaymentTypes.BTCLike);
if (paymentMethod != null &&
paymentMethod.GetPaymentMethodDetails() is BitcoinLikeOnChainPaymentMethod btc &&
btc.Activated &&
btc.GetDepositAddress(wallet.Network.NBitcoinNetwork).ScriptPubKey == paymentData.ScriptPubKey &&
paymentMethod.Calculate().Due > Money.Zero)
{
var address = await wallet.ReserveAddressAsync(invoice.StoreId, strategy, "invoice");
btc.DepositAddress = address.Address.ToString();
btc.KeyPath = address.KeyPath;
await _InvoiceRepository.NewPaymentDetails(invoice.Id, btc, wallet.Network);
_Aggregator.Publish(new InvoiceNewPaymentDetailsEvent(invoice.Id, btc, paymentMethod.GetId()));
paymentMethod.SetPaymentMethodDetails(btc);
invoice.SetPaymentMethod(paymentMethod);
}
wallet.InvalidateCache(strategy);
_Aggregator.Publish(new InvoiceEvent(invoice, InvoiceEvent.ReceivedPayment) { Payment = payment });
return invoice;