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