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

Function invoice_payment_deserialize

lightningd/invoice.c:299–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

hook_gives_failmsgFunction · 0.85

Tested by

no test coverage detected