mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-13 11:35:51 +01:00
Do not generate new address when a new payment is detected (#4984)
* Do not generate new address when a new payment is detected * Update BTCPayServer.Tests/UnitTest1.cs Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> --------- Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
This commit is contained in:
parent
52e108d32f
commit
acf003b1b4
2 changed files with 1 additions and 15 deletions
|
@ -2146,7 +2146,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));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue