aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-03-17 17:52:56 +0200
committerRiccardo Spagni <ric@spagni.net>2019-03-17 17:52:56 +0200
commitfd231226b94885ac8f2376e29e56f5bc6d099832 (patch)
tree500d07c6ce2add6a0d3d3cb11e364ceb8cabd731 /src
parentMerge pull request #5168 (diff)
parentrpc: quantize db size up to 5 GB in restricted mode (diff)
downloadmonero-fd231226b94885ac8f2376e29e56f5bc6d099832.tar.xz
Merge pull request #5177
bb2aed8e rpc: quantize db size up to 5 GB in restricted mode (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/rpc/core_rpc_server.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index d19403186..ecb8fc2c8 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -65,6 +65,11 @@ namespace
reasons += ", ";
reasons += reason;
}
+
+ uint64_t round_up(uint64_t value, uint64_t quantum)
+ {
+ return (value + quantum - 1) / quantum * quantum;
+ }
}
namespace cryptonote
@@ -247,7 +252,9 @@ namespace cryptonote
boost::shared_lock<boost::shared_mutex> lock(m_bootstrap_daemon_mutex);
res.was_bootstrap_ever_used = m_was_bootstrap_ever_used;
}
- res.database_size = restricted ? 0 : m_core.get_blockchain_storage().get_db().get_database_size();
+ res.database_size = m_core.get_blockchain_storage().get_db().get_database_size();
+ if (restricted)
+ res.database_size = round_up(res.database_size, 5ull* 1024 * 1024 * 1024);
res.update_available = restricted ? false : m_core.is_update_available();
res.version = restricted ? "" : MONERO_VERSION;
return true;