-
Notifications
You must be signed in to change notification settings - Fork 40
/
parse.h
26 lines (21 loc) · 883 Bytes
/
parse.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
#ifndef BITCOIN_PARSE_PARSE_H
#define BITCOIN_PARSE_PARSE_H
#include "types.h"
#include "io.h"
struct space;
/* Step 1: Fast forward *off to head of next block, or false if not found. */
bool next_block_header_prefix(struct file *f, off_t *off, const u32 marker);
/* Step 2: Now, read in the block header, and calculate double-SHA*/
bool
read_bitcoin_block_header(struct bitcoin_block *block,
struct file *f, off_t *off,
u8 block_md[SHA256_DIGEST_LENGTH],
const u32 marker);
/* Step 3: Either skip all the transactions, or... */
void skip_bitcoin_transactions(const struct bitcoin_block *b,
off_t block_start, off_t *off);
/* ... read them in (call this repeatedly). Allocates off ctx. */
void read_bitcoin_transaction(struct space *space,
struct bitcoin_transaction *t,
struct file *f, off_t *off);
#endif /* BITCOIN_PARSE_PARSE_H */