| 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 |
#pragma once |
| 31 |
|
| 32 |
#include <string> |
| 33 |
#include <vector> |
| 34 |
#include <lmdb.h> |
| 35 |
#include "wipeable_string.h" |
| 36 |
#include "crypto/crypto.h" |
| 37 |
#include "cryptonote_basic/cryptonote_basic.h" |
| 38 |
|
| 39 |
namespace tools |
| 40 |
{ |
| 41 |
class ringdb |
| 42 |
{ |
| 43 |
public: |
| 44 |
ringdb(std::string filename, const std::string &genesis); |
| 45 |
void close(); |
| 46 |
~ringdb(); |
| 47 |
|
| 48 |
bool add_rings(const crypto::chacha_key &chacha_key, const cryptonote::transaction_prefix &tx); |
| 49 |
bool remove_rings(const crypto::chacha_key &chacha_key, const std::vector<crypto::key_image> &key_images); |
| 50 |
bool remove_rings(const crypto::chacha_key &chacha_key, const cryptonote::transaction_prefix &tx); |
| 51 |
bool get_ring(const crypto::chacha_key &chacha_key, const crypto::key_image &key_image, std::vector<uint64_t> &outs); |
| 52 |
bool get_rings(const crypto::chacha_key &chacha_key, const std::vector<crypto::key_image> &key_images, std::vector<std::vector<uint64_t>> &all_outs); |
| 53 |
bool set_ring(const crypto::chacha_key &chacha_key, const crypto::key_image &key_image, const std::vector<uint64_t> &outs, bool relative); |
| 54 |
bool set_rings(const crypto::chacha_key &chacha_key, const std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> &rings, bool relative); |
| 55 |
|
| 56 |
bool blackball(const std::pair<uint64_t, uint64_t> &output); |
| 57 |
bool blackball(const std::vector<std::pair<uint64_t, uint64_t>> &outputs); |
| 58 |
bool unblackball(const std::pair<uint64_t, uint64_t> &output); |
| 59 |
bool blackballed(const std::pair<uint64_t, uint64_t> &output); |
| 60 |
bool clear_blackballs(); |
| 61 |
|
| 62 |
private: |
| 63 |
bool blackball_worker(const std::vector<std::pair<uint64_t, uint64_t>> &outputs, int op); |
| 64 |
|
| 65 |
private: |
| 66 |
std::string filename; |
| 67 |
MDB_env *env; |
| 68 |
MDB_dbi dbi_rings; |
| 69 |
MDB_dbi dbi_blackballs; |
| 70 |
}; |
| 71 |
} |