Repository navigation
listtransactions compares skip and count against an array it never fills - #1094
Open
whiskyrelaxing wants to merge 1 commit into
Open
whiskyrelaxing wants to merge 1 commit into
whiskyrelaxing wants to merge 1 commit into
Conversation
ohcee
reviewed
Nov 6, 2026
ohcee
left a comment
Collaborator
There was a problem hiding this comment.
utACK a09e0e1
ret was never filled, so the clamps compared against an empty array, skip ≥ 1 returned nothing, skip = 0 returned the whole collection. Both right-hand sides already said retReversed; this just makes the comparisons match. Checked that the pattern doesn't exist anywhere else in the file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
listtransactions declares two arrays and only fills one:
The loop fills retReversed. ret is never written to, but both clamps read its
size, rpcwallet.cpp:2943:
ret.size() is always 0. So any skip above zero puts nFrom past the end and nCount
at zero, and returns nothing. With skip at zero, nCount is replaced by the whole
collected size, which overshoots because the loop breaks on >= and
ListTransactions appends one row per detail entry.
On a wallet whose eight newest transactions have one row each and whose next two
have four and nineteen:
The patch points both clamps at retReversed and drops the dead declaration and
the stale comment. The right hand sides already said retReversed.size().
Checked by lifting the post-collection half of the function into a harness
compiled against the project's own UniValue. Unpatched it matches a live node on
sixteen cases; patched it returns the requested count on all of them and
successive pages join up.