diff options
author | Gav Wood <i@gavwood.com> | 2015-04-14 00:12:05 +0800 |
---|---|---|
committer | Gav Wood <i@gavwood.com> | 2015-04-14 00:12:05 +0800 |
commit | 8f659f39813d4418d1c1e016f4d84309a8044946 (patch) | |
tree | 2d0c18937427559f9c30b17e52a9c57b8ae55e2f /TestHelper.cpp | |
parent | fbb5adc9f9be5b9749c88592060eb07d71e60ab1 (diff) | |
download | dexon-solidity-8f659f39813d4418d1c1e016f4d84309a8044946.tar dexon-solidity-8f659f39813d4418d1c1e016f4d84309a8044946.tar.gz dexon-solidity-8f659f39813d4418d1c1e016f4d84309a8044946.tar.bz2 dexon-solidity-8f659f39813d4418d1c1e016f4d84309a8044946.tar.lz dexon-solidity-8f659f39813d4418d1c1e016f4d84309a8044946.tar.xz dexon-solidity-8f659f39813d4418d1c1e016f4d84309a8044946.tar.zst dexon-solidity-8f659f39813d4418d1c1e016f4d84309a8044946.zip |
Various fixes for mining.
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index e86b84aa..8b528b3e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -62,6 +62,37 @@ void connectClients(Client& c1, Client& c2) c2.connect("127.0.0.1", c1Port); #endif } + +void mine(State& s, BlockChain const& _bc) +{ + s.commitToMine(_bc); + GenericFarm<ProofOfWork> f; + bool completed = false; + f.onSolutionFound([&](ProofOfWork::Solution sol) + { + return completed = s.completeMine<ProofOfWork>(sol); + }); + f.setWork(s.info()); + f.startCPU(); + while (!completed) + this_thread::sleep_for(chrono::milliseconds(20)); +} + +void mine(BlockInfo& _bi) +{ + GenericFarm<ProofOfWork> f; + bool completed = false; + f.onSolutionFound([&](ProofOfWork::Solution sol) + { + ProofOfWork::assignResult(sol, _bi); + return completed = true; + }); + f.setWork(_bi); + f.startCPU(); + while (!completed) + this_thread::sleep_for(chrono::milliseconds(20)); +} + } namespace test |