mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 05:54:26 +01:00
Make wallet object system much more performant (#5441)
Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
@@ -311,6 +311,7 @@ namespace BTCPayServer.Controllers
|
||||
using (logs.Measure("Saving invoice"))
|
||||
{
|
||||
await _InvoiceRepository.CreateInvoiceAsync(entity, additionalSearchTerms);
|
||||
var links = new List<WalletObjectLinkData>();
|
||||
foreach (var method in paymentMethods)
|
||||
{
|
||||
if (method.GetPaymentMethodDetails() is BitcoinLikeOnChainPaymentMethod bp)
|
||||
@@ -323,18 +324,18 @@ namespace BTCPayServer.Controllers
|
||||
));
|
||||
if (bp.GetDepositAddress(((BTCPayNetwork)method.Network).NBitcoinNetwork) is BitcoinAddress address)
|
||||
{
|
||||
await _walletRepository.EnsureWalletObjectLink(
|
||||
new WalletObjectId(
|
||||
walletId,
|
||||
WalletObjectData.Types.Address,
|
||||
address.ToString()),
|
||||
new WalletObjectId(
|
||||
walletId,
|
||||
WalletObjectData.Types.Invoice,
|
||||
entity.Id));
|
||||
links.Add(WalletRepository.NewWalletObjectLinkData(new WalletObjectId(
|
||||
walletId,
|
||||
WalletObjectData.Types.Address,
|
||||
address.ToString()),
|
||||
new WalletObjectId(
|
||||
walletId,
|
||||
WalletObjectData.Types.Invoice,
|
||||
entity.Id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
await _walletRepository.EnsureCreated(null,links);
|
||||
}
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user