1
0
Fork 0
forked from lthn/blockchain

Merge branch 'lmdb_18_revert' of github.com:hyle-team/zano into lmdb_18_revert

This commit is contained in:
cryptozoidberg 2019-08-29 22:49:12 +02:00
commit ca7c84e37c
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 7 additions and 6 deletions

View file

@ -156,5 +156,5 @@ int find_epoch_number(const hash256& seed) noexcept;
const epoch_context& get_global_epoch_context(int epoch_number);
/// Get global shared epoch context with full dataset initialized.
const epoch_context_full& get_global_epoch_context_full(int epoch_number);
std::shared_ptr<epoch_context_full> get_global_epoch_context_full(int epoch_number);
} // namespace ethash

View file

@ -89,12 +89,12 @@ const epoch_context& get_global_epoch_context(int epoch_number)
return *thread_local_context;
}
const epoch_context_full& get_global_epoch_context_full(int epoch_number)
std::shared_ptr<epoch_context_full> get_global_epoch_context_full(int epoch_number)
{
// Check if local context matches epoch number.
if (!thread_local_context_full || thread_local_context_full->epoch_number != epoch_number)
update_local_context_full(epoch_number);
return *thread_local_context_full;
return thread_local_context_full;
}
} // namespace ethash

View file

@ -50,8 +50,9 @@ namespace currency
crypto::hash get_block_longhash(uint64_t height, const crypto::hash& block_header_hash, uint64_t nonce)
{
int epoch = ethash_height_to_epoch(height);
const auto& context = progpow::get_global_epoch_context_full(static_cast<int>(epoch));
auto res_eth = progpow::hash(context, static_cast<int>(height), *(ethash::hash256*)&block_header_hash, nonce);
std::shared_ptr<ethash::epoch_context_full> p_context = progpow::get_global_epoch_context_full(static_cast<int>(epoch));
CHECK_AND_ASSERT_THROW_MES(p_context, "progpow::get_global_epoch_context_full returned null");
auto res_eth = progpow::hash(*p_context, static_cast<int>(height), *(ethash::hash256*)&block_header_hash, nonce);
crypto::hash result = currency::null_hash;
memcpy(&result.data, &res_eth.final_hash, sizeof(res_eth.final_hash));
return result;

View file

@ -2,6 +2,6 @@
#define BUILD_COMMIT_ID "@VERSION@"
#define PROJECT_VERSION "1.0"
#define PROJECT_VERSION_BUILD_NO 48
#define PROJECT_VERSION_BUILD_NO 49
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"