Bitcoin Core has added a small set of tests for a basic question: what should happen when transaction bytes stop before the transaction is complete? Pull request #36456 was merged into the project's master branch on October 22, 2026. It adds 35 lines across two test files, covering truncated transaction encodings, incomplete length fields and an unsupported optional-data flag.
The development matters as maintenance, not as a new network rule. The merge commit changes tests rather than production transaction-parsing code. It does not establish a new Bitcoin Core release, introduce a transaction format or demonstrate that deployed nodes were accepting the malformed examples.
Start with a complete transaction and cut it short
The transaction test constructs a specimen with one input, one output and a witness stack containing one element. It serializes that specimen, reads the complete result back and checks that witness data is present. That successful read supplies a control: the starting bytes describe something the parser can deserialize.
Next, the test feeds the witness-aware reader every shorter prefix of that same byte sequence, including the empty prefix. Each attempt must throw an end-of-data exception. This is a systematic sweep across one specimen, not a claim that every possible malformed Bitcoin transaction has been tested. The loop catches cuts within fields without maintaining a separate hand-written example for each stopping point. The exact scope is visible in the merged test patch.
The second test file addresses CompactSize, Bitcoin's variable-length integer encoding used for counts and lengths. Its initial byte can mean that two, four or eight additional bytes are needed to read the value. The added cases supply fewer bytes than required and expect reading to fail. The underlying CompactSize reader separately enforces canonical encodings and, by default, a size limit. Incomplete input is one distinct failure condition, not shorthand for all invalid sizes.
Why the flag deserves its own check
Witness serialization adds structure that a parser must interpret correctly. BIP 144 describes a zero marker, a nonzero flag and witness data alongside the ordinary transaction fields. It explains the flag as a bit vector that leaves room for additional optional data.
That design does not mean an implementation can safely treat every nonzero flag as today's witness format. In the transaction reader at the merge commit, the low bit controls witness reading. Any unhandled flag bits cause rejection.
The new test supplies 0x02. Because that value does not set the witness bit, it probes a different path from ordinary witness deserialization. The expected result is rejection for unknown optional transaction data. The test documents that existing behavior without assigning new meaning to the unused bit.
The practical lesson for wallet and library developers is precise: a format discriminator needs its own negative tests. Testing only successful witness transactions would not exercise this particular rejection path.
Review narrowed the promise
The review also provides a useful warning about testing the wrong abstraction. An October 19 review comment proposed the prefix loop and removing checks against DecodeHexTx, noting that this helper does not generally promise to reject every mutation or truncation.
The final change tests the lower-level deserialization behavior instead. That distinction matters when an application offers more than one parsing mode. A test should establish the contract of the specific reader being called, rather than silently imposing a stronger contract on a convenience function.
The contributor said the cases arose while finding gaps in the alternative implementation bitcoin-s. That is useful context for cross-implementation testing, but it is not sufficient evidence for a broader claim about the security of bitcoin-s or an incident affecting its users.
What developers can take away
For maintainers of Bitcoin libraries, this patch offers a compact testing pattern: establish a complete serialized example, truncate it at every byte boundary, then separately exercise unsupported format flags and incomplete length encodings. A successful round trip and expected failures answer different questions.
The limitation remains important. One specimen cannot cover every transaction shape, parser mode or resource-exhaustion case. These additions are regression checks with a defined scope, not a complete parser audit.
For node operators, the immediate takeaway is correspondingly modest. A test-only master-branch merge is not an emergency upgrade instruction. Its value is in making existing rejection behavior explicit and repeatable for future development. Bitcoin software benefits when the boundary between complete data and incomplete data is checked mechanically, even when the resulting news is only 35 lines long.

