Equihash: Pass each obtained solution to a callback for immediate checking
Closes #1143
This commit is contained in:
@@ -188,19 +188,13 @@ Value generate(const Array& params, bool fHelp)
|
||||
pblock->nNonce.size());
|
||||
|
||||
// (x_1, x_2, ...) = A(I, V, n, k)
|
||||
std::set<std::vector<unsigned int>> solns;
|
||||
EhBasicSolveUncancellable(n, k, curr_state, solns);
|
||||
|
||||
for (auto soln : solns) {
|
||||
bool isValid;
|
||||
EhIsValidSolution(n, k, curr_state, soln, isValid);
|
||||
assert(isValid);
|
||||
std::function<bool(std::vector<eh_index>)> validBlock =
|
||||
[&pblock](std::vector<eh_index> soln) {
|
||||
pblock->nSolution = soln;
|
||||
|
||||
if (CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus())) {
|
||||
goto endloop;
|
||||
}
|
||||
}
|
||||
return CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus());
|
||||
};
|
||||
if (EhBasicSolveUncancellable(n, k, curr_state, validBlock));
|
||||
goto endloop;
|
||||
}
|
||||
endloop:
|
||||
CValidationState state;
|
||||
|
||||
Reference in New Issue
Block a user