diff --git a/.msggen.json b/.msggen.json index cebc164db..579e30c3e 100644 --- a/.msggen.json +++ b/.msggen.json @@ -58,6 +58,14 @@ "KeysendStatus": { "complete": 0 }, + "ListclosedchannelsClosedchannelsClose_cause": { + "local": 1, + "onchain": 5, + "protocol": 4, + "remote": 3, + "unknown": 0, + "user": 2 + }, "ListforwardsForwardsStatus": { "failed": 3, "local_failed": 2, @@ -649,6 +657,42 @@ "ListchannelsResponse": { "ListChannels.channels[]": 1 }, + "ListclosedchannelsClosedchannels": { + "ListClosedChannels.closedchannels[].alias": 4, + "ListClosedChannels.closedchannels[].channel_id": 2, + "ListClosedChannels.closedchannels[].channel_type": 8, + "ListClosedChannels.closedchannels[].close_cause": 24, + "ListClosedChannels.closedchannels[].closer": 6, + "ListClosedChannels.closedchannels[].final_to_us_msat": 19, + "ListClosedChannels.closedchannels[].funding_fee_paid_msat": 15, + "ListClosedChannels.closedchannels[].funding_fee_rcvd_msat": 16, + "ListClosedChannels.closedchannels[].funding_outnum": 13, + "ListClosedChannels.closedchannels[].funding_pushed_msat": 17, + "ListClosedChannels.closedchannels[].funding_txid": 12, + "ListClosedChannels.closedchannels[].last_commitment_fee_msat": 23, + "ListClosedChannels.closedchannels[].last_commitment_txid": 22, + "ListClosedChannels.closedchannels[].leased": 14, + "ListClosedChannels.closedchannels[].max_to_us_msat": 21, + "ListClosedChannels.closedchannels[].min_to_us_msat": 20, + "ListClosedChannels.closedchannels[].opener": 5, + "ListClosedChannels.closedchannels[].peer_id": 1, + "ListClosedChannels.closedchannels[].private": 7, + "ListClosedChannels.closedchannels[].short_channel_id": 3, + "ListClosedChannels.closedchannels[].total_htlcs_sent": 11, + "ListClosedChannels.closedchannels[].total_local_commitments": 9, + "ListClosedChannels.closedchannels[].total_msat": 18, + "ListClosedChannels.closedchannels[].total_remote_commitments": 10 + }, + "ListclosedchannelsClosedchannelsAlias": { + "ListClosedChannels.closedchannels[].alias.local": 1, + "ListClosedChannels.closedchannels[].alias.remote": 2 + }, + "ListclosedchannelsRequest": { + "ListClosedChannels.id": 1 + }, + "ListclosedchannelsResponse": { + "ListClosedChannels.closedchannels[]": 1 + }, "ListdatastoreDatastore": { "ListDatastore.datastore[].generation": 2, "ListDatastore.datastore[].hex": 3, @@ -2402,6 +2446,130 @@ "added": "pre-v0.10.1", "deprecated": false }, + "ListClosedChannels": { + "added": "v23.05", + "deprecated": null + }, + "ListClosedChannels.closedchannels[]": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].alias": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].alias.local": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].alias.remote": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].channel_id": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].channel_type": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].channel_type.bits[]": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].channel_type.names[]": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].close_cause": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].closer": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].final_to_us_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].funding_fee_paid_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].funding_fee_rcvd_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].funding_outnum": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].funding_pushed_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].funding_txid": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].last_commitment_fee_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].last_commitment_txid": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].leased": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].max_to_us_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].min_to_us_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].opener": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].peer_id": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].private": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].short_channel_id": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].total_htlcs_sent": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].total_local_commitments": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].total_msat": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.closedchannels[].total_remote_commitments": { + "added": "pre-v0.10.1", + "deprecated": false + }, + "ListClosedChannels.id": { + "added": "pre-v0.10.1", + "deprecated": false + }, "ListDatastore": { "added": "pre-v0.10.1", "deprecated": null diff --git a/cln-grpc/proto/node.proto b/cln-grpc/proto/node.proto index 9202a9f15..97e2f8c75 100644 Binary files a/cln-grpc/proto/node.proto and b/cln-grpc/proto/node.proto differ diff --git a/cln-grpc/src/convert.rs b/cln-grpc/src/convert.rs index 052269e45..e2ccc6b32 100644 Binary files a/cln-grpc/src/convert.rs and b/cln-grpc/src/convert.rs differ diff --git a/cln-grpc/src/server.rs b/cln-grpc/src/server.rs index 6c979971e..8f1690cb5 100644 --- a/cln-grpc/src/server.rs +++ b/cln-grpc/src/server.rs @@ -1242,6 +1242,38 @@ async fn list_peer_channels( } +async fn list_closed_channels( + &self, + request: tonic::Request, +) -> Result, tonic::Status> { + let req = request.into_inner(); + let req: requests::ListclosedchannelsRequest = req.into(); + debug!("Client asked for list_closed_channels"); + trace!("list_closed_channels request: {:?}", req); + let mut rpc = ClnRpc::new(&self.rpc_path) + .await + .map_err(|e| Status::new(Code::Internal, e.to_string()))?; + let result = rpc.call(Request::ListClosedChannels(req)) + .await + .map_err(|e| Status::new( + Code::Unknown, + format!("Error calling method ListClosedChannels: {:?}", e)))?; + match result { + Response::ListClosedChannels(r) => { + trace!("list_closed_channels response: {:?}", r); + Ok(tonic::Response::new(r.into())) + }, + r => Err(Status::new( + Code::Internal, + format!( + "Unexpected result {:?} to method call ListClosedChannels", + r + ) + )), + } + +} + async fn disconnect( &self, request: tonic::Request, diff --git a/cln-rpc/src/model.rs b/cln-rpc/src/model.rs index 09b170670..7c7198c52 100644 Binary files a/cln-rpc/src/model.rs and b/cln-rpc/src/model.rs differ diff --git a/contrib/msggen/msggen/gen/grpc.py b/contrib/msggen/msggen/gen/grpc.py index 76f756eb4..c479ed39c 100644 --- a/contrib/msggen/msggen/gen/grpc.py +++ b/contrib/msggen/msggen/gen/grpc.py @@ -50,6 +50,10 @@ overrides = { 'ListPeerChannels.channels[].channel_type': None, 'ListFunds.channels[].state': 'ChannelState', 'ListTransactions.transactions[].type[]': None, + + 'ListClosedChannels.closedchannels[].closer': "ChannelSide", + 'ListClosedChannels.closedchannels[].opener': "ChannelSide", + 'ListClosedChannels.closedchannels[].channel_type': None, } diff --git a/contrib/msggen/msggen/gen/rust.py b/contrib/msggen/msggen/gen/rust.py index b3d9c4c0e..26a5563e4 100644 --- a/contrib/msggen/msggen/gen/rust.py +++ b/contrib/msggen/msggen/gen/rust.py @@ -28,6 +28,10 @@ overrides = { 'ListFunds.channels[].state': 'ChannelState', 'ListTransactions.transactions[].type[]': None, 'Invoice.exposeprivatechannels': None, + + 'ListClosedChannels.closedchannels[].closer': "ChannelSide", + 'ListClosedChannels.closedchannels[].opener': "ChannelSide", + 'ListClosedChannels.closedchannels[].channel_type': None, } # A map of schema type to rust primitive types. diff --git a/contrib/msggen/msggen/patch.py b/contrib/msggen/msggen/patch.py index f25693bee..293c88ff7 100644 --- a/contrib/msggen/msggen/patch.py +++ b/contrib/msggen/msggen/patch.py @@ -62,7 +62,7 @@ class VersionAnnotationPatch(Patch): # the default value only on the first run. Code left commented # to show how it was done # if f.added is None and 'added' not in m: - # m['added'] = 'pre-v0.10.1' + # m['added'] = 'pre-v0.10.1' added = m.get('added', None) deprecated = m.get('deprecated', None) diff --git a/contrib/msggen/msggen/utils/utils.py b/contrib/msggen/msggen/utils/utils.py index bf0975bc6..cfebbf789 100644 --- a/contrib/msggen/msggen/utils/utils.py +++ b/contrib/msggen/msggen/utils/utils.py @@ -65,6 +65,7 @@ def load_jsonrpc_service(schema_dir: str): "TxPrepare", "TxSend", "ListPeerChannels", + "ListClosedChannels", # "decodepay", # "decode", # "delpay", diff --git a/contrib/pyln-testing/pyln/testing/grpc2py.py b/contrib/pyln-testing/pyln/testing/grpc2py.py index 6abbc49ff..fcd1e7e13 100644 --- a/contrib/pyln-testing/pyln/testing/grpc2py.py +++ b/contrib/pyln-testing/pyln/testing/grpc2py.py @@ -847,6 +847,53 @@ def listpeerchannels2py(m): }) +def listclosedchannels_closedchannels_alias2py(m): + return remove_default({ + "local": m.local, # PrimitiveField in generate_composite + "remote": m.remote, # PrimitiveField in generate_composite + }) + + +def listclosedchannels_closedchannels_channel_type2py(m): + return remove_default({ + "bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite + "names": [str(i) for i in m.names], # ArrayField[composite] in generate_composite + }) + + +def listclosedchannels_closedchannels2py(m): + return remove_default({ + "peer_id": hexlify(m.peer_id), # PrimitiveField in generate_composite + "channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite + "short_channel_id": m.short_channel_id, # PrimitiveField in generate_composite + "opener": str(m.opener), # EnumField in generate_composite + "closer": str(m.closer), # EnumField in generate_composite + "private": m.private, # PrimitiveField in generate_composite + "total_local_commitments": m.total_local_commitments, # PrimitiveField in generate_composite + "total_remote_commitments": m.total_remote_commitments, # PrimitiveField in generate_composite + "total_htlcs_sent": m.total_htlcs_sent, # PrimitiveField in generate_composite + "funding_txid": hexlify(m.funding_txid), # PrimitiveField in generate_composite + "funding_outnum": m.funding_outnum, # PrimitiveField in generate_composite + "leased": m.leased, # PrimitiveField in generate_composite + "funding_fee_paid_msat": amount2msat(m.funding_fee_paid_msat), # PrimitiveField in generate_composite + "funding_fee_rcvd_msat": amount2msat(m.funding_fee_rcvd_msat), # PrimitiveField in generate_composite + "funding_pushed_msat": amount2msat(m.funding_pushed_msat), # PrimitiveField in generate_composite + "total_msat": amount2msat(m.total_msat), # PrimitiveField in generate_composite + "final_to_us_msat": amount2msat(m.final_to_us_msat), # PrimitiveField in generate_composite + "min_to_us_msat": amount2msat(m.min_to_us_msat), # PrimitiveField in generate_composite + "max_to_us_msat": amount2msat(m.max_to_us_msat), # PrimitiveField in generate_composite + "last_commitment_txid": hexlify(m.last_commitment_txid), # PrimitiveField in generate_composite + "last_commitment_fee_msat": amount2msat(m.last_commitment_fee_msat), # PrimitiveField in generate_composite + "close_cause": str(m.close_cause), # EnumField in generate_composite + }) + + +def listclosedchannels2py(m): + return remove_default({ + "closedchannels": [listclosedchannels_closedchannels2py(i) for i in m.closedchannels], # ArrayField[composite] in generate_composite + }) + + def disconnect2py(m): return remove_default({ }) diff --git a/contrib/pyln-testing/pyln/testing/node_pb2.py b/contrib/pyln-testing/pyln/testing/node_pb2.py index 3521476d7..635940be1 100644 Binary files a/contrib/pyln-testing/pyln/testing/node_pb2.py and b/contrib/pyln-testing/pyln/testing/node_pb2.py differ diff --git a/contrib/pyln-testing/pyln/testing/node_pb2_grpc.py b/contrib/pyln-testing/pyln/testing/node_pb2_grpc.py index 3b3057b11..0c435faca 100644 --- a/contrib/pyln-testing/pyln/testing/node_pb2_grpc.py +++ b/contrib/pyln-testing/pyln/testing/node_pb2_grpc.py @@ -204,6 +204,11 @@ class NodeStub(object): request_serializer=node__pb2.ListpeerchannelsRequest.SerializeToString, response_deserializer=node__pb2.ListpeerchannelsResponse.FromString, ) + self.ListClosedChannels = channel.unary_unary( + '/cln.Node/ListClosedChannels', + request_serializer=node__pb2.ListclosedchannelsRequest.SerializeToString, + response_deserializer=node__pb2.ListclosedchannelsResponse.FromString, + ) self.Disconnect = channel.unary_unary( '/cln.Node/Disconnect', request_serializer=node__pb2.DisconnectRequest.SerializeToString, @@ -497,6 +502,12 @@ class NodeServicer(object): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def ListClosedChannels(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def Disconnect(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -762,6 +773,11 @@ def add_NodeServicer_to_server(servicer, server): request_deserializer=node__pb2.ListpeerchannelsRequest.FromString, response_serializer=node__pb2.ListpeerchannelsResponse.SerializeToString, ), + 'ListClosedChannels': grpc.unary_unary_rpc_method_handler( + servicer.ListClosedChannels, + request_deserializer=node__pb2.ListclosedchannelsRequest.FromString, + response_serializer=node__pb2.ListclosedchannelsResponse.SerializeToString, + ), 'Disconnect': grpc.unary_unary_rpc_method_handler( servicer.Disconnect, request_deserializer=node__pb2.DisconnectRequest.FromString, @@ -1478,6 +1494,23 @@ class Node(object): options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod + def ListClosedChannels(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/cln.Node/ListClosedChannels', + node__pb2.ListclosedchannelsRequest.SerializeToString, + node__pb2.ListclosedchannelsResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod def Disconnect(request, target,