From 00121a6193acab7f7c0c5db2c4e4fe973fe51e78 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 15 Mar 2021 11:53:18 +1030 Subject: [PATCH] lightningd/opening_control: deprecate old fundchannel_complete args. Signed-off-by: Rusty Russell Changelog-Deprecated: JSON-RPC: `fundchannel_complete` txid and txout parameters (use psbt) --- doc/lightning-fundchannel_complete.7 | 12 ++++++------ doc/lightning-fundchannel_complete.7.md | 8 ++++---- lightningd/opening_control.c | 2 +- plugins/spender/multifundchannel.c | 5 +---- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/doc/lightning-fundchannel_complete.7 b/doc/lightning-fundchannel_complete.7 index 3372a2b72675..bddd915bef02 100644 --- a/doc/lightning-fundchannel_complete.7 +++ b/doc/lightning-fundchannel_complete.7 @@ -3,7 +3,7 @@ lightning-fundchannel_complete - Command for completing channel establishment .SH SYNOPSIS -\fBfundchannel_complete\fR \fIid\fR \fItxid\fR \fItxout\fR +\fBfundchannel_complete\fR \fIid\fR \fIpsbt\fR .SH DESCRIPTION @@ -14,10 +14,8 @@ complete an initiated channel establishment with a connected peer\. \fIid\fR is the node id of the remote peer\. -\fItxid\fR is the hex string of the funding transaction id\. - - -\fItxout\fR is the integer outpoint of the funding output for this channel\. +\fIpsbt\fR is the transaction to use for funding (does not need to be +signed but must be otherwise complete)\. Note that the funding transaction MUST NOT be broadcast until after @@ -44,6 +42,8 @@ with \fBcode\fR being one of the following: 305: Peer is not connected\. .IP \[bu] 306: Unknown peer id\. +.IP \[bu] +309: PSBT does not have a unique, correct output to fund the channel\. .RE .SH AUTHOR @@ -61,4 +61,4 @@ lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7) Main web site: \fIhttps://github.com/ElementsProject/lightning\fR -\" SHA256STAMP:eea98ffd2086403dd7257878427fa9f3cf4bc9983579d097ee3b65e77760a071 +\" SHA256STAMP:2c5fa01a3d6add90b4e7053af11d98d8cc5ef79a427cf0c8391e3731ebd3e90b diff --git a/doc/lightning-fundchannel_complete.7.md b/doc/lightning-fundchannel_complete.7.md index c9ebe96430c7..c85f47eaaa61 100644 --- a/doc/lightning-fundchannel_complete.7.md +++ b/doc/lightning-fundchannel_complete.7.md @@ -4,7 +4,7 @@ lightning-fundchannel\_complete -- Command for completing channel establishment SYNOPSIS -------- -**fundchannel\_complete** *id* *txid* *txout* +**fundchannel\_complete** *id* *psbt* DESCRIPTION ----------- @@ -14,9 +14,8 @@ complete an initiated channel establishment with a connected peer. *id* is the node id of the remote peer. -*txid* is the hex string of the funding transaction id. - -*txout* is the integer outpoint of the funding output for this channel. +*psbt* is the transaction to use for funding (does not need to be +signed but must be otherwise complete). Note that the funding transaction MUST NOT be broadcast until after channel establishment has been successfully completed, as the commitment @@ -37,6 +36,7 @@ with `code` being one of the following: - -1: Catchall nonspecific error. - 305: Peer is not connected. - 306: Unknown peer id. +- 309: PSBT does not have a unique, correct output to fund the channel. AUTHOR ------ diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index aa6d265900e1..03fd9d4771ac 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -965,7 +965,7 @@ static struct command_result *json_fundchannel_complete(struct command *cmd, bool old_api; /* params is NULL for initial parameter desc generation! */ - if (params /* FIXME: && deprecated_apis */) { + if (params && deprecated_apis) { /* We used to have a three-arg version. */ if (params->type == JSMN_ARRAY) old_api = (params->size == 3); diff --git a/plugins/spender/multifundchannel.c b/plugins/spender/multifundchannel.c index 693b4ecc8c81..c153d2282c68 100644 --- a/plugins/spender/multifundchannel.c +++ b/plugins/spender/multifundchannel.c @@ -683,10 +683,7 @@ fundchannel_complete_dest(struct multifundchannel_destination *dest) &fundchannel_complete_err, dest); json_add_node_id(req->js, "id", &dest->id); - json_add_string(req->js, "txid", - type_to_string(tmpctx, struct bitcoin_txid, - mfc->txid)); - json_add_num(req->js, "txout", dest->outnum); + json_add_psbt(req->js, "psbt", mfc->psbt); send_outreq(cmd->plugin, req); }