1
0
Fork 0
forked from lthn/blockchain

added wallet size to open/store api

This commit is contained in:
cryptozoidberg 2020-05-12 21:48:15 +02:00
parent e6616cd225
commit b97065beba
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 9 additions and 1 deletions

View file

@ -432,6 +432,7 @@ public:
std::string seed;
bool recovered;
uint64_t wallet_local_bc_size;
uint64_t wallet_file_size;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(wallet_id)
@ -440,6 +441,7 @@ public:
KV_SERIALIZE(seed)
KV_SERIALIZE(recovered)
KV_SERIALIZE(wallet_local_bc_size)
KV_SERIALIZE(wallet_file_size)
END_KV_SERIALIZE_MAP()
};

View file

@ -359,7 +359,10 @@ namespace wallet_public
struct response
{
uint64_t wallet_file_size;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(wallet_file_size)
END_KV_SERIALIZE_MAP()
};
};

View file

@ -350,6 +350,8 @@ namespace tools
{
WALLET_RPC_BEGIN_TRY_ENTRY();
m_wallet.store();
boost::system::error_code ec = AUTO_VAL_INIT(ec);
res.wallet_file_size = boost::filesystem::file_size(m_wallet.get_wallet_path(), ec);
WALLET_RPC_CATCH_TRY_ENTRY();
return true;
}

View file

@ -794,7 +794,8 @@ std::string wallets_manager::open_wallet(const std::wstring& path, const std::st
}
}
EXCLUSIVE_CRITICAL_REGION_LOCAL(m_wallets_lock);
boost::system::error_code ec = AUTO_VAL_INIT(ec);
owr.wallet_file_size = boost::filesystem::file_size(path, ec);
wallet_vs_options& wo = m_wallets[owr.wallet_id];
**wo.w = w;
get_wallet_info(wo, owr.wi);