diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-02-27 08:30:59 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-03-16 10:32:42 +0000 |
commit | db10dd6d8329de92e212247a2eb101c773d4c3cd (patch) | |
tree | 5749b597db0a8858954d83b1fbb83755f8adeb82 /src/wallet/ringdb.h | |
parent | blockchain_utilities: new blockchain_blackball tool (diff) | |
download | monero-db10dd6d8329de92e212247a2eb101c773d4c3cd.tar.xz |
wallet: make ringdb an object with database state
Diffstat (limited to 'src/wallet/ringdb.h')
-rw-r--r-- | src/wallet/ringdb.h | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/wallet/ringdb.h b/src/wallet/ringdb.h index 5aea47075..351ae5a2b 100644 --- a/src/wallet/ringdb.h +++ b/src/wallet/ringdb.h @@ -30,21 +30,35 @@ #include <string> #include <vector> +#include <lmdb.h> #include "wipeable_string.h" #include "crypto/crypto.h" #include "cryptonote_basic/cryptonote_basic.h" namespace tools { - namespace ringdb + class ringdb { - bool add_rings(const std::string &filename, const crypto::chacha_key &chacha_key, const cryptonote::transaction_prefix &tx); - bool remove_rings(const std::string &filename, const crypto::chacha_key &chacha_key, const cryptonote::transaction_prefix &tx); - bool get_ring(const std::string &filename, const crypto::chacha_key &chacha_key, const crypto::key_image &key_image, std::vector<uint64_t> &outs); + public: + ringdb(std::string filename); + ~ringdb(); - bool blackball(const std::string &filename, const crypto::public_key &output); - bool unblackball(const std::string &filename, const crypto::public_key &output); - bool blackballed(const std::string &filename, const crypto::public_key &output); - bool clear_blackballs(const std::string &filename); - } + bool add_rings(const crypto::chacha_key &chacha_key, const cryptonote::transaction_prefix &tx); + bool remove_rings(const crypto::chacha_key &chacha_key, const cryptonote::transaction_prefix &tx); + bool get_ring(const crypto::chacha_key &chacha_key, const crypto::key_image &key_image, std::vector<uint64_t> &outs); + + bool blackball(const crypto::public_key &output); + bool unblackball(const crypto::public_key &output); + bool blackballed(const crypto::public_key &output); + bool clear_blackballs(); + + private: + bool blackball_worker(const crypto::public_key &output, int op); + + private: + std::string filename; + MDB_env *env; + MDB_dbi dbi_rings; + MDB_dbi dbi_blackballs; + }; } |