Skip to content

Commit

Permalink
Spec: Update to latest BOLT, include our first global feature definit…
Browse files Browse the repository at this point in the history
…ion.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Aug 29, 2019
1 parent 6310a18 commit 6349222
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CCANDIR := ccan

# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := 8b2cf0054660bece9e1004f42a500c6a1a77efd3
BOLTVERSION := 8555709811e6b2326f80dc479021b161e850bf03

-include config.vars

Expand Down
5 changes: 5 additions & 0 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 1 addition & 0 deletions lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions lightningd/closing_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 6349222

Please sign in to comment.