OlinCoin
Test
utxo_pool.h
1#pragma once
2
3#include "constants.h"
4#include "uthash.h"
5#include "base_tx.h"
6#include "leveldb/c.h"
7#define UTXO_POOL_KEY_LEN TX_HASH_LEN+sizeof(((Transaction*)0)->inputs->prev_utxo_output)
8
9typedef struct UTXOPoolKey {
10 unsigned char tx_hash[TX_HASH_LEN];
11 unsigned int vout;
13
14typedef struct UTXOPool {
15 UTXOPoolKey id;
16 UTXO *utxo;
17 UT_hash_handle hh;
18} UTXOPool;
19
20char *utxo_pool_path;
21leveldb_t *utxo_pool_db; // Level DB Database
22
28int utxo_pool_init_leveldb(char *db_env);
29
39int make_utxo_pool_key_with_hash(unsigned char *dest, size_t *len, unsigned char *hash, unsigned int vout);
40
50int make_utxo_pool_key(unsigned char *dest, size_t *len, Transaction *tx, unsigned int vout);
51
59int utxo_pool_add_leveldb(Transaction *tx, unsigned int vout);
60
69int utxo_pool_find_leveldb(UTXO **found_utxo, unsigned char *tx_hash, unsigned int vout);
70
78int utxo_pool_remove_leveldb(unsigned char *tx_hash, unsigned int vout);
79
86int utxo_pool_count(unsigned int *num_entries);
87
94void print_utxo(UTXO *utxo, char *prefix);
95
96/*
97Prints all of the utxo_pool hashmap to stdout with keys for visualizatoin
98
99prefix: string to put in front of all print commands used for tabbing structure
100*/
101void print_utxo_hashmap(char *prefix);
Definition: base_tx.h:19
Definition: utxo_pool.h:9
Definition: utxo_pool.h:14
Definition: base_tx.h:26