比特币源码阅读(MerkleRoot的计算)

src/consensus/merkle.cpp

uint256 BlockMerkleRoot(const CBlock& block, bool* mutated)
{
    std::vector leaves; //叶子节点
    leaves.resize(block.vtx.size());
    for (size_t s = 0; s < block.vtx.size(); s++) {
        leaves[s] = block.vtx[s]->GetHash(); //放入所有交易的hash
    }
    return ComputeMerkleRoot(std::move(leaves), mutated);
}
uint256 ComputeMerkleRoot(std::vector hashes, bool* mutated) {
    
    std::cout<<"test consensus/merkle.cpp 1 mutated: "< 1) {
        std::cout<<"test consensus/merkle.cpp 2 mutated: "<

你可能感兴趣的:(比特币源码阅读(MerkleRoot的计算))