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

Function fixup_hin

wallet/wallet.c:3745–3775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3743}
3744
3745static 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
3777bool wallet_htlcs_load_in_for_channel(struct wallet *wallet,
3778 struct channel *chan,

Callers 1

Calls 4

create_onionreplyFunction · 0.85
fmt_node_idFunction · 0.85
htlc_state_nameFunction · 0.50
fmt_amount_msatFunction · 0.50

Tested by

no test coverage detected