| 2719 | } |
| 2720 | |
| 2721 | static void fixup_hin(struct wallet *wallet, struct htlc_in *hin) |
| 2722 | { |
| 2723 | /* We didn't used to save failcore, failonion... */ |
| 2724 | #ifdef COMPAT_V061 |
| 2725 | /* We care about HTLCs being removed only, not those being added. */ |
| 2726 | if (hin->hstate < SENT_REMOVE_HTLC) |
| 2727 | return; |
| 2728 | |
| 2729 | /* Successful ones are fine. */ |
| 2730 | if (hin->preimage) |
| 2731 | return; |
| 2732 | |
| 2733 | /* Failed ones (only happens after db fixed!) OK. */ |
| 2734 | if (hin->badonion || hin->failonion) |
| 2735 | return; |
| 2736 | |
| 2737 | hin->failonion = create_onionreply(hin, |
| 2738 | hin->shared_secret, |
| 2739 | towire_temporary_node_failure(tmpctx)); |
| 2740 | |
| 2741 | log_broken(wallet->log, "HTLC #%"PRIu64" (%s) " |
| 2742 | " for amount %s" |
| 2743 | " from %s" |
| 2744 | " is missing a resolution:" |
| 2745 | " subsituting temporary node failure", |
| 2746 | hin->key.id, htlc_state_name(hin->hstate), |
| 2747 | type_to_string(tmpctx, struct amount_msat, &hin->msat), |
| 2748 | type_to_string(tmpctx, struct node_id, |
| 2749 | &hin->key.channel->peer->id)); |
| 2750 | #endif |
| 2751 | } |
| 2752 | |
| 2753 | bool wallet_htlcs_load_in_for_channel(struct wallet *wallet, |
| 2754 | struct channel *chan, |
no test coverage detected