diff --git a/CHANGELOG.md b/CHANGELOG.md index fed3804..6984675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/builder.rs b/src/builder.rs index 4ca4dc3..80dcf81 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -90,13 +90,13 @@ impl BundleType { requested_outputs: usize, ) -> Result { 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)