Skip to content

Conversation

@Sjors
Copy link
Owner

@Sjors Sjors commented Nov 4, 2025

I plan to split these into standalone pull requests in due time.

Based on

Non-breaking commits

mining: deprecate getCoinbaseCommitment()

Its value is only used by the getblocktemplate RPC and is redundant with the required_outputs fields of getCoinbase()

Breaking commits

mining: drop getCoinbaseTx(), etc

This drops three deprecated methods:

  • getCoinbaseTx()
  • getCoinbaseCommitment()
  • getWitnessCommitmentIndex()

Pass context to createNewBlock() and checkBlock()

Adding a context parameter ensures that these methods are run in their own thread and don't block other calls.

This is especially important for checkBlock() which may receive a slow to validate block from an untrusted origin (the IPC connection itself is assumed to trusted).

This is a breaking change both ways:

  • clients must use the updated capnp file
  • updated clients can't call these methods on an unupgraded node

Make non-mandatory coinbase commitment opt-in

This adds always_add_coinbase_commitment to BlockCreateOptions

It could be carefully documented to avoid making it a breaking change, by telling clients to omit it for older Bitcoin Core versions. But it's easier as a breaking change.

Part of the test is commented out pending the newly proposed getCoinbase() method

Introduce a new method intended to replace getCoinbaseTx(), which
provides a struct with everything clients need to construct a coinbase.
This is safer than providing a raw dummy coinbase that clients then have
to manipulate.

A new helper method ExtractCoinbaseTemplate() processes the dummy
coinbase transaction generated by BlockAssembler::CreateNewBlock
and produces a CoinbaseTemplate.

Expand the interface_ipc.py functional test to document its usage
and ensure equivalence.
Add default_witness_commitment to CoinbaseTemplate for use in the
getblocktemplate RPC.
Drop the following mining interface methods in favor of getCoinbase():

- getCoinbaseTx()
- getCoinbaseCommitment()
- getWitnessCommitmentIndex()
Clear dummy coinbase from block templates by default so it's not exposed to callers of getBlock().

Have RPC and test code opt-in to keeping the dummy coinbase where needed.
Adding a context parameter ensures that these methods are run in
their own thread and don't block other calls.

This is especially important for checkBlock() which may receive a
slow to validate block from an untrusted origin (the IPC connection
itself is assumed to trusted).

This is a breaking change both ways:
- clients must use the updated capnp file
- updated clients can't call these methods
  on an unupgraded node
@Sjors Sjors force-pushed the 2025/11/interface-breaking branch from e502f2d to e883903 Compare November 17, 2025 14:49
Previously the dummy coinbase returned by the Mining IPC interface
always had a witness and SegWit OP_RETURN output. This is unnecessary
for empty blocks as well as for blocks without any SegWit spends.

This commit makes this behavior configurable via
always_add_coinbase_commitment on BlockCreateOptions. It defaults to false,
making this a potentially breaking change to clients. The presence of this
field in requests makes it incompatible with Bitcoin Core v30, so it's a
breaking change in any case.

Preserve historical getblocktemplate RPC behavior. Although it doesn't return a
coinbase transaction, it does always provide a default_witness_commitment. This
is set in BlockAssembler::CreateNewBlock() via a call GenerateCoinbaseCommitment(),
which has the side-effect of adding a coinbase witness.
@Sjors Sjors force-pushed the 2025/11/interface-breaking branch from e883903 to 40d1886 Compare November 17, 2025 14:55
@Sjors
Copy link
Owner Author

Sjors commented Nov 17, 2025

I'll rebase after bitcoin#33880 lands to see if that fixes the failing jobs.

@Sjors
Copy link
Owner Author

Sjors commented Nov 24, 2025

PR bitcoin#33936 fixes an important memory management bug, so it justifies a breaking change imo. If it lands then I might as well PR the other breaking changes here.

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