Skip to content

Commit bcc02b8

Browse files
committed
Clear ENABLE_ZSA in Flags arbitrary strategy to fix V5 transaction roundtrip test
1 parent 9e75366 commit bcc02b8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

zebra-chain/src/orchard/arbitrary.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,15 @@ impl Arbitrary for Flags {
126126
type Parameters = ();
127127

128128
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
129-
(any::<u8>()).prop_map(Self::from_bits_truncate).boxed()
129+
(any::<u8>())
130+
.prop_map(|byte| {
131+
// Clear ENABLE_ZSA: it is only valid in V6, but this strategy
132+
// is also used for V5 transactions where it causes a deserialization error.
133+
#[cfg(feature = "tx_v6")]
134+
let byte = byte & !(Flags::ENABLE_ZSA.bits());
135+
Self::from_bits_truncate(byte)
136+
})
137+
.boxed()
130138
}
131139

132140
type Strategy = BoxedStrategy<Self>;

0 commit comments

Comments
 (0)