rpc: add blockchain disk size to getinfo
This should help new nodes predict how much disk space will be needed for a full sync
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <random>
|
||||
|
||||
#include "string_tools.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "common/util.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "crypto/crypto.h"
|
||||
@@ -3422,6 +3423,16 @@ bool BlockchainLMDB::is_read_only() const
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t BlockchainLMDB::get_database_size() const
|
||||
{
|
||||
uint64_t size = 0;
|
||||
boost::filesystem::path datafile(m_folder);
|
||||
datafile /= CRYPTONOTE_BLOCKCHAINDATA_FILENAME;
|
||||
if (!epee::file_io_utils::get_file_size(datafile.string(), size))
|
||||
size = 0;
|
||||
return size;
|
||||
}
|
||||
|
||||
void BlockchainLMDB::fixup()
|
||||
{
|
||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||
|
||||
@@ -375,6 +375,8 @@ private:
|
||||
|
||||
virtual bool is_read_only() const;
|
||||
|
||||
virtual uint64_t get_database_size() const;
|
||||
|
||||
// fix up anything that may be wrong due to past bugs
|
||||
virtual void fixup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user