Skip to content

Commit b953f32

Browse files
authored
Merge pull request #735 from evoskuil/master
Fix get_doubles().
2 parents ad1899d + 25c90ab commit b953f32

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

include/bitcoin/database/impl/query/consensus.ipp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,22 @@ bool CLASS::get_doubles(tx_links& out, const point& point) const NOEXCEPT
477477
if (!store_.duplicate.exists(point))
478478
return true;
479479

480-
auto success = false;
481-
for (auto it = store_.tx.it(point.hash()); it != it.end(); ++it)
480+
// Get the [tx.hash:index] of each spender of the point (index unused).
481+
const auto spenders = get_spenders(point);
482+
bool found{};
483+
484+
// Inpoints are deduped by the std::set.
485+
for (const auto& spender: spenders)
482486
{
483-
success = true;
484-
out.push_back(*it);
487+
// Exhaustive enumeration of all txs with spender hash.
488+
for (auto it = store_.tx.it(spender.hash()); it != it.end(); ++it)
489+
{
490+
found = true;
491+
out.push_back(*it);
492+
}
485493
}
486494

487-
return success;
495+
return found;
488496
}
489497

490498
TEMPLATE

0 commit comments

Comments
 (0)