Browse Source

Get rid of Ethash wrapper

cl-refactor
Paweł Bylica 8 years ago
parent
commit
013935d1c0
No known key found for this signature in database GPG Key ID: 7A0C037434FE77EF
  1. 4
      ethminer/MinerAux.h
  2. 21
      libethcore/BlockInfo.h
  3. 6
      libethcore/EthashAux.cpp
  4. 31
      libethcore/EthashAux.h

4
ethminer/MinerAux.h

@ -608,7 +608,7 @@ private:
void doBenchmark(MinerType _m, unsigned _warmupDuration = 15, unsigned _trialDuration = 3, unsigned _trials = 5)
{
Ethash::BlockHeader genesis;
BlockHeader genesis;
genesis.setNumber(m_benchmarkBlock);
genesis.setDifficulty(1 << 18);
cdebug << genesis.boundary();
@ -674,7 +674,7 @@ private:
void doSimulation(MinerType _m, int difficulty = 20)
{
Ethash::BlockHeader genesis;
BlockHeader genesis;
genesis.setNumber(m_benchmarkBlock);
genesis.setDifficulty(1 << 18);
cdebug << genesis.boundary();

21
libethcore/BlockInfo.h

@ -221,5 +221,26 @@ public:
}
};
class BlockHeaderRaw: public BlockInfo
{
public:
h256 const& seedHash() const;
Nonce const& nonce() const { return m_nonce; }
protected:
BlockHeaderRaw() = default;
BlockHeaderRaw(BlockInfo const& _bi): BlockInfo(_bi) {}
void clear() { m_mixHash = h256(); m_nonce = Nonce(); }
private:
Nonce m_nonce;
h256 m_mixHash;
mutable h256 m_seedHash;
};
using BlockHeader = BlockHeaderPolished<BlockHeaderRaw>;
}
}

6
libethcore/EthashAux.cpp

@ -49,17 +49,13 @@ const unsigned EthashProofOfWork::defaultGlobalWorkSizeMultiplier = 4096; // * C
const unsigned EthashProofOfWork::defaultMSPerBatch = 0;
const EthashProofOfWork::WorkPackage EthashProofOfWork::NullWorkPackage = EthashProofOfWork::WorkPackage();
h256 const& Ethash::BlockHeaderRaw::seedHash() const
h256 const& BlockHeaderRaw::seedHash() const
{
if (!m_seedHash)
m_seedHash = EthashAux::seedHash((unsigned)m_number);
return m_seedHash;
}
EthashAux::~EthashAux()
{
}
EthashAux* EthashAux::get()
{
static std::once_flag flag;

31
libethcore/EthashAux.h

@ -34,33 +34,6 @@ namespace eth
struct DAGChannel: public LogChannel { static const char* name(); static const int verbosity = 1; };
class Ethash
{
public:
using Nonce = h64;
class BlockHeaderRaw: public BlockInfo
{
public:
h256 const& seedHash() const;
Nonce const& nonce() const { return m_nonce; }
protected:
BlockHeaderRaw() = default;
BlockHeaderRaw(BlockInfo const& _bi): BlockInfo(_bi) {}
void clear() { m_mixHash = h256(); m_nonce = Nonce(); }
private:
Nonce m_nonce;
h256 m_mixHash;
mutable h256 m_seedHash;
};
using BlockHeader = BlockHeaderPolished<BlockHeaderRaw>;
};
/// Proof of work definition for Ethash.
struct EthashProofOfWork
{
@ -79,7 +52,7 @@ struct EthashProofOfWork
struct WorkPackage
{
WorkPackage() = default;
WorkPackage(Ethash::BlockHeader const& _bh) :
WorkPackage(BlockHeader const& _bh) :
boundary(_bh.boundary()),
headerHash(_bh.hashWithout()),
seedHash(_bh.seedHash())
@ -117,8 +90,6 @@ enum class DAGEraseMode
class EthashAux
{
public:
~EthashAux();
static EthashAux* get();
struct LightAllocation

Loading…
Cancel
Save