Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lightning-listfunds] Missing field #5345

Closed
bubelov opened this issue Jun 25, 2022 · 5 comments
Closed

[lightning-listfunds] Missing field #5345

bubelov opened this issue Jun 25, 2022 · 5 comments

Comments

@bubelov
Copy link
Contributor

bubelov commented Jun 25, 2022

It looks like reserved_to_block field is missing from gRPC mapping:

message ListfundsOutputs {
// ListFunds.outputs[].status
enum ListfundsOutputsStatus {
UNCONFIRMED = 0;
CONFIRMED = 1;
SPENT = 2;
}
bytes txid = 1;
uint32 output = 2;
Amount amount_msat = 3;
bytes scriptpubkey = 4;
optional string address = 5;
optional bytes redeemscript = 6;
ListfundsOutputsStatus status = 7;
bool reserved = 9;
optional uint32 blockheight = 8;
}

Is it intentional? It looks like CLI can return this field under certain conditions:

if (reserved)
json_add_num(response, "reserved_to_block",
utxo->reserved_til);

@vincenzopalazzo
Copy link
Collaborator

Yeah this was reported in some other issue as well, I think the code generator has bug for the optional filed

@bubelov
Copy link
Contributor Author

bubelov commented Jun 26, 2022

@vincenzopalazzo does it generate from this?

lightning/.msggen.json

Lines 580 to 589 in 9a880a0

"ListfundsOutputs": {
"ListFunds.outputs[].address": 5,
"ListFunds.outputs[].amount_msat": 3,
"ListFunds.outputs[].blockheight": 8,
"ListFunds.outputs[].output": 2,
"ListFunds.outputs[].redeemscript": 6,
"ListFunds.outputs[].reserved": 9,
"ListFunds.outputs[].scriptpubkey": 4,
"ListFunds.outputs[].status": 7,
"ListFunds.outputs[].txid": 1

lightning/cln-rpc/src/model.rs

Lines 1273 to 1292 in 9a880a0

pub struct ListfundsOutputs {
#[serde(alias = "txid")]
pub txid: String,
#[serde(alias = "output")]
pub output: u32,
#[serde(alias = "amount_msat")]
pub amount_msat: Amount,
#[serde(alias = "scriptpubkey")]
pub scriptpubkey: String,
#[serde(alias = "address", skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(alias = "redeemscript", skip_serializing_if = "Option::is_none")]
pub redeemscript: Option<String>,
// Path `ListFunds.outputs[].status`
#[serde(rename = "status")]
pub status: ListfundsOutputsStatus,
#[serde(alias = "reserved")]
pub reserved: bool,
#[serde(alias = "blockheight", skip_serializing_if = "Option::is_none")]
pub blockheight: Option<u32>,

It has a bunch of optional fields already so it doesn't look like it can't parse Rust's Option enums or something

@vincenzopalazzo
Copy link
Collaborator

The optional field can be also filed that exist only in a if-else JSON schema clause

@daywalker90
Copy link
Contributor

daywalker90 commented Apr 19, 2024

fixed in master with #7218

@vincenzopalazzo
Copy link
Collaborator

Lovelly @daywalker90 thanks! Looks like that you are the new msggen kind 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants