common: sphinx_path_new to take explicit len.
Useful if associated_data is not a tal pointer (xpay wants this). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -235,7 +235,7 @@ int main(int argc, char *argv[])
|
||||
pubkey_from_privkey(&path_key[DAVE], &path_key_pub[DAVE]);
|
||||
|
||||
/* Create an onion which encodes this. */
|
||||
sphinx_path = sphinx_path_new(tmpctx, NULL);
|
||||
sphinx_path = sphinx_path_new(tmpctx, NULL, 0);
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
struct tlv_onionmsg_tlv *payload
|
||||
= tlv_onionmsg_tlv_new(tmpctx);
|
||||
|
||||
@@ -306,7 +306,7 @@ int main(int argc, char *argv[])
|
||||
json_strfield("unknown_tag_1", "68656c6c6f");
|
||||
|
||||
/* Create the onionmessage */
|
||||
sphinx_path = sphinx_path_new(tmpctx, NULL);
|
||||
sphinx_path = sphinx_path_new(tmpctx, NULL, 0);
|
||||
for (size_t i = 0; i < ARRAY_SIZE(erd); i++) {
|
||||
struct tlv_onionmsg_tlv *tlv = tlv_onionmsg_tlv_new(tmpctx);
|
||||
u8 *onionmsg_tlv;
|
||||
|
||||
@@ -161,7 +161,8 @@ int main(int argc, char *argv[])
|
||||
generate_tok = json_get_member(json, toks, "generate");
|
||||
json_to_secret(json, json_get_member(json, generate_tok, "session_key"), &session_key);
|
||||
assoc_data = json_tok_bin_from_hex(tmpctx, json, json_get_member(json, generate_tok, "associated_data"));
|
||||
sp = sphinx_path_new_with_key(tmpctx, assoc_data, &session_key);
|
||||
sp = sphinx_path_new_with_key(tmpctx, assoc_data, tal_bytelen(assoc_data),
|
||||
&session_key);
|
||||
json_for_each_arr(i, t, json_get_member(json, generate_tok, "hops")) {
|
||||
struct pubkey k;
|
||||
const u8 *cursor;
|
||||
|
||||
@@ -171,7 +171,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Now, create onion! */
|
||||
sp = sphinx_path_new_with_key(tmpctx, associated_data, &session_key);
|
||||
sp = sphinx_path_new_with_key(tmpctx, associated_data, tal_bytelen(associated_data),
|
||||
&session_key);
|
||||
for (i = 0; i < tal_count(ids); i++)
|
||||
sphinx_add_hop_has_length(sp, &ids[i], onionhops[i]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user