From b84154d6e7f758c9eff348417a2c3414fe48e9cf Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Mon, 7 Sep 2015 12:52:09 -0400 Subject: [PATCH] wallet.cpp: Call update_account() to sync all account states to the blockchain when loading a wallet --- libraries/wallet/wallet.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 09d7ee29..575db736 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -648,6 +648,17 @@ public: FC_THROW( "Wallet chain ID does not match", ("wallet.chain_id", _wallet.chain_id) ("chain_id", _chain_id) ); + + vector< account_id_type > my_account_ids; + my_account_ids.reserve( _wallet.my_accounts.size() ); + for( const account_object& acct : _wallet.my_accounts ) + my_account_ids.push_back( acct.id ); + // TODO: Batch requests using _remote_db->get_accounts() + // to reduce number of round-trips. Remember get_accounts() has + // a limit of 100 results per call! + for( const account_id_type& acct_id : my_account_ids ) + _wallet.update_account( get_account( acct_id ) ); + return true; } void save_wallet_file(string wallet_filename = "")