Return the channel_update (or NULL if !gossmap_chan_set) */
| 1692 | |
| 1693 | /* Return the channel_update (or NULL if !gossmap_chan_set) */ |
| 1694 | u8 *gossmap_chan_get_update(const tal_t *ctx, |
| 1695 | const struct gossmap *map, |
| 1696 | const struct gossmap_chan *chan, |
| 1697 | int dir) |
| 1698 | { |
| 1699 | u16 len; |
| 1700 | u8 *msg; |
| 1701 | |
| 1702 | if (chan->cupdate_off[dir] == 0) |
| 1703 | return NULL; |
| 1704 | |
| 1705 | len = map_be16(map, chan->cupdate_off[dir] - sizeof(struct gossip_hdr) |
| 1706 | + offsetof(struct gossip_hdr, len)); |
| 1707 | msg = tal_arr(ctx, u8, len); |
| 1708 | |
| 1709 | map_copy(map, chan->cupdate_off[dir], msg, len); |
| 1710 | return msg; |
| 1711 | } |
| 1712 | |
| 1713 | /* BOLT #7: |
| 1714 | * 1. type: 258 (`channel_update`) |
no test coverage detected