Fix rpc::CoreTxIter logic.#704
Conversation
569cfce to
44ba60a
Compare
|
Can you come up with an example that would break without this PR (i.e. without iterating in chronological order)? You don't have to write it in code right now, just describe it. We can add it later to the blockchain tests so that we can cover more "edge-cases". |
|
@afilini the "chronological order" is just a good to have. The real fix is this:
Sorry I should have made it more clear. It just so happened that the test I wrote for the iterator didn't work initially (and I didn't know why) but then I realized that with different page sizes results were returned in different orders so I decided to change the logic to make things more predictable. |
44ba60a to
a2c4a33
Compare
|
@afilini I just updated the PR description and commit message to better describe the intention. |
|
@afilini Right now the The chronological nature of transactions returned is more of an "implementation detail" for determining field values of |
This fixes a bug where `CoreTxIter` attempts to call `listtransactions` immediately after a tx result is filtered (instead of being returned), when in fact, the correct logic will be to pop another tx result. The new logic also ensures that tx results are returned in chonological order. The test `test_list_transactions` verifies this. We also now ensure that `page_size` is between the range `[0 to 1000]` otherwise an error is returned. Some needless cloning is removed from `from_config` as well as logging improvements.
a2c4a33 to
74e2c47
Compare
|
Ah ok, that's fine. The other bug was clear to me, instead of an |
Description
This fixes a bug where
CoreTxIterattempts to calllisttransactionsimmediately after a tx result is filtered (instead of being returned), when in fact, the correct logic will be to pop another tx result.The new logic also ensures that tx results are returned in chonological order. The test
test_list_transactionsverifies this. We also now ensure thatpage_sizeis between the range[0 to 1000]otherwise an error is returned.Some needless cloning is removed from
from_configas well as logging improvements.Notes to the reviewers
This is an oversight by me (sorry) for PR #683
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingBugfixes:
* [ ] This pull request breaks the existing API