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