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

Function new_htlc_in

lightningd/htlc_end.c:127–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

channel_added_their_htlcFunction · 0.85

Calls 2

time_nowFunction · 0.85
htlc_in_checkFunction · 0.85

Tested by

no test coverage detected