MCPcopy Create free account
hub / github.com/ElementsProject/elements / CalculateRoot

Method CalculateRoot

src/primitives/block.cpp:42–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42uint256 DynaFedParamEntry::CalculateRoot() const
43{
44 if (m_serialize_type == 0) {
45 return uint256();
46 }
47
48 std::vector<uint256> compact_leaves;
49 compact_leaves.push_back(SerializeHash(m_signblockscript, SER_GETHASH, 0));
50 compact_leaves.push_back(SerializeHash(m_signblock_witness_limit, SER_GETHASH, 0));
51 uint256 compact_root(ComputeFastMerkleRoot(compact_leaves));
52
53 uint256 extra_root;
54 if (m_serialize_type ==1 ) {
55 // It's pruned, take the stored value
56 extra_root = m_elided_root;
57 } else if (m_serialize_type == 2) {
58 // It's unpruned, compute the node value
59 extra_root = CalculateExtraRoot();
60 }
61
62 std::vector<uint256> leaves;
63 leaves.push_back(compact_root);
64 leaves.push_back(extra_root);
65 return ComputeFastMerkleRoot(leaves);
66}
67
68uint256 DynaFedParamEntry::CalculateExtraRoot() const
69{

Callers 5

UpdateTipMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
paramEntryToJSONFunction · 0.80
getblockchaininfoFunction · 0.80

Calls 4

SerializeHashFunction · 0.85
ComputeFastMerkleRootFunction · 0.85
uint256Class · 0.50
push_backMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64