24 #include <boost/endian/conversion.hpp> 30 namespace graphene {
namespace protocol {
38 return boost::endian::endian_reverse(
id._hash[0].value());
43 if( 0 == _block_id._hash[0].value() )
46 tmp._hash[0] = boost::endian::endian_reverse(
block_num());
47 static_assert(
sizeof(tmp._hash[0]) == 4,
"should be 4 bytes" );
48 memcpy(_block_id._hash, tmp._hash, std::min(
sizeof(_block_id),
sizeof(tmp)));
55 if( !_signee.valid() )
67 return signee() == expected_signee;
73 if( transactions.size() == 0 )
74 return empty_checksum;
76 if( 0 == _calculated_merkle_root._hash[0].value() )
78 vector<digest_type> ids;
79 ids.resize( transactions.size() );
80 for( uint32_t i = 0; i < transactions.size(); ++i )
81 ids[i] = transactions[i].merkle_digest();
83 vector<digest_type>::size_type current_number_of_hashes = ids.size();
84 while( current_number_of_hashes > 1 )
87 uint32_t i_max = current_number_of_hashes - (current_number_of_hashes&1);
90 for( uint32_t i = 0; i < i_max; i += 2 )
93 if( current_number_of_hashes&1 )
94 ids[k++] = ids[i_max];
95 current_number_of_hashes = k;
99 return _calculated_merkle_root;
static ripemd160 hash(const fc::sha512 &h)
static sha224 hash(const char *d, uint32_t dlen)
compact_signature sign_compact(const fc::sha256 &digest, bool require_canonical=true) const
static sha256 hash(const char *d, uint32_t dlen)
const checksum_type & calculate_merkle_root() const
contains only the public point of an elliptic curve key.
#define GRAPHENE_IMPLEMENT_EXTERNAL_SERIALIZATION(type)
an elliptic curve private key.