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

Function new_existing_htlc

common/htlc_wire.c:41–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41struct existing_htlc *new_existing_htlc(const tal_t *ctx,
42 u64 id,
43 enum htlc_state state,
44 struct amount_msat amount,
45 const struct sha256 *payment_hash,
46 u32 cltv_expiry,
47 const u8 onion_routing_packet[TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE)],
48 const struct pubkey *blinding TAKES,
49 const struct preimage *preimage TAKES,
50 const struct failed_htlc *failed TAKES)
51{
52 struct existing_htlc *existing = tal(ctx, struct existing_htlc);
53
54 existing->id = id;
55 existing->state = state;
56 existing->amount = amount;
57 existing->cltv_expiry = cltv_expiry;
58 existing->payment_hash = *payment_hash;
59 memcpy(existing->onion_routing_packet, onion_routing_packet,
60 sizeof(existing->onion_routing_packet));
61 existing->blinding = tal_dup_or_null(existing, struct pubkey, blinding);
62 existing->payment_preimage
63 = tal_dup_or_null(existing, struct preimage, preimage);
64 if (failed)
65 existing->failed = failed_htlc_dup(existing, failed);
66 else
67 existing->failed = NULL;
68
69 return existing;
70}
71
72/* FIXME: We could adapt tools/generate-wire.py to generate structures
73 * and code like this. */

Callers 1

peer_htlcsFunction · 0.85

Calls 1

failed_htlc_dupFunction · 0.85

Tested by

no test coverage detected