Browse Source

Spec: Update to latest BOLT, include our first global feature definition.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pull/2938/head
Rusty Russell 5 years ago
committed by Christian Decker
parent
commit
6349222ea2
  1. 2
      Makefile
  2. 5
      channeld/channeld.c
  3. 9
      common/features.h
  4. 1
      lightningd/channel_control.c
  5. 1
      lightningd/closing_control.c
  6. 3
      lightningd/peer_htlcs.c

2
Makefile

@ -15,7 +15,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := 8b2cf0054660bece9e1004f42a500c6a1a77efd3
BOLTVERSION := 8555709811e6b2326f80dc479021b161e850bf03
-include config.vars

5
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:

9
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 */

1
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:

1
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:

3
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;
}

Loading…
Cancel
Save