mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Merge 489b587669 into merged_master (Bitcoin PR bitcoin/bitcoin#25215)
This commit is contained in:
commit
fe8d041f9f
9 changed files with 29 additions and 26 deletions
10
src/rest.cpp
10
src/rest.cpp
|
|
@ -812,10 +812,10 @@ static bool rest_getutxos(const std::any& context, HTTPRequest* req, const std::
|
|||
if (!maybe_chainman) return false;
|
||||
ChainstateManager& chainman = *maybe_chainman;
|
||||
{
|
||||
auto process_utxos = [&vOutPoints, &outs, &hits](const CCoinsView& view, const CTxMemPool& mempool) {
|
||||
auto process_utxos = [&vOutPoints, &outs, &hits](const CCoinsView& view, const CTxMemPool* mempool) {
|
||||
for (const COutPoint& vOutPoint : vOutPoints) {
|
||||
Coin coin;
|
||||
bool hit = !mempool.isSpent(vOutPoint) && view.GetCoin(vOutPoint, coin);
|
||||
bool hit = (!mempool || !mempool->isSpent(vOutPoint)) && view.GetCoin(vOutPoint, coin);
|
||||
hits.push_back(hit);
|
||||
if (hit) outs.emplace_back(std::move(coin));
|
||||
}
|
||||
|
|
@ -828,10 +828,10 @@ static bool rest_getutxos(const std::any& context, HTTPRequest* req, const std::
|
|||
LOCK2(cs_main, mempool->cs);
|
||||
CCoinsViewCache& viewChain = chainman.ActiveChainstate().CoinsTip();
|
||||
CCoinsViewMemPool viewMempool(&viewChain, *mempool);
|
||||
process_utxos(viewMempool, *mempool);
|
||||
process_utxos(viewMempool, mempool);
|
||||
} else {
|
||||
LOCK(cs_main); // no need to lock mempool!
|
||||
process_utxos(chainman.ActiveChainstate().CoinsTip(), CTxMemPool());
|
||||
LOCK(cs_main);
|
||||
process_utxos(chainman.ActiveChainstate().CoinsTip(), nullptr);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < hits.size(); ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue