Skip to content

Commit 16fb867

Browse files
niftyneirustyrussell
authored andcommitted
wire: import shutdown proposal from lightning/bolts#847
1 parent 88616c7 commit 16fb867

File tree

8 files changed

+179
-12
lines changed

8 files changed

+179
-12
lines changed

closingd/closingd.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void send_offer(struct per_peer_state *pps,
187187
type_to_string(tmpctx, struct amount_sat, &fee_to_offer));
188188

189189
assert(our_sig.sighash_type == SIGHASH_ALL);
190-
msg = towire_closing_signed(NULL, channel_id, fee_to_offer, &our_sig.s);
190+
msg = towire_closing_signed(NULL, channel_id, fee_to_offer, &our_sig.s, NULL);
191191
sync_crypto_write(pps, take(msg));
192192
}
193193

@@ -231,6 +231,7 @@ receive_offer(struct per_peer_state *pps,
231231
struct amount_sat received_fee;
232232
struct bitcoin_signature their_sig;
233233
struct bitcoin_tx *tx;
234+
struct tlv_closing_signed_tlvs *close_tlvs;
234235

235236
/* Wait for them to say something interesting */
236237
do {
@@ -254,8 +255,10 @@ receive_offer(struct per_peer_state *pps,
254255
} while (!msg);
255256

256257
their_sig.sighash_type = SIGHASH_ALL;
258+
close_tlvs = tlv_closing_signed_tlvs_new(msg);
257259
if (!fromwire_closing_signed(msg, &their_channel_id,
258-
&received_fee, &their_sig.s))
260+
&received_fee, &their_sig.s,
261+
close_tlvs))
259262
peer_failed_warn(pps, channel_id,
260263
"Expected closing_signed: %s",
261264
tal_hex(tmpctx, msg));
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--- wire/peer_wire.csv 2021-05-18 11:15:05.539134131 -0500
2+
+++ - 2021-05-18 11:15:15.690789516 -0500
3+
@@ -90,6 +90,10 @@
4+
msgdata,closing_signed,channel_id,channel_id,
5+
msgdata,closing_signed,fee_satoshis,u64,
6+
msgdata,closing_signed,signature,signature,
7+
+msgdata,closing_signed,tlvs,closing_signed_tlvs,
8+
+tlvtype,closing_signed_tlvs,fee_range,1
9+
+tlvdata,closing_signed_tlvs,fee_range,min_fee_satoshis,u64,
10+
+tlvdata,closing_signed_tlvs,fee_range,max_fee_satoshis,u64,
11+
msgtype,update_add_htlc,128
12+
msgdata,update_add_htlc,channel_id,channel_id,
13+
msgdata,update_add_htlc,id,u64,

wire/peer_printgen.c

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

wire/peer_printgen.h

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

wire/peer_wire.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ msgtype,closing_signed,39
182182
msgdata,closing_signed,channel_id,channel_id,
183183
msgdata,closing_signed,fee_satoshis,u64,
184184
msgdata,closing_signed,signature,signature,
185+
msgdata,closing_signed,tlvs,closing_signed_tlvs,
186+
tlvtype,closing_signed_tlvs,fee_range,1
187+
tlvdata,closing_signed_tlvs,fee_range,min_fee_satoshis,u64,
188+
tlvdata,closing_signed_tlvs,fee_range,max_fee_satoshis,u64,
185189
msgtype,update_add_htlc,128
186190
msgdata,update_add_htlc,channel_id,channel_id,
187191
msgdata,update_add_htlc,id,u64,

wire/peer_wiregen.c

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

wire/peer_wiregen.h

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

wire/test/run-peer-wire.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,20 +611,27 @@ static struct msg_funding_signed *fromwire_struct_funding_signed(const tal_t *ct
611611
static void *towire_struct_closing_signed(const tal_t *ctx,
612612
const struct msg_closing_signed *s)
613613
{
614+
struct tlv_closing_signed_tlvs *close_tlvs;
615+
616+
close_tlvs = tlv_closing_signed_tlvs_new(ctx);
614617
return towire_closing_signed(ctx,
615618
&s->channel_id,
616619
s->fee_satoshis,
617-
&s->signature);
620+
&s->signature,
621+
close_tlvs);
618622
}
619623

620624
static struct msg_closing_signed *fromwire_struct_closing_signed(const tal_t *ctx, const void *p)
621625
{
622626
struct msg_closing_signed *s = tal(ctx, struct msg_closing_signed);
627+
struct tlv_closing_signed_tlvs *close_tlvs;
623628

629+
close_tlvs = tlv_closing_signed_tlvs_new(ctx);
624630
if (fromwire_closing_signed(p,
625631
&s->channel_id,
626632
&s->fee_satoshis,
627-
&s->signature))
633+
&s->signature,
634+
close_tlvs))
628635
return s;
629636
return tal_free(s);
630637
}

0 commit comments

Comments
 (0)