diff --git a/Makefile b/Makefile index 20e0fa178..3a1cea5b3 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ CCANDIR := ccan # Where we keep the BOLT RFCs BOLTDIR := ../lightning-rfc/ -BOLTVERSION := 24226302741ec2701571c2036319fdb5554cb07c +BOLTVERSION := 17df7f2bba4dab844569c3305201606dee800741 -include config.vars diff --git a/common/bolt11.c b/common/bolt11.c index e892a9611..cbd8f4245 100644 --- a/common/bolt11.c +++ b/common/bolt11.c @@ -157,8 +157,8 @@ static void decode_p(struct bolt11 *b11, /* BOLT #11: * * A reader... MUST skip over unknown fields, OR an `f` field - * with unknown `version`, OR `p`, `h`, or `n` fields that do - * NOT have `data_length`s of 52, 52, or 53, respectively. + * with unknown `version`, OR `p`, `h`, `s` or `n` fields that do + * NOT have `data_length`s of 52, 52, 52 or 53, respectively. */ if (data_length != 52) { unknown_field(b11, hu5, data, data_len, 'p', data_length); @@ -210,8 +210,8 @@ static void decode_h(struct bolt11 *b11, /* BOLT #11: * * A reader... MUST skip over unknown fields, OR an `f` field - * with unknown `version`, OR `p`, `h`, or `n` fields that do - * NOT have `data_length`s of 52, 52, or 53, respectively. */ + * with unknown `version`, OR `p`, `h`, `s` or `n` fields that do + * NOT have `data_length`s of 52, 52, 52 or 53, respectively. */ if (data_length != 52) { unknown_field(b11, hu5, data, data_len, 'h', data_length); return; @@ -285,8 +285,8 @@ static char *decode_n(struct bolt11 *b11, /* BOLT #11: * * A reader... MUST skip over unknown fields, OR an `f` field - * with unknown `version`, OR `p`, `h`, or `n` fields that do - * NOT have `data_length`s of 52, 52, or 53, respectively. */ + * with unknown `version`, OR `p`, `h`, `s` or `n` fields that do + * NOT have `data_length`s of 52, 52, 52 or 53, respectively. */ if (data_length != 53) return unknown_field(b11, hu5, data, data_len, 'n', data_length); @@ -1024,6 +1024,7 @@ char *bolt11_encode_(const tal_t *ctx, * - if a specific minimum `amount` is required for successful payment: * - MUST include that `amount`. * - MUST encode `amount` as a positive decimal integer with no leading 0s. + * - If the `p` multiplier is used the `amount` the last decimal MUST be `0`. * - SHOULD use the shortest representation possible, by using the largest multiplier or omitting the multiplier. */ if (b11->msat) { diff --git a/common/features.h b/common/features.h index 1b7d99e59..b6ad670a8 100644 --- a/common/features.h +++ b/common/features.h @@ -47,7 +47,7 @@ void set_feature_bit(u8 **ptr, u32 bit); * | 6/7 | `gossip_queries` |... * | 8/9 | `var_onion_optin` |... * | 10/11 | `gossip_queries_ex` |... - * | 12/13| `option_static_remotekey` |... + * | 12/13 | `option_static_remotekey` |... */ #define OPT_DATA_LOSS_PROTECT 0 #define OPT_INITIAL_ROUTING_SYNC 2 diff --git a/common/onion.c b/common/onion.c index c0e425011..09c964644 100644 --- a/common/onion.c +++ b/common/onion.c @@ -69,9 +69,12 @@ u8 *onion_nonfinal_hop(const tal_t *ctx, /* BOLT #4: * * The writer: - * - MUST include `amt_to_forward` and `outgoing_cltv_value` - * for every node. - * - MUST include `short_channel_id` for every non-final node. + *... + * - For every node: + * - MUST include `amt_to_forward` and `outgoing_cltv_value`. + * - For every non-final node: + * - MUST include `short_channel_id` + * - MUST NOT include `payment_data` */ tlv_amt.amt_to_forward = forward.millisatoshis; /* Raw: TLV convert */ tlv_cltv.outgoing_cltv_value = outgoing_cltv; @@ -106,10 +109,16 @@ u8 *onion_final_hop(const tal_t *ctx, /* BOLT #4: * * The writer: - * - MUST include `amt_to_forward` and `outgoing_cltv_value` - * for every node. *... - * - MUST NOT include `short_channel_id` for the final node. + * - For every node: + * - MUST include `amt_to_forward` and `outgoing_cltv_value`. + *... + * - For the final node: + * - MUST NOT include `short_channel_id` + * - if the recipient provided `payment_secret`: + * - MUST include `payment_data` + * - MUST set `payment_secret` to the one provided + * - MUST set `total_msat` to the total amount it will send */ tlv_amt.amt_to_forward = forward.millisatoshis; /* Raw: TLV convert */ tlv_cltv.outgoing_cltv_value = outgoing_cltv; @@ -255,7 +264,8 @@ struct onion_payload *onion_decode(const tal_t *ctx, * * The writer: *... - * - MUST include `short_channel_id` for every non-final node. + * - For every non-final node: + * - MUST include `short_channel_id` */ if (rs->nextcase == ONION_FORWARD) { if (!tlv->short_channel_id)