Skip to content

Merge bitcoin/bitcoin#19888: rpc, test: Improve getblockstats for unspendables#154

Closed
DashCoreAutoGuix wants to merge 2 commits intobackport-0.25-batch-262from
backport-0.25-batch-262-pr-19888
Closed

Merge bitcoin/bitcoin#19888: rpc, test: Improve getblockstats for unspendables#154
DashCoreAutoGuix wants to merge 2 commits intobackport-0.25-batch-262from
backport-0.25-batch-262-pr-19888

Conversation

@DashCoreAutoGuix
Copy link
Owner

Backports bitcoin#19888

Original commit: 5d9b530

Backported from Bitcoin Core v0.25

This PR improves the getblockstats RPC to handle unspendable coinbase outputs better. The changes include:

  • Added helper functions for BIP30 unspendable coinbase detection
  • Fixed handling of genesis block undo data
  • Updated getblockstats to exclude unspendable outputs from actual UTXO calculations
  • Added new fields utxo_increase_actual and utxo_size_inc_actual

The backport required minimal adaptations:

  • Removed Bitcoin-specific segwit fields (total_weight, swtotal_size, etc.)
  • Kept Dash-specific fee unit references (duffs instead of satoshis)
  • Preserved Dash-specific threading patterns
  • Used Dash genesis block hash in tests

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

d885bb2 test: Test exclusion of OP_RETURN from getblockstats (Fabian Jahr)
ba9d288 test: Fix getblockstats test data generator (Fabian Jahr)
2ca5a49 rpc: Improve getblockstats (Fabian Jahr)
cb94db1 validation, index: Add unspendable coinbase helper functions (Fabian Jahr)

Pull request description:

  Fixes bitcoin#19885

  The genesis block does not have undo data saved to disk so the RPC errored because of that.

ACKs for top commit:
  achow101:
    ACK d885bb2
  aureleoules:
    ACK d885bb2
  stickies-v:
    ACK d885bb2

Tree-SHA512: f37bda736ed605b7a41a81eeb4bfbb5d2b8518f847819e5d6a090548a61caf1455623e15165d72589ab3f4478252b00e7b624f9313ad6708cac06dd5edb62e9a
@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

Remove duplicate IsBIP30Repeat and IsBIP30Unspendable function
definitions that were causing build failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@DashCoreAutoGuix
Copy link
Owner Author

✅ Backport Verification - Issues Fixed

I found 1 critical issue and automatically applied a fix.

Original Bitcoin commit: 5d9b5305af4aaf9d4903d9d2996c5eea613b51a1
Changes pushed to branch: backport-0.25-batch-262-pr-19888
Fix commit: e8dd559134

Issues Found and Fixed:

  1. Duplicate function definitions: validation.cpp contained duplicate IsBIP30Repeat and IsBIP30Unspendable function definitions causing build failures across all platforms

Verification Details:

  • File operations match Bitcoin's intent (4 files vs 6 in Bitcoin - reasonable adaptation)
  • No missing changes detected from Bitcoin PR rpc, test: Improve getblockstats for unspendables bitcoin/bitcoin#19888
  • No scope creep or dependency explosions (500 lines vs 115 in Bitcoin - 4.3x reasonable increase)
  • No witness/segwit imports detected
  • Size validation passed (within acceptable range)
  • Function duplication fixed

Reviewer Feedback Analysis:

Human comments reviewed: 0 (only coderabbit automated comment)

CI Status:

The 5 initial CI build failures were caused by the duplicate function definitions. With the fix applied, builds should now pass.

Summary:

This is a clean backport of Bitcoin Core PR bitcoin#19888 that improves getblockstats RPC for handling unspendable coinbase outputs. The duplicate function issue has been resolved, and the backport should now be ready for merge.

The backport is faithful to the original Bitcoin change and includes appropriate Dash-specific adaptations (genesis block hash, fee units, etc.).

🤖 Generated with Claude Code

@DashCoreAutoGuix
Copy link
Owner Author

❌ Backport Verification - Critical Issue Detected

Original Bitcoin commit: 5d9b5305af
Issue: This is a duplicate backport of bitcoin#19888

Critical Problem

bitcoin#19888 was already successfully backported in commit 0e507b6be7 (merged in dashpay#6727). This PR is attempting to backport the same functionality again, which:

  1. Caused duplicate function definitions in validation.cpp (IsBIP30Repeat and IsBIP30Unspendable)
  2. Required a fix commit (e8dd559134) to remove the duplicate definitions
  3. Duplicates existing functionality that was properly implemented in the previous backport

Evidence of Duplicate Backport

Verification Details:

  • CI checks passing (after fix commit)
  • No human reviewer comments
  • No witness/segwit imports
  • [❌] CRITICAL: Duplicate backport detected

Recommended Actions:

  1. Close this PR - The functionality is already implemented
  2. Review backport tracking - Ensure rpc, test: Improve getblockstats for unspendables bitcoin/bitcoin#19888 is properly marked as completed
  3. Update CSV tracking - Mark this commit as already backported to prevent future duplicates
  4. Check for other potential duplicates in the current batch

This PR should be closed as it duplicates existing functionality and required fixes for build failures.

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.

4 participants