| 134 | } |
| 135 | |
| 136 | bool IsChildWithParentsTree(const Package& package) |
| 137 | { |
| 138 | if (!IsChildWithParents(package)) return false; |
| 139 | std::unordered_set<Txid, SaltedTxidHasher> parent_txids; |
| 140 | std::transform(package.cbegin(), package.cend() - 1, std::inserter(parent_txids, parent_txids.end()), |
| 141 | [](const auto& ptx) { return ptx->GetHash(); }); |
| 142 | // Each parent must not have an input who is one of the other parents. |
| 143 | return std::all_of(package.cbegin(), package.cend() - 1, [&](const auto& ptx) { |
| 144 | for (const auto& input : ptx->vin) { |
| 145 | if (parent_txids.contains(input.prevout.hash)) return false; |
| 146 | } |
| 147 | return true; |
| 148 | }); |
| 149 | } |
| 150 | |
| 151 | uint256 GetPackageHash(const std::vector<CTransactionRef>& transactions) |
| 152 | { |