Fix the orchard::ShieldedData serialization/deserialization functions to use the correct order of the asset burn field in V6 transaction as it's defined in ZIP 230

This commit is contained in:
Dmitry Demin 2024-11-11 21:27:27 +01:00
parent 3cce4894d0
commit ce6c5c36ff
1 changed files with 7 additions and 7 deletions

View File

@ -376,13 +376,13 @@ impl<V: OrchardFlavorExt> ZcashSerialize for orchard::ShieldedData<V> {
// Denoted as `vSpendAuthSigsOrchard` in the spec.
zcash_serialize_external_count(&sigs, &mut writer)?;
// Denoted as `bindingSigOrchard` in the spec.
self.binding_sig.zcash_serialize(&mut writer)?;
#[cfg(feature = "tx-v6")]
// Denoted as `vAssetBurn` in the spec (ZIP 230).
self.burn.zcash_serialize(&mut writer)?;
// Denoted as `bindingSigOrchard` in the spec.
self.binding_sig.zcash_serialize(&mut writer)?;
Ok(())
}
}
@ -434,6 +434,10 @@ impl<V: OrchardFlavorExt> ZcashDeserialize for Option<orchard::ShieldedData<V>>
let sigs: Vec<Signature<SpendAuth>> =
zcash_deserialize_external_count(actions.len(), &mut reader)?;
// TODO: FIXME: add a proper comment
#[cfg(feature = "tx-v6")]
let burn = (&mut reader).zcash_deserialize_into()?;
// Denoted as `bindingSigOrchard` in the spec.
let binding_sig: Signature<Binding> = (&mut reader).zcash_deserialize_into()?;
@ -448,10 +452,6 @@ impl<V: OrchardFlavorExt> ZcashDeserialize for Option<orchard::ShieldedData<V>>
let actions: AtLeastOne<orchard::AuthorizedAction<V>> = authorized_actions.try_into()?;
// TODO: FIXME: add a proper comment
#[cfg(feature = "tx-v6")]
let burn = (&mut reader).zcash_deserialize_into()?;
Ok(Some(orchard::ShieldedData::<V> {
flags,
value_balance,