-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlock.h
More file actions
42 lines (31 loc) · 822 Bytes
/
Block.h
File metadata and controls
42 lines (31 loc) · 822 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
#ifndef BLOCK_H
#define BLOCK_H
#include <QByteArray>
#include <QDateTime>
#include <QVariant>
class Block
{
public:
explicit Block(int index, QByteArray prevHash, QVariant data, int nonce = 0);
Block();
int index() const;
void setIndex(int index);
int nonce() const;
void setNonce(int nonce);
QVariant data() const;
void setData(const QVariant &data);
QByteArray prevHash() const;
void setPrevHash(const QByteArray &prevHash);
QByteArray hash() const;
QByteArray hash(int nonce) const;
QByteArray header() const;
QString toString() const;
QByteArray toByteArray() const;
static const Block fromByteArray(const QByteArray &byteArray);
private:
int m_index;
int m_nonce;
QVariant m_data;
QByteArray m_prevHash;
};
#endif // BLOCK_H