OlinCoin
Test
base_block.h
1#pragma once
2#include "constants.h"
3#include "base_tx.h"
4
5typedef 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;
11
12typedef 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 */
23void hash_blockheader(unsigned char *dest, BlockHeader *header);
24
25/*
26Prints a Block Header to stdout so data can be visualized
27
28header: header to be printed
29
30*/
31void print_block_header(BlockHeader *header, char *prefix);
32void pretty_print_block_header(BlockHeader *block, char *prefix);
33
34/*
35Prints a block to stdout, (including header) for visualization
36
37block: block to print
38prefix: string to put in front of all print commands used for tabbing structure
39*/
40void print_block(Block *block, char *prefix);
41void pretty_print_block(Block *block, char *prefix);
42
Definition: base_block.h:5
Definition: base_block.h:12
Definition: base_tx.h:19