From 35e0a968bde4644a86f6f455b1a50ca25398fa15 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 2 Apr 2019 14:16:45 +0000 Subject: wallet2: "output lineup" fake out selection Based on python code by sarang: https://github.com/SarangNoether/skunkworks/blob/outputs/outputs/simulate.py --- src/wallet/wallet2.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/wallet/wallet2.h') 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 #include #include +#include #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 &rct_offsets); + gamma_picker(const std::vector &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::max(); } + result_type operator()() { return crypto::rand(); } + } engine; + +private: + std::gamma_distribution gamma; + const std::vector &rct_offsets; + const uint64_t *begin, *end; + uint64_t num_rct_outputs; + double average_output_time; + }; + class wallet_keys_unlocker { public: -- cgit v1.2.3