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

Function update_channel

common/gossmap.c:588–613  ·  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

586 * * [`u64`:`htlc_maximum_msat`]
587 */
588static bool update_channel(struct gossmap *map, u64 cupdate_off)
589{
590 struct short_channel_id_dir scidd;
591 struct gossmap_chan *chan;
592 struct half_chan hc;
593 bool ret;
594
595 ret = fill_from_update(map, &scidd, &hc, cupdate_off);
596 chan = gossmap_find_chan(map, &scidd.scid);
597 /* This can happen if channel gets deleted! */
598 if (!chan)
599 return ret;
600
601 /* Are we replacing an existing one? Then old one is dead. */
602 if (gossmap_chan_set(chan, scidd.dir))
603 map->num_dead++;
604 else
605 map->num_live++;
606
607 /* Preserve this */
608 hc.nodeidx = chan->half[scidd.dir].nodeidx;
609 chan->half[scidd.dir] = hc;
610 chan->cupdate_off[scidd.dir] = cupdate_off;
611
612 return ret;
613}
614
615static void remove_channel_by_deletemsg(struct gossmap *map, u64 del_off)
616{

Callers 1

map_catchupFunction · 0.85

Calls 3

fill_from_updateFunction · 0.85
gossmap_find_chanFunction · 0.85
gossmap_chan_setFunction · 0.85

Tested by

no test coverage detected