Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit 1c400ee

Browse files
committedApr 12, 2018
Use managed::hash() from ethash
1 parent 3ecda25 commit 1c400ee

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed
 

‎libethcore/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ set(SOURCES
99
include_directories(BEFORE ..)
1010

1111
add_library(ethcore ${SOURCES})
12-
target_link_libraries(ethcore ethash-legacy devcore hwmon)
12+
target_link_libraries(ethcore PUBLIC devcore PRIVATE hwmon ethash-legacy ethash::ethash)
1313

1414
if(ETHASHCL)
15-
target_link_libraries(ethcore ethash-cl)
15+
target_link_libraries(ethcore PRIVATE ethash-cl)
1616
endif()
1717
if(ETHASHCUDA)
18-
target_link_libraries(ethcore ethash-cuda)
18+
target_link_libraries(ethcore PUBLIC ethash-cuda)
1919
endif()

‎libethcore/EthashAux.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "EthashAux.h"
1919
#include <libethash/internal.h>
2020

21+
#include <ethash/ethash.hpp>
22+
2123
using namespace std;
2224
using namespace chrono;
2325
using namespace dev;
@@ -69,12 +71,9 @@ Result EthashAux::LightAllocation::compute(h256 const& _headerHash, uint64_t _no
6971

7072
Result EthashAux::eval(int epoch, h256 const& _headerHash, uint64_t _nonce) noexcept
7173
{
72-
try
73-
{
74-
return get().light(epoch)->compute(_headerHash, _nonce);
75-
}
76-
catch(...)
77-
{
78-
return Result{~h256(), h256()};
79-
}
80-
}
74+
auto headerHash = ethash::hash256::from_bytes(_headerHash.data());
75+
auto result = ethash::managed::hash(epoch, headerHash, _nonce);
76+
h256 mix{reinterpret_cast<byte*>(result.mix_hash.bytes), h256::ConstructFromPointer};
77+
h256 final{reinterpret_cast<byte*>(result.final_hash.bytes), h256::ConstructFromPointer};
78+
return {final, mix};
79+
}

0 commit comments

Comments
 (0)
This repository has been archived.