-
Notifications
You must be signed in to change notification settings - Fork 879
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
Fixes corrupt wallet #1839
Conversation
bb0dd16
to
fc22949
Compare
@@ -1115,6 +1112,10 @@ const confirmations::WalletInfo LedgerImpl::GetConfirmationsWalletInfo( | |||
|
|||
wallet_info.payment_id = info.paymentId_; | |||
|
|||
if (info.keyInfoSeed_.empty()) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
@@ -68,7 +68,7 @@ void BatClient::requestCredentialsCallback( | |||
|
|||
ledger_->SetUserId(user_id); | |||
|
|||
std::string registrar_vk = ledger_->GetRegistrarVK(); | |||
std::string registrar_vk; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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
fc22949
to
d6dd40d
Compare
d6dd40d
to
ceb4e04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves brave/brave-browser#3440
Resolves brave/brave-browser#2997
Resolves brave/brave-browser#3046
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests
) onnpm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist: