| 3743 | } |
| 3744 | |
| 3745 | static void fixup_hin(struct wallet *wallet, struct htlc_in *hin) |
| 3746 | { |
| 3747 | /* We didn't used to save failcore, failonion... */ |
| 3748 | #ifdef COMPAT_V061 |
| 3749 | /* We care about HTLCs being removed only, not those being added. */ |
| 3750 | if (hin->hstate < SENT_REMOVE_HTLC) |
| 3751 | return; |
| 3752 | |
| 3753 | /* Successful ones are fine. */ |
| 3754 | if (hin->preimage) |
| 3755 | return; |
| 3756 | |
| 3757 | /* Failed ones (only happens after db fixed!) OK. */ |
| 3758 | if (hin->badonion || hin->failonion) |
| 3759 | return; |
| 3760 | |
| 3761 | hin->failonion = create_onionreply(hin, |
| 3762 | hin->shared_secret, |
| 3763 | towire_temporary_node_failure(tmpctx)); |
| 3764 | |
| 3765 | log_broken(wallet->log, "HTLC #%"PRIu64" (%s) " |
| 3766 | " for amount %s" |
| 3767 | " from %s" |
| 3768 | " is missing a resolution:" |
| 3769 | " subsituting temporary node failure", |
| 3770 | hin->key.id, htlc_state_name(hin->hstate), |
| 3771 | fmt_amount_msat(tmpctx, hin->msat), |
| 3772 | fmt_node_id(tmpctx, |
| 3773 | &hin->key.channel->peer->id)); |
| 3774 | #endif |
| 3775 | } |
| 3776 | |
| 3777 | bool wallet_htlcs_load_in_for_channel(struct wallet *wallet, |
| 3778 | struct channel *chan, |
no test coverage detected