From 0b63e51a33787560f4f063937ad2891b60f24a6f Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 17 Oct 2015 17:34:05 +0800 Subject: [PATCH] prevent more excessive saving of wallet backups, and save wallet after import --- libraries/wallet/wallet.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 836c45a03c..5735cdf3a2 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2641,7 +2641,7 @@ map wallet_api::import_accounts( string filename, string password const auto plain_text = fc::aes_decrypt( password_hash, encrypted_key ); const auto private_key = fc::raw::unpack( plain_text ); - import_key( item.account_name, string( graphene::utilities::key_to_wif( private_key ) ) ); + my->import_key( item.account_name, string( graphene::utilities::key_to_wif( private_key ) ) ); ++import_successes; } catch( const fc::exception& e ) @@ -2650,6 +2650,7 @@ map wallet_api::import_accounts( string filename, string password ++import_failures; } } + save_wallet_file(); ilog( "successfully imported ${n} keys for account ${name}", ("n", import_successes)("name", item.account_name) ); if( import_failures > 0 ) elog( "failed to import ${n} keys for account ${name}", ("n", import_failures)("name", item.account_name) ); @@ -2697,9 +2698,9 @@ bool wallet_api::import_account_keys( string filename, string password, string s my->import_key( dest_account_name, string( graphene::utilities::key_to_wif( private_key ) ) ); } + save_wallet_file(); return true; } - save_wallet_file(); FC_ASSERT( found_account );