diff --git a/zebra-chain/src/transaction/serialize.rs b/zebra-chain/src/transaction/serialize.rs index c05d6afd4..64650dd8a 100644 --- a/zebra-chain/src/transaction/serialize.rs +++ b/zebra-chain/src/transaction/serialize.rs @@ -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::(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::(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::(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>; 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>; 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::()?); - // 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`,