Skip to content

Commit

Permalink
Merge pull request #150 from brave-intl/upgrade-path
Browse files Browse the repository at this point in the history
Adds upgrade path from 55.12-55.14
  • Loading branch information
NejcZdovc authored Oct 18, 2018
2 parents 779c1a8 + 55c092f commit 3e35b5e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/bat_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,28 @@ bool BatClient::loadState(const std::string& data) {

state_.reset(new braveledger_bat_helper::CLIENT_STATE_ST(state));

bool stateChanged = false;

// clear old reconciles
if (state_->batch_.size() == 0) {
state_->current_reconciles_ = {};
stateChanged = true;
}

// fix timestamp ms to s conversion
if (std::to_string(state_->reconcileStamp_).length() > 10) {
state_->reconcileStamp_ = state_->reconcileStamp_ / 1000;
stateChanged = true;
}

// fix timestamp ms to s conversion
if (std::to_string(state_->bootStamp_).length() > 10) {
state_->bootStamp_ = state_->bootStamp_ / 1000;
stateChanged = true;
}

if (stateChanged) {
saveState();
}

return true;
Expand Down

0 comments on commit 3e35b5e

Please sign in to comment.