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

Function add_htlc

tests/fuzz/fuzz-full_channel.c:116–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116static bool add_htlc(struct channel *channel, enum side sender, u64 id,
117 const struct preimage *preimage,
118 struct amount_msat msatoshi, u32 cltv)
119{
120 struct sha256 rhash;
121 u8 *dummy_routing;
122
123 dummy_routing = tal_arr(channel, u8, TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE));
124 sha256(&rhash, preimage, sizeof(*preimage));
125
126 if (channel_add_htlc(channel, sender, id, msatoshi, cltv, &rhash,
127 dummy_routing, NULL, NULL, NULL, NULL, true) != CHANNEL_ERR_ADD_OK) {
128 tal_free(dummy_routing);
129 return false;
130 }
131
132 tal_free(dummy_routing);
133 return true;
134}
135
136static bool fulfill_htlc(struct channel *channel, enum side original_sender,
137 u64 id, const struct preimage *preimage)

Callers 1

runFunction · 0.70

Calls 3

channel_add_htlcFunction · 0.85
tal_freeFunction · 0.85
sha256Class · 0.70

Tested by

no test coverage detected