Skip to content

Commit b74d32f

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 <[email protected]>
1 parent 33e5876 commit b74d32f

File tree

8 files changed

+700
-676
lines changed

8 files changed

+700
-676
lines changed

.msggen.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,8 @@
16981698
},
16991699
"FundchannelCompleteRequest": {
17001700
"FundChannel_Complete.id": 1,
1701-
"FundChannel_Complete.psbt": 2
1701+
"FundChannel_Complete.psbt": 2,
1702+
"FundChannel_Complete.withhold": 3
17021703
},
17031704
"FundchannelCompleteResponse": {
17041705
"FundChannel_Complete.channel_id": 1,
@@ -7322,6 +7323,10 @@
73227323
"added": "pre-v0.10.1",
73237324
"deprecated": null
73247325
},
7326+
"FundChannel_Complete.withhold": {
7327+
"added": "v25.12",
7328+
"deprecated": null
7329+
},
73257330
"FundChannel_Start": {
73267331
"added": "pre-v0.10.1",
73277332
"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
@@ -13594,6 +13594,13 @@
1359413594
"description": [
1359513595
"Transaction to use for funding (does not need to be signed but must be otherwise complete)."
1359613596
]
13597+
},
13598+
"withhold": {
13599+
"type": "boolean",
13600+
"added": "v25.12",
13601+
"description": [
13602+
"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."
13603+
]
1359713604
}
1359813605
}
1359913606
},

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

Lines changed: 672 additions & 672 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
@@ -1023,10 +1023,12 @@ static struct command_result *json_fundchannel_complete(struct command *cmd,
10231023
struct wally_psbt *funding_psbt;
10241024
u32 *funding_txout_num = NULL;
10251025
struct funding_channel *fc;
1026+
bool *withhold;
10261027

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

@@ -1099,9 +1101,7 @@ static struct command_result *json_fundchannel_complete(struct command *cmd,
10991101
return command_check_done(cmd);
11001102

11011103
fc->funding_psbt = tal_steal(fc, funding_psbt);
1102-
1103-
/* FIXME: Set by option */
1104-
fc->withheld = false;
1104+
fc->withheld = *withhold;
11051105

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

0 commit comments

Comments
 (0)