MCPcopy Create free account
hub / github.com/ElementsProject/lightning / gossmap_chan_get_update

Function gossmap_chan_get_update

common/gossmap.c:1700–1717  ·  view source on GitHub ↗

Return the channel_update (or NULL if !gossmap_chan_set) */

Source from the content-addressed store, hash-verified

1698
1699/* Return the channel_update (or NULL if !gossmap_chan_set) */
1700u8 *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`)

Callers 4

spam_new_peerFunction · 0.85
get_checksumFunction · 0.85

Calls 2

map_be16Function · 0.85
map_copyFunction · 0.85

Tested by

no test coverage detected