Makefile: update bolts to 60cfb5972ad4bec4c49ee0f9e729fb3352fcdc6a.

"BOLT 4: Remove legacy format, make var_onion_optin compulsory."

This also renamed the redundant "tlv_payload" to "payload", so we
replace "tlv_tlv_payload" with "tlv_payload" everyhere!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-04-07 16:06:14 +09:30
parent 06d42694d5
commit 15f8e1e63c
15 changed files with 118 additions and 146 deletions

View File

@ -23,7 +23,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs
BOLTDIR := ../bolts/
DEFAULT_BOLTVERSION := f32c6ddb5f11b431c9bb4f501cdec604172a90de
DEFAULT_BOLTVERSION := 60cfb5972ad4bec4c49ee0f9e729fb3352fcdc6a
# Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION)

View File

@ -3,11 +3,8 @@
#include "config.h"
#include <common/utils.h>
/* BOLT #4:
*
* - a 1300-byte `hop_payloads` consisting of multiple, variable length,
* `hop_payload` payloads or up to 20 fixed sized legacy `hop_data` payloads.
*/
/* FIXME: This is a legacy concept, which should be eliminated now we have
* only onion tlv payloads. */
#define ROUTING_MAX_HOPS 20
/* BOLT #7:

View File

@ -16,13 +16,13 @@
* - MUST return an error if the payload contains other tlv fields than
* `encrypted_recipient_data` and `current_blinding_point`.
*/
static bool check_nonfinal_tlv(const struct tlv_tlv_payload *tlv,
static bool check_nonfinal_tlv(const struct tlv_payload *tlv,
u64 *failtlvtype)
{
for (size_t i = 0; i < tal_count(tlv->fields); i++) {
switch (tlv->fields[i].numtype) {
case TLV_TLV_PAYLOAD_BLINDING_POINT:
case TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA:
case TLV_PAYLOAD_BLINDING_POINT:
case TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA:
continue;
}
*failtlvtype = tlv->fields[i].numtype;
@ -39,16 +39,16 @@ static bool check_nonfinal_tlv(const struct tlv_tlv_payload *tlv,
* `encrypted_recipient_data`, `current_blinding_point`, `amt_to_forward`,
* `outgoing_cltv_value` and `total_amount_msat`.
*/
static bool check_final_tlv(const struct tlv_tlv_payload *tlv,
static bool check_final_tlv(const struct tlv_payload *tlv,
u64 *failtlvtype)
{
for (size_t i = 0; i < tal_count(tlv->fields); i++) {
switch (tlv->fields[i].numtype) {
case TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA:
case TLV_TLV_PAYLOAD_BLINDING_POINT:
case TLV_TLV_PAYLOAD_AMT_TO_FORWARD:
case TLV_TLV_PAYLOAD_OUTGOING_CLTV_VALUE:
case TLV_TLV_PAYLOAD_TOTAL_AMOUNT_MSAT:
case TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA:
case TLV_PAYLOAD_BLINDING_POINT:
case TLV_PAYLOAD_AMT_TO_FORWARD:
case TLV_PAYLOAD_OUTGOING_CLTV_VALUE:
case TLV_PAYLOAD_TOTAL_AMOUNT_MSAT:
continue;
}
*failtlvtype = tlv->fields[i].numtype;
@ -65,7 +65,7 @@ static u64 ceil_div(u64 a, u64 b)
static bool handle_blinded_forward(struct onion_payload *p,
struct amount_msat amount_in,
u32 cltv_expiry,
const struct tlv_tlv_payload *tlv,
const struct tlv_payload *tlv,
const struct tlv_encrypted_data_tlv *enc,
u64 *failtlvtype)
{
@ -81,7 +81,7 @@ static bool handle_blinded_forward(struct onion_payload *p,
* contain either `short_channel_id` or `next_node_id`.
*/
if (!enc->short_channel_id && !enc->next_node_id) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
return false;
}
@ -104,7 +104,7 @@ static bool handle_blinded_forward(struct onion_payload *p,
* contain `payment_relay`.
*/
if (!enc->payment_relay) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
return false;
}
@ -118,7 +118,7 @@ static bool handle_blinded_forward(struct onion_payload *p,
}
static bool handle_blinded_terminal(struct onion_payload *p,
const struct tlv_tlv_payload *tlv,
const struct tlv_payload *tlv,
const struct tlv_encrypted_data_tlv *enc,
u64 *failtlvtype)
{
@ -132,17 +132,17 @@ static bool handle_blinded_terminal(struct onion_payload *p,
* for the payment.
*/
if (!tlv->amt_to_forward) {
*failtlvtype = TLV_TLV_PAYLOAD_AMT_TO_FORWARD;
*failtlvtype = TLV_PAYLOAD_AMT_TO_FORWARD;
return false;
}
if (!tlv->outgoing_cltv_value) {
*failtlvtype = TLV_TLV_PAYLOAD_OUTGOING_CLTV_VALUE;
*failtlvtype = TLV_PAYLOAD_OUTGOING_CLTV_VALUE;
return false;
}
if (!tlv->total_amount_msat) {
*failtlvtype = TLV_TLV_PAYLOAD_TOTAL_AMOUNT_MSAT;
*failtlvtype = TLV_PAYLOAD_TOTAL_AMOUNT_MSAT;
return false;
}
@ -182,7 +182,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
p->final = (rs->nextcase == ONION_END);
/* BOLT-remove-legacy-onion #4:
/* BOLT #4:
* 1. type: `hop_payloads`
* 2. data:
* * [`bigsize`:`length`]
@ -197,9 +197,9 @@ struct onion_payload *onion_decode(const tal_t *ctx,
/* We do this manually so we can accept extra types, and get
* error off and type. */
p->tlv = tlv_tlv_payload_new(p);
if (!fromwire_tlv(&cursor, &max, tlvs_tlv_tlv_payload,
TLVS_ARRAY_SIZE_tlv_tlv_payload,
p->tlv = tlv_payload_new(p);
if (!fromwire_tlv(&cursor, &max, tlvs_tlv_payload,
TLVS_ARRAY_SIZE_tlv_payload,
p->tlv, &p->tlv->fields, accepted_extra_tlvs,
failtlvpos, failtlvtype)) {
return tal_free(p);
@ -216,7 +216,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
/* Only supported with --experimental-onion-messages! */
if (!blinding_support) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
goto field_bad;
}
@ -231,13 +231,13 @@ struct onion_payload *onion_decode(const tal_t *ctx,
*/
if (blinding) {
if (p->tlv->blinding_point) {
*failtlvtype = TLV_TLV_PAYLOAD_BLINDING_POINT;
*failtlvtype = TLV_PAYLOAD_BLINDING_POINT;
goto field_bad;
}
p->blinding = tal_dup(p, struct pubkey, blinding);
} else {
if (!p->tlv->blinding_point) {
*failtlvtype = TLV_TLV_PAYLOAD_BLINDING_POINT;
*failtlvtype = TLV_PAYLOAD_BLINDING_POINT;
goto field_bad;
}
p->blinding = tal_dup(p, struct pubkey,
@ -255,7 +255,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
enc = decrypt_encrypted_data(tmpctx, p->blinding, &p->blinding_ss,
p->tlv->encrypted_recipient_data);
if (!enc) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
goto field_bad;
}
@ -266,7 +266,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
* `encrypted_recipient_data.payment_constraints.max_cltv_expiry`.
*/
if (cltv_expiry > enc->payment_constraints->max_cltv_expiry) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
goto field_bad;
}
@ -278,7 +278,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
*/
if (amount_msat_less(amount_in,
amount_msat(enc->payment_constraints->htlc_minimum_msat))) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
goto field_bad;
}
@ -303,7 +303,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
/* No features, this is easy */
if (!memeqzero(enc->allowed_features,
tal_bytelen(enc->allowed_features))) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
goto field_bad;
}
@ -335,7 +335,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
* is present.
*/
if (blinding || p->tlv->blinding_point) {
*failtlvtype = TLV_TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
*failtlvtype = TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA;
goto field_bad;
}
@ -346,11 +346,11 @@ struct onion_payload *onion_decode(const tal_t *ctx,
* `outgoing_cltv_value` are not present.
*/
if (!p->tlv->amt_to_forward) {
*failtlvtype = TLV_TLV_PAYLOAD_AMT_TO_FORWARD;
*failtlvtype = TLV_PAYLOAD_AMT_TO_FORWARD;
goto field_bad;
}
if (!p->tlv->outgoing_cltv_value) {
*failtlvtype = TLV_TLV_PAYLOAD_OUTGOING_CLTV_VALUE;
*failtlvtype = TLV_PAYLOAD_OUTGOING_CLTV_VALUE;
goto field_bad;
}
@ -366,7 +366,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
*/
if (!p->final) {
if (!p->tlv->short_channel_id) {
*failtlvtype = TLV_TLV_PAYLOAD_SHORT_CHANNEL_ID;
*failtlvtype = TLV_PAYLOAD_SHORT_CHANNEL_ID;
goto field_bad;
}
p->forward_channel = tal_dup(p, struct short_channel_id,

View File

@ -11,20 +11,18 @@
/* BOLT #4:
*
* ### `tlv_payload` format
* ### `payload` format
*
* This is a more flexible format, which avoids the redundant
* `short_channel_id` field for the final node. It is formatted
* according to the Type-Length-Value format defined in [BOLT
* #1](01-messaging.md#type-length-value-format).
* This is formatted according to the Type-Length-Value format defined
* in [BOLT #1](01-messaging.md#type-length-value-format).
*/
static u8 *make_tlv_hop(const tal_t *ctx,
const struct tlv_tlv_payload *tlv)
const struct tlv_payload *tlv)
{
/* We can't have over 64k anyway */
u8 *tlvs = tal_arr(ctx, u8, 3);
towire_tlv_tlv_payload(&tlvs, tlv);
towire_tlv_payload(&tlvs, tlv);
switch (bigsize_put(tlvs, tal_bytelen(tlvs) - 3)) {
case 1:
@ -43,12 +41,11 @@ u8 *onion_nonfinal_hop(const tal_t *ctx,
struct amount_msat forward,
u32 outgoing_cltv)
{
struct tlv_tlv_payload *tlv = tlv_tlv_payload_new(tmpctx);
struct tlv_payload *tlv = tlv_payload_new(tmpctx);
/* BOLT #4:
*
* The writer:
*...
* - For every node:
* - MUST include `amt_to_forward` and `outgoing_cltv_value`.
* - For every non-final node:
@ -68,8 +65,8 @@ u8 *onion_final_hop(const tal_t *ctx,
const struct secret *payment_secret,
const u8 *payment_metadata)
{
struct tlv_tlv_payload *tlv = tlv_tlv_payload_new(tmpctx);
struct tlv_tlv_payload_payment_data tlv_pdata;
struct tlv_payload *tlv = tlv_payload_new(tmpctx);
struct tlv_payload_payment_data tlv_pdata;
/* These go together! */
if (!payment_secret)
@ -78,7 +75,6 @@ u8 *onion_final_hop(const tal_t *ctx,
/* BOLT #4:
*
* The writer:
*...
* - For every node:
* - MUST include `amt_to_forward` and `outgoing_cltv_value`.
*...
@ -108,7 +104,7 @@ u8 *onion_blinded_hop(const tal_t *ctx,
const u8 *enctlv,
const struct pubkey *blinding)
{
struct tlv_tlv_payload *tlv = tlv_tlv_payload_new(tmpctx);
struct tlv_payload *tlv = tlv_payload_new(tmpctx);
if (amt_to_forward) {
tlv->amt_to_forward

View File

@ -33,7 +33,7 @@ struct onion_payload {
struct secret blinding_ss;
/* The raw TLVs contained in the payload. */
struct tlv_tlv_payload *tlv;
struct tlv_payload *tlv;
};
u8 *onion_nonfinal_hop(const tal_t *ctx,

View File

@ -651,7 +651,7 @@ struct route_step *process_onionpacket(
cursor - paddedheader, 0);
fromwire_hmac(&cursor, &max, &step->next->hmac);
/* BOLT-remove-legacy-onion #4:
/* BOLT #4:
* Since no `payload` TLV value can ever be shorter than 2 bytes, `length` values of 0 and 1 are
* reserved. (`0` indicated a legacy format no longer supported, and `1` is reserved for future
* use). */

View File

@ -172,7 +172,7 @@ static void invoice_payment_add_tlvs(struct json_stream *stream,
struct htlc_set *hset)
{
struct htlc_in *hin;
const struct tlv_tlv_payload *tlvs;
const struct tlv_payload *tlvs;
assert(tal_count(hset->htlcs) > 0);
/* Pick the first HTLC as representative for the entire set. */

View File

@ -1184,14 +1184,6 @@ send_payment(struct lightningd *ld,
ret = pubkey_from_node_id(&pubkey, &ids[i]);
assert(ret);
/* BOLT #4:
* - Unless `node_announcement`, `init` message or the
* [BOLT #11](11-payment-encoding.md#tagged-fields) offers feature
* `var_onion_optin`:
* - MUST use the legacy payload format instead.
*/
/* FIXME: This requirement is now obsolete, and we should remove it! */
onion = onion_final_hop(cmd,
route[i].amount,
base_expiry + route[i].delay,

View File

@ -271,20 +271,10 @@ static void fail_out_htlc(struct htlc_out *hout, const char *localfail)
/* BOLT #4:
*
* * `amt_to_forward`: The amount, in millisatoshis, to forward to the next
* receiving peer specified within the routing information.
*
* For non-final nodes, this value amount MUST include the origin node's computed _fee_ for the
* receiving peer. When processing an incoming Sphinx packet and the HTLC
* message that it is encapsulated within, if the following inequality
* doesn't hold, then the HTLC should be rejected as it would indicate that
* a prior hop has deviated from the specified parameters:
*
* incoming_htlc_amt - fee >= amt_to_forward
*
* Where `fee` is calculated according to the receiving peer's
* advertised fee schema (as described in [BOLT
* #7](07-routing-gossip.md#htlc-fees)).
* - if it is not the final node:
* - MUST return an error if:
* ...
* - incoming `amount_msat` - `fee` < `amt_to_forward` (where `fee` is the advertised fee as described in [BOLT #7](07-routing-gossip.md#htlc-fees))
*/
static bool check_fwd_amount(struct htlc_in *hin,
struct amount_msat amt_to_forward,
@ -317,22 +307,10 @@ static bool check_fwd_amount(struct htlc_in *hin,
/* BOLT #4:
*
* * `outgoing_cltv_value`: The CLTV value that the _outgoing_ HTLC carrying
* the packet should have.
*
* cltv_expiry - cltv_expiry_delta >= outgoing_cltv_value
*
* Inclusion of this field allows a hop to both authenticate the
* information specified by the origin node, and the parameters of the
* HTLC forwarded, and ensure the origin node is using the current
* `cltv_expiry_delta` value. If there is no next hop,
* `cltv_expiry_delta` is 0. If the values don't correspond, then the
* HTLC should be failed and rejected, as this indicates that either a
* forwarding node has tampered with the intended HTLC values or that the
* origin node has an obsolete `cltv_expiry_delta` value. The hop MUST be
* consistent in responding to an unexpected `outgoing_cltv_value`,
* whether it is the final node or not, to avoid leaking its position in
* the route.
* - if it is not the final node:
* - MUST return an error if:
* ...
* - `cltv_expiry` - `cltv_expiry_delta` < `outgoing_cltv_value`
*/
static bool check_cltv(struct htlc_in *hin,
u32 cltv_expiry, u32 outgoing_cltv_value, u32 delta)
@ -399,9 +377,11 @@ static void handle_localpay(struct htlc_in *hin,
struct lightningd *ld = hin->key.channel->peer->ld;
/* BOLT #4:
*
* For the final node, this value MUST be exactly equal to the
* incoming htlc amount, otherwise the HTLC should be rejected.
* - if it is the final node:
* - MUST treat `total_msat` as if it were equal to `amt_to_forward` if it
* is not present.
* - MUST return an error if:
* - incoming `amount_msat` != `amt_to_forward`.
*/
if (!amount_msat_eq(amt_to_forward, hin->msat)) {
log_debug(hin->key.channel->log,
@ -412,7 +392,6 @@ static void handle_localpay(struct htlc_in *hin,
type_to_string(tmpctx, struct amount_msat,
&amt_to_forward));
/* BOLT #4:
*
* 1. type: 19 (`final_incorrect_htlc_amount`)
* 2. data:
* * [`u64`:`incoming_htlc_amt`]
@ -424,14 +403,22 @@ static void handle_localpay(struct htlc_in *hin,
}
/* BOLT #4:
*
* 1. type: 18 (`final_incorrect_cltv_expiry`)
* 2. data:
* * [`u32`:`cltv_expiry`]
*
* The CLTV expiry in the HTLC doesn't match the value in the onion.
* - if it is the final node:
* - MUST treat `total_msat` as if it were equal to `amt_to_forward` if it
* is not present.
* - MUST return an error if:
*...
* - incoming `cltv_expiry` != `cltv_expiry_delta`.
*/
if (!check_cltv(hin, hin->cltv_expiry, outgoing_cltv_value, 0)) {
/* BOLT #4:
*
* 1. type: 18 (`final_incorrect_cltv_expiry`)
* 2. data:
* * [`u32`:`cltv_expiry`]
*
* The CLTV expiry in the HTLC doesn't match the value in the onion.
*/
failmsg = towire_final_incorrect_cltv_expiry(NULL,
hin->cltv_expiry);
goto fail;
@ -470,7 +457,7 @@ static void handle_localpay(struct htlc_in *hin,
* the payload, the erring node may include that `type` and its byte `offset` in
* the decrypted byte stream.
*/
failmsg = towire_invalid_onion_payload(NULL, TLV_TLV_PAYLOAD_PAYMENT_METADATA,
failmsg = towire_invalid_onion_payload(NULL, TLV_PAYLOAD_PAYMENT_METADATA,
/* FIXME: offset? */ 0);
goto fail;
}

View File

@ -297,7 +297,7 @@ static const struct plugin_command commands[] = {
};
static struct command_result *
htlc_accepted_continue(struct command *cmd, struct tlv_tlv_payload *payload)
htlc_accepted_continue(struct command *cmd, struct tlv_payload *payload)
{
struct json_stream *response;
response = jsonrpc_stream_success(cmd);
@ -317,7 +317,7 @@ struct keysend_in {
struct sha256 payment_hash;
struct preimage payment_preimage;
char *label;
struct tlv_tlv_payload *payload;
struct tlv_payload *payload;
struct tlv_field *preimage_field, *desc_field;
};
@ -373,7 +373,7 @@ htlc_accepted_invoice_created(struct command *cmd, const char *buf,
/* Now we can fill in the payment secret, from invoice. */
ki->payload->payment_data = tal(ki->payload,
struct tlv_tlv_payload_payment_data);
struct tlv_payload_payment_data);
json_to_secret(buf, json_get_member(buf, result, "payment_secret"),
&ki->payload->payment_data->payment_secret);
@ -428,7 +428,7 @@ static struct command_result *htlc_accepted_call(struct command *cmd,
const u8 *rawpayload;
struct sha256 payment_hash;
size_t max;
struct tlv_tlv_payload *payload;
struct tlv_payload *payload;
struct tlv_field *preimage_field = NULL, *desc_field = NULL;
bigsize_t s;
struct keysend_in *ki;
@ -456,8 +456,8 @@ static struct command_result *htlc_accepted_call(struct command *cmd,
/* Note: This is a magic pointer value, not an actual array */
allowed = cast_const(u64 *, FROMWIRE_TLV_ANY_TYPE);
payload = tlv_tlv_payload_new(cmd);
if (!fromwire_tlv(&rawpayload, &max, tlvs_tlv_tlv_payload, TLVS_ARRAY_SIZE_tlv_tlv_payload,
payload = tlv_payload_new(cmd);
if (!fromwire_tlv(&rawpayload, &max, tlvs_tlv_payload, TLVS_ARRAY_SIZE_tlv_payload,
payload, &payload->fields, allowed, &err_off, &err_type)) {
plugin_log(
cmd->plugin, LOG_UNUSUAL, "Malformed TLV payload type %"PRIu64" at off %zu %.*s",

View File

@ -1626,7 +1626,7 @@ static void tlvstream_set_tlv_payload_data(struct tlv_field **stream,
u8 *ser = tal_arr(NULL, u8, 0);
towire_secret(&ser, payment_secret);
towire_tu64(&ser, total_msat);
tlvstream_set_raw(stream, TLV_TLV_PAYLOAD_PAYMENT_DATA, ser, tal_bytelen(ser));
tlvstream_set_raw(stream, TLV_PAYLOAD_PAYMENT_DATA, ser, tal_bytelen(ser));
tal_free(ser);
}
@ -1649,16 +1649,16 @@ static void payment_add_hop_onion_payload(struct payment *p,
* basically the channel going to the next node. */
dst->pubkey = node->node_id;
dst->tlv_payload = tlv_tlv_payload_new(cr->hops);
dst->tlv_payload = tlv_payload_new(cr->hops);
fields = &dst->tlv_payload->fields;
tlvstream_set_tu64(fields, TLV_TLV_PAYLOAD_AMT_TO_FORWARD,
tlvstream_set_tu64(fields, TLV_PAYLOAD_AMT_TO_FORWARD,
msat);
tlvstream_set_tu32(fields, TLV_TLV_PAYLOAD_OUTGOING_CLTV_VALUE,
tlvstream_set_tu32(fields, TLV_PAYLOAD_OUTGOING_CLTV_VALUE,
cltv);
if (!final)
tlvstream_set_short_channel_id(fields,
TLV_TLV_PAYLOAD_SHORT_CHANNEL_ID,
TLV_PAYLOAD_SHORT_CHANNEL_ID,
&next->scid);
if (payment_secret != NULL) {
@ -1669,7 +1669,7 @@ static void payment_add_hop_onion_payload(struct payment *p,
}
if (payment_metadata != NULL) {
assert(final);
tlvstream_set_raw(fields, TLV_TLV_PAYLOAD_PAYMENT_METADATA,
tlvstream_set_raw(fields, TLV_PAYLOAD_PAYMENT_METADATA,
payment_metadata, tal_bytelen(payment_metadata));
}
}
@ -1681,7 +1681,7 @@ static void payment_add_blindedpath(const tal_t *ctx,
u32 final_cltv)
{
/* It's a bit of a weird API for us, so we convert it back to
* the struct tlv_tlv_payload */
* the struct tlv_payload */
u8 **tlvs = blinded_onion_hops(tmpctx, final_amt, final_cltv,
final_amt, bpath);
@ -1698,7 +1698,7 @@ static void payment_add_blindedpath(const tal_t *ctx,
/* Length is prepended, discard that first! */
fromwire_bigsize(&cursor, &max);
hops[i].tlv_payload = fromwire_tlv_tlv_payload(ctx, &cursor, &max);
hops[i].tlv_payload = fromwire_tlv_payload(ctx, &cursor, &max);
}
}

View File

@ -16,7 +16,7 @@ struct legacy_payload {
/* struct holding the information necessary to call createonion */
struct createonion_hop {
struct node_id pubkey;
struct tlv_tlv_payload *tlv_payload;
struct tlv_payload *tlv_payload;
};
struct createonion_request {

View File

@ -125,10 +125,10 @@ wire/peer_wiregen.h_args := --include='common/channel_id.h' --include='bitcoin/t
wire/peer_wiregen.c_args := -s --expose-tlv-type=tlv_n1 --expose-tlv-type=tlv_n2
# The tlv_payload isn't parsed in a fromwire, so we need to expose it.
wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' -s --expose-tlv-type=tlv_tlv_payload
# The payload isn't parsed in a fromwire, so we need to expose it.
wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' -s --expose-tlv-type=tlv_payload
wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_tlv_payload
wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_payload
# Same for _exp versions
wire/peer_exp_wiregen.h_args := $(wire/peer_wiregen.h_args) --include='wire/channel_type_wiregen.h'

View File

@ -1,15 +1,15 @@
--- wire/onion_wire.csv 2021-11-16 15:17:39.446494580 +1030
+++ wire/onion_wire.csv.raw 2021-11-16 15:36:00.046441058 +1030
@@ -8,6 +8,41 @@
tlvdata,tlv_payload,payment_data,total_msat,tu64,
tlvtype,tlv_payload,payment_metadata,16
tlvdata,tlv_payload,payment_metadata,payment_metadata,byte,...
+tlvtype,tlv_payload,encrypted_recipient_data,10
+tlvdata,tlv_payload,encrypted_recipient_data,encrypted_data,byte,...
+tlvtype,tlv_payload,blinding_point,12
+tlvdata,tlv_payload,blinding_point,blinding,point,
+tlvtype,tlv_payload,total_amount_msat,18
+tlvdata,tlv_payload,total_amount_msat,total_msat,tu64,
tlvdata,payload,payment_data,total_msat,tu64,
tlvtype,payload,payment_metadata,16
tlvdata,payload,payment_metadata,payment_metadata,byte,...
+tlvtype,payload,encrypted_recipient_data,10
+tlvdata,payload,encrypted_recipient_data,encrypted_data,byte,...
+tlvtype,payload,blinding_point,12
+tlvdata,payload,blinding_point,blinding,point,
+tlvtype,payload,total_amount_msat,18
+tlvdata,payload,total_amount_msat,total_msat,tu64,
+tlvtype,encrypted_data_tlv,padding,1
+tlvdata,encrypted_data_tlv,padding,padding,byte,...
+tlvtype,encrypted_data_tlv,short_channel_id,2

View File

@ -1,21 +1,21 @@
#include <wire/onion_defs.h>
tlvtype,tlv_payload,amt_to_forward,2
tlvdata,tlv_payload,amt_to_forward,amt_to_forward,tu64,
tlvtype,tlv_payload,outgoing_cltv_value,4
tlvdata,tlv_payload,outgoing_cltv_value,outgoing_cltv_value,tu32,
tlvtype,tlv_payload,short_channel_id,6
tlvdata,tlv_payload,short_channel_id,short_channel_id,short_channel_id,
tlvtype,tlv_payload,payment_data,8
tlvdata,tlv_payload,payment_data,payment_secret,byte,32
tlvdata,tlv_payload,payment_data,total_msat,tu64,
tlvtype,tlv_payload,payment_metadata,16
tlvdata,tlv_payload,payment_metadata,payment_metadata,byte,...
tlvtype,tlv_payload,encrypted_recipient_data,10
tlvdata,tlv_payload,encrypted_recipient_data,encrypted_data,byte,...
tlvtype,tlv_payload,blinding_point,12
tlvdata,tlv_payload,blinding_point,blinding,point,
tlvtype,tlv_payload,total_amount_msat,18
tlvdata,tlv_payload,total_amount_msat,total_msat,tu64,
tlvtype,payload,amt_to_forward,2
tlvdata,payload,amt_to_forward,amt_to_forward,tu64,
tlvtype,payload,outgoing_cltv_value,4
tlvdata,payload,outgoing_cltv_value,outgoing_cltv_value,tu32,
tlvtype,payload,short_channel_id,6
tlvdata,payload,short_channel_id,short_channel_id,short_channel_id,
tlvtype,payload,payment_data,8
tlvdata,payload,payment_data,payment_secret,byte,32
tlvdata,payload,payment_data,total_msat,tu64,
tlvtype,payload,payment_metadata,16
tlvdata,payload,payment_metadata,payment_metadata,byte,...
tlvtype,payload,encrypted_recipient_data,10
tlvdata,payload,encrypted_recipient_data,encrypted_data,byte,...
tlvtype,payload,blinding_point,12
tlvdata,payload,blinding_point,blinding,point,
tlvtype,payload,total_amount_msat,18
tlvdata,payload,total_amount_msat,total_msat,tu64,
tlvtype,encrypted_data_tlv,padding,1
tlvdata,encrypted_data_tlv,padding,padding,byte,...
tlvtype,encrypted_data_tlv,short_channel_id,2

1 #include <wire/onion_defs.h>
2 tlvtype,tlv_payload,amt_to_forward,2 tlvtype,payload,amt_to_forward,2
3 tlvdata,tlv_payload,amt_to_forward,amt_to_forward,tu64, tlvdata,payload,amt_to_forward,amt_to_forward,tu64,
4 tlvtype,tlv_payload,outgoing_cltv_value,4 tlvtype,payload,outgoing_cltv_value,4
5 tlvdata,tlv_payload,outgoing_cltv_value,outgoing_cltv_value,tu32, tlvdata,payload,outgoing_cltv_value,outgoing_cltv_value,tu32,
6 tlvtype,tlv_payload,short_channel_id,6 tlvtype,payload,short_channel_id,6
7 tlvdata,tlv_payload,short_channel_id,short_channel_id,short_channel_id, tlvdata,payload,short_channel_id,short_channel_id,short_channel_id,
8 tlvtype,tlv_payload,payment_data,8 tlvtype,payload,payment_data,8
9 tlvdata,tlv_payload,payment_data,payment_secret,byte,32 tlvdata,payload,payment_data,payment_secret,byte,32
10 tlvdata,tlv_payload,payment_data,total_msat,tu64, tlvdata,payload,payment_data,total_msat,tu64,
11 tlvtype,tlv_payload,payment_metadata,16 tlvtype,payload,payment_metadata,16
12 tlvdata,tlv_payload,payment_metadata,payment_metadata,byte,... tlvdata,payload,payment_metadata,payment_metadata,byte,...
13 tlvtype,tlv_payload,encrypted_recipient_data,10 tlvtype,payload,encrypted_recipient_data,10
14 tlvdata,tlv_payload,encrypted_recipient_data,encrypted_data,byte,... tlvdata,payload,encrypted_recipient_data,encrypted_data,byte,...
15 tlvtype,tlv_payload,blinding_point,12 tlvtype,payload,blinding_point,12
16 tlvdata,tlv_payload,blinding_point,blinding,point, tlvdata,payload,blinding_point,blinding,point,
17 tlvtype,tlv_payload,total_amount_msat,18 tlvtype,payload,total_amount_msat,18
18 tlvdata,tlv_payload,total_amount_msat,total_msat,tu64, tlvdata,payload,total_amount_msat,total_msat,tu64,
19 tlvtype,encrypted_data_tlv,padding,1
20 tlvdata,encrypted_data_tlv,padding,padding,byte,...
21 tlvtype,encrypted_data_tlv,short_channel_id,2