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
rpc: Avoid getchaintxstats invalid results #29720
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
2ece999
to
fa032a5
Compare
fa032a5
to
faeb205
Compare
Concept ACK, could we add a test for this? |
A test is already present in |
fa146d9
to
fa28613
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.
tACK fa28613
I have written some additional coverage to test the behavior and build my understanding, it could be added here or I can make a follow-up: fjahr@03a0f31
I think |
fa28613
to
fa73710
Compare
re-ACK fa73710
Here is a version with |
fa73710
to
ef692e5
Compare
@fjahr Thanks! I've pushed your test commit with small fixups. |
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
The CI failure can be ignored during review. It is fixed in #30144 |
The
getchaintxstats
RPC reply during AU background download may return non-zero, but invalid, values forwindow_tx_count
andtxrate
.For example,
txcount
may be zero for a to-be-downloaded block, but may be non-zero for an ancestor block which is already downloaded. Thus, the values returned may be negative (and cause intermediate integer sanitizer violations).Also,
txcount
may be accurate for the snapshot base block, or a descendant of it. However it may be zero for an ancestor block that still needs to be downloaded. Thus, the values returned may be positive, but wrong.Fix all issues by skipping the returned value if either
txcount
is unset (equal to zero).Also, skip
txcount
in the returned value, if it is unset (equal to zero).Fixes #29328