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

Function channel_fail_permanent

lightningd/channel.c:790–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790void channel_fail_permanent(struct channel *channel,
791 enum state_change reason,
792 const char *fmt,
793 ...)
794{
795 /* Don't do anything if it's an stub channel because
796 * peer has already closed it unilatelrally. */
797 if (is_stub_scid(channel->scid))
798 return;
799
800 struct lightningd *ld = channel->peer->ld;
801 va_list ap;
802 char *why;
803
804 va_start(ap, fmt);
805 why = tal_vfmt(tmpctx, fmt, ap);
806 va_end(ap);
807
808 log_unusual(channel->log, "Peer permanent failure in %s: %s",
809 channel_state_name(channel), why);
810
811 /* We can have multiple errors, eg. onchaind failures. */
812 if (!channel->error)
813 channel->error = towire_errorfmt(channel,
814 &channel->cid, "%s", why);
815
816 channel_set_owner(channel, NULL);
817 /* Drop non-cooperatively (unilateral) to chain. */
818 drop_to_chain(ld, channel, false);
819
820 if (channel_active(channel))
821 channel_set_state(channel,
822 channel->state,
823 AWAITING_UNILATERAL,
824 reason,
825 why);
826
827 tal_free(why);
828}
829
830void channel_fail_forget(struct channel *channel, const char *fmt, ...)
831{

Callers 14

channel_internal_errorFunction · 0.70
channel_errFunction · 0.70
channel_errmsgFunction · 0.70
funding_depth_cbFunction · 0.70
json_dev_failFunction · 0.70
onchaind_funding_spentFunction · 0.70
close_command_timeoutFunction · 0.70
peer_start_closingdFunction · 0.70
peer_got_revokeFunction · 0.70
htlcs_notify_new_blockFunction · 0.70
try_update_blockheightFunction · 0.70

Calls 8

is_stub_scidFunction · 0.85
channel_set_ownerFunction · 0.85
drop_to_chainFunction · 0.85
channel_activeFunction · 0.85
channel_set_stateFunction · 0.85
tal_freeFunction · 0.85
channel_state_nameFunction · 0.70
towire_errorfmtFunction · 0.50

Tested by

no test coverage detected