Skip to content

Commit

Permalink
Fix regression in output padding
Browse files Browse the repository at this point in the history
Closes #121.
  • Loading branch information
str4d committed Feb 12, 2024
1 parent ab3aea5 commit c7d5913
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this library adheres to Rust's notion of

## [Unreleased]

### Fixed
- `sapling_crypto::builder::BundleType::num_outputs` now matches the previous
behaviour for Sapling bundle padding, by including dummy outputs if there are
no requested outputs but some requested spends, and `bundle_required` is set
to `false` (as in `BundleType::DEFAULT`).

## [0.1.0] - 2024-01-26
The crate has been completely rewritten. See [`zcash/librustzcash`] for the
history of this rewrite.
Expand Down
8 changes: 4 additions & 4 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ impl BundleType {
requested_outputs: usize,
) -> Result<usize, &'static str> {
match self {
BundleType::Transactional { bundle_required } => {
Ok(if *bundle_required || requested_outputs > 0 {
BundleType::Transactional { bundle_required } => Ok(
if *bundle_required || requested_spends > 0 || requested_outputs > 0 {
core::cmp::max(requested_outputs, MIN_SHIELDED_OUTPUTS)
} else {
0
})
}
},
),
BundleType::Coinbase => {
if requested_spends == 0 {
Ok(requested_outputs)
Expand Down

0 comments on commit c7d5913

Please sign in to comment.