Skip to content

Commit ede8097

Browse files
committedOct 9, 2024·
Update GetBlockchainInfoResult to support Vec of warnings
1 parent 99af4bd commit ede8097

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎json/src/lib.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,14 @@ pub struct GetAddressInfoResult {
10801080
pub label: Option<String>,
10811081
}
10821082

1083+
/// Used to represent values that can either be a string or a string array.
1084+
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
1085+
#[serde(untagged)]
1086+
pub enum StringOrStringArray {
1087+
String(String),
1088+
StringArray(Vec<String>),
1089+
}
1090+
10831091
/// Models the result of "getblockchaininfo"
10841092
#[derive(Clone, Debug, Deserialize, Serialize)]
10851093
pub struct GetBlockchainInfoResult {
@@ -1121,8 +1129,8 @@ pub struct GetBlockchainInfoResult {
11211129
/// Status of softforks in progress
11221130
#[serde(default)]
11231131
pub softforks: HashMap<String, Softfork>,
1124-
/// Any network and blockchain warnings.
1125-
pub warnings: String,
1132+
/// Any network and blockchain warnings. In later versions of bitcoind, it's an array of strings.
1133+
pub warnings: StringOrStringArray,
11261134
}
11271135

11281136
#[derive(Clone, PartialEq, Eq, Debug)]

0 commit comments

Comments
 (0)
Please sign in to comment.