Repository navigation
fullblocktests: Add ErrTicketInputScript tests. - #3796
Merged
davecgh merged 3 commits intoSep 14, 2026
Merged
Conversation
The old comment said the block contains "scripts that do not involve p2pkh or p2sh addresses for a ticket purchase." That wording implies the block is testing the scripts a ticket purchase spends, but that's not what it's doing. The block replaces the script of the first output so it is no longer tagged OP_SSTX (no longer a ticket at all) and is thus rejected as a regular transaction that creates a stake output.
This adds a test which ensures the chain rejects a block when a ticket purchase spends an output whose script is neither p2pkh nor p2sh. The first block in the section pays a regular transaction output to a bare OP_TRUE script. The second block buys a ticket with that output. The ticket is otherwise valid, so the input script check is what rejects the block. The following large reorg test builds on the new accepted block so it still extends the best chain tip.
This adds a test which ensures the chain rejects a block when a ticket purchase spends an output whose script version != 0. The setup block now pays a second output to a p2sh script with script version 1. The new block buys a ticket with that output. The script form is allowed, so the version check is what rejects the block.
davecgh
approved these changes
Sep 14, 2026
davecgh
left a comment
Member
There was a problem hiding this comment.
Thanks. The additional tests look good and are nice additions.
I'm approving it regardless since the updated comment is more explicit and a good improvement, but I will note that the framing of the first commit isn't really correct. The existing comment was actually correct too.
The point there is that, in the stake tree, p2pkh and p2sh addresses must be prefixed by an OP_SSTX in order for them to be recognized as such. Therefore, providing a regular script that is of that type without the required prefix does result in a block with "scripts that do not involve p2pkh or p2sh addresses" because, from the viewpoint of the stake tree, they are in fact not a p2pkh or p2sh address.
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.
This is work towards #1182.
This adds full block test coverage for
ErrTicketInputScript(previously namedErrSStxInScrTypebefore #1468).The old comment used to say:
This new
Ticket input script testssection creates those outputs.bti2covers the script form andbti3covers the script version ofcheckTicketPurchaseInputs.Notes:
bmf37changes the ticket's own first output, which strips theOP_SSTXtag, so that block is rejected as a regular transaction with a stake output (ErrRegTxCreateStakeOut). The first commit fixes its comment to say so.bti2andbti3passnilcoinbase spends.outshas no spare entry at that height and both blocks are rejected.