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

Function invoice_payment_deserialize

lightningd/invoice.c:300–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300static bool
301invoice_payment_deserialize(struct invoice_payment_hook_payload *payload,
302 const char *buffer,
303 const jsmntok_t *toks)
304{
305 struct lightningd *ld = payload->ld;
306 const u8 *failmsg;
307
308 /* If peer dies or something, this can happen. */
309 if (!payload->set && !payload->outpoint) {
310 log_debug(ld->log, "invoice '%s' paying htlc_in has gone!",
311 payload->label->s);
312 return false;
313 }
314
315 if (payload->set) {
316 /* Did we have a hook result? */
317 failmsg = hook_gives_failmsg(NULL, ld, buffer, toks);
318 if (failmsg) {
319 htlc_set_fail(payload->set, take(failmsg));
320 return false;
321 }
322 }
323 return true;
324}
325
326REGISTER_PLUGIN_HOOK(invoice_payment,
327 invoice_payment_deserialize,

Callers

nothing calls this directly

Calls 1

hook_gives_failmsgFunction · 0.85

Tested by

no test coverage detected