ZIP 244: Change semantics of `sequence_sig_digest`

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Jack Grigg 2022-01-03 22:32:57 +00:00
parent 8572075604
commit 2442192519
1 changed files with 14 additions and 2 deletions

View File

@ -531,8 +531,7 @@ S.2b: sequence_sig_digest
This is a BLAKE2b-256 hash initialized with the personalization field value This is a BLAKE2b-256 hash initialized with the personalization field value
``ZTxIdSequencHash``. ``ZTxIdSequencHash``.
If the ``SIGHASH_ANYONECANPAY`` flag is not set, and the sighash type is neither If the ``SIGHASH_ANYONECANPAY`` flag is not set::
``SIGHASH_SINGLE`` nor ``SIGHASH_NONE``::
identical to the value of ``sequence_digest`` as specified for the identical to the value of ``sequence_digest`` as specified for the
transaction identifier in section T.2b. transaction identifier in section T.2b.
@ -736,6 +735,17 @@ happens in the block that activates this ZIP.
The block header byte format and version are not altered by this ZIP. The block header byte format and version are not altered by this ZIP.
=========
Rationale
=========
Several changes in this ZIP (relative to ZIP 243 [#zip-0243]_) were made to
align with BIP 341 [#bip-0341]_:
- The semantics of ``sequence_sig_digest`` were changed, to commit to ``nSequence``
even if ``SIGHASH_SINGLE`` or ``SIGHASH_NONE`` is set. The rationale for this
change is inherited from BIP 341 [#bip-0341-nSequence]_.
======================== ========================
Reference implementation Reference implementation
======================== ========================
@ -754,3 +764,5 @@ References
.. [#zip-0143] `ZIP 143: Transaction Signature Validation for Overwinter <zip-0143.rst>`_ .. [#zip-0143] `ZIP 143: Transaction Signature Validation for Overwinter <zip-0143.rst>`_
.. [#zip-0243] `ZIP 243: Transaction Signature Validation for Sapling <zip-0243.rst>`_ .. [#zip-0243] `ZIP 243: Transaction Signature Validation for Sapling <zip-0243.rst>`_
.. [#zip-0307] `ZIP 307: Light Client Protocol for Payment Detection <zip-0307.rst>`_ .. [#zip-0307] `ZIP 307: Light Client Protocol for Payment Detection <zip-0307.rst>`_
.. [#bip-0341] `BIP 341: Taproot: SegWit version 1 spending rules <https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki>`_
.. [#bip-0341-nSequence] `Why does the signature message commit to all input nSequence if SIGHASH_SINGLE or SIGHASH_NONE are set? <https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-18>`_