AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 63 Bitcoin

mining: ensure witness commitment check in submitBlock

Public commit record

What the developer wrote

Authored by Sjors Provoost

83/100 · Strong
mining: ensure witness commitment check in submitBlock

When an IPC client requests a new block template via the Mining interface,
we hold on to its CBlock. That way when they call submitSolution() we can
modify it in place, rather than having to reconstruct the full block like
the submitblock RPC does.

Before this commit however we forgot to invalidate
m_checked_witness_commitment, which we should since the client brings a
new coinbase.

This would cause us to accept an invalid chaintip.

Fix this and add a test to confirm that we now reject such a block.
As a sanity check, we add a second node to the test and confirm that will
accept our mined block.

Note that the IPC code takes the coinbase as provided, unlike the
submitblock RPC which calls UpdateUncommittedBlockStructures() and adds
witness commitment to the coinbase if it was missing.

Although that could have been an alternative fix, we instead document that
IPC clients are expected to provide the full coinbase including witness
commitment.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

Bitcoin Core's new mining IPC interface had a bug where it could accept an invalid block as the new chain tip. When an external mining client submitted a block solution with a new coinbase transaction, the node failed to re-check the block's witness commitment. This cached check could remain marked valid from the original template, allowing a block with a missing or wrong witness commitment to be accepted. The fix resets those cached checks whenever the coinbase is swapped in, and adds a test proving such invalid blocks are now rejected.

Recommended action

Treat this as a security-relevant consensus/validation bug in the IPC mining interface. Ensure the fix is included in any release branch that ships the Mining interface. Operators using external miners via IPC should upgrade. No emergency network-wide action is indicated because the interface is new and the RPC submitblock path was unaffected.

Security signals we found

01

acceptance of invalid chain tip due to stale cached validation flag

02

missing witness commitment re-validation after coinbase replacement

03

IPC mining interface submitSolution path affected

04

test added for rejection of witness-stripped coinbase

Risk score

Why this scored 63/100

Our methodology →
Potential impact 22/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 7/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.