Files

48 lines
1.7 KiB
C++
Raw Permalink Normal View History

2017-11-09 19:34:51 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2015 The Bitcoin Core developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2018-01-16 10:47:52 +00:00
#ifndef FLOWEE_MERKLE
#define FLOWEE_MERKLE
#include <cstdint>
#include <vector>
#include "primitives/MutableBlock.h"
2026-04-14 23:43:29 +02:00
#include "primitives/Block.h"
#include "uint256.h"
2018-08-11 12:07:28 +03:00
uint256 ComputeMerkleRoot(std::vector<uint256> hashes, bool* mutated);
std::vector<uint256> ComputeMerkleBranch(const std::vector<uint256>& leaves, uint32_t position);
uint256 ComputeMerkleRootFromBranch(const uint256& leaf, const std::vector<uint256>& branch, uint32_t position);
/*
* Compute the Merkle root of the transactions in a block.
* *mutated is set to true if a duplicated subtree was found.
*/
2026-04-14 23:43:29 +02:00
uint256 BlockMerkleRoot(const MutableBlock& block, bool* mutated = nullptr);
uint256 BlockMerkleRoot(const Block &block, bool* mutated = nullptr);
/*
* Compute the Merkle branch for the tree of transactions in a block, for a
* given position.
* This can be verified using ComputeMerkleRootFromBranch.
*/
2021-11-02 09:36:09 +01:00
std::vector<uint256> BlockMerkleBranch(const MutableBlock& block, uint32_t position);
#endif