diff --git a/json/src/lib.rs b/json/src/lib.rs index 26fd92ba..f0b55ee6 100644 --- a/json/src/lib.rs +++ b/json/src/lib.rs @@ -878,6 +878,8 @@ pub struct Bip9SoftforkInfo { pub enum SoftforkType { Buried, Bip9, + #[serde(other)] + Other, } /// Status of a softfork @@ -2078,3 +2080,18 @@ where } Ok(Some(res)) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_softfork_type() { + let buried: SoftforkType = serde_json::from_str("\"buried\"").unwrap(); + assert_eq!(buried, SoftforkType::Buried); + let bip9: SoftforkType = serde_json::from_str("\"bip9\"").unwrap(); + assert_eq!(bip9, SoftforkType::Bip9); + let other: SoftforkType = serde_json::from_str("\"bip8\"").unwrap(); + assert_eq!(other, SoftforkType::Other); + } +}