diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index b8edb760..e95b763e 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -212,7 +212,7 @@ #define BC_OFFERS_CURRENCY_MARKET_FILENAME "market.bin" -#define WALLET_FILE_SERIALIZATION_VERSION (CURRENCY_FORMATION_VERSION+63) +#define WALLET_FILE_SERIALIZATION_VERSION (CURRENCY_FORMATION_VERSION+64) #define CURRENT_MEMPOOL_ARCHIVE_VER (CURRENCY_FORMATION_VERSION+31) diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index b5f6953c..05c4230d 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -610,30 +610,46 @@ namespace tools { // do not load wallet if data version is greather than the code version if (ver > WALLET_FILE_SERIALIZATION_VERSION) + { + LOG_PRINT_MAGENTA("Wallet file truncated due to WALLET_FILE_SERIALIZATION_VERSION is more then curren build", LOG_LEVEL_0); return; + } + + if (ver < 147) + { + LOG_PRINT_MAGENTA("Wallet file truncated due to old version", LOG_LEVEL_0); + return; + } + + if (t_archive::is_saving::value) + { + uint64_t formation_ver = CURRENCY_FORMATION_VERSION; + a & formation_ver; + } + else + { + uint64_t formation_ver = 0; + a & formation_ver; + if (formation_ver != CURRENCY_FORMATION_VERSION) + { + LOG_PRINT_MAGENTA("Wallet file truncated due to mismatch CURRENCY_FORMATION_VERSION", LOG_LEVEL_0); + return; + } + } a & m_blockchain; a & m_transfers; a & m_multisig_transfers; - a & m_key_images; - + a & m_key_images; a & m_unconfirmed_txs; - if (ver < 144) //reset unconfirmed due to "coinbase relay bug" - { - m_unconfirmed_txs.clear(); - } - a & m_unconfirmed_multisig_transfers; a & m_payments; a & m_transfer_history; a & m_unconfirmed_in_transfers; a & m_contracts; a & m_money_expirations; - if (ver >= 144) - { - a & m_pending_key_images; - a & m_tx_keys; - } + a & m_pending_key_images; + a & m_tx_keys; } diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index debe1300..a7227fdb 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -19,7 +19,8 @@ using namespace epee; namespace tools { //----------------------------------------------------------------------------------- - const command_line::arg_descriptor wallet_rpc_server::arg_rpc_bind_port = {"rpc-bind-port", "Starts wallet as rpc server for wallet operations, sets bind port for server", "", true}; + const command_line::arg_descriptor wallet_rpc_server:: + = {"rpc-bind-port", "Starts wallet as rpc server for wallet operations, sets bind port for server", "", true}; const command_line::arg_descriptor wallet_rpc_server::arg_rpc_bind_ip = {"rpc-bind-ip", "Specify ip to bind rpc server", "127.0.0.1"}; const command_line::arg_descriptor wallet_rpc_server::arg_miner_text_info = { "miner-text-info", "Wallet password", "", true };