-
Notifications
You must be signed in to change notification settings - Fork 0
/
work_handler.h
56 lines (42 loc) · 940 Bytes
/
work_handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef WORK_HANDLER_H
#define WORK_HANDLER_H
#include <stdbool.h>
#include "uint256.h"
#include "sha256.h"
#include "server.h"
#include "queue.h"
typedef uint32_t int32;
typedef uint64_t int64;
#define SEED_SIZE 32
#define NONCE_SIZE 8
#define TOTAL_SIZE SEED_SIZE + NONCE_SIZE
#define BYTE_LENGTH 32
typedef struct solution_arguments
{
int32 difficulty;
int64 nonce;
BYTE seed[32];
} SOLN_ARGS;
typedef struct work
{
int sd;
int worker_count;
BYTE target[BYTE_LENGTH];
int64 nonce;
int32 difficulty;
BYTE x[BYTE_LENGTH + NONCE_SIZE];
} Work;
typedef struct helper_args {
int64 start;
int64 end;
BYTE target[BYTE_LENGTH];
BYTE x[BYTE_LENGTH + NONCE_SIZE];
int sd;
int32 difficulty;
} Helper;
void init_work_handler(Queue *queue);
bool check_solution(SOLN_ARGS sol_args);
void do_work(Helper *args);
void set_abort_flag_false();
void set_abort_flag_true();
#endif