-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock.hpp
More file actions
42 lines (36 loc) · 1.36 KB
/
block.hpp
File metadata and controls
42 lines (36 loc) · 1.36 KB
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
#pragma once
#ifndef BLOCK_HPP
#define BLOCK_HPP
#include<iostream>
#include<random>
#include<vector>
#include<string>
using namespace std;
class Block{
private:
long long index;
string date_time;
string last_hash;
string hash_;
string data;
long long Nonce;
int difficulty;
public:
Block(long long idx, string dt, string last_h, string hsh, string dat, long long nonce, int diff=4)
: index(idx), date_time(dt), last_hash(last_h), hash_(hsh), data(dat), Nonce(nonce), difficulty(diff) {}
long long getIndex() const { return index; }
string getDateTime() const { return date_time; }
string getLastHash() const { return last_hash; }
string getHash() const { return hash_; }
string getData() const { return data; }
long long getNonce() const { return Nonce; }
int getDifficulty() const { return difficulty; }
void setIndex(long long idx) { index = idx; }
void setDateTime(const string& dt) { date_time = dt; }
void setLastHash(const string& last_h) { last_hash = last_h; }
void setHash(const string& hsh) { hash_ = hsh; }
void setData(const string& dat) { data = dat; }
void setNonce(long long nonce) { Nonce = nonce; }
void setDifficulty(int diff) { difficulty = diff; }
};
#endif // BLOCK_HPP