Skip to content

Empty excess_data - #141

Merged
Sjors merged 3 commits into
stratum-mining:masterfrom
Sjors:2026/10/empty-excess-data
Nov 11, 2026
Merged

Sjors merged 3 commits into
stratum-mining:masterfrom
Sjors:2026/10/empty-excess-data

Conversation

@Sjors

@Sjors Sjors commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Depends on:

The SRI version already does this.

Alternative to #138.

Sjors and others added 2 commits October 15, 2026 03:06
Store non-null submitted coinbases in both mock submission methods,
including when the mock rejects the block. This matches Bitcoin Core's
in-place template mutation and lets tests observe the submitted coinbase
through getBlock().

Co-authored-by: Толли <ziphyr.xyeag@gmail.com>
No excess data is currently defined, and the coinbase witness does not
belong in this field. Always send empty excess_data, as proposed in:
stratum-mining/sv2-spec#241

This also avoids reading the coinbase after a submitted solution has
replaced it with a transaction that may have no inputs, fixing the crash
described in stratum-mining#138.
@xyephy

xyephy commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Concept ACK, thanks for picking this up.

One thing that could be added is a test for the crash: the mock now stores the coinbase, but no test submits a coinbase without inputs and then sends RequestTransactionData. request_transaction_data_after_coinbase_without_inputs and the SendSubmitSolutionCoinbase helper from #138 do that, and on top of this PR they only need the store_submitted_coinbase line removed. With master's RequestTransactionData the test crashes, and with this PR it passes. Happy for you to pick it in, or I can open a follow-up after this merges.

Submit an empty coinbase over the SV2 connection, then request transaction
data for the same template. Check that the provider responds successfully
with empty excess_data and no transactions instead of reading vin[0].

Adapt the regression test and SendSubmitSolutionCoinbase helper from stratum-mining#138,
omitting the mock switch because submitted coinbases are already retained
unconditionally.

Co-authored-by: Толли <ziphyr.xyeag@gmail.com>
@Sjors

Sjors commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

I'm probably going to merge this next week and bake a new release.

@xyephy

xyephy commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

I'm probably going to merge this next week and bake a new release.

I will do one last review and drop it before then

@xyephy xyephy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tACK a32129b

Reverting the template_provider.cpp change makes the new test crash on the old vin[0] read, so it covers the bug. Ran it with the SRI pool, JDS and JDC on regtest: every RequestTransactionData and DeclareMiningJob succeeded, with JDC now receiving an empty excess_data.

@Sjors
Sjors merged commit 30a2292 into stratum-mining:master Nov 11, 2026
25 checks passed
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.

2 participants