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

Function gossmap_chan_get_update_details

common/gossmap.c:1728–1771  ·  view source on GitHub ↗

BOLT #7: * 1. type: 258 (`channel_update`) * 2. data: * * [`signature`:`signature`] * * [`chain_hash`:`chain_hash`] * * [`short_channel_id`:`short_channel_id`] * * [`u32`:`timestamp`] * * [`byte`:`message_flags`] * * [`byte`:`channel_flags`] * * [`u16`:`cltv_expiry_delta`] * * [`u64`:`htlc_minimum_msat`] * * [`u32`:`fee_base_msat`] * * [`u32`:`fe

Source from the content-addressed store, hash-verified

1726 * * [`u64`:`htlc_maximum_msat`]
1727 */
1728void gossmap_chan_get_update_details(const struct gossmap *map,
1729 const struct gossmap_chan *chan,
1730 int dir,
1731 u32 *timestamp,
1732 u8 *message_flags,
1733 u8 *channel_flags,
1734 u16 *cltv_expiry_delta,
1735 u32 *fee_base_msat,
1736 u32 *fee_proportional_millionths,
1737 struct amount_msat *htlc_minimum_msat,
1738 struct amount_msat *htlc_maximum_msat)
1739{
1740 /* Note that first two bytes are message type */
1741 const u64 scid_off = chan->cupdate_off[dir] + 2 + (64 + 32);
1742 const u64 timestamp_off = scid_off + 8;
1743 const u64 message_flags_off = timestamp_off + 4;
1744 const u64 channel_flags_off = message_flags_off + 1;
1745 const u64 cltv_expiry_delta_off = channel_flags_off + 1;
1746 const u64 htlc_minimum_off = cltv_expiry_delta_off + 2;
1747 const u64 fee_base_off = htlc_minimum_off + 8;
1748 const u64 fee_prop_off = fee_base_off + 4;
1749 const u64 htlc_maximum_off = fee_prop_off + 4;
1750
1751 assert(gossmap_chan_set(chan, dir));
1752
1753 if (timestamp)
1754 *timestamp = map_be32(map, timestamp_off);
1755 if (channel_flags)
1756 *channel_flags = map_u8(map, channel_flags_off);
1757 if (message_flags)
1758 *message_flags = map_u8(map, message_flags_off);
1759 if (cltv_expiry_delta)
1760 *cltv_expiry_delta = map_be16(map, cltv_expiry_delta_off);
1761 if (fee_base_msat)
1762 *fee_base_msat = map_be32(map, fee_base_off);
1763 if (fee_proportional_millionths)
1764 *fee_proportional_millionths = map_be32(map, fee_prop_off);
1765 if (htlc_minimum_msat)
1766 *htlc_minimum_msat
1767 = amount_msat(map_be64(map, htlc_minimum_off));
1768 if (htlc_maximum_msat)
1769 *htlc_maximum_msat
1770 = amount_msat(map_be64(map, htlc_maximum_off));
1771}
1772
1773/* BOLT #7:
1774 * 1. type: 257 (`node_announcement`)

Callers 15

get_timestampFunction · 0.85
get_timestampFunction · 0.85
want_updateFunction · 0.85
forward_htlcFunction · 0.85
gossmap_apply_localmodsFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
json_add_halfchanFunction · 0.85
get_chan_htlc_maxFunction · 0.85
get_chan_htlc_minFunction · 0.85
get_chan_htlc_maxFunction · 0.85
get_chan_htlc_minFunction · 0.85

Calls 6

gossmap_chan_setFunction · 0.85
map_be32Function · 0.85
map_u8Function · 0.85
map_be16Function · 0.85
map_be64Function · 0.85
amount_msatClass · 0.70

Tested by 2

mainFunction · 0.68
mainFunction · 0.68