mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 21:59:10 +02:00
refactor: unify container presence checks - trivial counts
The changes made here were: | From | To | |-------------------|------------------| | `m.count(k)` | `m.contains(k)` | | `!m.count(k)` | `!m.contains(k)` | | `m.count(k) == 0` | `!m.contains(k)` | | `m.count(k) != 0` | `m.contains(k)` | | `m.count(k) > 0` | `m.contains(k)` | The commit contains the trivial, mechanical refactors where it doesn't matter if the container can have multiple elements or not Co-authored-by: Jan B <608446+janb84@users.noreply.github.com>
This commit is contained in:
@@ -130,7 +130,7 @@ bool IsChildWithParents(const Package& package)
|
||||
|
||||
// Every transaction must be a parent of the last transaction in the package.
|
||||
return std::all_of(package.cbegin(), package.cend() - 1,
|
||||
[&input_txids](const auto& ptx) { return input_txids.count(ptx->GetHash()) > 0; });
|
||||
[&input_txids](const auto& ptx) { return input_txids.contains(ptx->GetHash()); });
|
||||
}
|
||||
|
||||
bool IsChildWithParentsTree(const Package& package)
|
||||
@@ -142,7 +142,7 @@ bool IsChildWithParentsTree(const Package& package)
|
||||
// Each parent must not have an input who is one of the other parents.
|
||||
return std::all_of(package.cbegin(), package.cend() - 1, [&](const auto& ptx) {
|
||||
for (const auto& input : ptx->vin) {
|
||||
if (parent_txids.count(input.prevout.hash) > 0) return false;
|
||||
if (parent_txids.contains(input.prevout.hash)) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user