From a76518a02995702159fd1d61a5cd597897029c41 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 14 Nov 2019 10:43:53 +1030 Subject: [PATCH] common/sphinx: rename hop_data to hop_data_legacy. This highlights the various places we need to change. Signed-off-by: Rusty Russell --- common/sphinx.c | 2 +- common/sphinx.h | 4 ++-- devtools/onion.c | 2 +- lightningd/pay.c | 7 +------ lightningd/peer_htlcs.c | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/common/sphinx.c b/common/sphinx.c index 5fe79a2f8..bdf93766b 100644 --- a/common/sphinx.c +++ b/common/sphinx.c @@ -426,7 +426,7 @@ static struct hop_params *generate_hop_params( return params; } -static void deserialize_hop_data(struct hop_data *data, const u8 *src) +static void deserialize_hop_data(struct hop_data_legacy *data, const u8 *src) { const u8 *cursor = src; size_t max = FRAME_SIZE; diff --git a/common/sphinx.h b/common/sphinx.h index d6fc81ef9..6e39f5aef 100644 --- a/common/sphinx.h +++ b/common/sphinx.h @@ -61,7 +61,7 @@ struct sphinx_path; * * [`u32`:`outgoing_cltv_value`] * * [`12*byte`:`padding`] */ -struct hop_data { +struct hop_data_legacy { u8 realm; struct short_channel_id channel_id; struct amount_msat amt_forward; @@ -80,7 +80,7 @@ struct route_step { struct onionpacket *next; enum sphinx_payload_type type; union { - struct hop_data v0; + struct hop_data_legacy v0; } payload; u8 *raw_payload; }; diff --git a/devtools/onion.c b/devtools/onion.c index 271409141..6691e8aca 100644 --- a/devtools/onion.c +++ b/devtools/onion.c @@ -29,7 +29,7 @@ static void do_generate(int argc, char **argv, struct secret session_key; struct secret *shared_secrets; struct sphinx_path *sp; - struct hop_data hops_data[num_hops]; + struct hop_data_legacy hops_data[num_hops]; const u8* tmp_assocdata =tal_dup_arr(ctx, u8, assocdata, ASSOC_DATA_SIZE, 0); diff --git a/lightningd/pay.c b/lightningd/pay.c index 83a3404b5..e36cc26fd 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -632,7 +632,6 @@ send_payment(struct lightningd *ld, struct secret *path_secrets; enum onion_type failcode; size_t i, n_hops = tal_count(route); - struct hop_data *hop_data = tal_arr(tmpctx, struct hop_data, n_hops); struct node_id *ids = tal_arr(tmpctx, struct node_id, n_hops); struct wallet_payment *payment = NULL; struct htlc_out *hout; @@ -653,14 +652,10 @@ send_payment(struct lightningd *ld, for (i = 0; i < n_hops; i++) ids[i] = route[i].nodeid; - /* Copy hop_data[n] from route[n+1] (ie. where it goes next) */ + /* Create sphinx path */ for (i = 0; i < n_hops - 1; i++) { ret = pubkey_from_node_id(&pubkey, &ids[i]); assert(ret); - hop_data[i].realm = 0; - hop_data[i].channel_id = route[i+1].channel_id; - hop_data[i].amt_forward = route[i+1].amount; - hop_data[i].outgoing_cltv = base_expiry + route[i+1].delay; sphinx_add_v0_hop(path, &pubkey, &route[i + 1].channel_id, route[i + 1].amount, base_expiry + route[i + 1].delay); diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 4c14c31de..da9f32ee5 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -762,7 +762,7 @@ htlc_accepted_hook_callback(struct htlc_accepted_hook_payload *request, enum htlc_accepted_result result; enum onion_type failure_code; u8 *channel_update; - struct hop_data *hop_data; + struct hop_data_legacy *hop_data; result = htlc_accepted_hook_deserialize(buffer, toks, &payment_preimage, &failure_code, &channel_update); hop_data = &rs->payload.v0;