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

Function update_channel

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

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

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