OlinCoin
Test
src
includes
blocks
base_block.h
1
#pragma once
2
#include "constants.h"
3
#include "base_tx.h"
4
5
typedef
struct
BlockHeader
{
6
unsigned
long
timestamp;
7
unsigned
char
all_tx[ALL_TX_HASH_LEN];
8
unsigned
char
prev_header_hash[BLOCK_HASH_LEN];
9
unsigned
long
nonce;
10
}
BlockHeader
;
11
12
typedef
struct
Block
{
13
unsigned
int
num_txs;
14
BlockHeader
header;
15
Transaction
** txs;
16
}
Block
;
17
18
/* Hashes passed block header
19
*
20
* dest: Buffer to write hash to, expected to be of size BLOCK_HASH_LEN
21
* header: Block header to hash
22
*/
23
void
hash_blockheader(
unsigned
char
*dest,
BlockHeader
*header);
24
25
/*
26
Prints a Block Header to stdout so data can be visualized
27
28
header: header to be printed
29
30
*/
31
void
print_block_header(
BlockHeader
*header,
char
*prefix);
32
void
pretty_print_block_header(
BlockHeader
*block,
char
*prefix);
33
34
/*
35
Prints a block to stdout, (including header) for visualization
36
37
block: block to print
38
prefix: string to put in front of all print commands used for tabbing structure
39
*/
40
void
print_block(
Block
*block,
char
*prefix);
41
void
pretty_print_block(
Block
*block,
char
*prefix);
42
BlockHeader
Definition:
base_block.h:5
Block
Definition:
base_block.h:12
Transaction
Definition:
base_tx.h:19
Generated by
1.9.3