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