From 79a48c03e30e7e1cd963df0749511115c5fb6a67 Mon Sep 17 00:00:00 2001 From: wiesche Date: Sat, 12 Sep 2026 13:35:26 +0200 Subject: [PATCH] fix slate version order --- libwallet/src/slate_versions/mod.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libwallet/src/slate_versions/mod.rs b/libwallet/src/slate_versions/mod.rs index 7819aa5..657c865 100644 --- a/libwallet/src/slate_versions/mod.rs +++ b/libwallet/src/slate_versions/mod.rs @@ -54,9 +54,9 @@ fn kernel_has_height_arg(feature: u8) -> bool { #[derive(EnumIter, Serialize, Deserialize, Clone, Debug, PartialEq, PartialOrd, Eq, Ord)] pub enum SlateVersion { /// V5 (Most Current) - V5, + V5 = 5, /// V4 - V4, + V4 = 4, } impl TryFrom for SlateVersion { @@ -208,6 +208,21 @@ pub mod tests { use grin_wallet_util::byte_ser; use std::convert::TryInto; + #[test] + fn version_order() { + use strum::IntoEnumIterator; + + assert!(SlateVersion::V4 < SlateVersion::V5); + assert_eq!( + SlateVersion::V4.cmp(&SlateVersion::V5), + std::cmp::Ordering::Less + ); + assert_eq!( + SlateVersion::iter().collect::>(), + vec![SlateVersion::V5, SlateVersion::V4] + ); + } + /// Populate a test internal slate with all fields to test conversions pub fn populate_test_slate() -> Result { let keychain = ExtKeychain::from_random_seed(true).unwrap();