OlinCoin
Test
wallet_pool.h
1#pragma once
2
3#include "constants.h"
4#include "uthash.h"
5#include "utxo_pool.h"
6#include "init_db.h"
7
8typedef struct {
9 mbedtls_ecdsa_context *key_pair;
10 unsigned long amt;
11 int spent; // True when included in a tx but not validated in a block
13
14typedef struct {
15 UTXOPoolKey id;
16 WalletEntry *entry;
17 UT_hash_handle hh;
19
20typedef struct {
21 unsigned char public_key_hash[PUB_KEY_HASH_LEN];
22 mbedtls_ecdsa_context *key_pair;
23 UT_hash_handle hh;
24} KeyPool;
25
26char *key_pool_path;
27leveldb_t *key_pool_db; // Level DB Database
28char *wallet_pool_path;
29leveldb_t *wallet_pool_db; // Level DB Database
30
31
38int wallet_init_leveldb(char *db_env);
39
44void destroy_wallet();
45
56int wallet_pool_build_add_leveldb(Transaction *tx, unsigned int vout, mbedtls_ecdsa_context *key_pair);
57
65int wallet_pool_add_wallet_entry_leveldb(unsigned char *db_key, WalletEntry *entry);
66
75int wallet_pool_find_leveldb(WalletEntry **found_entry, unsigned char *tx_hash, unsigned int vout);
76
84int wallet_pool_remove_leveldb(unsigned char *tx_hash, unsigned int vout);
85
92int wallet_pool_count(unsigned int *num_entries);
93
100int key_pool_add_leveldb(mbedtls_ecp_keypair *key_pair);
101
109int key_pool_find_leveldb(mbedtls_ecdsa_context **keypair, unsigned char *public_key_hash);
110
117int key_pool_remove_leveldb(unsigned char *public_key_hash);
118
125int key_pool_count(unsigned int *num_entries);
126
136mbedtls_ecdsa_context *check_if_output_unlockable_leveldb(Transaction *tx, unsigned int vout);
Definition: wallet_pool.h:20
Definition: base_tx.h:19
Definition: utxo_pool.h:9
Definition: wallet_pool.h:8
Definition: wallet_pool.h:14