-
Notifications
You must be signed in to change notification settings - Fork 8
/
peer.hpp
48 lines (43 loc) · 1.13 KB
/
peer.hpp
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
#ifndef __PEER_H__
#define __PEER_H__
#include <openssl/sha.h>
#include "processor.hpp"
#include "rsa.hpp"
#include "client.hpp"
#include "server.hpp"
#include <iostream>
#include <memory>
#include <string>
#include <cstdlib>
#include <queue>
#include <openssl/rsa.h>
#include <chrono>
#include <thread>
// This number defines how many iterations to try to find a new block
// before recalling bootsrap_peers(), which we should do to ensure
// we have a group of live peers.
#define BOOTSTRAP_RETRY 50
unsigned char* SHA1(const unsigned char* s, size_t size, unsigned char* md);
/*
This struct defines the arguments that the communcations thread
will receieve from the master thread
*/
struct comm_thread_args {
synchronized_queue<transaction*>* tq;
synchronized_queue<block*>* bq;
synchronized_queue<std::string*>* peerq;
blockchain* bc;
Client* client;
};
/*
This struct defines the arguments that processor thread will receive
from the master thread
*/
struct processing_thread_args {
synchronized_queue<transaction*>* tq;
synchronized_queue<block*>* bq;
synchronized_queue<std::string*>* peerq;
blockchain* bc;
Client* client;
};
#endif