aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.h25
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: