msggen: Extend support range to v0.10.1 and mark address, added in v23.02

This commit is contained in:
Christian Decker
2023-05-30 19:20:46 +02:00
committed by Rusty Russell
parent 2d53707611
commit 8c02d9587d
6 changed files with 189 additions and 187 deletions

View File

@@ -2874,7 +2874,7 @@
"deprecated": null "deprecated": null
}, },
"Getinfo.address[]": { "Getinfo.address[]": {
"added": "pre-v0.10.1", "added": "v23.02",
"deprecated": false "deprecated": false
}, },
"Getinfo.address[].address": { "Getinfo.address[].address": {

View File

@@ -70,7 +70,7 @@ message GetinfoRequest {
message GetinfoResponse { message GetinfoResponse {
bytes id = 1; bytes id = 1;
string alias = 2; optional string alias = 2;
bytes color = 3; bytes color = 3;
uint32 num_peers = 4; uint32 num_peers = 4;
uint32 num_pending_channels = 5; uint32 num_pending_channels = 5;

View File

@@ -52,7 +52,7 @@ impl From<responses::GetinfoResponse> for pb::GetinfoResponse {
fn from(c: responses::GetinfoResponse) -> Self { fn from(c: responses::GetinfoResponse) -> Self {
Self { Self {
id: c.id.serialize().to_vec(), // Rule #2 for type pubkey id: c.id.serialize().to_vec(), // Rule #2 for type pubkey
alias: c.alias, // Rule #2 for type string alias: c.alias, // Rule #2 for type string?
color: hex::decode(&c.color).unwrap(), // Rule #2 for type hex color: hex::decode(&c.color).unwrap(), // Rule #2 for type hex
num_peers: c.num_peers, // Rule #2 for type u32 num_peers: c.num_peers, // Rule #2 for type u32
num_pending_channels: c.num_pending_channels, // Rule #2 for type u32 num_pending_channels: c.num_pending_channels, // Rule #2 for type u32
@@ -65,7 +65,7 @@ impl From<responses::GetinfoResponse> for pb::GetinfoResponse {
network: c.network, // Rule #2 for type string network: c.network, // Rule #2 for type string
fees_collected_msat: Some(c.fees_collected_msat.into()), // Rule #2 for type msat fees_collected_msat: Some(c.fees_collected_msat.into()), // Rule #2 for type msat
// Field: Getinfo.address[] // Field: Getinfo.address[]
address: c.address.into_iter().map(|i| i.into()).collect(), // Rule #3 for type GetinfoAddress address: c.address.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
// Field: Getinfo.binding[] // Field: Getinfo.binding[]
binding: c.binding.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 binding: c.binding.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
warning_bitcoind_sync: c.warning_bitcoind_sync, // Rule #2 for type string? warning_bitcoind_sync: c.warning_bitcoind_sync, // Rule #2 for type string?

6
cln-rpc/src/model.rs generated
View File

@@ -1518,7 +1518,8 @@ pub mod responses {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GetinfoResponse { pub struct GetinfoResponse {
pub id: PublicKey, pub id: PublicKey,
pub alias: String, #[serde(skip_serializing_if = "Option::is_none")]
pub alias: Option<String>,
pub color: String, pub color: String,
pub num_peers: u32, pub num_peers: u32,
pub num_pending_channels: u32, pub num_pending_channels: u32,
@@ -1532,7 +1533,8 @@ pub mod responses {
pub blockheight: u32, pub blockheight: u32,
pub network: String, pub network: String,
pub fees_collected_msat: Amount, pub fees_collected_msat: Amount,
pub address: Vec<GetinfoAddress>, #[serde(skip_serializing_if = "crate::is_none_or_empty")]
pub address: Option<Vec<GetinfoAddress>>,
#[serde(skip_serializing_if = "crate::is_none_or_empty")] #[serde(skip_serializing_if = "crate::is_none_or_empty")]
pub binding: Option<Vec<GetinfoBinding>>, pub binding: Option<Vec<GetinfoBinding>>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@@ -111,7 +111,7 @@ class OptionalPatch(Patch):
# Oldest supported versions. Bump this if you no longer want to # Oldest supported versions. Bump this if you no longer want to
# support older versions, and you want to make required fields # support older versions, and you want to make required fields
# more stringent. # more stringent.
supported = 'v0.12.0' supported = 'v0.10.1'
def visit(self, f: model.Field) -> None: def visit(self, f: model.Field) -> None:
if f.added not in self.versions: if f.added not in self.versions:

File diff suppressed because one or more lines are too long