-
Notifications
You must be signed in to change notification settings - Fork 120
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
fix(rpc): Avoid selecting duplicate transactions in block templates #6006
Conversation
- Creates a new WeightedIndex instead of updating the weights - Logs tx hashes and unpaid_actions in getblocktemplate
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6006 +/- ##
==========================================
- Coverage 78.01% 77.94% -0.07%
==========================================
Files 312 312
Lines 38997 38997
==========================================
- Hits 30425 30398 -27
- Misses 8572 8599 +27 |
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.
Looks good, just a few tweaks for usability and maintenance.
How do you know this fix works?
Can you find a second reviewer for this PR?
zebra-rpc/src/methods/get_block_template_rpcs/types/get_block_template.rs
Outdated
Show resolved
Hide resolved
It failed about 10 in ~30 tests before the change and 0 in ~20 tests after the change. I checked the logic for the mempool and it shouldn't be returning any duplicate transactions, I also checked the hashes returned by the The new selection logic doesn't clone candidate transactions anymore so I think that guarantees against duplication there. I tried to be thorough in confirming that the new logic works, I think
Good idea, I added @oxarbitrage as a reviewer. |
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.
I think it looks good, i made a few manual calls and got no duplicates.
I was thinking on making a script that just runs getblocktemplate
and check there are no duplicate transactions however i am not really sure if it worth it.
If we think it does, we can think on the test for it in a separated issue with lower priority.
We already have a CI test PR that will catch this bug, so I don't think we need any other tests. |
Motivation
The block template should not contain duplicate transactions.
Closes #5982.
Solution
FullTransactions
request.Review
Part of regular scheduled work.
Reviewer Checklist