Skip to content

Commit 733efcf

Browse files
committed
BOLTs: import spec additions for option_simple_close.
Signed-off-by: Rusty Russell <[email protected]>
1 parent 58e1428 commit 733efcf

14 files changed

+72
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CCANDIR := ccan
2626

2727
# Where we keep the BOLT RFCs
2828
BOLTDIR := ../bolts/
29-
DEFAULT_BOLTVERSION := acd383145dd8c3fecd69ce94e4a789767b984ac0
29+
DEFAULT_BOLTVERSION := ccfa38ed4f592c3711156bb4ded77f44ec01101d
3030
# Can be overridden on cmdline.
3131
BOLTVERSION := $(DEFAULT_BOLTVERSION)
3232

channeld/channeld.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4554,6 +4554,8 @@ static void peer_in(struct peer *peer, const u8 *msg)
45544554
case WIRE_FUNDING_CREATED:
45554555
case WIRE_FUNDING_SIGNED:
45564556
case WIRE_CLOSING_SIGNED:
4557+
case WIRE_CLOSING_COMPLETE:
4558+
case WIRE_CLOSING_SIG:
45574559
case WIRE_TX_ADD_INPUT:
45584560
case WIRE_TX_REMOVE_INPUT:
45594561
case WIRE_TX_ADD_OUTPUT:

closingd/closingd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void send_offer(struct per_peer_state *pps,
165165

166166
/* BOLT #3:
167167
*
168-
* ## Closing Transaction
168+
* ## Legacy Closing Transaction
169169
*...
170170
* Each node offering a signature... MAY eliminate its
171171
* own output.

common/close_tx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ struct bitcoin_tx *create_close_tx(const tal_t *ctx,
2929

3030
/* BOLT #3:
3131
*
32-
* ## Closing Transaction
32+
* ## Legacy Closing Transaction
33+
*
34+
* This variant is used for `closing_signed` messages (i.e. where
35+
* `option_simple_close` is not negotiated).
3336
*
3437
* Note that there are two possible variants for each node.
3538
*

common/gossmap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,8 @@ const void *gossmap_stream_next(const tal_t *ctx,
17921792
case WIRE_SPLICE_LOCKED:
17931793
case WIRE_SHUTDOWN:
17941794
case WIRE_CLOSING_SIGNED:
1795+
case WIRE_CLOSING_COMPLETE:
1796+
case WIRE_CLOSING_SIG:
17951797
case WIRE_UPDATE_ADD_HTLC:
17961798
case WIRE_UPDATE_FULFILL_HTLC:
17971799
case WIRE_UPDATE_FAIL_HTLC:

common/interactivetx.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ static u8 *read_next_msg(const tal_t *ctx,
157157
case WIRE_FUNDING_CREATED:
158158
case WIRE_FUNDING_SIGNED:
159159
case WIRE_CLOSING_SIGNED:
160+
case WIRE_CLOSING_COMPLETE:
161+
case WIRE_CLOSING_SIG:
160162
case WIRE_UPDATE_ADD_HTLC:
161163
case WIRE_UPDATE_FULFILL_HTLC:
162164
case WIRE_UPDATE_FAIL_HTLC:
@@ -747,6 +749,8 @@ char *process_interactivetx_updates(const tal_t *ctx,
747749
case WIRE_CHANNEL_READY:
748750
case WIRE_SHUTDOWN:
749751
case WIRE_CLOSING_SIGNED:
752+
case WIRE_CLOSING_COMPLETE:
753+
case WIRE_CLOSING_SIG:
750754
case WIRE_UPDATE_ADD_HTLC:
751755
case WIRE_UPDATE_FULFILL_HTLC:
752756
case WIRE_UPDATE_FAIL_HTLC:

common/shutdown_scriptpubkey.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
* 3. if (and only if) `option_shutdown_anysegwit` is negotiated:
1111
* * `OP_1` through `OP_16` inclusive, followed by a single push of 2 to 40 bytes
1212
* (witness program versions 1 through 16)
13+
* 4. if (and only if) `option_simple_close` is negotiated:
14+
* * `OP_RETURN` followed by one of:
15+
* * `6` to `75` inclusive followed by exactly that many bytes
16+
* * `76` followed by `76` to `80` followed by exactly that many bytes
1317
*
1418
* A receiving node:
1519
*...

connectd/gossip_rcvd_filter.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ static bool is_msg_gossip_broadcast(const u8 *cursor)
6767
case WIRE_CHANNEL_READY:
6868
case WIRE_SHUTDOWN:
6969
case WIRE_CLOSING_SIGNED:
70+
case WIRE_CLOSING_COMPLETE:
71+
case WIRE_CLOSING_SIG:
7072
case WIRE_UPDATE_ADD_HTLC:
7173
case WIRE_UPDATE_FULFILL_HTLC:
7274
case WIRE_UPDATE_FAIL_HTLC:

connectd/gossip_store.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ static bool public_msg_type(enum peer_wire type)
7676
case WIRE_TX_ABORT:
7777
case WIRE_SHUTDOWN:
7878
case WIRE_CLOSING_SIGNED:
79+
case WIRE_CLOSING_COMPLETE:
80+
case WIRE_CLOSING_SIG:
7981
case WIRE_UPDATE_ADD_HTLC:
8082
case WIRE_UPDATE_FULFILL_HTLC:
8183
case WIRE_UPDATE_FAIL_HTLC:

connectd/multiplex.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ static bool is_urgent(enum peer_wire type)
364364
case WIRE_TX_ACK_RBF:
365365
case WIRE_SHUTDOWN:
366366
case WIRE_CLOSING_SIGNED:
367+
case WIRE_CLOSING_COMPLETE:
368+
case WIRE_CLOSING_SIG:
367369
case WIRE_UPDATE_ADD_HTLC:
368370
case WIRE_UPDATE_FULFILL_HTLC:
369371
case WIRE_UPDATE_FAIL_HTLC:

gossipd/gossipd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ static void handle_recv_gossip(struct daemon *daemon, const u8 *outermsg)
238238
case WIRE_CHANNEL_READY:
239239
case WIRE_SHUTDOWN:
240240
case WIRE_CLOSING_SIGNED:
241+
case WIRE_CLOSING_COMPLETE:
242+
case WIRE_CLOSING_SIG:
241243
case WIRE_UPDATE_ADD_HTLC:
242244
case WIRE_UPDATE_FULFILL_HTLC:
243245
case WIRE_UPDATE_FAIL_HTLC:

openingd/dualopend.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,8 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state)
16681668
case WIRE_FUNDING_CREATED:
16691669
case WIRE_FUNDING_SIGNED:
16701670
case WIRE_CLOSING_SIGNED:
1671+
case WIRE_CLOSING_COMPLETE:
1672+
case WIRE_CLOSING_SIG:
16711673
case WIRE_UPDATE_ADD_HTLC:
16721674
case WIRE_UPDATE_FULFILL_HTLC:
16731675
case WIRE_UPDATE_FAIL_HTLC:
@@ -2050,6 +2052,8 @@ static bool run_tx_interactive(struct state *state,
20502052
case WIRE_CHANNEL_READY:
20512053
case WIRE_SHUTDOWN:
20522054
case WIRE_CLOSING_SIGNED:
2055+
case WIRE_CLOSING_COMPLETE:
2056+
case WIRE_CLOSING_SIG:
20532057
case WIRE_UPDATE_ADD_HTLC:
20542058
case WIRE_UPDATE_FULFILL_HTLC:
20552059
case WIRE_UPDATE_FAIL_HTLC:
@@ -4231,6 +4235,8 @@ static u8 *handle_peer_in(struct state *state)
42314235
case WIRE_FUNDING_CREATED:
42324236
case WIRE_FUNDING_SIGNED:
42334237
case WIRE_CLOSING_SIGNED:
4238+
case WIRE_CLOSING_COMPLETE:
4239+
case WIRE_CLOSING_SIG:
42344240
case WIRE_UPDATE_ADD_HTLC:
42354241
case WIRE_UPDATE_FULFILL_HTLC:
42364242
case WIRE_UPDATE_FAIL_HTLC:

wire/peer_wire.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ static bool unknown_type(enum peer_wire t)
1515
case WIRE_CHANNEL_READY:
1616
case WIRE_SHUTDOWN:
1717
case WIRE_CLOSING_SIGNED:
18+
case WIRE_CLOSING_COMPLETE:
19+
case WIRE_CLOSING_SIG:
1820
case WIRE_UPDATE_ADD_HTLC:
1921
case WIRE_UPDATE_FULFILL_HTLC:
2022
case WIRE_UPDATE_FAIL_HTLC:
@@ -81,6 +83,8 @@ bool is_msg_for_gossipd(const u8 *cursor)
8183
case WIRE_CHANNEL_READY:
8284
case WIRE_SHUTDOWN:
8385
case WIRE_CLOSING_SIGNED:
86+
case WIRE_CLOSING_COMPLETE:
87+
case WIRE_CLOSING_SIG:
8488
case WIRE_UPDATE_ADD_HTLC:
8589
case WIRE_UPDATE_FULFILL_HTLC:
8690
case WIRE_UPDATE_FAIL_HTLC:
@@ -305,6 +309,18 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
305309
* 2. data:
306310
* * [`channel_id`:`channel_id`]
307311
*/
312+
case WIRE_CLOSING_COMPLETE:
313+
/* BOLT #2:
314+
* 1. type: 40 (`closing_complete`)
315+
* 2. data:
316+
* * [`channel_id`:`channel_id`]
317+
*/
318+
case WIRE_CLOSING_SIG:
319+
/* BOLT #2:
320+
* 1. type: 41 (`closing_sig`)
321+
* 2. data:
322+
* * [`channel_id`:`channel_id`]
323+
*/
308324
case WIRE_UPDATE_ADD_HTLC:
309325
/* BOLT #2:
310326
* 1. type: 128 (`update_add_htlc`)

wire/peer_wire.csv

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,30 @@ msgdata,closing_signed,tlvs,closing_signed_tlvs,
245245
tlvtype,closing_signed_tlvs,fee_range,1
246246
tlvdata,closing_signed_tlvs,fee_range,min_fee_satoshis,u64,
247247
tlvdata,closing_signed_tlvs,fee_range,max_fee_satoshis,u64,
248+
msgtype,closing_complete,40
249+
msgdata,closing_complete,channel_id,channel_id,
250+
msgdata,closing_complete,closer_scriptpubkey_len,u16,
251+
msgdata,closing_complete,closer_scriptpubkey,byte,closer_scriptpubkey_len
252+
msgdata,closing_complete,closee_scriptpubkey_len,u16,
253+
msgdata,closing_complete,closee_scriptpubkey,byte,closee_scriptpubkey_len
254+
msgdata,closing_complete,fee_satoshis,u64,
255+
msgdata,closing_complete,locktime,u32,
256+
msgdata,closing_complete,tlvs,closing_tlvs,
257+
msgtype,closing_sig,41
258+
msgdata,closing_sig,channel_id,channel_id,
259+
msgdata,closing_sig,closer_scriptpubkey_len,u16,
260+
msgdata,closing_sig,closer_scriptpubkey,byte,closer_scriptpubkey_len
261+
msgdata,closing_sig,closee_scriptpubkey_len,u16,
262+
msgdata,closing_sig,closee_scriptpubkey,byte,closee_scriptpubkey_len
263+
msgdata,closing_sig,fee_satoshis,u64,
264+
msgdata,closing_sig,locktime,u32,
265+
msgdata,closing_sig,tlvs,closing_tlvs,
266+
tlvtype,closing_tlvs,closer_output_only,1
267+
tlvdata,closing_tlvs,closer_output_only,sig,signature,
268+
tlvtype,closing_tlvs,closee_output_only,2
269+
tlvdata,closing_tlvs,closee_output_only,sig,signature,
270+
tlvtype,closing_tlvs,closer_and_closee_outputs,3
271+
tlvdata,closing_tlvs,closer_and_closee_outputs,sig,signature,
248272
msgtype,update_add_htlc,128
249273
msgdata,update_add_htlc,channel_id,channel_id,
250274
msgdata,update_add_htlc,id,u64,

0 commit comments

Comments
 (0)