Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Jul 8, 2025

Issue being fixed or feature implemented

#6539
#6651

These log records are useless because RPC can be called remotely for non-existing tx:

2025-04-28T12:53:35Z ERROR: Unable to get spend information

What was done?

Just removed error log for it.

How Has This Been Tested?

Call RPC for non-existing transaction:

getspentinfo '{"txid":"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9", "index":0}'

Breaking Changes

N/A

Changes are only log-related

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

These log records are useless because RPC can be called remotely:

    2025-04-28T12:53:35Z ERROR: Unable to get spend information
@knst knst added this to the 23 milestone Jul 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Walkthrough

The changes in this update modify several functions in src/rpc/index_util.cpp to simplify error handling. The affected functions (GetAddressIndex, GetSpentIndex, GetTimestampIndex, GetAddressUnspentIndex, and GetMempoolAddressDeltaIndex) now return boolean values directly from underlying database read operations rather than returning error messages upon failure. This adjustment removes explicit error reporting and streamlines the control flow, resulting in these functions returning false if the database queries fail. No changes were made to the function signatures or the declarations of any exported or public entities.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e7ea396 and 53a3415.

📒 Files selected for processing (1)
  • src/rpc/index_util.cpp (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: kwvg
PR: dashpay/dash#6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: kwvg
PR: dashpay/dash#6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Learnt from: kwvg
PR: dashpay/dash#6530
File: src/validation.cpp:360-362
Timestamp: 2025-01-14T08:37:16.955Z
Learning: The UpdateTransactionsFromBlock() method in txmempool.cpp takes parameters in the order: vHashUpdate, ancestor_size_limit, ancestor_count_limit. The size limit comes before the count limit.
src/rpc/index_util.cpp (2)
Learnt from: kwvg
PR: dashpay/dash#6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
🔇 Additional comments (5)
src/rpc/index_util.cpp (5)

29-29: LGTM: Simplified error handling removes unnecessary logging.

The change directly returns the boolean result from ReadAddressIndex instead of logging an error message, which aligns with the PR objective to remove alarming log records for expected failure scenarios.


39-39: LGTM: Consistent error handling simplification.

The change replaces error logging with a simple false return when ReadAddressUnspentIndex fails, maintaining the same function behavior while removing unnecessary log noise.


59-59: LGTM: Mempool index error handling simplified.

The change removes error logging in favor of returning false directly when getAddressIndex fails, which is consistent with the other functions and removes alarming log messages.


83-83: LGTM: Spent index error handling streamlined.

The change directly returns the boolean result from ReadSpentIndex, which specifically addresses the PR objective of removing the "ERROR: Unable to get spend information" log message mentioned in the issue.


95-95: LGTM: Timestamp index error handling simplified.

The change directly returns the boolean result from ReadTimestampIndex, completing the consistent pattern of removing error logging across all index utility functions.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@knst knst requested review from PastaPastaPasta and UdjinM6 July 8, 2025 13:14
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK 53a3415

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

makes sense

utACK 53a3415

@PastaPastaPasta PastaPastaPasta merged commit d9f52ac into dashpay:develop Jul 9, 2025
31 of 33 checks passed
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Jul 9, 2025
… spent information

53a3415 fix: remove useless but alarming log record about spent information (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented

  dashpay#6539
  dashpay#6651

  These log records are useless because RPC can be called remotely for non-existing tx:

      2025-04-28T12:53:35Z ERROR: Unable to get spend information

  ## What was done?
  Just removed error log for it.

  ## How Has This Been Tested?
  Call RPC for non-existing transaction:

      getspentinfo '{"txid":"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9", "index":0}'

  ## Breaking Changes
  N/A

  Changes are only log-related

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  PastaPastaPasta:
    utACK 53a3415
  UdjinM6:
    utACK 53a3415

Tree-SHA512: c671d41c17efd18c82d16e83104a62b1f736f599e1fe78ef021a45c112010c8898f0d00837599208238773751fb9f308f9eae41991ec02d6f73564f96f34cf5f
@UdjinM6 UdjinM6 modified the milestones: 23, 22.1.3 Jul 9, 2025
PastaPastaPasta added a commit that referenced this pull request Jul 10, 2025
9ec8e66 docs: add v22.1.3 release notes and archive v22.1.2 (pasta)
95c2a0e chore: bump version to v22.1.3 (pasta)
3345046 chore: update chainparams for v22.1.3 release (pasta)
1db850a Merge #6632: perf: versionbits avoid calculation which is not used (pasta)
4173e3c Merge #6739: docs: Fix broken links from translation instructions and a typo (pasta)
9eda785 Merge #6740: feat: improve logging of non-existing destinations for masternode payment (pasta)
47b6826 Merge #6744: fix: remove useless but alarming log record about spent information (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Backports for a new version, v22.1.3

  ## What was done?
  See release notes

  ## How Has This Been Tested?

  ## Breaking Changes
  None

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK 9ec8e66
  kwvg:
    utACK 9ec8e66

Tree-SHA512: 9e94b472c32f87c46d60fe53bcec59cb2ec1823e56cfbc2fe4a07d476e1c576c0d7f0c54115aeca902767651591556d68c8e81b81ac9bd12bc5291fa17f5a768
@knst knst deleted the fix-spentinfo branch July 15, 2025 13:56
PastaPastaPasta added a commit that referenced this pull request Jul 15, 2025
9ec8e66 docs: add v22.1.3 release notes and archive v22.1.2 (pasta)
95c2a0e chore: bump version to v22.1.3 (pasta)
3345046 chore: update chainparams for v22.1.3 release (pasta)
1db850a Merge #6632: perf: versionbits avoid calculation which is not used (pasta)
4173e3c Merge #6739: docs: Fix broken links from translation instructions and a typo (pasta)
9eda785 Merge #6740: feat: improve logging of non-existing destinations for masternode payment (pasta)
47b6826 Merge #6744: fix: remove useless but alarming log record about spent information (pasta)

Pull request description:

  ## Issue being fixed or feature implemented

  ## What was done?

  ## How Has This Been Tested?

  ## Breaking Changes
  n/a

  ## Checklist:
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK 2527ca5
  kwvg:
    utACK 2527ca5

Tree-SHA512: 3ecf4f26a816db6be797208ce5d519b8c3571a4aae832d8a1dcf41add4cc48d102459302e1777786b19f577c0a3222d77ce490e2301e73963d6021e2cdc2ad86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants