Skip to content

Commit

Permalink
msggen: Include AddPsbtOutput to RPC list and meta field map; regener…
Browse files Browse the repository at this point in the history
…ate libraries
  • Loading branch information
s373nZ committed Feb 25, 2024
1 parent 052542e commit e050b66
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,17 @@
"AddgossipRequest": {
"AddGossip.message": 1
},
"AddpsbtoutputRequest": {
"AddPsbtOutput.destination": 4,
"AddPsbtOutput.initialpsbt": 3,
"AddPsbtOutput.locktime": 2,
"AddPsbtOutput.satoshi": 1
},
"AddpsbtoutputResponse": {
"AddPsbtOutput.estimated_added_weight": 2,
"AddPsbtOutput.outnum": 3,
"AddPsbtOutput.psbt": 1
},
"AutocleaninvoiceRequest": {
"AutoCleanInvoice.cycle_seconds": 2,
"AutoCleanInvoice.expired_by": 1
Expand Down Expand Up @@ -1854,6 +1865,38 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"AddPsbtOutput": {
"added": "v23.11",
"deprecated": false
},
"AddPsbtOutput.destination": {
"added": "v23.11",
"deprecated": false
},
"AddPsbtOutput.estimated_added_weight": {
"added": "v23.11",
"deprecated": false
},
"AddPsbtOutput.initialpsbt": {
"added": "v23.11",
"deprecated": false
},
"AddPsbtOutput.locktime": {
"added": "v23.11",
"deprecated": false
},
"AddPsbtOutput.outnum": {
"added": "v23.11",
"deprecated": false
},
"AddPsbtOutput.psbt": {
"added": "v23.11",
"deprecated": false
},
"AddPsbtOutput.satoshi": {
"added": "v23.11",
"deprecated": false
},
"AutoCleanInvoice": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
14 changes: 14 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.

35 changes: 35 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 @@ -218,6 +218,38 @@ async fn add_gossip(

}

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

}

async fn auto_clean_invoice(
&self,
request: tonic::Request<pb::AutocleaninvoiceRequest>,
Expand Down
52 changes: 52 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.

3 changes: 3 additions & 0 deletions contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ def load_jsonrpc_method(name):


def load_jsonrpc_service():
# FIXME: Maybe this list should be located somewhere other than utils so
# it's more intuitive to remember to update when new RPC calls are added?
method_names = [
"Getinfo",
"ListPeers",
"ListFunds",
"SendPay",
"ListChannels",
"AddGossip",
"AddPsbtOutput",
"AutoCleanInvoice",
"CheckMessage",
"Close",
Expand Down
8 changes: 8 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ def addgossip2py(m):
})


def addpsbtoutput2py(m):
return remove_default({
"psbt": m.psbt, # PrimitiveField in generate_composite
"estimated_added_weight": m.estimated_added_weight, # PrimitiveField in generate_composite
"outnum": m.outnum, # PrimitiveField in generate_composite
})


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

0 comments on commit e050b66

Please sign in to comment.