document transaction transparent types (#3498)

This commit is contained in:
Alfredo Garcia 2022-02-11 00:16:29 -03:00 committed by GitHub
parent c57339bbee
commit 62750c8192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 2 deletions

View File

@ -438,7 +438,10 @@ impl ZcashSerialize for Transaction {
outputs,
lock_time,
} => {
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs.zcash_serialize(&mut writer)?;
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs.zcash_serialize(&mut writer)?;
// Denoted as `lock_time` in the spec.
@ -450,7 +453,10 @@ impl ZcashSerialize for Transaction {
lock_time,
joinsplit_data,
} => {
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs.zcash_serialize(&mut writer)?;
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs.zcash_serialize(&mut writer)?;
// Denoted as `lock_time` in the spec.
@ -474,7 +480,10 @@ impl ZcashSerialize for Transaction {
// Denoted as `nVersionGroupId` in the spec.
writer.write_u32::<LittleEndian>(OVERWINTER_VERSION_GROUP_ID)?;
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs.zcash_serialize(&mut writer)?;
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs.zcash_serialize(&mut writer)?;
// Denoted as `lock_time` in the spec.
@ -504,7 +513,10 @@ impl ZcashSerialize for Transaction {
// Denoted as `nVersionGroupId` in the spec.
writer.write_u32::<LittleEndian>(SAPLING_VERSION_GROUP_ID)?;
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs.zcash_serialize(&mut writer)?;
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs.zcash_serialize(&mut writer)?;
// Denoted as `lock_time` in the spec.
@ -591,8 +603,10 @@ impl ZcashSerialize for Transaction {
// Denoted as `nExpiryHeight` in the spec.
writer.write_u32::<LittleEndian>(expiry_height.0)?;
// transparent
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs.zcash_serialize(&mut writer)?;
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs.zcash_serialize(&mut writer)?;
// A bundle of fields denoted in the spec as `nSpendsSapling`, `vSpendsSapling`,
@ -668,7 +682,9 @@ impl ZcashDeserialize for Transaction {
// https://zips.z.cash/protocol/protocol.pdf#txnconsensus
match (version, overwintered) {
(1, false) => Ok(Transaction::V1 {
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs: Vec::zcash_deserialize(&mut limited_reader)?,
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs: Vec::zcash_deserialize(&mut limited_reader)?,
// Denoted as `lock_time` in the spec.
lock_time: LockTime::zcash_deserialize(&mut limited_reader)?,
@ -677,7 +693,9 @@ impl ZcashDeserialize for Transaction {
// Version 2 transactions use Sprout-on-BCTV14.
type OptV2Jsd = Option<JoinSplitData<Bctv14Proof>>;
Ok(Transaction::V2 {
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs: Vec::zcash_deserialize(&mut limited_reader)?,
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs: Vec::zcash_deserialize(&mut limited_reader)?,
// Denoted as `lock_time` in the spec.
lock_time: LockTime::zcash_deserialize(&mut limited_reader)?,
@ -697,7 +715,9 @@ impl ZcashDeserialize for Transaction {
// Version 3 transactions use Sprout-on-BCTV14.
type OptV3Jsd = Option<JoinSplitData<Bctv14Proof>>;
Ok(Transaction::V3 {
// Denoted as `tx_in_count` and `tx_in` in the spec.
inputs: Vec::zcash_deserialize(&mut limited_reader)?,
// Denoted as `tx_out_count` and `tx_out` in the spec.
outputs: Vec::zcash_deserialize(&mut limited_reader)?,
// Denoted as `lock_time` in the spec.
lock_time: LockTime::zcash_deserialize(&mut limited_reader)?,
@ -730,7 +750,10 @@ impl ZcashDeserialize for Transaction {
// instead we have to pull the component parts out manually and
// then assemble them.
// Denoted as `tx_in_count` and `tx_in` in the spec.
let inputs = Vec::zcash_deserialize(&mut limited_reader)?;
// Denoted as `tx_out_count` and `tx_out` in the spec.
let outputs = Vec::zcash_deserialize(&mut limited_reader)?;
// Denoted as `lock_time` in the spec.
@ -821,8 +844,10 @@ impl ZcashDeserialize for Transaction {
// Denoted as `nExpiryHeight` in the spec.
let expiry_height = block::Height(limited_reader.read_u32::<LittleEndian>()?);
// transparent
// Denoted as `tx_in_count` and `tx_in` in the spec.
let inputs = Vec::zcash_deserialize(&mut limited_reader)?;
// Denoted as `tx_out_count` and `tx_out` in the spec.
let outputs = Vec::zcash_deserialize(&mut limited_reader)?;
// A bundle of fields denoted in the spec as `nSpendsSapling`, `vSpendsSapling`,