Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes corrupt wallet #1839

Merged
merged 1 commit into from
Mar 6, 2019
Merged

Fixes corrupt wallet #1839

merged 1 commit into from
Mar 6, 2019

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Mar 5, 2019

Resolves brave/brave-browser#3440
Resolves brave/brave-browser#2997
Resolves brave/brave-browser#3046

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Verified that these changes build without errors on
    • Windows
    • macOS
    • Linux
  • Verified that these changes pass automated tests (npm test brave_unit_tests && npm test brave_browser_tests) on
    • Windows
    • macOS
    • Linux
  • Verified that all lint errors/warnings are resolved (npm run lint)
  • Ran git rebase master (if needed).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Yes or QA/No) to include the closed issue in milestone

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

@@ -1115,6 +1112,10 @@ const confirmations::WalletInfo LedgerImpl::GetConfirmationsWalletInfo(

wallet_info.payment_id = info.paymentId_;

if (info.keyInfoSeed_.empty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have corrupted state, this would fail, so we need to return blank wallet_info object

Copy link
Collaborator

@tmancey tmancey Mar 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a blank wallet_info object, as payment_id has been set?

@NejcZdovc NejcZdovc requested review from tmancey and bridiver and removed request for tmancey March 5, 2019 16:15
@NejcZdovc NejcZdovc marked this pull request as ready for review March 5, 2019 16:17
@@ -68,7 +68,7 @@ void BatClient::requestCredentialsCallback(

ledger_->SetUserId(user_id);

std::string registrar_vk = ledger_->GetRegistrarVK();
std::string registrar_vk;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this variable should be empty when starting

@@ -86,7 +86,7 @@ void BatClient::requestCredentialsCallback(
return;
}

braveledger_bat_helper::WALLET_INFO_ST wallet_info = ledger_->GetWalletInfo();
braveledger_bat_helper::WALLET_INFO_ST wallet_info;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this variable should be empty when starting

const uint64_t stamp = ledger_->GetBootStamp();
const std::string persona_id = ledger_->GetPersonaId();

if (!payment_id.empty() && stamp != 0 && !persona_id.empty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wallet was created and is correct, so we should skip creating new one

Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants