| 40 | } |
| 41 | |
| 42 | uint256 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 | |
| 68 | uint256 DynaFedParamEntry::CalculateExtraRoot() const |
| 69 | { |