From 6349222ea2d506bb26e46291e52c47d4af763b07 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 28 Aug 2019 11:05:46 +0930 Subject: [PATCH] Spec: Update to latest BOLT, include our first global feature definition. Signed-off-by: Rusty Russell --- Makefile | 2 +- channeld/channeld.c | 5 +++++ common/features.h | 9 +++++++++ lightningd/channel_control.c | 1 + lightningd/closing_control.c | 1 + lightningd/peer_htlcs.c | 3 ++- 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 141788f08..80d5b220a 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ CCANDIR := ccan # Where we keep the BOLT RFCs BOLTDIR := ../lightning-rfc/ -BOLTVERSION := 8b2cf0054660bece9e1004f42a500c6a1a77efd3 +BOLTVERSION := 8555709811e6b2326f80dc479021b161e850bf03 -include config.vars diff --git a/channeld/channeld.c b/channeld/channeld.c index 5947cf7bf..bb02ce37a 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -2231,6 +2231,11 @@ static void peer_reconnect(struct peer *peer, * - MUST set `next_revocation_number` to the commitment number * of the next `revoke_and_ack` message it expects to receive. * - if it supports `option_data_loss_protect`: + * - MUST set `my_current_per_commitment_point` to its commitment + * point for the last signed commitment it received from its + * channel peer (i.e. the commitment_point corresponding to the + * commitment transaction the sender would use to unilaterally + * close). * - if `next_revocation_number` equals 0: * - MUST set `your_last_per_commitment_secret` to all zeroes * - otherwise: diff --git a/common/features.h b/common/features.h index 5ef524f66..945081437 100644 --- a/common/features.h +++ b/common/features.h @@ -36,4 +36,13 @@ bool global_feature_negotiated(const u8 *gfeatures, size_t f); #define LOCAL_UPFRONT_SHUTDOWN_SCRIPT 4 #define LOCAL_GOSSIP_QUERIES 6 +/* BOLT #9: + * + * ## Assigned `globalfeatures` flags + *... + * | Bits | Name | ... + * | 8/9 | `var_onion_optin` | ... + */ +#define GLOBAL_VAR_ONION 8 + #endif /* LIGHTNING_COMMON_FEATURES_H */ diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index 05126d934..f5ac55013 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -344,6 +344,7 @@ void peer_start_channeld(struct channel *channel, /* BOLT #2: * * - if it supports `option_data_loss_protect`: + *... * - if `next_revocation_number` equals 0: * - MUST set `your_last_per_commitment_secret` to all zeroes * - otherwise: diff --git a/lightningd/closing_control.c b/lightningd/closing_control.c index 5a8146b4f..49bf81974 100644 --- a/lightningd/closing_control.c +++ b/lightningd/closing_control.c @@ -247,6 +247,7 @@ void peer_start_closingd(struct channel *channel, /* BOLT #2: * * - if it supports `option_data_loss_protect`: + *... * - if `next_revocation_number` equals 0: * - MUST set `your_last_per_commitment_secret` to all zeroes * - otherwise: diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 1da2d403c..9dc5d6bd0 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -309,7 +309,7 @@ static void handle_localpay(struct htlc_in *hin, * * - if the `cltv_expiry` value is unreasonably near the present: * - MUST fail the HTLC. - * - MUST return a `final_expiry_too_soon` error. + * - MUST return an `incorrect_or_unknown_payment_details` error. */ if (get_block_height(ld->topology) + ld->config.cltv_final > cltv_expiry) { @@ -318,6 +318,7 @@ static void handle_localpay(struct htlc_in *hin, cltv_expiry, get_block_height(ld->topology), ld->config.cltv_final); + /* FIXME! */ failcode = WIRE_FINAL_EXPIRY_TOO_SOON; goto fail; }