diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-21 12:55:55 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-21 23:49:53 +0000 |
commit | bb2aed8e4d78fd87c2bc3e094922ba208b037654 (patch) | |
tree | f32d0c830846d8e74cbe761a2f9eda42352c5aaf /src/rpc/core_rpc_server.cpp | |
parent | Merge pull request #4988 (diff) | |
download | monero-bb2aed8e4d78fd87c2bc3e094922ba208b037654.tar.xz |
rpc: quantize db size up to 5 GB in restricted mode
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index b524273bf..6ccf7fe64 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 @@ -214,7 +219,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; |