mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
sign blob data
This commit is contained in:
parent
7ee6da17fa
commit
22a7b73692
2 changed files with 14 additions and 4 deletions
|
@ -1324,13 +1324,22 @@ namespace cryptonote
|
||||||
crypto::hash get_sig_data(const block& b)
|
crypto::hash get_sig_data(const block& b)
|
||||||
{
|
{
|
||||||
crypto::hash sig_data;
|
crypto::hash sig_data;
|
||||||
std::stringstream ss;
|
blobdata blob = get_block_hashing_blob_sig_data(b);
|
||||||
ss << (b.nonce + b.timestamp);
|
crypto::cn_fast_hash(blob.data(), blob.size(), sig_data);
|
||||||
std::string d(ss.str());
|
|
||||||
crypto::cn_fast_hash(d.data(), d.size(), sig_data);
|
|
||||||
return sig_data;
|
return sig_data;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
|
blobdata get_block_hashing_blob_sig_data(const block& b)
|
||||||
|
{
|
||||||
|
block_header tmp = static_cast<const block_header&>(b);
|
||||||
|
memset(&tmp.signature, 0, sizeof(tmp.signature));
|
||||||
|
blobdata blob = t_serializable_object_to_blob(tmp);
|
||||||
|
crypto::hash tree_root_hash = get_tx_tree_hash(b);
|
||||||
|
blob.append(reinterpret_cast<const char*>(&tree_root_hash), sizeof(tree_root_hash));
|
||||||
|
blob.append(tools::get_varint_data(b.tx_hashes.size()+1));
|
||||||
|
return blob;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------
|
||||||
std::vector<uint64_t> relative_output_offsets_to_absolute(const std::vector<uint64_t>& off)
|
std::vector<uint64_t> relative_output_offsets_to_absolute(const std::vector<uint64_t>& off)
|
||||||
{
|
{
|
||||||
std::vector<uint64_t> res = off;
|
std::vector<uint64_t> res = off;
|
||||||
|
|
|
@ -122,6 +122,7 @@ namespace cryptonote
|
||||||
bool get_block_hash(const block& b, crypto::hash& res);
|
bool get_block_hash(const block& b, crypto::hash& res);
|
||||||
crypto::hash get_block_hash(const block& b);
|
crypto::hash get_block_hash(const block& b);
|
||||||
crypto::hash get_sig_data(const block& b);
|
crypto::hash get_sig_data(const block& b);
|
||||||
|
blobdata get_block_hashing_blob_sig_data(const block& b);
|
||||||
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash *block_hash);
|
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash *block_hash);
|
||||||
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b);
|
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b);
|
||||||
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash &block_hash);
|
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash &block_hash);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue