mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
rpc: restrict the recent cutoff size in restricted RPC mode
This commit is contained in:
parent
0564da5fdc
commit
2eef90d6ef
1 changed files with 9 additions and 0 deletions
|
@ -59,6 +59,8 @@ using namespace epee;
|
||||||
#define MAX_RESTRICTED_FAKE_OUTS_COUNT 40
|
#define MAX_RESTRICTED_FAKE_OUTS_COUNT 40
|
||||||
#define MAX_RESTRICTED_GLOBAL_FAKE_OUTS_COUNT 5000
|
#define MAX_RESTRICTED_GLOBAL_FAKE_OUTS_COUNT 5000
|
||||||
|
|
||||||
|
#define OUTPUT_HISTOGRAM_RECENT_CUTOFF_RESTRICTION (3 * 86400) // 3 days max, the wallet requests 1.8 days
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void add_reason(std::string &reasons, const char *reason)
|
void add_reason(std::string &reasons, const char *reason)
|
||||||
|
@ -1882,6 +1884,13 @@ namespace cryptonote
|
||||||
if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_GET_OUTPUT_HISTOGRAM>(invoke_http_mode::JON_RPC, "get_output_histogram", req, res, r))
|
if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_GET_OUTPUT_HISTOGRAM>(invoke_http_mode::JON_RPC, "get_output_histogram", req, res, r))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
const bool restricted = m_restricted && ctx;
|
||||||
|
if (restricted && req.recent_cutoff > 0 && req.recent_cutoff < (uint64_t)time(NULL) - OUTPUT_HISTOGRAM_RECENT_CUTOFF_RESTRICTION)
|
||||||
|
{
|
||||||
|
res.status = "Recent cutoff is too old";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> histogram;
|
std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> histogram;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue