2

What would happen if a node sent a non-segwit transaction with flag and marker bytes announcing a witness section, but then put 0x00 for each input’s witness stack? Would this “waste of extra bytes” be acceptable to other nodes?

1 Answer 1

2

The extended serialization format introduced in BIP144, which is used for serializing witnesses, specifies:

If the witness is empty, the old serialization format must be used.

So, no, using the extended serialization format for a transaction with all empty witnesses would be incorrect.

Note that this is not a consensus or policy rule, but just a serialization rule. Violating it doesn't mean the transaction is invalid or non-standard, only that it was conveyed in an incorrect manner. It's a property of the protocol used between nodes, but in theory, two nodes could privately agree on a different protocol which has different serialization rules, as long as they use the normal protocol with normal nodes.

That said, the wtxid introduced in BIP141 is defined as the double-SHA256 hash of the BIP144 serialization of the transaction. This aspect is a concensus rule, as the hash value is normative. Even hypothetical nodes that use a different serialization format must use the BIP144 serialization for wtxid computation. In particular, the combination implies that for non-segwit transactions the txid and wtxid are equal.

It is also the case that Bitcoin Core versions 0.14.x through 0.18.x unintentionally permitted using the extended format even for transactions without witnesses. This was just on deserialization; even if a transaction would be received this way, it would be serialized correctly on relay.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.