aboutsummaryrefslogtreecommitdiffstats
path: root/TestHelper.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2015-04-14 00:12:05 +0800
committerGav Wood <i@gavwood.com>2015-04-14 18:56:58 +0800
commitefdd3790a0405654933f456751230254cef95151 (patch)
tree49858d780698755113eae1aa88dca3e423ceed90 /TestHelper.cpp
parentd0efe9333fc88bae5ab82ef0435d99d9be4e21d4 (diff)
downloaddexon-solidity-efdd3790a0405654933f456751230254cef95151.tar.gz
dexon-solidity-efdd3790a0405654933f456751230254cef95151.tar.zst
dexon-solidity-efdd3790a0405654933f456751230254cef95151.zip
Various fixes for mining.
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r--TestHelper.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 45fe55b0..93c564e6 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