splice: Add funding outnum

Fixes #7005

Changelog-Changed: Added outnum of new funding output to splice_signed RPC command
This commit is contained in:
Dusty Daemon 2024-07-11 14:32:56 -04:00 committed by neil saitug
parent d77301c338
commit 21bc89f189
9 changed files with 337 additions and 312 deletions

View file

@ -3113,6 +3113,7 @@
"Splice_Signed.sign_first": 3
},
"Splice_signedResponse": {
"Splice_Signed.outnum": 3,
"Splice_Signed.tx": 1,
"Splice_Signed.txid": 2
},
@ -10788,6 +10789,10 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"Splice_Signed.outnum": {
"added": "v24.08",
"deprecated": false
},
"Splice_Signed.psbt": {
"added": "pre-v0.10.1",
"deprecated": false

View file

@ -2655,6 +2655,7 @@ message Splice_signedRequest {
message Splice_signedResponse {
bytes tx = 1;
bytes txid = 2;
optional uint32 outnum = 3;
}
message Splice_updateRequest {

View file

@ -2474,6 +2474,7 @@ impl From<responses::Splice_initResponse> for pb::SpliceInitResponse {
impl From<responses::Splice_signedResponse> for pb::SpliceSignedResponse {
fn from(c: responses::Splice_signedResponse) -> Self {
Self {
outnum: c.outnum, // Rule #2 for type u32?
tx: hex::decode(&c.tx).unwrap(), // Rule #2 for type hex
txid: hex::decode(&c.txid).unwrap(), // Rule #2 for type txid
}

2
cln-rpc/src/model.rs generated
View file

@ -8499,6 +8499,8 @@ pub mod responses {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Splice_signedResponse {
#[serde(skip_serializing_if = "Option::is_none")]
pub outnum: Option<u32>,
pub tx: String,
pub txid: String,
}

View file

@ -28150,6 +28150,13 @@
"description": [
"The txid is of the final transaction."
]
},
"outnum": {
"added": "v24.08",
"type": "u32",
"description": [
"The index of the new funding output."
]
}
}
},

File diff suppressed because one or more lines are too long

View file

@ -1947,6 +1947,7 @@ def splice_init2py(m):
def splice_signed2py(m):
return remove_default({
"outnum": m.outnum, # PrimitiveField in generate_composite
"tx": hexlify(m.tx), # PrimitiveField in generate_composite
"txid": hexlify(m.txid), # PrimitiveField in generate_composite
})

View file

@ -54,6 +54,13 @@
"description": [
"The txid is of the final transaction."
]
},
"outnum": {
"added": "v24.08",
"type": "u32",
"description": [
"The index of the new funding output."
]
}
}
},

View file

@ -501,6 +501,7 @@ static void handle_tx_broadcast(struct send_splice_info *info)
json_add_hex(response, "tx", tx_bytes, tal_bytelen(tx_bytes));
json_add_txid(response, "txid", &txid);
json_add_u32(response, "outnum", info->output_index);
was_pending(command_success(info->cc->cmd, response));
}