Merge #12079: Improve prioritisetransaction test coverage
[bitcoinplatinum.git] / src / consensus / merkle.h
blobd57bb3412e9d0353850909c528ec639c14c7f492
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.
5 #ifndef BITCOIN_MERKLE
6 #define BITCOIN_MERKLE
8 #include <stdint.h>
9 #include <vector>
11 #include <primitives/transaction.h>
12 #include <primitives/block.h>
13 #include <uint256.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
33 * given position.
34 * This can be verified using ComputeMerkleRootFromBranch.
36 std::vector<uint256> BlockMerkleBranch(const CBlock& block, uint32_t position);
38 #endif