| 28 | } |
| 29 | |
| 30 | CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std::set<uint256>* txids) |
| 31 | { |
| 32 | header = block.GetBlockHeader(); |
| 33 | |
| 34 | std::vector<bool> vMatch; |
| 35 | std::vector<uint256> vHashes; |
| 36 | |
| 37 | vMatch.reserve(block.vtx.size()); |
| 38 | vHashes.reserve(block.vtx.size()); |
| 39 | |
| 40 | for (unsigned int i = 0; i < block.vtx.size(); i++) |
| 41 | { |
| 42 | const uint256& hash = block.vtx[i]->GetHash(); |
| 43 | if (txids && txids->count(hash)) { |
| 44 | vMatch.push_back(true); |
| 45 | } else if (filter && filter->IsRelevantAndUpdate(*block.vtx[i])) { |
| 46 | vMatch.push_back(true); |
| 47 | vMatchedTxn.emplace_back(i, hash); |
| 48 | } else { |
| 49 | vMatch.push_back(false); |
| 50 | } |
| 51 | vHashes.push_back(hash); |
| 52 | } |
| 53 | |
| 54 | txn = CPartialMerkleTree(vHashes, vMatch); |
| 55 | } |
| 56 | |
| 57 | uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::vector<uint256> &vTxid) { |
| 58 | //we can never have zero txs in a merkle block, we always need the coinbase tx |
nothing calls this directly
no test coverage detected