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

Function apply_update

gossipd/gossip_generation.c:569–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569static void apply_update(struct daemon *daemon,
570 const struct chan *chan,
571 int direction,
572 u8 *update TAKES)
573{
574 u8 *msg;
575 struct peer *peer = find_peer(daemon, &chan->nodes[!direction]->id);
576
577 if (!is_chan_public(chan)) {
578 /* Save and restore taken state, for handle_channel_update */
579 bool update_taken = taken(update);
580
581 /* handle_channel_update will not put private updates in the
582 * broadcast list, but we send it direct to the peer (if we
583 * have one connected) now */
584 if (peer)
585 queue_peer_msg(peer, update);
586
587 if (update_taken)
588 take(update);
589 }
590
591 msg = handle_channel_update(daemon->rstate, update, peer, NULL, true);
592 if (msg)
593 status_failed(STATUS_FAIL_INTERNAL_ERROR,
594 "%s: rejected local channel update %s: %s",
595 __func__,
596 /* Normally we must not touch something taken()
597 * but we're in deep trouble anyway, and
598 * handle_channel_update only tal_steals onto
599 * tmpctx, so it's actually OK. */
600 tal_hex(tmpctx, update),
601 tal_hex(tmpctx, msg));
602}
603
604static void sign_timestamp_and_apply_update(struct daemon *daemon,
605 const struct chan *chan,

Callers 2

apply_deferred_updateFunction · 0.85

Calls 7

is_chan_publicFunction · 0.85
takenFunction · 0.85
tal_hexFunction · 0.85
find_peerFunction · 0.70
queue_peer_msgFunction · 0.70
handle_channel_updateFunction · 0.70
status_failedFunction · 0.50

Tested by

no test coverage detected