Skip to content

Commit 69edbb1

Browse files
committed
lightningd: add withhold option to fundchannel_complete.
This is just a polite way of telling us that if we close, don't bother broadcasting since we didn't broadcast the funding tx. Changelog-Added: JSON-RPC: `fundchannel_complete` new parameter `withhold` (default false). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 0173a30 commit 69edbb1

File tree

8 files changed

+694
-670
lines changed

8 files changed

+694
-670
lines changed

.msggen.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,8 @@
16581658
},
16591659
"FundchannelCompleteRequest": {
16601660
"FundChannel_Complete.id": 1,
1661-
"FundChannel_Complete.psbt": 2
1661+
"FundChannel_Complete.psbt": 2,
1662+
"FundChannel_Complete.withhold": 3
16621663
},
16631664
"FundchannelCompleteResponse": {
16641665
"FundChannel_Complete.channel_id": 1,
@@ -7176,6 +7177,10 @@
71767177
"added": "pre-v0.10.1",
71777178
"deprecated": null
71787179
},
7180+
"FundChannel_Complete.withhold": {
7181+
"added": "v25.12",
7182+
"deprecated": null
7183+
},
71797184
"FundChannel_Start": {
71807185
"added": "pre-v0.10.1",
71817186
"deprecated": null

cln-grpc/proto/node.proto

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-rpc/src/model.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/msggen/msggen/schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13092,6 +13092,13 @@
1309213092
"description": [
1309313093
"Transaction to use for funding (does not need to be signed but must be otherwise complete)."
1309413094
]
13095+
},
13096+
"withhold": {
13097+
"type": "boolean",
13098+
"added": "v25.12",
13099+
"description": [
13100+
"Mark this channel 'withheld' so we know we haven't broadcast the funding transaction. If the channel is closed before we call `sendpsbt` on this psbt, it will simply be closed immediately."
13101+
]
1309513102
}
1309613103
}
1309713104
},

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Lines changed: 666 additions & 666 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/schemas/fundchannel_complete.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
"description": [
2727
"Transaction to use for funding (does not need to be signed but must be otherwise complete)."
2828
]
29+
},
30+
"withhold": {
31+
"type": "boolean",
32+
"added": "v25.12",
33+
"description": [
34+
"Mark this channel 'withheld' so we know we haven't broadcast the funding transaction. If the channel is closed before we call `sendpsbt` on this psbt, it will simply be closed immediately."
35+
]
2936
}
3037
}
3138
},

lightningd/opening_control.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,10 +1025,12 @@ static struct command_result *json_fundchannel_complete(struct command *cmd,
10251025
struct wally_psbt *funding_psbt;
10261026
u32 *funding_txout_num = NULL;
10271027
struct funding_channel *fc;
1028+
bool *withhold;
10281029

10291030
if (!param_check(cmd, buffer, params,
10301031
p_req("id", param_node_id, &id),
10311032
p_req("psbt", param_psbt, &funding_psbt),
1033+
p_opt_def("withhold", param_bool, &withhold, false),
10321034
NULL))
10331035
return command_param_failed();
10341036

@@ -1101,9 +1103,7 @@ static struct command_result *json_fundchannel_complete(struct command *cmd,
11011103
return command_check_done(cmd);
11021104

11031105
fc->funding_psbt = tal_steal(fc, funding_psbt);
1104-
1105-
/* FIXME: Set by option */
1106-
fc->withheld = false;
1106+
fc->withheld = *withhold;
11071107

11081108
/* Set the cmd to this new cmd */
11091109
peer->uncommitted_channel->fc->cmd = cmd;

0 commit comments

Comments
 (0)