Skip to content

Commit 6c4cd8a

Browse files
committed
Merge #268: json: add Other variant to SoftforkType
3f04a34 json: add Other variant to SoftforkType (Marko Bencun) Pull request description: Fixes #267. Without this variant, a call to `client.get_blockchain_info()` likely fails on some versions of bitcoind where other types of softfork deployments were active. ACKs for top commit: apoelstra: ACK 3f04a34 tcharding: ACK 3f04a34 Tree-SHA512: d6252d6118967ac87cf26fd3caab495c16450b6e228e62d57b895438be811ac6fd05d2f1fe58ad57a6dd107e34d715c2fa408ce11da793d6e5a0af7ded5f9343
2 parents fc3a12d + 3f04a34 commit 6c4cd8a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

json/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,8 @@ pub struct Bip9SoftforkInfo {
878878
pub enum SoftforkType {
879879
Buried,
880880
Bip9,
881+
#[serde(other)]
882+
Other,
881883
}
882884

883885
/// Status of a softfork
@@ -2078,3 +2080,18 @@ where
20782080
}
20792081
Ok(Some(res))
20802082
}
2083+
2084+
#[cfg(test)]
2085+
mod tests {
2086+
use super::*;
2087+
2088+
#[test]
2089+
fn test_softfork_type() {
2090+
let buried: SoftforkType = serde_json::from_str("\"buried\"").unwrap();
2091+
assert_eq!(buried, SoftforkType::Buried);
2092+
let bip9: SoftforkType = serde_json::from_str("\"bip9\"").unwrap();
2093+
assert_eq!(bip9, SoftforkType::Bip9);
2094+
let other: SoftforkType = serde_json::from_str("\"bip8\"").unwrap();
2095+
assert_eq!(other, SoftforkType::Other);
2096+
}
2097+
}

0 commit comments

Comments
 (0)