Skip to content

Allow warnings to be either a string or a string sequence. #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,14 @@ pub struct GetAddressInfoResult {
pub label: Option<String>,
}

/// Used to represent values that can either be a string or a string array.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum StringOrStringArray {
String(String),
StringArray(Vec<String>),
}

/// Models the result of "getblockchaininfo"
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GetBlockchainInfoResult {
Expand Down Expand Up @@ -1044,8 +1052,8 @@ pub struct GetBlockchainInfoResult {
/// Status of softforks in progress
#[serde(default)]
pub softforks: HashMap<String, Softfork>,
/// Any network and blockchain warnings.
pub warnings: String,
/// Any network and blockchain warnings. In later versions of bitcoind, it's an array of strings.
pub warnings: StringOrStringArray,
}

#[derive(Clone, PartialEq, Eq, Debug)]
Expand Down
Loading