Browse Source

Stricter interface for EthashAux::light()

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
648a83f0fc
  1. 2
      eth/main.cpp
  2. 2
      ethminer/main.cpp
  3. 5
      libethcore/EthashAux.cpp
  4. 1
      libethcore/EthashAux.h
  5. 8
      test/libethcore/dagger.cpp

2
eth/main.cpp

@ -866,7 +866,7 @@ int main(int argc, char** argv)
cout << " with seed as " << seedHash << endl; cout << " with seed as " << seedHash << endl;
if (valid) if (valid)
cout << "(mixHash = " << r.mixHash << ")" << endl; 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); exit(0);
} }
catch (...) catch (...)

2
ethminer/main.cpp

@ -441,7 +441,7 @@ int main(int argc, char** argv)
cout << " with seed as " << seedHash << endl; cout << " with seed as " << seedHash << endl;
if (valid) if (valid)
cout << "(mixHash = " << r.mixHash << ")" << endl; 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); exit(0);
} }
catch (...) catch (...)

5
libethcore/EthashAux.cpp

@ -105,11 +105,6 @@ void EthashAux::killCache(h256 const& _s)
m_lights.erase(_s); m_lights.erase(_s);
} }
EthashAux::LightType EthashAux::light(BlockInfo const& _header)
{
return light(_header.seedHash());
}
EthashAux::LightType EthashAux::light(h256 const& _seedHash) EthashAux::LightType EthashAux::light(h256 const& _seedHash)
{ {
RecursiveGuard l(get()->x_lights); RecursiveGuard l(get()->x_lights);

1
libethcore/EthashAux.h

@ -65,7 +65,6 @@ public:
static uint64_t number(h256 const& _seedHash); static uint64_t number(h256 const& _seedHash);
static uint64_t cacheSize(BlockInfo const& _header); static uint64_t cacheSize(BlockInfo const& _header);
static LightType light(BlockInfo const& _header);
static LightType light(h256 const& _seedHash); static LightType light(h256 const& _seedHash);
static const uint64_t NotGenerating = (uint64_t)-1; static const uint64_t NotGenerating = (uint64_t)-1;

8
test/libethcore/dagger.cpp

@ -63,14 +63,14 @@ BOOST_AUTO_TEST_CASE(basic_test)
unsigned cacheSize(o["cache_size"].get_int()); unsigned cacheSize(o["cache_size"].get_int());
h256 cacheHash(o["cache_hash"].get_str()); h256 cacheHash(o["cache_hash"].get_str());
BOOST_REQUIRE_EQUAL(EthashAux::get()->light(header)->size, cacheSize); BOOST_REQUIRE_EQUAL(EthashAux::get()->light(header.seedHash())->size, cacheSize);
BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->light(header)->data()), cacheHash); BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->light(header.seedHash())->data()), cacheHash);
#if TEST_FULL #if TEST_FULL
unsigned fullSize(o["full_size"].get_int()); unsigned fullSize(o["full_size"].get_int());
h256 fullHash(o["full_hash"].get_str()); h256 fullHash(o["full_hash"].get_str());
BOOST_REQUIRE_EQUAL(EthashAux::get()->full(header)->size(), fullSize); BOOST_REQUIRE_EQUAL(EthashAux::get()->full(header.seedHash())->size(), fullSize);
BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->full(header)->data()), fullHash); BOOST_REQUIRE_EQUAL(sha3(EthashAux::get()->full(header.seedHash())->data()), fullHash);
#endif #endif
h256 result(o["result"].get_str()); h256 result(o["result"].get_str());

Loading…
Cancel
Save