Apply suggestions from code review

Make the specification of the cases in which empty hashes are produced more
explicit, and less dependent upon how these rules are scoped.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Kris Nuttycombe 2021-05-18 08:16:00 -06:00 committed by GitHub
parent 12fa6ffa8e
commit 9ccd44743f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 7 deletions

View File

@ -219,7 +219,8 @@ The personalization field of this hash is set to::
"ZTxIdPrevoutHash"
In the case that the transaction has no transparent inputs, ``prevouts_digest`` is ::
In the case that the transaction has transparent outputs but no transparent inputs,
``prevouts_digest`` is ::
BLAKE2b-256("ZTxIdPrevoutHash", [])
@ -232,7 +233,8 @@ The personalization field of this hash is set to::
"ZTxIdSequencHash"
In the case that the transaction has no transparent inputs, ``sequence_digest`` is ::
In the case that the transaction has transparent outputs but no transparent inputs,
``sequence_digest`` is ::
BLAKE2b-256("ZTxIdSequencHash", [])
@ -247,7 +249,8 @@ The personalization field of this hash is set to::
"ZTxIdOutputsHash"
In the case that the transaction has no transparent outputs, ``outputs_digest`` is ::
In the case that the transaction has transparent inputs but no transparent outputs,
``outputs_digest`` is ::
BLAKE2b-256("ZTxIdOutputsHash", [])
@ -284,7 +287,8 @@ The personalization field of this hash is set to::
"ZTxIdSSpendsHash"
In the case that no Sapling spends are present, ``sapling_spends_digest`` is ::
In the case that the transaction has Sapling outputs but no Sapling spends,
``sapling_spends_digest`` is ::
BLAKE2b-256("ZTxIdSSpendsHash", [])
@ -327,7 +331,8 @@ The personalization field of this hash is set to::
"ZTxIdSOutputHash"
In the case that no Sapling outputs are present, ``sapling_outputs_digest`` is ::
In the case that the transaction has Sapling spends but no Sapling outputs,
``sapling_outputs_digest`` is ::
BLAKE2b-256("ZTxIdSOutputHash", [])
@ -447,8 +452,8 @@ A new per-input transaction digest algorithm is defined that constructs a hash t
signed by a transaction creator to commit to the effects of the transaction. A signature
digest is produced for each transparent input, each Sapling input, and each Orchard
action. For transparent inputs, this follows closely the algorithms from ZIP 143 [#zip-0143]_
and ZIP 243 [#zip-0243]_. For other input types, this algorithm has the exact same
output as the transaction digest algorithm, thus the txid may be signed directly.
and ZIP 243 [#zip-0243]_. For shielded inputs, this algorithm has the exact same output
as the transaction digest algorithm, thus the txid may be signed directly.
The overall structure of the hash is as follows; each name referenced here will be
described in detail below::