integration-tests: add BIP-54 coinbase compliance test#453
Open
Sjors wants to merge 1 commit intostratum-mining:mainfrom
Open
integration-tests: add BIP-54 coinbase compliance test#453Sjors wants to merge 1 commit intostratum-mining:mainfrom
Sjors wants to merge 1 commit intostratum-mining:mainfrom
Conversation
Contributor
Author
|
100% vibe coded :-) |
xyephy
reviewed
May 4, 2026
Comment on lines
+47
to
+48
| new_best_hash = tp.get_best_block_hash().unwrap(); | ||
| new_height = tp.get_blockchain_info().unwrap().blocks; |
Collaborator
There was a problem hiding this comment.
get_best_block_hash() and get_blockchain_info() are separate RPCs; hash and height can disagree under load (saw 4 blocks/run locally). Suggest mirroring jdc_block_propagation.rs — sniff SUBMIT_SOLUTION JDC→TP, then read the tip once.
Comment on lines
+78
to
+79
| .first() | ||
| .expect("coinbase must have exactly one input"); |
Collaborator
There was a problem hiding this comment.
Nit: unreachable since is_coinbase() already enforces input.len() == 1. &coinbase.input[0] will do.
BIP-54 (Consensus Cleanup) requires that every block's coinbase transaction has nLockTime equal to the block height minus one and a non-final nSequence (not 0xffffffff) on its sole input. Add an integration test that drives a block end-to-end through the SV2 stack (minerd -> translator -> JDC -> JDS/Pool -> Template Provider) and, once the new tip is accepted by Bitcoin Core, fetches the block and asserts both invariants on its coinbase. A small get_block helper is exposed on BitcoinCore and TemplateProvider to allow tests to inspect freshly accepted blocks. See https://github.com/bitcoin/bips/blob/master/bip-0054.md
Contributor
Author
|
Rebased and addressed @xyephy's feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BIP-54 (Consensus Cleanup) requires that every block's coinbase transaction has
nLockTimeequal to the block height minus one and a non-finalnSequence(not 0xffffffff) on its sole input.Add an integration test that drives a block end-to-end through the SV2 stack (minerd -> translator -> JDC -> JDS/Pool -> Template Provider) and, once the new tip is accepted by Bitcoin Core, fetches the block and asserts both invariants on its coinbase.
A small
get_blockhelper is exposed onBitcoinCoreandTemplateProviderto allow tests to inspect freshly accepted blocks.