-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTransaction.h
More file actions
executable file
·58 lines (47 loc) · 1.17 KB
/
Transaction.h
File metadata and controls
executable file
·58 lines (47 loc) · 1.17 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <string>
#include <fstream>
using std::string;
using std::ofstream;
/**
*
* Transaction - Defining the new Transaction Type
*
*/
struct Transaction {
unsigned int value;
string sender;
string receiver;
};
/**
* TransactionDumpInfo - Prints the data of the transaction to a given file
*
* The data is printed in the following format:
* Sender Name: <name>
* Receiver Name: <name>
* Transaction Value: <value>
*
* @param transaction Transaction to print
*/
void TransactionDumpInfo(const Transaction& transaction, ofstream& file);
/**
* TransactionHashMessage - Hashs the message of the transaction
*
* @param transaction Transaction to hash
*
* @return The hashed message
*/
string TransactionHashedMessage(const Transaction& transaction);
/**
* TransactionVerifyHashedMessage - Verifies that a given transaction suits a given hashed message
*
* @param transaction Given transaction
* @param hashedMessage Hashed message to verify
*
* @return true if the message given is suitable to this transaction, false otherwise
*
*/
bool TransactionVerifyHashedMessage(
const Transaction& transaction,
string hashedMessage
);