| 3562 | } |
| 3563 | |
| 3564 | static 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 | |
| 3593 | static void handle_shutdown_cmd(struct peer *peer, const u8 *inmsg) |
| 3594 | { |
no test coverage detected