2018-07-26 15:36:45 -07:00
|
|
|
// Copyright (c) 2015-2018 The Bitcoin Core developers
|
2015-11-17 08:35:40 -08:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-03-22 07:19:44 -07:00
|
|
|
#ifndef BITCOIN_CONSENSUS_MERKLE_H
|
|
|
|
#define BITCOIN_CONSENSUS_MERKLE_H
|
2015-11-17 08:35:40 -08:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <vector>
|
|
|
|
|
2017-11-09 16:57:53 -08:00
|
|
|
#include <primitives/transaction.h>
|
|
|
|
#include <primitives/block.h>
|
|
|
|
#include <uint256.h>
|
2015-11-17 08:35:40 -08:00
|
|
|
|
2018-05-12 11:48:41 -07:00
|
|
|
uint256 ComputeMerkleRoot(std::vector<uint256> hashes, bool* mutated = nullptr);
|
2015-11-17 08:35:40 -08:00
|
|
|
|
2015-11-17 08:35:44 -08:00
|
|
|
/*
|
|
|
|
* Compute the Merkle root of the transactions in a block.
|
|
|
|
* *mutated is set to true if a duplicated subtree was found.
|
|
|
|
*/
|
2017-08-06 22:36:37 -07:00
|
|
|
uint256 BlockMerkleRoot(const CBlock& block, bool* mutated = nullptr);
|
2015-11-17 08:35:44 -08:00
|
|
|
|
2015-11-05 16:42:38 -08:00
|
|
|
/*
|
|
|
|
* Compute the Merkle root of the witness transactions in a block.
|
|
|
|
* *mutated is set to true if a duplicated subtree was found.
|
|
|
|
*/
|
2017-08-06 22:36:37 -07:00
|
|
|
uint256 BlockWitnessMerkleRoot(const CBlock& block, bool* mutated = nullptr);
|
2015-11-05 16:42:38 -08:00
|
|
|
|
2018-03-22 07:19:44 -07:00
|
|
|
#endif // BITCOIN_CONSENSUS_MERKLE_H
|