hop has size prepended, so this isn't a simple "append" */
| 1369 | |
| 1370 | /* hop has size prepended, so this isn't a simple "append" */ |
| 1371 | static void hop_append(u8 **hop, const u8 *appendme) |
| 1372 | { |
| 1373 | bigsize_t prepended_len; |
| 1374 | const u8 *cursor = *hop; |
| 1375 | size_t tlvs_len = tal_bytelen(*hop); |
| 1376 | u8 *result; |
| 1377 | |
| 1378 | /* Pull off length */ |
| 1379 | prepended_len = fromwire_bigsize(&cursor, &tlvs_len); |
| 1380 | assert(cursor); |
| 1381 | assert(prepended_len == tlvs_len); |
| 1382 | |
| 1383 | /* Rewrite: length + contents */ |
| 1384 | result = tal_arr(tal_parent(*hop), u8, 0); |
| 1385 | towire_bigsize(&result, tlvs_len + tal_bytelen(appendme)); |
| 1386 | towire(&result, cursor, tlvs_len); |
| 1387 | towire(&result, appendme, tal_bytelen(appendme)); |
| 1388 | |
| 1389 | tal_free(*hop); |
| 1390 | *hop = result; |
| 1391 | } |
| 1392 | |
| 1393 | static const u8 *create_onion(const tal_t *ctx, |
| 1394 | struct attempt *attempt, |
no test coverage detected