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

Function process_channel_update

gossipd/gossmap_manage.c:882–997  ·  view source on GitHub ↗

This is called both from when we receive the channel update, and if * we had to defer. */

Source from the content-addressed store, hash-verified

880/* This is called both from when we receive the channel update, and if
881 * we had to defer. */
882static const char *process_channel_update(const tal_t *ctx,
883 struct gossmap_manage *gm,
884 struct short_channel_id scid,
885 const secp256k1_ecdsa_signature *signature,
886 u8 message_flags,
887 u8 channel_flags,
888 u16 cltv_expiry_delta,
889 struct amount_msat htlc_minimum_msat,
890 struct amount_msat htlc_maximum_msat,
891 u32 fee_base_msat,
892 u32 fee_proportional_millionths,
893 u32 timestamp,
894 const u8 *update,
895 const struct node_id *source_peer)
896{
897 struct gossmap_chan *chan;
898 struct node_id node_id, remote_id;
899 const char *err;
900 int dir = (channel_flags & ROUTING_FLAGS_DIRECTION);
901 struct gossmap *gossmap = gossmap_manage_get_gossmap(gm);
902 u64 offset;
903
904 chan = gossmap_find_chan(gossmap, &scid);
905 if (!chan) {
906 /* Did we explicitly reject announce? Ignore completely. */
907 if (in_txout_failures(gm->txf, scid)) {
908 status_debug("Previously-rejected announce for %s",
909 fmt_short_channel_id(tmpctx, scid));
910 return NULL;
911 }
912
913 /* Seeker may want to ask about this. */
914 query_unknown_channel(gm->daemon, source_peer, scid);
915
916 /* Don't send them warning, it can happen. */
917 bad_gossip(source_peer,
918 tal_fmt(tmpctx, "Unknown channel %s",
919 fmt_short_channel_id(tmpctx, scid)));
920 return NULL;
921 }
922
923 /* Now we know node, we can check signature. */
924 gossmap_node_get_id(gossmap,
925 gossmap_nth_node(gossmap, chan, dir),
926 &node_id);
927
928 err = sigcheck_channel_update(ctx, &node_id, signature, update);
929 if (err)
930 return err;
931
932 /* Don't allow private updates on public channels! */
933 if (message_flags & ROUTING_OPT_DONT_FORWARD) {
934 return tal_fmt(ctx, "Do not set DONT_FORWARD on public channel_updates (%s)",
935 fmt_short_channel_id(tmpctx, scid));
936 }
937
938 /* Do we have same or earlier update? */
939 if (gossmap_chan_set(chan, dir)) {

Callers 2

process_pending_cupdateFunction · 0.85

Calls 15

gossmap_find_chanFunction · 0.85
in_txout_failuresFunction · 0.85
fmt_short_channel_idFunction · 0.85
query_unknown_channelFunction · 0.85
bad_gossipFunction · 0.85
gossmap_node_get_idFunction · 0.85
gossmap_nth_nodeFunction · 0.85
sigcheck_channel_updateFunction · 0.85
gossmap_chan_setFunction · 0.85
gossip_store_addFunction · 0.85

Tested by

no test coverage detected