rpc: improve get_output_distribution

It can now handle small reorgs without having to rescan the
whole blockchain.

Also add a test for it.
This commit is contained in:
moneromooo-monero 2019-04-25 16:41:33 +00:00
parent 581994b61c
commit 0eb0d6b802
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
7 changed files with 270 additions and 20 deletions

View file

@ -32,6 +32,7 @@
#include <cstdint>
#include <string>
#include <vector>
#include "crypto/hash.h"
namespace cryptonote
{
@ -56,7 +57,7 @@ class RpcHandler
virtual std::string handle(const std::string& request) = 0;
static boost::optional<output_distribution_data>
get_output_distribution(const std::function<bool(uint64_t, uint64_t, uint64_t, uint64_t&, std::vector<uint64_t>&, uint64_t&)> &f, uint64_t amount, uint64_t from_height, uint64_t to_height, bool cumulative);
get_output_distribution(const std::function<bool(uint64_t, uint64_t, uint64_t, uint64_t&, std::vector<uint64_t>&, uint64_t&)> &f, uint64_t amount, uint64_t from_height, uint64_t to_height, const std::function<crypto::hash(uint64_t)> &get_hash, bool cumulative, uint64_t blockchain_height);
};