Skip to content

Commit

Permalink
Confirmations fails to initialize when creating a new wallet (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmancey authored Jan 24, 2019
1 parent 5e96c0e commit 7feab91
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/confirmations_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1348,12 +1348,16 @@ void ConfirmationsImpl::LoadState() {
void ConfirmationsImpl::OnStateLoaded(
const Result result,
const std::string& json) {
if (result == FAILED) {
BLOG(ERROR) << "Failed to load confirmations state";
return;
auto confirmations_json = json;

if (result != SUCCESS) {
BLOG(ERROR) << "Failed to load confirmations state, resetting to default"
" values";

confirmations_json = ToJSON();
}

if (!FromJSON(json)) {
if (!FromJSON(confirmations_json)) {
BLOG(ERROR) << "Failed to parse confirmations state: " << json;
return;
}
Expand Down

0 comments on commit 7feab91

Please sign in to comment.