BOLT #11: * * `r` (3): `data_length` variable. One or more entries containing * extra routing information for a private route; there may be more * than one `r` field * * * `pubkey` (264 bits) * * `short_channel_id` (64 bits) * * `fee_base_msat` (32 bits, big-endian) * * `fee_proportional_millionths` (32 bits, big-endian) * * `cltv_expiry_delta` (16 bits, big-endian) */
| 454 | * * `cltv_expiry_delta` (16 bits, big-endian) |
| 455 | */ |
| 456 | static char *decode_r(struct bolt11 *b11, |
| 457 | struct hash_u5 *hu5, |
| 458 | u5 **data, size_t *data_len, |
| 459 | size_t data_length) |
| 460 | { |
| 461 | size_t rlen = data_length * 5 / 8; |
| 462 | u8 *r8 = tal_arr(tmpctx, u8, rlen); |
| 463 | size_t n = 0; |
| 464 | struct route_info *r = tal_arr(b11->routes, struct route_info, n); |
| 465 | const u8 *cursor = r8; |
| 466 | |
| 467 | /* Route hops don't split in 5 bit boundaries, so convert whole thing */ |
| 468 | pull_bits_certain(hu5, data, data_len, r8, data_length * 5, false); |
| 469 | |
| 470 | do { |
| 471 | struct route_info ri; |
| 472 | if (!fromwire_route_info(&cursor, &rlen, &ri)) { |
| 473 | return tal_fmt(b11, "r: hop %zu truncated", n); |
| 474 | } |
| 475 | tal_arr_expand(&r, ri); |
| 476 | } while (rlen); |
| 477 | |
| 478 | /* Append route */ |
| 479 | tal_arr_expand(&b11->routes, r); |
| 480 | return NULL; |
| 481 | } |
| 482 | |
| 483 | static void shift_bitmap_down(u8 *bitmap, size_t bits) |
| 484 | { |
no test coverage detected