| 337 | } |
| 338 | |
| 339 | static bool |
| 340 | invoice_payment_deserialize(struct invoice_payment_hook_payload *payload, |
| 341 | const char *buffer, |
| 342 | const jsmntok_t *toks) |
| 343 | { |
| 344 | struct lightningd *ld = payload->ld; |
| 345 | const u8 *failmsg; |
| 346 | |
| 347 | /* If peer dies or something, this can happen. */ |
| 348 | if (!payload->set) { |
| 349 | log_debug(ld->log, "invoice '%s' paying htlc_in has gone!", |
| 350 | payload->label->s); |
| 351 | return false; |
| 352 | } |
| 353 | |
| 354 | /* Did we have a hook result? */ |
| 355 | failmsg = hook_gives_failmsg(NULL, ld, |
| 356 | payload->set->htlcs[0], buffer, toks); |
| 357 | if (failmsg) { |
| 358 | htlc_set_fail(payload->set, take(failmsg)); |
| 359 | return false; |
| 360 | } |
| 361 | return true; |
| 362 | } |
| 363 | |
| 364 | REGISTER_PLUGIN_HOOK(invoice_payment, |
| 365 | invoice_payment_deserialize, |
nothing calls this directly
no test coverage detected