Fix regression in output padding

Closes zcash/sapling-crypto#121.
This commit is contained in:
Jack Grigg 2024-02-12 20:13:44 +00:00
parent ab3aea55c0
commit c7d5913a90
2 changed files with 10 additions and 4 deletions

View File

@ -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.

View File

@ -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)