fix inconsistent result of labels in greenfield compared to ui wallets tx list

This commit is contained in:
Kukks 2022-12-14 15:57:18 +01:00
parent 5b7b217b9c
commit e5c7fc93e2
No known key found for this signature in database
GPG key ID: 8E5530D9D1C93097

View file

@ -307,11 +307,18 @@ namespace BTCPayServer.Controllers.Greenfield
var walletId = new WalletId(storeId, cryptoCode); var walletId = new WalletId(storeId, cryptoCode);
var utxos = await wallet.GetUnspentCoins(derivationScheme.AccountDerivation); var utxos = await wallet.GetUnspentCoins(derivationScheme.AccountDerivation);
var walletTransactionsInfoAsync = await _walletRepository.GetWalletTransactionsInfo(walletId, var walletTransactionsInfoAsync = await _walletRepository.GetWalletTransactionsInfo(walletId,
utxos.Select(u => u.OutPoint.Hash.ToString()).ToHashSet().ToArray()); utxos.SelectMany(GetWalletObjectsQuery.Get).Distinct().ToArray());
return Ok(utxos.Select(coin => return Ok(utxos.Select(coin =>
{ {
walletTransactionsInfoAsync.TryGetValue(coin.OutPoint.Hash.ToString(), out var info); walletTransactionsInfoAsync.TryGetValue(coin.OutPoint.Hash.ToString(), out var info);
walletTransactionsInfoAsync.TryGetValue(coin.ScriptPubKey.ToHex(), out var info2);
if (info is not null && info2 is not null)
{
info.Merge(info2);
}
info ??= info2;
return new OnChainWalletUTXOData() return new OnChainWalletUTXOData()
{ {