Skip to content

Commit f053465

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 16f988f commit f053465

File tree

8 files changed

+696
-672
lines changed

8 files changed

+696
-672
lines changed

.msggen.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,8 @@
16771677
},
16781678
"FundchannelCompleteRequest": {
16791679
"FundChannel_Complete.id": 1,
1680-
"FundChannel_Complete.psbt": 2
1680+
"FundChannel_Complete.psbt": 2,
1681+
"FundChannel_Complete.withhold": 3
16811682
},
16821683
"FundchannelCompleteResponse": {
16831684
"FundChannel_Complete.channel_id": 1,
@@ -7233,6 +7234,10 @@
72337234
"added": "pre-v0.10.1",
72347235
"deprecated": null
72357236
},
7237+
"FundChannel_Complete.withhold": {
7238+
"added": "v25.12",
7239+
"deprecated": null
7240+
},
72367241
"FundChannel_Start": {
72377242
"added": "pre-v0.10.1",
72387243
"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
@@ -13252,6 +13252,13 @@
1325213252
"description": [
1325313253
"Transaction to use for funding (does not need to be signed but must be otherwise complete)."
1325413254
]
13255+
},
13256+
"withhold": {
13257+
"type": "boolean",
13258+
"added": "v25.12",
13259+
"description": [
13260+
"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."
13261+
]
1325513262
}
1325613263
}
1325713264
},

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

Lines changed: 668 additions & 668 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
@@ -1022,10 +1022,12 @@ static struct command_result *json_fundchannel_complete(struct command *cmd,
10221022
struct wally_psbt *funding_psbt;
10231023
u32 *funding_txout_num = NULL;
10241024
struct funding_channel *fc;
1025+
bool *withhold;
10251026

10261027
if (!param_check(cmd, buffer, params,
10271028
p_req("id", param_node_id, &id),
10281029
p_req("psbt", param_psbt, &funding_psbt),
1030+
p_opt_def("withhold", param_bool, &withhold, false),
10291031
NULL))
10301032
return command_param_failed();
10311033

@@ -1098,9 +1100,7 @@ static struct command_result *json_fundchannel_complete(struct command *cmd,
10981100
return command_check_done(cmd);
10991101

11001102
fc->funding_psbt = tal_steal(fc, funding_psbt);
1101-
1102-
/* FIXME: Set by option */
1103-
fc->withheld = false;
1103+
fc->withheld = *withhold;
11041104

11051105
/* Set the cmd to this new cmd */
11061106
peer->uncommitted_channel->fc->cmd = cmd;

0 commit comments

Comments
 (0)