From 255415b6cb1dcb4b30ac16f86f984ed64afdc2ff Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 27 Jul 2022 11:23:32 +0200 Subject: [PATCH] msggen: Add conversion from cln-rpc to cln-grpc for Option We didn't have optional Outpoints as arguments so far, so let's backfill that. Changelog-Changed: cln-rpc: The `wrong_funding` argument for `close` was changed from `bytes` to `outpoint` --- cln-grpc/src/convert.rs | 2 +- contrib/msggen/msggen/gen/grpc.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cln-grpc/src/convert.rs b/cln-grpc/src/convert.rs index bf2a1ca986bc..9892777267d5 100644 --- a/cln-grpc/src/convert.rs +++ b/cln-grpc/src/convert.rs @@ -1080,7 +1080,7 @@ impl From<&pb::CloseRequest> for requests::CloseRequest { unilateraltimeout: c.unilateraltimeout.clone(), // Rule #1 for type u32? destination: c.destination.clone(), // Rule #1 for type string? fee_negotiation_step: c.fee_negotiation_step.clone(), // Rule #1 for type string? - wrong_funding: c.wrong_funding.clone(), // Rule #1 for type outpoint? + wrong_funding: c.wrong_funding.as_ref().map(|a| a.into()), // Rule #1 for type outpoint? force_lease_closed: c.force_lease_closed.clone(), // Rule #1 for type boolean? feerange: Some(c.feerange.iter().map(|s| s.into()).collect()), // Rule #4 } diff --git a/contrib/msggen/msggen/gen/grpc.py b/contrib/msggen/msggen/gen/grpc.py index 4d523a313b00..9f5c963ba80f 100644 --- a/contrib/msggen/msggen/gen/grpc.py +++ b/contrib/msggen/msggen/gen/grpc.py @@ -428,6 +428,7 @@ def generate_composite(self, prefix, field: CompositeField) -> None: 'msat_or_any?': f'c.{name}.as_ref().map(|a| a.into())', 'feerate': f'c.{name}.as_ref().unwrap().into()', 'feerate?': f'c.{name}.as_ref().map(|a| a.into())', + 'outpoint?': f'c.{name}.as_ref().map(|a| a.into())', 'RoutehintList?': f'c.{name}.clone().map(|rl| rl.into())', 'short_channel_id': f'cln_rpc::primitives::ShortChannelId::from_str(&c.{name}).unwrap()', 'short_channel_id?': f'c.{name}.as_ref().map(|v| cln_rpc::primitives::ShortChannelId::from_str(&v).unwrap())',