1
0
Fork 0
forked from lthn/blockchain

fixed wallet compability issues and added smooth pass of CURRENCY_FORMATION_VERSION change

This commit is contained in:
crypro.zoidberg 2019-05-08 00:53:31 +02:00
parent af4c0b3f25
commit 19177cb7de
3 changed files with 31 additions and 14 deletions

View file

@ -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)

View file

@ -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;
}

View file

@ -19,7 +19,8 @@ using namespace epee;
namespace tools
{
//-----------------------------------------------------------------------------------
const command_line::arg_descriptor<std::string> 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<std::string> 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<std::string> 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<std::string> wallet_rpc_server::arg_miner_text_info = { "miner-text-info", "Wallet password", "", true };