| 297 | } |
| 298 | |
| 299 | static bool |
| 300 | invoice_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 | |
| 325 | REGISTER_PLUGIN_HOOK(invoice_payment, |
| 326 | invoice_payment_deserialize, |
nothing calls this directly
no test coverage detected