Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
Always save wallet after operations requiring unlocking
Browse files Browse the repository at this point in the history
  • Loading branch information
vikramrajkumar committed May 9, 2014
1 parent 4402497 commit 1300929
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libraries/rpc/rpc_server.cpp
Expand Up @@ -343,7 +343,12 @@ namespace bts { namespace rpc {
if (arguments.size() < required_argument_count)
FC_THROW_EXCEPTION(exception, "too few arguments (expected at least ${count})", ("count", required_argument_count));

return method_data.method(arguments);
auto result = method_data.method(arguments);

if (method_data.prerequisites & rpc_server::wallet_unlocked)
_client->get_wallet()->save();

return result;
}

// This method invokes the function directly, called by the CLI intepreter.
Expand Down Expand Up @@ -1167,7 +1172,6 @@ TODO: bitcoin supports all below info
rescan = true;

_client->get_wallet()->import_key(key, label);
_client->get_wallet()->save();

if (rescan)
_client->get_wallet()->scan_chain(*_client->get_chain(), 0);
Expand Down Expand Up @@ -1218,7 +1222,6 @@ As a json rpc call
rescan = true;

_client->get_wallet()->import_wif_key(wif, label);
_client->get_wallet()->save();

if (rescan)
_client->get_wallet()->scan_chain(*_client->get_chain(), 0);
Expand Down

0 comments on commit 1300929

Please sign in to comment.