45 bool mutation =
false;
46 while (hashes.size() > 1) {
48 for (
size_t pos = 0; pos + 1 < hashes.size(); pos += 2) {
49 if (hashes[pos] == hashes[pos + 1]) {
54 if (hashes.size() & 1) {
55 hashes.push_back(hashes.back());
57 SHA256D64(hashes[0].begin(), hashes[0].begin(), hashes.size() / 2);
58 hashes.resize(hashes.size() / 2);
63 if (hashes.size() == 0) {
70 std::vector<uint256> leaves;
71 leaves.resize(block.
vtx.size());
72 for (
size_t s = 0; s < block.
vtx.size(); s++) {
73 leaves[s] = block.
vtx[s]->GetId();
std::vector< CTransactionRef > vtx
uint256 ComputeMerkleRoot(std::vector< uint256 > hashes, bool *mutated)
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
Compute the Merkle root of the transactions in a block.
void SHA256D64(uint8_t *out, const uint8_t *in, size_t blocks)
Compute multiple double-SHA256's of 64-byte blobs.