| 105 | } |
| 106 | |
| 107 | bool sphinx_add_hop_has_length(struct sphinx_path *path, const struct pubkey *pubkey, |
| 108 | const u8 *payload TAKES) |
| 109 | { |
| 110 | struct sphinx_hop sp; |
| 111 | bigsize_t lenlen, prepended_len; |
| 112 | |
| 113 | /* You promised size was prepended! */ |
| 114 | if (tal_bytelen(payload) == 0) |
| 115 | return false; |
| 116 | lenlen = bigsize_get(payload, tal_bytelen(payload), &prepended_len); |
| 117 | if (add_overflows_u64(lenlen, prepended_len)) |
| 118 | return false; |
| 119 | if (lenlen + prepended_len != tal_bytelen(payload)) |
| 120 | return false; |
| 121 | |
| 122 | sp.raw_payload = tal_dup_talarr(path, u8, payload); |
| 123 | sp.pubkey = *pubkey; |
| 124 | tal_arr_expand(&path->hops, sp); |
| 125 | return true; |
| 126 | } |
| 127 | |
| 128 | void sphinx_add_hop(struct sphinx_path *path, const struct pubkey *pubkey, |
| 129 | const u8 *payload TAKES) |
no test coverage detected