|
@ -220,15 +220,16 @@ static void runtest(const char *filename) |
|
|
json_to_pubkey(buffer, pubkeytok, &pubkey); |
|
|
json_to_pubkey(buffer, pubkeytok, &pubkey); |
|
|
if (!typetok || json_tok_streq(buffer, typetok, "legacy")) { |
|
|
if (!typetok || json_tok_streq(buffer, typetok, "legacy")) { |
|
|
/* Legacy has a single 0 prepended as "realm" byte */ |
|
|
/* Legacy has a single 0 prepended as "realm" byte */ |
|
|
full = tal_arrz(ctx, u8, 1); |
|
|
full = tal_arrz(ctx, u8, 33); |
|
|
|
|
|
memcpy(full + 1, payload, tal_bytelen(payload)); |
|
|
} else { |
|
|
} else { |
|
|
/* TLV has length prepended */ |
|
|
/* TLV has length prepended */ |
|
|
full = tal_arr(ctx, u8, 0); |
|
|
full = tal_arr(ctx, u8, 0); |
|
|
towire_bigsize(&full, tal_bytelen(payload)); |
|
|
towire_bigsize(&full, tal_bytelen(payload)); |
|
|
|
|
|
prepended = tal_bytelen(full); |
|
|
|
|
|
tal_resize(&full, prepended + tal_bytelen(payload)); |
|
|
|
|
|
memcpy(full + prepended, payload, tal_bytelen(payload)); |
|
|
} |
|
|
} |
|
|
prepended = tal_bytelen(full); |
|
|
|
|
|
tal_resize(&full, prepended + tal_bytelen(payload)); |
|
|
|
|
|
memcpy(full + prepended, payload, tal_bytelen(payload)); |
|
|
|
|
|
sphinx_add_hop(path, &pubkey, full); |
|
|
sphinx_add_hop(path, &pubkey, full); |
|
|
} |
|
|
} |
|
|
res = create_onionpacket(ctx, path, &shared_secrets); |
|
|
res = create_onionpacket(ctx, path, &shared_secrets); |
|
|