Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

merkle.h 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) 2015 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.
  4. #ifndef BITCOIN_MERKLE
  5. #define BITCOIN_MERKLE
  6. #include <stdint.h>
  7. #include <vector>
  8. #include "primitives/transaction.h"
  9. #include "primitives/block.h"
  10. #include "uint256.h"
  11. uint256 ComputeMerkleRoot(const std::vector<uint256>& leaves, bool* mutated = NULL);
  12. std::vector<uint256> ComputeMerkleBranch(const std::vector<uint256>& leaves, uint32_t position);
  13. uint256 ComputeMerkleRootFromBranch(const uint256& leaf, const std::vector<uint256>& branch, uint32_t position);
  14. /*
  15. * Compute the Merkle root of the transactions in a block.
  16. * *mutated is set to true if a duplicated subtree was found.
  17. */
  18. uint256 BlockMerkleRoot(const CBlock& block, bool* mutated = NULL);
  19. /*
  20. * Compute the Merkle branch for the tree of transactions in a block, for a
  21. * given position.
  22. * This can be verified using ComputeMerkleRootFromBranch.
  23. */
  24. std::vector<uint256> BlockMerkleBranch(const CBlock& block, uint32_t position);
  25. #endif