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

Function handle_fail

channeld/channeld.c:3564–3591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3562}
3563
3564static void handle_fail(struct peer *peer, const u8 *inmsg)
3565{
3566 struct failed_htlc *failed_htlc;
3567 enum channel_remove_err e;
3568 struct htlc *h;
3569
3570 if (!fromwire_channeld_fail_htlc(inmsg, inmsg, &failed_htlc))
3571 master_badmsg(WIRE_CHANNELD_FAIL_HTLC, inmsg);
3572
3573 e = channel_fail_htlc(peer->channel, REMOTE, failed_htlc->id, &h);
3574 switch (e) {
3575 case CHANNEL_ERR_REMOVE_OK:
3576 h->failed = tal_steal(h, failed_htlc);
3577 send_fail_or_fulfill(peer, h);
3578 start_commit_timer(peer);
3579 return;
3580 case CHANNEL_ERR_NO_SUCH_ID:
3581 case CHANNEL_ERR_ALREADY_FULFILLED:
3582 case CHANNEL_ERR_HTLC_UNCOMMITTED:
3583 case CHANNEL_ERR_HTLC_NOT_IRREVOCABLE:
3584 case CHANNEL_ERR_BAD_PREIMAGE:
3585 status_failed(STATUS_FAIL_MASTER_IO,
3586 "HTLC %"PRIu64" removal failed: %s",
3587 failed_htlc->id,
3588 channel_remove_err_name(e));
3589 }
3590 abort();
3591}
3592
3593static void handle_shutdown_cmd(struct peer *peer, const u8 *inmsg)
3594{

Callers 1

req_inFunction · 0.85

Calls 7

channel_fail_htlcFunction · 0.85
send_fail_or_fulfillFunction · 0.85
start_commit_timerFunction · 0.85
channel_remove_err_nameFunction · 0.85
abortFunction · 0.85
master_badmsgFunction · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected