1
0
Fork 0
forked from lthn/blockchain

added seed infor to get_block_template

This commit is contained in:
crypro.zoidberg 2019-04-12 15:52:03 +02:00
parent f7048fd7af
commit 6976ebb18d
3 changed files with 13 additions and 0 deletions

View file

@ -39,6 +39,14 @@ namespace currency
return height / ETHASH_EPOCH_LENGTH;
}
//--------------------------------------------------------------
crypto::hash ethash_epoch_to_seed(int epoch)
{
auto res_eth = ethash_calculate_epoch_seed(epoch);
crypto::hash result = currency::null_hash;
memcpy(&result.data, &res_eth, sizeof(res_eth));
return result;
}
//--------------------------------------------------------------
crypto::hash get_block_longhash(uint64_t height, const crypto::hash& block_long_ash, uint64_t nonce)
{
int epoch = ethash_height_to_epoch(height);

View file

@ -28,6 +28,7 @@
namespace currency
{
int ethash_height_to_epoch(uint64_t height);
crypto::hash ethash_epoch_to_seed(int epoch);
crypto::hash get_block_longhash(uint64_t h, const crypto::hash& block_long_ash, uint64_t nonce);
void get_block_longhash(const block& b, crypto::hash& res);
crypto::hash get_block_longhash(const block& b);

View file

@ -799,6 +799,10 @@ namespace currency
res.blocktemplate_blob = string_tools::buff_to_hex_nodelimer(block_blob);
res.prev_hash = string_tools::pod_to_hex(b.prev_id);
//calculate epoch seed
res.seed = currency::ethash_epoch_to_seed(currency::ethash_height_to_epoch(res.height));
res.status = CORE_RPC_STATUS_OK;
return true;