Add tests that exercise the cancellation code branches

This commit is contained in:
Jack Grigg
2016-07-21 16:39:32 +12:00
parent 2dbabb1159
commit 5b4ebcd5e2
5 changed files with 238 additions and 35 deletions

View File

@@ -521,7 +521,9 @@ void static BitcoinMiner(CWallet *pwallet)
pblock->nNonce.ToString());
std::set<std::vector<unsigned int>> solns;
try {
std::function<bool()> cancelled = [pindexPrev] { return pindexPrev != chainActive.Tip(); };
std::function<bool(EhSolverCancelCheck)> cancelled = [pindexPrev](EhSolverCancelCheck pos) {
return pindexPrev != chainActive.Tip();
};
EhOptimisedSolve(n, k, curr_state, solns, cancelled);
} catch (EhSolverCancelledException&) {
LogPrint("pow", "Equihash solver cancelled\n");