Browse Source

common/sphinx: rename hop_data to hop_data_legacy.

This highlights the various places we need to change.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
committed by Christian Decker
parent
commit
a76518a029
  1. 2
      common/sphinx.c
  2. 4
      common/sphinx.h
  3. 2
      devtools/onion.c
  4. 7
      lightningd/pay.c
  5. 2
      lightningd/peer_htlcs.c

2
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;

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

2
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);

7
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);

2
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;

Loading…
Cancel
Save