Add class JobResult.

This commit is contained in:
XMRig 2017-06-11 10:58:46 +03:00
parent 3ad11685cc
commit a0a8711dab
12 changed files with 112 additions and 22 deletions

View file

@ -25,6 +25,8 @@
#include "crypto/CryptoNight.h"
#include "crypto/CryptoNight_p.h"
#include "crypto/CryptoNight_test.h"
#include "net/Job.h"
#include "net/JobResult.h"
#include "Options.h"
@ -91,6 +93,14 @@ void (*cryptonight_variations[4])(const void *input, size_t size, void *output,
#endif
bool CryptoNight::hash(const Job &job, JobResult &result, cryptonight_ctx *ctx)
{
cryptonight_hash_ctx(job.blob(), job.size(), result.result, ctx);
return *reinterpret_cast<uint64_t*>(result.result + 24) < job.target();
}
bool CryptoNight::init(int algo, int variant)
{
if (variant < 1 || variant > 4) {

View file

@ -39,9 +39,14 @@ struct cryptonight_ctx {
};
class Job;
class JobResult;
class CryptoNight
{
public:
static bool hash(const Job &job, JobResult &result, cryptonight_ctx *ctx);
static bool init(int algo, int variant);
private: