2017-08-28 18:06:01 +02:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_INVOICE_H
|
|
|
|
#define LIGHTNING_LIGHTNINGD_INVOICE_H
|
2016-09-06 09:17:49 +02:00
|
|
|
#include "config.h"
|
2020-08-31 03:13:25 +02:00
|
|
|
#include <wire/onion_wiregen.h>
|
2019-04-11 02:08:55 +02:00
|
|
|
|
|
|
|
struct amount_msat;
|
2019-12-12 00:55:45 +01:00
|
|
|
struct htlc_set;
|
2019-04-11 02:08:55 +02:00
|
|
|
struct lightningd;
|
|
|
|
struct sha256;
|
|
|
|
|
2019-12-12 00:55:45 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* invoice_check_payment - check if this payment would be valid
|
|
|
|
* @ctx: tal context to allocate return off
|
|
|
|
* @ld: lightningd
|
|
|
|
* @payment_hash: hash of preimage they want.
|
|
|
|
* @msat: amount they offer to pay.
|
|
|
|
* @payment_secret: they payment secret they sent, if any.
|
|
|
|
*
|
|
|
|
* Returns NULL if there's a problem, otherwise returns the invoice details.
|
|
|
|
*/
|
|
|
|
const struct invoice_details *
|
|
|
|
invoice_check_payment(const tal_t *ctx,
|
|
|
|
struct lightningd *ld,
|
|
|
|
const struct sha256 *payment_hash,
|
|
|
|
const struct amount_msat msat,
|
|
|
|
const struct secret *payment_secret);
|
|
|
|
|
2019-04-11 02:08:55 +02:00
|
|
|
/**
|
2019-12-12 00:55:45 +01:00
|
|
|
* invoice_try_pay - process payment for these incoming payments.
|
2019-04-11 02:08:55 +02:00
|
|
|
* @ld: lightningd
|
2019-12-12 00:55:45 +01:00
|
|
|
* @set: the htlc_set used to pay this.
|
|
|
|
* @details: returned from successful invoice_check_payment.
|
2019-04-11 02:08:55 +02:00
|
|
|
*
|
2019-12-12 00:55:45 +01:00
|
|
|
* Either calls fulfill_htlc_set() or fail_htlc_set().
|
2019-04-11 02:08:55 +02:00
|
|
|
*/
|
|
|
|
void invoice_try_pay(struct lightningd *ld,
|
2019-12-12 00:55:45 +01:00
|
|
|
struct htlc_set *set,
|
|
|
|
const struct invoice_details *details);
|
2016-09-06 09:17:49 +02:00
|
|
|
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_INVOICE_H */
|