forked from dhruvbansal/bitcoin-iterate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
format.h
66 lines (63 loc) · 1.74 KB
/
format.h
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
59
60
61
62
63
64
65
66
/*******************************************************************************
*
* = format.h
*
* Defines a function for interpolating blockchain data into a
* user-provided format string.
*
*/
#ifndef BITCOIN_ITERATE_DUMP_H
#define BITCOIN_ITERATE_DUMP_H
#include "types.h"
#include "utxo.h"
/**
* print_format - Interpolate blockchain data into user-provided format string.
*
* @format: format string
* @utxo_map: global UTXO map
* @b: current block
* @t: current transaction
* @txnum: current transaction number
* @i: current transaction input
* @o: current transaction output
* @u: current UTXO
* @last_utxo_block: last block for which UTXOs were iterated over
*
* In typical usage, most arguments will be `NULL` as shown in the
* following examples:
*
* Example:
* // Print block b
* print_format(blockfmt, &utxo_map, b, NULL, 0, NULL, NULL, NULL);
*
* Example:
*
* // Print transaction t with number txnum in block b
* print_format(txfmt, &utxo_map, b, t, txnum, NULL, NULL, NULL);
*
* Example:
*
* // Print transaction input i in transaction t with number txnum in block b
* print_format(inputfmt, &utxo_map, b, t, txnum, i, NULL, NULL);
*
* Example:
*
* // Print transaction output o in transaction t with number txnum in block b
* print_format(outputfmt, &utxo_map, b, t, txnum, NULL, o, NULL);
*
* Example:
*
* // Print UTXO u in block b
* print_format(utxofmt, &utxo_map, b, NULL, 0, NULL, NULL, u);
*
*/
void print_format(const char *format,
const struct utxo_map *utxo_map,
struct block *b,
struct transaction *t,
size_t txnum,
struct input *i,
struct output *o,
struct utxo *u,
struct block *last_utxo_block);
#endif /* BITCOIN_ITERATE_DUMP_H */