Skip to content

test multiple coinbase outputs round-trip - #325

Open
xyephy wants to merge 1 commit into
stratum-mining:mainfrom
xyephy:2026/03/coinbase-output-integration
Open

test multiple coinbase outputs round-trip#325
xyephy wants to merge 1 commit into
stratum-mining:mainfrom
xyephy:2026/03/coinbase-output-integration

Conversation

@xyephy

@xyephy xyephy commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator

Add an end-to-end test: mine a real block through TP → Pool → Translator → Minerd, then assert the accepted block's coinbase outputs and that it includes a real mempool transaction.

Closes #58

@xyephy
xyephy marked this pull request as draft March 9, 2026 04:23
@xyephy
xyephy force-pushed the 2026/03/coinbase-output-integration branch 3 times, most recently from 1706f1c to 1a2b6db Compare March 9, 2026 05:11
@xyephy
xyephy force-pushed the 2026/03/coinbase-output-integration branch from 1a2b6db to 7b4e11f Compare March 26, 2026 18:10
@xyephy
xyephy marked this pull request as ready for review March 27, 2026 07:32
@xyephy
xyephy force-pushed the 2026/03/coinbase-output-integration branch from 7b4e11f to 5605a41 Compare March 31, 2026 18:33
@xyephy
xyephy force-pushed the 2026/03/coinbase-output-integration branch from 5605a41 to 6e5254a Compare April 23, 2026 07:34
@GitGab19

Copy link
Copy Markdown
Member

How is this different wrt integration tests we added in #321?

Aren't we already testing multiple coinbase outputs in those tests?

@xyephy

xyephy commented May 12, 2026

Copy link
Copy Markdown
Collaborator Author

Aren't we already testing multiple coinbase outputs in those tests?

No — #321 checks that the pool correctly maps user_identity to payout addresses by deserializing NewExtendedMiningJob at the pool boundary. This PR tests that coinbase_tx_outputs set by the Template Provider survive the full TP → Pool → Translator → Minerd pipeline, using Bitcoin Core block acceptance as the assertion. If any layer drops or corrupts a coinbase output, the block is consensus-invalid and the test fails.

@GitGab19

Copy link
Copy Markdown
Member

I see.

Are you gonna solve conflicts and make this PR up to date?

@xyephy

xyephy commented May 13, 2026

Copy link
Copy Markdown
Collaborator Author

I see.

Are you gonna solve conflicts and make this PR up to date?

yes

@xyephy
xyephy force-pushed the 2026/03/coinbase-output-integration branch 2 times, most recently from 2092a48 to 1acda25 Compare May 13, 2026 22:16

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see how the tests on this file are asserting what this PR aims to achieve.

we simply assert that some block was mined, while there's no assertion with regards to how many outputs there are in the coinbase tx

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fair point, block acceptance alone is too weak. I will replace it with a block-inspection assertion (decode coinbase tx, check count + witness commitment + reward).

// Requires a custom Bitcoin Core build with -testmulticoinbase support, which adds extra
// OP_RETURN outputs to the coinbase. Set BITCOIN_NODE_BIN to the custom binary path.
#[tokio::test]
#[ignore = "requires custom Bitcoin Core build with -testmulticoinbase; set BITCOIN_NODE_BIN"]

@plebhash plebhash May 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the strategy behind this ignore is not clear

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what does one need to do to get testmulticoinbase into Bitcoin Core?

and if it's not readily available on official Bitcoin Core distribution, why should it be covered by SRI CI?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You would need a local Bitcoin Core patch since there's no upstream path. I patched it locally when I was working on stratum-mining/sv2-tp#55, and the upstream PR that would have made it testable without a patch, bitcoin/bitcoin#33890, was closed unmerged.

Agreed it shouldn't be in SRI CI. Dropping the test. Looking for an SRI-compatible alternative for issue #58, will propose before re-pushing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given that the idea proposed in bitcoin/bitcoin#33890 wasn't useful for Sv2, and that it got closed, I'm wondering if issue #58 makes sense at all at this point.

As I was already pointing out in this comment we already have a test which covers the case of having multiple outputs in a coinbase tx, it's called pool_solo_mining_partial_donation().

Maybe the thing which is missing there is simply the block submission, which could be eventually added very easily without adding anything else.

@xyephy
xyephy force-pushed the 2026/03/coinbase-output-integration branch from 1acda25 to f0396f7 Compare June 10, 2026 20:02
@xyephy

xyephy commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

Updated: dropped the testmulticoinbase test (no upstream path after bitcoin/bitcoin#33890 closed). Now a single end-to-end test as suggested; a real block is mined and its coinbase outputs asserted directly. The test also requires the block to include a mempool transaction, so job serialization with real txdata is covered too.

@xyephy
xyephy force-pushed the 2026/03/coinbase-output-integration branch from f0396f7 to 76c9c83 Compare June 12, 2026 04:37
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.

Integration tests against TP with multiple coinbase outputs

3 participants