Bitcoin Core 28.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
merkle_tests.cpp File Reference
#include <consensus/merkle.h>
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
Include dependency graph for merkle_tests.cpp:

Go to the source code of this file.

Functions

static uint256 ComputeMerkleRootFromBranch (const uint256 &leaf, const std::vector< uint256 > &vMerkleBranch, uint32_t nIndex)
 
static void MerkleComputation (const std::vector< uint256 > &leaves, uint256 *proot, bool *pmutated, uint32_t branchpos, std::vector< uint256 > *pbranch)
 
static std::vector< uint256ComputeMerkleBranch (const std::vector< uint256 > &leaves, uint32_t position)
 
static std::vector< uint256BlockMerkleBranch (const CBlock &block, uint32_t position)
 
static uint256 BlockBuildMerkleTree (const CBlock &block, bool *fMutated, std::vector< uint256 > &vMerkleTree)
 
static std::vector< uint256BlockGetMerkleBranch (const CBlock &block, const std::vector< uint256 > &vMerkleTree, int nIndex)
 
static int ctz (uint32_t i)
 
 BOOST_AUTO_TEST_CASE (merkle_test)
 
 BOOST_AUTO_TEST_CASE (merkle_test_empty_block)
 
 BOOST_AUTO_TEST_CASE (merkle_test_oneTx_block)
 
 BOOST_AUTO_TEST_CASE (merkle_test_OddTxWithRepeatedLastTx_block)
 
 BOOST_AUTO_TEST_CASE (merkle_test_LeftSubtreeRightSubtree)
 
 BOOST_AUTO_TEST_CASE (merkle_test_BlockWitness)
 

Function Documentation

◆ BlockBuildMerkleTree()

static uint256 BlockBuildMerkleTree ( const CBlock & block,
bool * fMutated,
std::vector< uint256 > & vMerkleTree )
static

Definition at line 131 of file merkle_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BlockGetMerkleBranch()

static std::vector< uint256 > BlockGetMerkleBranch ( const CBlock & block,
const std::vector< uint256 > & vMerkleTree,
int nIndex )
static

Definition at line 159 of file merkle_tests.cpp.

Here is the caller graph for this function:

◆ BlockMerkleBranch()

static std::vector< uint256 > BlockMerkleBranch ( const CBlock & block,
uint32_t position )
static

Definition at line 120 of file merkle_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BOOST_AUTO_TEST_CASE() [1/6]

BOOST_AUTO_TEST_CASE ( merkle_test )

Definition at line 183 of file merkle_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/6]

BOOST_AUTO_TEST_CASE ( merkle_test_BlockWitness )

Definition at line 330 of file merkle_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/6]

BOOST_AUTO_TEST_CASE ( merkle_test_empty_block )

Definition at line 253 of file merkle_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/6]

BOOST_AUTO_TEST_CASE ( merkle_test_LeftSubtreeRightSubtree )

Definition at line 301 of file merkle_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/6]

BOOST_AUTO_TEST_CASE ( merkle_test_OddTxWithRepeatedLastTx_block )

Definition at line 277 of file merkle_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/6]

BOOST_AUTO_TEST_CASE ( merkle_test_oneTx_block )

Definition at line 263 of file merkle_tests.cpp.

Here is the call graph for this function:

◆ ComputeMerkleBranch()

static std::vector< uint256 > ComputeMerkleBranch ( const std::vector< uint256 > & leaves,
uint32_t position )
static

Definition at line 114 of file merkle_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeMerkleRootFromBranch()

static uint256 ComputeMerkleRootFromBranch ( const uint256 & leaf,
const std::vector< uint256 > & vMerkleBranch,
uint32_t nIndex )
static

Definition at line 13 of file merkle_tests.cpp.

Here is the caller graph for this function:

◆ ctz()

static int ctz ( uint32_t i)
inlinestatic

Definition at line 173 of file merkle_tests.cpp.

Here is the caller graph for this function:

◆ MerkleComputation()

static void MerkleComputation ( const std::vector< uint256 > & leaves,
uint256 * proot,
bool * pmutated,
uint32_t branchpos,
std::vector< uint256 > * pbranch )
static

Definition at line 27 of file merkle_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: