Merge pull request #124 from zcash/121-pad-outputs-if-spends

Fix regression in output padding
This commit is contained in:
Kris Nuttycombe 2024-02-15 12:36:34 -07:00 committed by GitHub
commit 346a650741
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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)