Skip to content

Commit 87c95f6

Browse files
committed
Allow warnings to be either a string or a string sequence.
1 parent f19c1b5 commit 87c95f6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

json/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,14 @@ pub struct GetAddressInfoResult {
10031003
pub label: Option<String>,
10041004
}
10051005

1006+
/// Used to represent values that can either be a string or a string array.
1007+
#[derive(Clone, Debug, Deserialize, Serialize)]
1008+
#[serde(untagged)]
1009+
pub enum StringOrStringArray {
1010+
String(String),
1011+
StringArray(Vec<String>),
1012+
}
1013+
10061014
/// Models the result of "getblockchaininfo"
10071015
#[derive(Clone, Debug, Deserialize, Serialize)]
10081016
pub struct GetBlockchainInfoResult {
@@ -1044,8 +1052,8 @@ pub struct GetBlockchainInfoResult {
10441052
/// Status of softforks in progress
10451053
#[serde(default)]
10461054
pub softforks: HashMap<String, Softfork>,
1047-
/// Any network and blockchain warnings.
1048-
pub warnings: String,
1055+
/// Any network and blockchain warnings. In later versions of bitcoind, it's an array of strings.
1056+
pub warnings: StringOrStringArray,
10491057
}
10501058

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

0 commit comments

Comments
 (0)