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 queue not being deleted for split one time tip #5782

Merged
merged 1 commit into from
Jun 10, 2020
Merged

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Jun 9, 2020

Resolves brave/brave-browser#10176

Submitter Checklist:

Test Plan:

defined in the issue

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

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@NejcZdovc NejcZdovc added this to the 1.12.x - Nightly milestone Jun 9, 2020
@NejcZdovc NejcZdovc requested a review from a team June 9, 2020 14:38
@NejcZdovc NejcZdovc self-assigned this Jun 9, 2020
@@ -74,6 +75,7 @@ void ContributionTip::ServerPublisher(
queue_list.push_back(std::move(publisher));

auto queue = ledger::ContributionQueue::New();
queue->id = base::GenerateGUID();
Copy link
Contributor Author

@NejcZdovc NejcZdovc Jun 9, 2020

Choose a reason for hiding this comment

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

normally queue id is generated right before it's inserted in db. And then we select them after the timer passes out of db. Problem is that one time tip skip normal queue flow as we don't want to delay them like AC or monthly tips. Because of that we need to generate id when object is created so that queue can be than deleted correctly

@emerick emerick self-requested a review June 9, 2020 14:44
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

LGTM

@NejcZdovc
Copy link
Contributor Author

CI failed on test-install

@NejcZdovc NejcZdovc merged commit a0d8ebf into master Jun 10, 2020
@NejcZdovc NejcZdovc deleted the one-tip-queue branch June 10, 2020 05:25
@LaurenWags
Copy link
Member

Verified using

Brave | 1.12.14 Chromium: 83.0.4103.97 (Official Build) nightly (64-bit)
-- | --
Revision | 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{#657}
OS | macOS Version 10.14.6 (Build 18G3020)

Scenario 1:


Scenario 2: (same funding sources as scenario 1, but recurring tip instead of one time tip)
pre-req: have a staging wallet which was funded anonymously previously w/ BAT - should have a decent amount

  1. Launch clean profile w/ flags /Applications/Brave\ Browser\ Nightly.app/Contents/MacOS/Brave\ Browser\ Nightly --enable-logging=stderr --vmodule=*/bat-native-ledger/*=6,*/brave_rewards/*=6 --log-level=2 --rewards=staging=true,reconcile-interval=10 --brave-ads-staging
  2. Enable Rewards
  3. Claim UGP grant (30 BAT).
  4. Restore the wallet, note balance (should be at least 20 BAT)
  5. Set up monthly tip to kjozwiakstaging.github.io 50 BAT. (leave AC table empty)
  6. Wait for recurring tip to contribute
  7. Confirmed ending wallet balance was as expected, tips panel is as expected, etc.
  8. Restart the browser (ensuring enough time before next short reconcile due to flag used on initial launch).
  9. Confirmed a portion of the tip was not contributed again.

Scenario 3 (same as scenario 1 but with different funding source):
pre-req: have a staging wallet which was funded anonymously previously w/ BAT - should have a decent amount

  1. Launch clean profile w/ flags /Applications/Brave\ Browser\ Nightly.app/Contents/MacOS/Brave\ Browser\ Nightly --enable-logging=stderr --vmodule=*/bat-native-ledger/*=6,*/brave_rewards/*=6 --log-level=2 --rewards=staging=true --brave-ads-staging
  2. Enable Rewards
  3. Claim UGP grant (30 BAT).
  4. Connect a KYC'd uphold wallet, note balance (should be at least 20 BAT)
  5. Tip kjozwiakstaging.github.io 50 BAT.
  6. Give the tip a bit of time to process.
  7. Confirmed ending wallet balance was as expected, tips panel is as expected, etc.
  8. Restart the browser.
  9. Confirmed a portion of the tip was not contributed again.

Scenario 4 (same as scenario 3 but with tipping a non-KYC'd, verified publisher):
pre-req: have a staging wallet which was funded anonymously previously w/ BAT - should have a decent amount

  1. Launch clean profile w/ flags /Applications/Brave\ Browser\ Nightly.app/Contents/MacOS/Brave\ Browser\ Nightly --enable-logging=stderr --vmodule=*/bat-native-ledger/*=6,*/brave_rewards/*=6 --log-level=2 --rewards=staging=true --brave-ads-staging
  2. Enable Rewards
  3. Claim UGP grant (30 BAT).
  4. Connect a KYC'd uphold wallet, note balance (should be at least 20 BAT)
  5. Tip duckduckgo.com 10 BAT.
  6. Tip duckduckgo.com 1 BAT.
  7. Tip duckduckgo.com 10 BAT. (your remaining UGP grant balance is now 9 BAT, you can check this on brave://rewards-internals)
  8. Tip duckduckgo.com 10 BAT again.
  9. Confirmed only VG grant balance was used to tip DDG, the remaining amount (1 BAT) which would have come from Uphold was sent to pending tip as expected.
  10. Restart the browser.
  11. Confirmed a second entry was not added to the pending list for the Uphold portion of the last tip (1 BAT).

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

Successfully merging this pull request may close these issues.

[Desktop] portion of split funded tips are being processed again on browser restart
4 participants