diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-02 14:16:45 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-18 15:14:38 +0000 |
commit | 35e0a968bde4644a86f6f455b1a50ca25398fa15 (patch) | |
tree | bede71958240b9f83161ff7d3b54512ac2d81d27 /src/wallet/wallet2.h | |
parent | Merge pull request #5415 (diff) | |
download | monero-35e0a968bde4644a86f6f455b1a50ca25398fa15.tar.xz |
wallet2: "output lineup" fake out selection
Based on python code by sarang:
https://github.com/SarangNoether/skunkworks/blob/outputs/outputs/simulate.py
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 8561c42ba..d101e87f5 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -39,6 +39,7 @@ #include <boost/serialization/deque.hpp> #include <boost/thread/lock_guard.hpp> #include <atomic> +#include <random> #include "include_base_utils.h" #include "cryptonote_basic/account.h" @@ -76,6 +77,30 @@ namespace tools class wallet2; class Notify; + class gamma_picker + { + public: + uint64_t pick(); + gamma_picker(const std::vector<uint64_t> &rct_offsets); + gamma_picker(const std::vector<uint64_t> &rct_offsets, double shape, double scale); + + private: + struct gamma_engine + { + typedef uint64_t result_type; + static constexpr result_type min() { return 0; } + static constexpr result_type max() { return std::numeric_limits<result_type>::max(); } + result_type operator()() { return crypto::rand<result_type>(); } + } engine; + +private: + std::gamma_distribution<double> gamma; + const std::vector<uint64_t> &rct_offsets; + const uint64_t *begin, *end; + uint64_t num_rct_outputs; + double average_output_time; + }; + class wallet_keys_unlocker { public: |