Paweł Bylica
8 years ago
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
4 changed files with
25 additions and
37 deletions
-
ethminer/MinerAux.h
-
libethcore/BlockInfo.h
-
libethcore/EthashAux.cpp
-
libethcore/EthashAux.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(); |
|
|
|
|
|
@ -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>; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -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; |
|
|
|
|
|
@ -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 |
|
|
|