aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-18 22:01:51 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-18 22:01:51 +0200
commit950f79dc03fc39f93b0a61936c7ff0fc56fb954c (patch)
tree36b0a6b942f8c48142a57c02e166b4ef28de4714 /src/wallet/wallet2.h
parentMerge pull request #5458 (diff)
parentsimplewallet: fix output representation offset (diff)
downloadmonero-950f79dc03fc39f93b0a61936c7ff0fc56fb954c.tar.xz
Merge pull request #5389
588e6700 simplewallet: fix output representation offset (moneromooo-monero) 35e0a968 wallet2: "output lineup" fake out selection (moneromooo-monero)
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: