Skip to content

Commit

Permalink
msggen: add upgradewallet method
Browse files Browse the repository at this point in the history
Changelog-None
  • Loading branch information
daywalker90 authored and cdecker committed May 15, 2024
1 parent 8edd3d4 commit c1c6763
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 81 deletions.
38 changes: 38 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -2470,6 +2470,16 @@
"UnreserveinputsResponse": {
"UnreserveInputs.reservations[]": 1
},
"UpgradewalletRequest": {
"UpgradeWallet.feerate": 1,
"UpgradeWallet.reservedok": 2
},
"UpgradewalletResponse": {
"UpgradeWallet.psbt": 2,
"UpgradeWallet.tx": 3,
"UpgradeWallet.txid": 4,
"UpgradeWallet.upgraded_outs": 1
},
"UtxopsbtRequest": {
"UtxoPsbt.excess_as_change": 9,
"UtxoPsbt.feerate": 2,
Expand Down Expand Up @@ -8549,6 +8559,34 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"UpgradeWallet": {
"added": "pre-v0.10.1",
"deprecated": null
},
"UpgradeWallet.feerate": {
"added": "v23.02",
"deprecated": false
},
"UpgradeWallet.psbt": {
"added": "v23.02",
"deprecated": false
},
"UpgradeWallet.reservedok": {
"added": "v23.02",
"deprecated": false
},
"UpgradeWallet.tx": {
"added": "v23.02",
"deprecated": false
},
"UpgradeWallet.txid": {
"added": "v23.02",
"deprecated": false
},
"UpgradeWallet.upgraded_outs": {
"added": "v23.02",
"deprecated": false
},
"UtxoPsbt": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
13 changes: 13 additions & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions cln-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2682,6 +2682,38 @@ async fn unreserve_inputs(

}

async fn upgrade_wallet(
&self,
request: tonic::Request<pb::UpgradewalletRequest>,
) -> Result<tonic::Response<pb::UpgradewalletResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::UpgradewalletRequest = req.into();
debug!("Client asked for upgrade_wallet");
trace!("upgrade_wallet 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::UpgradeWallet(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method UpgradeWallet: {:?}", e)))?;
match result {
Response::UpgradeWallet(r) => {
trace!("upgrade_wallet response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call UpgradeWallet",
r
)
)),
}

}

async fn wait_block_height(
&self,
request: tonic::Request<pb::WaitblockheightRequest>,
Expand Down
50 changes: 50 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def load_jsonrpc_service():
"Splice_Signed",
"Splice_Update",
"UnreserveInputs",
"UpgradeWallet",
"WaitBlockHeight",
"Wait",
# "ListConfigs",
Expand Down
166 changes: 85 additions & 81 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ def __init__(self, channel):
request_serializer=node__pb2.UnreserveinputsRequest.SerializeToString,
response_deserializer=node__pb2.UnreserveinputsResponse.FromString,
)
self.UpgradeWallet = channel.unary_unary(
'/cln.Node/UpgradeWallet',
request_serializer=node__pb2.UpgradewalletRequest.SerializeToString,
response_deserializer=node__pb2.UpgradewalletResponse.FromString,
)
self.WaitBlockHeight = channel.unary_unary(
'/cln.Node/WaitBlockHeight',
request_serializer=node__pb2.WaitblockheightRequest.SerializeToString,
Expand Down Expand Up @@ -992,6 +997,12 @@ def UnreserveInputs(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def UpgradeWallet(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 WaitBlockHeight(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -1482,6 +1493,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.UnreserveinputsRequest.FromString,
response_serializer=node__pb2.UnreserveinputsResponse.SerializeToString,
),
'UpgradeWallet': grpc.unary_unary_rpc_method_handler(
servicer.UpgradeWallet,
request_deserializer=node__pb2.UpgradewalletRequest.FromString,
response_serializer=node__pb2.UpgradewalletResponse.SerializeToString,
),
'WaitBlockHeight': grpc.unary_unary_rpc_method_handler(
servicer.WaitBlockHeight,
request_deserializer=node__pb2.WaitblockheightRequest.FromString,
Expand Down Expand Up @@ -2963,6 +2979,23 @@ def UnreserveInputs(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def UpgradeWallet(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/UpgradeWallet',
node__pb2.UpgradewalletRequest.SerializeToString,
node__pb2.UpgradewalletResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def WaitBlockHeight(request,
target,
Expand Down
9 changes: 9 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,15 @@ def unreserveinputs2py(m):
})


def upgradewallet2py(m):
return remove_default({
"psbt": m.psbt, # PrimitiveField in generate_composite
"tx": hexlify(m.tx), # PrimitiveField in generate_composite
"txid": hexlify(m.txid), # PrimitiveField in generate_composite
"upgraded_outs": m.upgraded_outs, # PrimitiveField in generate_composite
})


def waitblockheight2py(m):
return remove_default({
"blockheight": m.blockheight, # PrimitiveField in generate_composite
Expand Down

0 comments on commit c1c6763

Please sign in to comment.