mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
eth working
This commit is contained in:
parent
32916c3362
commit
522d9f1e46
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <libethcore/EthashAux.h>
|
||||||
#include <libethereum/Client.h>
|
#include <libethereum/Client.h>
|
||||||
#include <liblll/Compiler.h>
|
#include <liblll/Compiler.h>
|
||||||
#include <libevm/VMFactory.h>
|
#include <libevm/VMFactory.h>
|
||||||
@ -63,11 +64,17 @@ void connectClients(Client& c1, Client& c2)
|
|||||||
void mine(State& s, BlockChain const& _bc)
|
void mine(State& s, BlockChain const& _bc)
|
||||||
{
|
{
|
||||||
s.commitToMine(_bc);
|
s.commitToMine(_bc);
|
||||||
GenericFarm<Ethash> f;
|
GenericFarm<EthashProofOfWork> f;
|
||||||
bool completed = false;
|
bool completed = false;
|
||||||
f.onSolutionFound([&](ProofOfWork::Solution sol)
|
Ethash::BlockHeader header(s.info);
|
||||||
|
f.onSolutionFound([&](EthashProofOfWork::Solution sol)
|
||||||
{
|
{
|
||||||
return completed = s.completeMine<ProofOfWork>(sol);
|
header.m_mixHash = sol.mixHash;
|
||||||
|
header.m_nonce = sol.nonce;
|
||||||
|
RLPStream ret;
|
||||||
|
header.streamRLP(ret);
|
||||||
|
s.sealBlock(ret);
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
f.setWork(s.info());
|
f.setWork(s.info());
|
||||||
f.startCPU();
|
f.startCPU();
|
||||||
@ -77,9 +84,9 @@ void mine(State& s, BlockChain const& _bc)
|
|||||||
|
|
||||||
void mine(BlockInfo& _bi)
|
void mine(BlockInfo& _bi)
|
||||||
{
|
{
|
||||||
GenericFarm<ProofOfWork> f;
|
GenericFarm<EthashProofOfWork> f;
|
||||||
bool completed = false;
|
bool completed = false;
|
||||||
f.onSolutionFound([&](ProofOfWork::Solution sol)
|
f.onSolutionFound([&](EthashProofOfWork::Solution sol)
|
||||||
{
|
{
|
||||||
_bi.proof = sol;
|
_bi.proof = sol;
|
||||||
return completed = true;
|
return completed = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user