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

Function new_htlc_in

lightningd/htlc_end.c:126–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126struct htlc_in *new_htlc_in(const tal_t *ctx,
127 struct channel *channel, u64 id,
128 struct amount_msat msat, u32 cltv_expiry,
129 const struct sha256 *payment_hash,
130 const struct secret *shared_secret TAKES,
131 const struct pubkey *path_key TAKES,
132 const u8 *onion_routing_packet,
133 const struct tlv_field *extra_tlvs,
134 bool fail_immediate)
135{
136 struct htlc_in *hin = tal(ctx, struct htlc_in);
137
138 hin->dbid = 0;
139 hin->key.channel = channel;
140 hin->key.id = id;
141 hin->msat = msat;
142 hin->cltv_expiry = cltv_expiry;
143 hin->payment_hash = *payment_hash;
144 hin->status = NULL;
145 hin->fail_immediate = fail_immediate;
146 hin->shared_secret = tal_dup_or_null(hin, struct secret, shared_secret);
147 hin->path_key = tal_dup_or_null(hin, struct pubkey, path_key);
148 memcpy(hin->onion_routing_packet, onion_routing_packet,
149 sizeof(hin->onion_routing_packet));
150 if (extra_tlvs)
151 hin->extra_tlvs = tlv_field_arr_dup(hin, extra_tlvs);
152 else
153 hin->extra_tlvs = NULL;
154
155 hin->hstate = RCVD_ADD_COMMIT;
156 hin->badonion = 0;
157 hin->failonion = NULL;
158 hin->preimage = NULL;
159 hin->we_filled = NULL;
160 hin->payload = NULL;
161
162 hin->received_time = clock_time();
163
164 return htlc_in_check(hin, "new_htlc_in");
165}
166
167struct htlc_out *htlc_out_check(const struct htlc_out *hout,
168 const char *abortstr)

Callers 1

channel_added_their_htlcFunction · 0.85

Calls 3

tlv_field_arr_dupFunction · 0.85
clock_timeFunction · 0.85
htlc_in_checkFunction · 0.70

Tested by

no test coverage detected