From 648a83f0fc9b700096498f862395bd9b9671b8e6 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 14 May 2015 21:53:59 +0200 Subject: [PATCH] Stricter interface for EthashAux::light() --- eth/main.cpp | 2 +- ethminer/main.cpp | 2 +- libethcore/EthashAux.cpp | 5 ----- libethcore/EthashAux.h | 1 - test/libethcore/dagger.cpp | 8 ++++---- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index e352cd53a..dc130e296 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -866,7 +866,7 @@ int main(int argc, char** argv) cout << " with seed as " << seedHash << endl; if (valid) cout << "(mixHash = " << r.mixHash << ")" << endl; - cout << "SHA3( light(seed) ) = " << sha3(EthashAux::light(bi)->data()) << endl; + cout << "SHA3( light(seed) ) = " << sha3(EthashAux::light(bi.seedHash())->data()) << endl; exit(0); } catch (...) diff --git a/ethminer/main.cpp b/ethminer/main.cpp index 33c2e7c80..732d49dee 100644 --- a/ethminer/main.cpp +++ b/ethminer/main.cpp @@ -441,7 +441,7 @@ int main(int argc, char** argv) cout << " with seed as " << seedHash << endl; if (valid) cout << "(mixHash = " << r.mixHash << ")" << endl; - cout << "SHA3( light(seed) ) = " << sha3(EthashAux::light(bi)->data()) << endl; + cout << "SHA3( light(seed) ) = " << sha3(EthashAux::light(bi.seedHash())->data()) << endl; exit(0); } catch (...) diff --git a/libethcore/EthashAux.cpp b/libethcore/EthashAux.cpp index 4f29a6516..aeacf325a 100644 --- a/libethcore/EthashAux.cpp +++ b/libethcore/EthashAux.cpp @@ -105,11 +105,6 @@ void EthashAux::killCache(h256 const& _s) m_lights.erase(_s); } -EthashAux::LightType EthashAux::light(BlockInfo const& _header) -{ - return light(_header.seedHash()); -} - EthashAux::LightType EthashAux::light(h256 const& _seedHash) { RecursiveGuard l(get()->x_lights); diff --git a/libethcore/EthashAux.h b/libethcore/EthashAux.h index 2a4060e78..64501e37b 100644 --- a/libethcore/EthashAux.h +++ b/libethcore/EthashAux.h @@ -65,7 +65,6 @@ public: static uint64_t number(h256 const& _seedHash); static uint64_t cacheSize(BlockInfo const& _header); - static LightType light(BlockInfo const& _header); static LightType light(h256 const& _seedHash); static const uint64_t NotGenerating = (uint64_t)-1; diff --git a/test/libethcore/dagger.cpp b/test/libethcore/dagger.cpp index 4faf0a283..59770373d 100644 --- a/test/libethcore/dagger.cpp +++ b/test/libethcore/dagger.cpp @@ -63,14 +63,14 @@ BOOST_AUTO_TEST_CASE(basic_test) unsigned cacheSize(o["cache_size"].get_int()); h256 cacheHash(o["cache_hash"].get_str()); - BOOST_REQUIRE_EQUAL(EthashAux::get()->light(header)->size, cacheSize); - BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->light(header)->data()), cacheHash); + BOOST_REQUIRE_EQUAL(EthashAux::get()->light(header.seedHash())->size, cacheSize); + BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->light(header.seedHash())->data()), cacheHash); #if TEST_FULL unsigned fullSize(o["full_size"].get_int()); h256 fullHash(o["full_hash"].get_str()); - BOOST_REQUIRE_EQUAL(EthashAux::get()->full(header)->size(), fullSize); - BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->full(header)->data()), fullHash); + BOOST_REQUIRE_EQUAL(EthashAux::get()->full(header.seedHash())->size(), fullSize); + BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->full(header.seedHash())->data()), fullHash); #endif h256 result(o["result"].get_str());