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

Function fixup_hin

wallet/wallet.c:2721–2751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2719}
2720
2721static 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
2753bool wallet_htlcs_load_in_for_channel(struct wallet *wallet,
2754 struct channel *chan,

Callers 1

Calls 4

create_onionreplyFunction · 0.50
htlc_state_nameFunction · 0.50
type_to_stringClass · 0.50

Tested by

no test coverage detected