-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChain.h
More file actions
46 lines (38 loc) · 848 Bytes
/
Copy pathChain.h
File metadata and controls
46 lines (38 loc) · 848 Bytes
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
#ifndef CHAIN_H
#define CHAIN_H
#include <openssl/sha.h>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "Block.h"
#include "Miner.h"
#include "Miner_Race.h"
using namespace std;
class Chain {
private:
struct Node {
struct Node *prev, *next;
Block block;
int block_index;
};
public:
int size;
struct Node *head, *tail;
Miner miner;
Miner_Race mr;
bool mine_race;
Chain();
Chain(int sign_len);
Chain(int miners, int sign_len);
struct Node *new_node(Block b);
int add_block(Block b);
void print_chain();
void edit_block(int index, string new_data);
struct Node *get_block(int index);
void update_blocks_from(struct Node *node);
void remine_blocks_from(int index);
void remine_block(int index);
Block *block_iterator(int start);
int mine_controller(Block &b);
};
#endif