QStringsentinel=QInputDialog::getText(nullptr,"Enter sentinel address","Enter the sentinel address for bad block reporting (e.g. http://badblockserver.com:8080). Enter nothing to disable.",QLineEdit::Normal,QString::fromStdString(ethereum()->sentinel()),&ok);
cerr<<"Selected GPU mining without having compiled with -DETHASHCL=1"<<endl;
exit(1);
#endif
}
}
if(mode==OperationMode::DAGInit)
if(mode==OperationMode::DAGInit)
doInitDAG(m_initDAG);
doInitDAG(m_initDAG);
@ -317,7 +360,12 @@ public:
<<" --allow-opencl-cpu Allows CPU to be considered as an OpenCL device if the OpenCL platform supports it."<<endl
<<" --allow-opencl-cpu Allows CPU to be considered as an OpenCL device if the OpenCL platform supports it."<<endl
<<" --list-devices List the detected OpenCL devices and exit."<<endl
<<" --list-devices List the detected OpenCL devices and exit."<<endl
<<" --current-block Let the miner know the current block number at configuration time. Will help determine DAG size and required GPU memory."<<endl
<<" --current-block Let the miner know the current block number at configuration time. Will help determine DAG size and required GPU memory."<<endl
#if ETH_ETHASHCL || !ETH_TRUE
<<" --cl-extragpu-mem Set the memory (in MB) you believe your GPU requires for stuff other than mining. Windows rendering e.t.c.."<<endl
<<" --cl-extragpu-mem Set the memory (in MB) you believe your GPU requires for stuff other than mining. Windows rendering e.t.c.."<<endl
<<" --cl-local-work Set the OpenCL local work size. Default is "<<toString(ethash_cl_miner::c_defaultLocalWorkSize)<<endl
<<" --cl-global-work Set the OpenCL global work size as a multiple of the local work size. Default is "<<toString(ethash_cl_miner::c_defaultGlobalWorkSizeMultiplier)<<" * "<<toString(ethash_cl_miner::c_defaultLocalWorkSize)<<endl
<<" --cl-ms-per-batch Set the OpenCL target milliseconds per batch (global workgroup size). Default is "<<toString(ethash_cl_miner::c_defaultMSPerBatch)<<". If 0 is given then no autoadjustment of global work size will happen"<<endl
#endif
;
;
}
}
@ -442,14 +490,14 @@ private:
for(unsignedi=0;!completed;++i)
for(unsignedi=0;!completed;++i)
{
{
if(current)
if(current)
cnote<<"Mining on PoWhash"<<current.headerHash<<": "<<f.miningProgress();
minelog<<"Mining on PoWhash"<<current.headerHash<<": "<<f.miningProgress();
else
else
cnote<<"Getting work package...";
minelog<<"Getting work package...";
Json::Valuev=rpc.eth_getWork();
Json::Valuev=rpc.eth_getWork();
h256hh(v[0].asString());
h256hh(v[0].asString());
h256newSeedHash(v[1].asString());
h256newSeedHash(v[1].asString());
if(current.seedHash!=newSeedHash)
if(current.seedHash!=newSeedHash)
cnote<<"Grabbing DAG for"<<newSeedHash;
minelog<<"Grabbing DAG for"<<newSeedHash;
if(!(dag=EthashAux::full(newSeedHash,true,[&](unsigned_pc){cout<<"\rCreating DAG. "<<_pc<<"% done..."<<flush;return0;})))
if(!(dag=EthashAux::full(newSeedHash,true,[&](unsigned_pc){cout<<"\rCreating DAG. "<<_pc<<"% done..."<<flush;return0;})))
h256const&root()const{if(!node(m_root).size())BOOST_THROW_EXCEPTION(BadRoot());/*std::cout << "Returning root as " << ret << " (really " << m_root << ")" << std::endl;*/returnm_root;}// patch the root in the case of the empty trie. TODO: handle this properly.
h256const&root()const{if(node(m_root).empty())BOOST_THROW_EXCEPTION(BadRoot());/*std::cout << "Returning root as " << ret << " (really " << m_root << ")" << std::endl;*/returnm_root;}// patch the root in the case of the empty trie. TODO: handle this properly.
voidsetRefPrice(u256_weiPerRef){if((bigint)m_refsPerBlock*_weiPerRef>std::numeric_limits<u256>::max())BOOST_THROW_EXCEPTION(Overflow()<<errinfo_comment("ether price * block fees is larger than 2**256-1, choose a smaller number."));elsem_weiPerRef=_weiPerRef;}
voidsetRefBlockFees(u256_refsPerBlock){if((bigint)m_weiPerRef*_refsPerBlock>std::numeric_limits<u256>::max())BOOST_THROW_EXCEPTION(Overflow()<<errinfo_comment("ether price * block fees is larger than 2**256-1, choose a smaller number."));elsem_refsPerBlock=_refsPerBlock;}
std::map<unsigned,h256s>m_readyChainMap;///< Subchains ready for download
std::map<unsigned,h256s>m_downloadingChainMap;///< Subchains currently being downloading. In sync with m_chainSyncPeers
std::map<std::weak_ptr<EthereumPeer>,unsigned,std::owner_less<std::weak_ptr<EthereumPeer>>>m_chainSyncPeers;///< Peers to m_downloadingSubchain number map
h256Hashm_knownHashes;///< Subchain start markers. Used to track suchain completion
unsignedm_syncingBlockNumber=0;///< Current subchain marker
boolm_hashScanComplete=false;///< True if leading peer completed hashchain scan and we have a list of subchains ready
mutableboost::shared_mutexm_lock;///< General lock for the sets, m_future and m_unknown.
mutableboost::shared_mutexm_lock;///< General lock for the sets, m_future and m_unknown.
h256Hashm_drainingSet;///< All blocks being imported.
h256Hashm_drainingSet;///< All blocks being imported.
@ -144,8 +145,8 @@ private:
std::unordered_multimap<h256,std::pair<h256,bytes>>m_unknown;///< For blocks that have an unknown parent; we map their parent hash to the block stuff, and insert once the block appears.
std::unordered_multimap<h256,std::pair<h256,bytes>>m_unknown;///< For blocks that have an unknown parent; we map their parent hash to the block stuff, and insert once the block appears.
h256Hashm_knownBad;///< Set of blocks that we know will never be valid.
h256Hashm_knownBad;///< Set of blocks that we know will never be valid.
std::multimap<unsigned,std::pair<h256,bytes>>m_future;///< Set of blocks that are not yet valid. Ordered by timestamp
std::multimap<unsigned,std::pair<h256,bytes>>m_future;///< Set of blocks that are not yet valid. Ordered by timestamp
Signalm_onReady;///< Called when a subsequent call to import blocks will return a non-empty container. Be nice and exit fast.
Signal<>m_onReady;///< Called when a subsequent call to import blocks will return a non-empty container. Be nice and exit fast.
Signalm_onRoomAvailable;///< Called when space for new blocks becomes availabe after a drain. Be nice and exit fast.
Signal<>m_onRoomAvailable;///< Called when space for new blocks becomes availabe after a drain. Be nice and exit fast.
mutableMutexm_verification;///< Mutex that allows writing to m_verified, m_verifying and m_unverified.
mutableMutexm_verification;///< Mutex that allows writing to m_verified, m_verifying and m_unverified.
std::condition_variablem_moreToVerify;///< Signaled when m_unverified has a new entry.
std::condition_variablem_moreToVerify;///< Signaled when m_unverified has a new entry.
voidsetRefPrice(u256_weiPerRef){if((bigint)m_refsPerBlock*_weiPerRef>std::numeric_limits<u256>::max())BOOST_THROW_EXCEPTION(Overflow()<<errinfo_comment("ether price * block fees is larger than 2**256-1, choose a smaller number."));elsem_weiPerRef=_weiPerRef;}
voidsetRefBlockFees(u256_refsPerBlock){if((bigint)m_weiPerRef*_refsPerBlock>std::numeric_limits<u256>::max())BOOST_THROW_EXCEPTION(Overflow()<<errinfo_comment("ether price * block fees is larger than 2**256-1, choose a smaller number."));elsem_refsPerBlock=_refsPerBlock;}