1
0
Fork 0
forked from lthn/blockchain

wallet: --disable-wallet-free-space-check added for simplewallet and Zano

This commit is contained in:
sowle 2020-08-31 15:40:37 +03:00
parent 01dc176ff4
commit 3755f0da18
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
8 changed files with 29 additions and 3 deletions

View file

@ -31,6 +31,7 @@ namespace command_line
const arg_descriptor<bool> arg_disable_stop_if_time_out_of_sync = { "disable-stop-if-time-out-of-sync", "Do not stop the daemon if serious time synchronization problem is detected", false, true };
const arg_descriptor<bool> arg_disable_stop_on_low_free_space = { "disable-stop-on-low-free-space", "Do not stop the daemon if free space at data dir is critically low", false, true };
const arg_descriptor<bool> arg_disable_wallet_free_space_check = { "disable-wallet-free-space-check", "Disable checking for free space in wallet", false, true };
const arg_descriptor<bool> arg_enable_offers_service = { "enable-offers-service", "Enables marketplace feature", false, false};
const arg_descriptor<std::string> arg_db_engine = { "db-engine", "Specify database engine for storage. May be \"lmdb\"(default) or \"mdbx\"", ARG_DB_ENGINE_LMDB, false };

View file

@ -210,6 +210,7 @@ namespace command_line
extern const arg_descriptor<bool> arg_disable_upnp;
extern const arg_descriptor<bool> arg_disable_stop_if_time_out_of_sync;
extern const arg_descriptor<bool> arg_disable_stop_on_low_free_space;
extern const arg_descriptor<bool> arg_disable_wallet_free_space_check;
extern const arg_descriptor<bool> arg_enable_offers_service;
extern const arg_descriptor<std::string> arg_db_engine;
extern const arg_descriptor<bool> arg_no_predownload;

View file

@ -183,7 +183,8 @@ simple_wallet::simple_wallet()
m_do_not_set_date(false),
m_do_pos_mining(false),
m_refresh_progress_reporter(*this),
m_offline_mode(false)
m_offline_mode(false),
m_free_space_check_enabled(true)
{
m_cmd_binder.set_handler("start_mining", boost::bind(&simple_wallet::start_mining, this, _1), "start_mining <threads_count> - Start mining in daemon");
m_cmd_binder.set_handler("stop_mining", boost::bind(&simple_wallet::stop_mining, this, _1), "Stop mining in daemon");
@ -369,6 +370,7 @@ void simple_wallet::handle_command_line(const boost::program_options::variables_
m_do_not_set_date = command_line::get_arg(vm, arg_dont_set_date);
m_do_pos_mining = command_line::get_arg(vm, arg_do_pos_mining);
m_restore_wallet = command_line::get_arg(vm, arg_restore_wallet);
m_free_space_check_enabled = !command_line::get_arg(vm, command_line::arg_disable_wallet_free_space_check);
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::try_connect_to_daemon()
@ -390,6 +392,7 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
m_wallet.reset(new tools::wallet2());
m_wallet->callback(this->shared_from_this());
m_wallet->set_do_rise_transfer(false);
m_wallet->set_free_space_check_enabled(m_free_space_check_enabled);
try
{
m_wallet->generate(epee::string_encoding::utf8_to_wstring(m_wallet_file), password, create_auditable_wallet);
@ -429,6 +432,7 @@ bool simple_wallet::restore_wallet(const std::string& wallet_file, const std::st
m_wallet.reset(new tools::wallet2());
m_wallet->callback(this->shared_from_this());
m_wallet->set_do_rise_transfer(true);
m_wallet->set_free_space_check_enabled(m_free_space_check_enabled);
try
{
if (tracking_wallet)
@ -474,6 +478,7 @@ bool simple_wallet::open_wallet(const string &wallet_file, const std::string& pa
m_wallet_file = wallet_file;
m_wallet.reset(new tools::wallet2());
m_wallet->callback(shared_from_this());
m_wallet->set_free_space_check_enabled(m_free_space_check_enabled);
while (true)
{
@ -1768,6 +1773,7 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_offline_mode);
command_line::add_arg(desc_params, command_line::arg_log_file);
command_line::add_arg(desc_params, command_line::arg_log_level);
command_line::add_arg(desc_params, command_line::arg_disable_wallet_free_space_check);
tools::wallet_rpc_server::init_options(desc_params);

View file

@ -166,6 +166,7 @@ namespace currency
bool m_print_brain_wallet;
bool m_do_pos_mining;
bool m_offline_mode;
bool m_free_space_check_enabled;
std::string m_restore_wallet;
epee::console_handlers_binder m_cmd_binder;

View file

@ -52,7 +52,8 @@ namespace tools
m_minimum_height(WALLET_MINIMUM_HEIGHT_UNSET_CONST),
m_pos_mint_packing_size(WALLET_DEFAULT_POS_MINT_PACKING_SIZE),
m_current_wallet_file_size(0),
m_use_deffered_global_outputs(false)
m_use_deffered_global_outputs(false),
m_do_free_space_check(true)
{
m_core_runtime_config = currency::get_default_core_runtime_config();
}
@ -2514,6 +2515,15 @@ void wallet2::set_use_deffered_global_outputs(bool use)
m_use_deffered_global_outputs = use;
}
//----------------------------------------------------------------------------------------------------
void wallet2::set_free_space_check_enabled(bool value)
{
if (value != m_do_free_space_check)
{
WLT_LOG_L0("free space check " << (value ? "enabled" : "disabled"));
}
m_do_free_space_check = value;
}
//----------------------------------------------------------------------------------------------------
void wallet2::store_watch_only(const std::wstring& path_to_save, const std::string& password) const
{
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(path_to_save != m_wallet_file, "trying to save watch-only wallet to the same wallet file!");
@ -2566,6 +2576,9 @@ void wallet2::check_for_free_space_and_throw_if_it_lacks(const std::wstring& wal
{
namespace fs = boost::filesystem;
if (!m_do_free_space_check)
return;
try
{
fs::path wallet_file_path(wallet_filename);

View file

@ -802,6 +802,7 @@ namespace tools
uint64_t get_sync_progress();
uint64_t get_wallet_file_size()const;
void set_use_deffered_global_outputs(bool use);
void set_free_space_check_enabled(bool value);
private:
@ -980,6 +981,7 @@ private:
mutable uint64_t m_current_wallet_file_size;
bool m_use_deffered_global_outputs;
bool m_do_free_space_check;
//this needed to access wallets state in coretests, for creating abnormal blocks and tranmsactions
friend class test_generator;

View file

@ -63,7 +63,8 @@ wallets_manager::wallets_manager():m_pview(&m_view_stub),
m_is_pos_allowed(false),
m_qt_logs_enbaled(false),
m_dont_save_wallet_at_stop(false),
m_use_deffered_global_outputs(false)
m_use_deffered_global_outputs(false),
m_free_space_check_enabled(true)
{
#ifndef MOBILE_WALLET_BUILD
m_offers_service.set_disabled(true);

View file

@ -213,6 +213,7 @@ private:
bool m_remote_node_mode;
bool m_qt_logs_enbaled;
bool m_free_space_check_enabled;
std::string m_qt_dev_tools;
std::atomic<bool> m_is_pos_allowed;