forked from lthn/blockchain
Merge branch 'develop' into flags
This commit is contained in:
commit
d803771b52
2 changed files with 0 additions and 50 deletions
|
|
@ -2298,8 +2298,6 @@ void wallet2::generate(const std::wstring& path, const std::string& pass, bool a
|
|||
clear();
|
||||
prepare_file_names(path);
|
||||
|
||||
check_for_free_space_and_throw_if_it_lacks(m_wallet_file);
|
||||
|
||||
m_password = pass;
|
||||
m_account.generate(auditable_wallet);
|
||||
init_log_prefix();
|
||||
|
|
@ -2349,8 +2347,6 @@ void wallet2::load(const std::wstring& wallet_, const std::string& password)
|
|||
clear();
|
||||
prepare_file_names(wallet_);
|
||||
|
||||
check_for_free_space_and_throw_if_it_lacks(m_wallet_file);
|
||||
|
||||
m_password = password;
|
||||
|
||||
std::string keys_buff;
|
||||
|
|
@ -2427,8 +2423,6 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor
|
|||
{
|
||||
LOG_PRINT_L0("(before storing: pending_key_images: " << m_pending_key_images.size() << ", pki file elements: " << m_pending_key_images_file_container.size() << ", tx_keys: " << m_tx_keys.size() << ")");
|
||||
|
||||
// check_for_free_space_and_throw_if_it_lacks(path_to_save); temporary disabled, wallet saving implemented in two-stage scheme to avoid data loss due to lack of space
|
||||
|
||||
std::string ascii_path_to_save = epee::string_encoding::convert_to_ansii(path_to_save);
|
||||
|
||||
//prepare data
|
||||
|
|
@ -2571,49 +2565,6 @@ void wallet2::store_watch_only(const std::wstring& path_to_save, const std::stri
|
|||
wo.store(path_to_save, password);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::check_for_free_space_and_throw_if_it_lacks(const std::wstring& wallet_filename, uint64_t exact_size_needed_if_known /* = UINT64_MAX */)
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
try
|
||||
{
|
||||
fs::path wallet_file_path(wallet_filename);
|
||||
fs::path base_path = wallet_file_path.parent_path();
|
||||
if (base_path.empty())
|
||||
base_path = fs::path(".");
|
||||
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(fs::is_directory(base_path), "directory does not exist: " << base_path.string());
|
||||
|
||||
uint64_t min_free_size = exact_size_needed_if_known;
|
||||
if (min_free_size == UINT64_MAX)
|
||||
{
|
||||
// if exact size needed is unknown -- determine it as
|
||||
// twice the original wallet file size or MINIMUM_REQUIRED_WALLET_FREE_SPACE_BYTES, which one is bigger
|
||||
min_free_size = MINIMUM_REQUIRED_WALLET_FREE_SPACE_BYTES;
|
||||
if (fs::is_regular_file(wallet_file_path))
|
||||
min_free_size = std::max(min_free_size, 2 * static_cast<uint64_t>(fs::file_size(wallet_file_path)));
|
||||
}
|
||||
else
|
||||
{
|
||||
min_free_size += 1024 * 1024 * 10; // add a little for FS overhead and so
|
||||
}
|
||||
|
||||
fs::space_info si = fs::space(base_path);
|
||||
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(si.available > min_free_size, "free space at " << base_path.string() << " is too low: " << si.available << ", required minimum is: " << min_free_size);
|
||||
}
|
||||
catch (tools::error::wallet_common_error&)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(false, "failed to determine free space: " << e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(false, "failed to determine free space: unknown exception");
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
uint64_t wallet2::unlocked_balance() const
|
||||
{
|
||||
uint64_t stub = 0;
|
||||
|
|
|
|||
|
|
@ -927,7 +927,6 @@ private:
|
|||
void exception_handler();
|
||||
void exception_handler() const;
|
||||
uint64_t get_minimum_allowed_fee_for_contract(const crypto::hash& ms_id);
|
||||
void check_for_free_space_and_throw_if_it_lacks(const std::wstring& path, uint64_t exact_size_needed_if_known = UINT64_MAX);
|
||||
bool generate_packing_transaction_if_needed(currency::transaction& tx, uint64_t fake_outputs_number);
|
||||
bool store_unsigned_tx_to_file_and_reserve_transfers(const finalize_tx_param& ftp, const std::string& filename, std::string* p_unsigned_tx_blob_str = nullptr);
|
||||
void check_and_throw_if_self_directed_tx_with_payment_id_requested(const construct_tx_param& ctp);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue