delete uneeded code, replace with bc::hash_literal as per William Swanson (s_tec)'s comment.

pull/162/head
Amir Taaki 9 years ago
parent d44f6aaf92
commit e827ff5c86

@ -47,21 +47,13 @@ bc::hash_digest create_merkle(bc::hash_list& merkle)
return merkle[0];
}
// Convert hex string to hash bytes.
bc::hash_digest get_hash(const std::string& value)
{
bc::hash_digest result;
bool success = bc::decode_hash(result, value);
return result;
}
int main()
{
// Replace these hashes with ones from a block to reproduce the same merkle root.
bc::hash_list tx_hashes{{
get_hash("0000000000000000000000000000000000000000000000000000000000000000"),
get_hash("0000000000000000000000000000000000000000000000000000000000000011"),
get_hash("0000000000000000000000000000000000000000000000000000000000000022"),
bc::hash_literal("0000000000000000000000000000000000000000000000000000000000000000"),
bc::hash_literal("0000000000000000000000000000000000000000000000000000000000000011"),
bc::hash_literal("0000000000000000000000000000000000000000000000000000000000000022"),
}};
const bc::hash_digest merkle_root = create_merkle(tx_hashes);
std::cout << "Result: " << bc::encode_hex(merkle_root) << std::endl;

Loading…
Cancel
Save