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

Function gossmap_chan_get_update

common/gossmap.c:1694–1711  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1692
1693/* Return the channel_update (or NULL if !gossmap_chan_set) */
1694u8 *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`)

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