-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BIP 325: Clarify that scriptWitness is a stack, not a byte string #978
Conversation
Is it leaking Bitcoin Core implementation details into the document to bring up vectors here? The word 'vector' isn't otherwise in this BIP. Wouldn't it just be accurate to make it say that it's encoded just like BIP141? The compactsize count followed by the items (if there are any) is just how vectors in the software get encoded. |
It just happens that an empty byte vector is serialized identical to an empty vector of any other type, but it takes the reader an extra step. Thus, the minor fixup suggestion.
Jup. Thx & done |
cc @kallewoof |
ACK Please merge at your convenience (ping @luke-jr). |
Huh? An empty vector of any type is serialised as a 1-byte block where that byte is |
Currently the serializer can choose whether to serialize it as a 0-byte-block or a 1-byte-block ( |
Hmm, I thought there was code that would error out in the 1-byte- |
|
If a reset is needed can be tested by running a reindex with the following diff: - if (!v.empty()) v >> tx_spending.vin[0].scriptWitness.stack;
+ v >> tx_spending.vin[0].scriptWitness.stack; |
Thanks - yeah, it fails as we're using the scriptSig, not the scriptWitness. Alas. |
I think there's a problem with signet's difficulty adjustments that requires a chain restart, so I think that makes the code simplification (at the cost of an extra byte per block) worthwile. |
ACK, the code PR has been updated to match this change |
ACK, ping @luke-jr |
Strictly speaking the bip isn't wrong. It just happens that an empty byte vector is serialized identical to an empty vector of any other type, but it takes the reader an extra step. Thus, the minor fixup suggestion.