1 // Copyright (c) 2015-2017 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
11 #include <primitives/transaction.h>
12 #include <primitives/block.h>
15 uint256
ComputeMerkleRoot(const std::vector
<uint256
>& leaves
, bool* mutated
= nullptr);
16 std::vector
<uint256
> ComputeMerkleBranch(const std::vector
<uint256
>& leaves
, uint32_t position
);
17 uint256
ComputeMerkleRootFromBranch(const uint256
& leaf
, const std::vector
<uint256
>& branch
, uint32_t position
);
20 * Compute the Merkle root of the transactions in a block.
21 * *mutated is set to true if a duplicated subtree was found.
23 uint256
BlockMerkleRoot(const CBlock
& block
, bool* mutated
= nullptr);
26 * Compute the Merkle root of the witness transactions in a block.
27 * *mutated is set to true if a duplicated subtree was found.
29 uint256
BlockWitnessMerkleRoot(const CBlock
& block
, bool* mutated
= nullptr);
32 * Compute the Merkle branch for the tree of transactions in a block, for a
34 * This can be verified using ComputeMerkleRootFromBranch.
36 std::vector
<uint256
> BlockMerkleBranch(const CBlock
& block
, uint32_t position
);