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

Function local_disable_chan

gossipd/gossip_generation.c:870–893  ·  view source on GitHub ↗

We don't immediately disable, to avoid flapping. */

Source from the content-addressed store, hash-verified

868
869/* We don't immediately disable, to avoid flapping. */
870void local_disable_chan(struct daemon *daemon, const struct chan *chan, int direction)
871{
872 struct deferred_update *du;
873 u8 *update = prev_update(tmpctx, daemon, chan, direction);
874 if (!update)
875 return;
876
877 du = find_deferred_update(daemon, chan);
878
879 /* Will a deferred update disable it already? OK, nothing to do. */
880 if (du && is_disabled(du->update))
881 return;
882
883 /* OK, we definitely don't want deferred update to re-enable! */
884 tal_free(du);
885
886 /* Is it already disabled? */
887 if (is_disabled(update))
888 return;
889
890 /* This is deferred indefinitely (flushed if needed though) */
891 set_disable_flag(update, true);
892 defer_update(daemon, 0xFFFFFFFF, chan, direction, take(update));
893}
894
895/* lightningd tells us it used the local channel update. */
896void handle_used_local_channel_update(struct daemon *daemon, const u8 *msg)

Callers 3

peer_disable_channelsFunction · 0.85

Calls 6

prev_updateFunction · 0.85
find_deferred_updateFunction · 0.85
is_disabledFunction · 0.85
tal_freeFunction · 0.85
set_disable_flagFunction · 0.85
defer_updateFunction · 0.85

Tested by

no test coverage detected