| 108 | } |
| 109 | |
| 110 | bool sphinx_add_hop_has_length(struct sphinx_path *path, const struct pubkey *pubkey, |
| 111 | const u8 *payload TAKES) |
| 112 | { |
| 113 | struct sphinx_hop sp; |
| 114 | bigsize_t lenlen, prepended_len; |
| 115 | |
| 116 | /* In case length is missing, we'll return false. */ |
| 117 | prepended_len = UINT64_MAX; |
| 118 | lenlen = bigsize_get(payload, tal_bytelen(payload), &prepended_len); |
| 119 | if (add_overflows_u64(lenlen, prepended_len)) |
| 120 | return false; |
| 121 | if (lenlen + prepended_len != tal_bytelen(payload)) |
| 122 | return false; |
| 123 | |
| 124 | sp.raw_payload = tal_dup_talarr(path, u8, payload); |
| 125 | sp.pubkey = *pubkey; |
| 126 | tal_arr_expand(&path->hops, sp); |
| 127 | return true; |
| 128 | } |
| 129 | |
| 130 | static u8 *make_v0_hop(const tal_t *ctx, |
| 131 | const struct short_channel_id *scid, |