| 3766 | } |
| 3767 | |
| 3768 | static void fixup_hin(struct wallet *wallet, struct htlc_in *hin) |
| 3769 | { |
| 3770 | /* We didn't used to save failcore, failonion... */ |
| 3771 | #ifdef COMPAT_V061 |
| 3772 | /* We care about HTLCs being removed only, not those being added. */ |
| 3773 | if (hin->hstate < SENT_REMOVE_HTLC) |
| 3774 | return; |
| 3775 | |
| 3776 | /* Successful ones are fine. */ |
| 3777 | if (hin->preimage) |
| 3778 | return; |
| 3779 | |
| 3780 | /* Failed ones (only happens after db fixed!) OK. */ |
| 3781 | if (hin->badonion || hin->failonion) |
| 3782 | return; |
| 3783 | |
| 3784 | hin->failonion = create_onionreply(hin, |
| 3785 | hin->shared_secret, |
| 3786 | towire_temporary_node_failure(tmpctx)); |
| 3787 | |
| 3788 | log_broken(wallet->log, "HTLC #%"PRIu64" (%s) " |
| 3789 | " for amount %s" |
| 3790 | " from %s" |
| 3791 | " is missing a resolution:" |
| 3792 | " subsituting temporary node failure", |
| 3793 | hin->key.id, htlc_state_name(hin->hstate), |
| 3794 | fmt_amount_msat(tmpctx, hin->msat), |
| 3795 | fmt_node_id(tmpctx, |
| 3796 | &hin->key.channel->peer->id)); |
| 3797 | #endif |
| 3798 | } |
| 3799 | |
| 3800 | bool wallet_htlcs_load_in_for_channel(struct wallet *wallet, |
| 3801 | struct channel *chan, |
no test coverage detected