Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
  • Loading branch information
nuttycom and daira authored Jun 8, 2021
1 parent f70285d commit eb3d01a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions zcash_primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl TxVersion {
BranchId::Sapling | BranchId::Blossom | BranchId::Heartwood | BranchId::Canopy => {
TxVersion::Sapling
}
BranchId::Nu5 => TxVersion::Zip225, //TEMPORARY WORKAROUND
BranchId::Nu5 => TxVersion::Zip225,
#[cfg(feature = "zfuture")]
BranchId::ZFuture => TxVersion::ZFuture,
}
Expand Down Expand Up @@ -862,7 +862,7 @@ impl Transaction {
if self.orchard_bundle.is_some() {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"Orchard components may not be present when serializing to the V4 transaction format."
"Orchard components cannot be present when serializing to the V4 transaction format."
));
}

Expand All @@ -882,6 +882,12 @@ impl Transaction {
}

pub fn write_v5<W: Write>(&self, mut writer: W) -> io::Result<()> {
if self.sprout_bundle.is_some() {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"Sprout components cannot be present when serializing to the V5 transaction format.",
));
}
self.write_v5_header(&mut writer)?;
self.write_transparent(&mut writer)?;
self.write_v5_sapling(&mut writer)?;
Expand Down Expand Up @@ -933,7 +939,7 @@ impl Transaction {
|w, e| w.write_all(e),
)?;

if !bundle.shielded_spends.is_empty() || !bundle.shielded_outputs.is_empty() {
if !(bundle.shielded_spends.is_empty() && bundle.shielded_outputs.is_empty()) {
bundle.authorization.binding_sig.write(&mut writer)?;
}
} else {
Expand Down

0 comments on commit eb3d01a

Please sign in to comment.