MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / IsChildWithParentsTree

Function IsChildWithParentsTree

src/policy/packages.cpp:136–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136bool 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
151uint256 GetPackageHash(const std::vector<CTransactionRef>& transactions)
152{

Callers 2

BOOST_AUTO_TEST_CASEFunction · 0.85
submitpackageFunction · 0.85

Calls 6

IsChildWithParentsFunction · 0.85
cbeginMethod · 0.45
cendMethod · 0.45
endMethod · 0.45
GetHashMethod · 0.45
containsMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68