/* * 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 . */ #ifndef FLOWEE_MERKLE #define FLOWEE_MERKLE #include #include #include "primitives/MutableBlock.h" #include "primitives/Block.h" #include "uint256.h" uint256 ComputeMerkleRoot(std::vector hashes, bool* mutated); std::vector ComputeMerkleBranch(const std::vector& leaves, uint32_t position); uint256 ComputeMerkleRootFromBranch(const uint256& leaf, const std::vector& 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. */ 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. */ std::vector BlockMerkleBranch(const MutableBlock& block, uint32_t position); #endif