diff --git a/src/currency_core/basic_pow_helpers.cpp b/src/currency_core/basic_pow_helpers.cpp index 95ed6dfd..94af36d9 100644 --- a/src/currency_core/basic_pow_helpers.cpp +++ b/src/currency_core/basic_pow_helpers.cpp @@ -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); diff --git a/src/currency_core/basic_pow_helpers.h b/src/currency_core/basic_pow_helpers.h index ccc1a132..4bea2718 100644 --- a/src/currency_core/basic_pow_helpers.h +++ b/src/currency_core/basic_pow_helpers.h @@ -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); diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 5089f054..a27ec33d 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -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;