mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
sphinx: Clean up after migrating to the sphinx_path struct
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
ca0dc01bee
commit
6831db62f7
@@ -24,9 +24,9 @@ static void do_generate(int argc, char **argv,
|
|||||||
struct pubkey *path = tal_arr(ctx, struct pubkey, num_hops);
|
struct pubkey *path = tal_arr(ctx, struct pubkey, num_hops);
|
||||||
u8 rawpubkey[PUBKEY_LEN], rawprivkey[PRIVKEY_LEN];
|
u8 rawpubkey[PUBKEY_LEN], rawprivkey[PRIVKEY_LEN];
|
||||||
struct secret session_key;
|
struct secret session_key;
|
||||||
struct hop_data hops_data[num_hops];
|
|
||||||
struct secret *shared_secrets;
|
struct secret *shared_secrets;
|
||||||
struct sphinx_path *sp;
|
struct sphinx_path *sp;
|
||||||
|
struct hop_data hops_data[num_hops];
|
||||||
|
|
||||||
assocdata = tal_arr(ctx, u8, ASSOC_DATA_SIZE);
|
assocdata = tal_arr(ctx, u8, ASSOC_DATA_SIZE);
|
||||||
memset(&session_key, 'A', sizeof(struct secret));
|
memset(&session_key, 'A', sizeof(struct secret));
|
||||||
@@ -109,13 +109,11 @@ static void do_generate(int argc, char **argv,
|
|||||||
sphinx_add_v0_hop(sp, &path[i], &hops_data[i].channel_id, hops_data[i].amt_forward, i);
|
sphinx_add_v0_hop(sp, &path[i], &hops_data[i].channel_id, hops_data[i].amt_forward, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct onionpacket *res =
|
struct onionpacket *res = create_onionpacket(ctx, sp, &shared_secrets);
|
||||||
create_onionpacket(ctx, sp, &shared_secrets);
|
|
||||||
|
|
||||||
u8 *serialized = serialize_onionpacket(ctx, res);
|
u8 *serialized = serialize_onionpacket(ctx, res);
|
||||||
if (!serialized)
|
if (!serialized)
|
||||||
errx(1, "Error serializing message.");
|
errx(1, "Error serializing message.");
|
||||||
else
|
|
||||||
printf("%s\n", tal_hex(ctx, serialized));
|
printf("%s\n", tal_hex(ctx, serialized));
|
||||||
tal_free(ctx);
|
tal_free(ctx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -603,6 +603,7 @@ send_payment(struct lightningd *ld,
|
|||||||
|
|
||||||
/* Expiry for HTLCs is absolute. And add one to give some margin. */
|
/* Expiry for HTLCs is absolute. And add one to give some margin. */
|
||||||
base_expiry = get_block_height(ld->topology) + 1;
|
base_expiry = get_block_height(ld->topology) + 1;
|
||||||
|
memset(&finalscid, 0, sizeof(struct short_channel_id));
|
||||||
|
|
||||||
path = sphinx_path_new(tmpctx, rhash->u.u8);
|
path = sphinx_path_new(tmpctx, rhash->u.u8);
|
||||||
/* Extract IDs for each hop: create_onionpacket wants array. */
|
/* Extract IDs for each hop: create_onionpacket wants array. */
|
||||||
@@ -624,11 +625,6 @@ send_payment(struct lightningd *ld,
|
|||||||
|
|
||||||
/* And finally set the final hop to the special values in
|
/* And finally set the final hop to the special values in
|
||||||
* BOLT04 */
|
* BOLT04 */
|
||||||
hop_data[i].realm = 0;
|
|
||||||
hop_data[i].outgoing_cltv = base_expiry + route[i].delay;
|
|
||||||
memset(&hop_data[i].channel_id, 0, sizeof(struct short_channel_id));
|
|
||||||
hop_data[i].amt_forward = route[i].amount;
|
|
||||||
|
|
||||||
memset(&finalscid, 0, sizeof(struct short_channel_id));
|
memset(&finalscid, 0, sizeof(struct short_channel_id));
|
||||||
ret = pubkey_from_node_id(&pubkey, &ids[i]);
|
ret = pubkey_from_node_id(&pubkey, &ids[i]);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|||||||
Reference in New Issue
Block a user