2 #include <fc/io/raw.hpp>
3 #include <fc/bitutil.hpp>
11 return digest_type::hash(*
this);
16 return fc::endian_reverse_u32(
id._hash[0]);
21 auto tmp = fc::sha224::hash(*
this);
24 static_assert(
sizeof(tmp._hash[0]) == 4,
"should be 4 bytes");
26 memcpy(
result._hash, tmp._hash, std::min(
sizeof(
result),
sizeof(tmp)));
42 return signee() == expected_signee;
50 std::vector<digest_type> ids;
55 std::vector<digest_type>::size_type current_number_of_hashes = ids.size();
56 while (current_number_of_hashes > 1)
59 uint32_t i_max = current_number_of_hashes - (current_number_of_hashes & 1);
62 for (uint32_t i = 0; i < i_max; i += 2)
63 ids[k++] = digest_type::hash(std::make_pair(ids[i], ids[i + 1]));
65 if (current_number_of_hashes & 1)
66 ids[k++] = ids[i_max];
67 current_number_of_hashes = k;
69 return checksum_type::hash(ids[0]);
74 : _block_num(block_num)
77 , _block_witness(block_witness)
82 : _block_num(block.block_num())
83 , _block_id(block.id().str())
84 , _when(block.timestamp)
85 , _block_witness(block.witness)
91 , _block_witness(witness_owner)
95 block_info::operator std::string()
const
97 std::stringstream store;
98 store << _block_num <<
":" << _block_id <<
"|";
99 store << _when.to_iso_string() <<
"~" << _block_witness;
fc::ripemd160 checksum_type
fc::ripemd160 block_id_type
std::vector< signed_transaction > transactions
checksum_type calculate_merkle_root() const