2016-09-06 09:17:49 +02:00
|
|
|
#ifndef LIGHTNING_DAEMON_INVOICE_H
|
|
|
|
#define LIGHTNING_DAEMON_INVOICE_H
|
|
|
|
#include "config.h"
|
2017-02-02 05:05:45 +01:00
|
|
|
#include <bitcoin/preimage.h>
|
2017-06-20 07:45:03 +02:00
|
|
|
#include <ccan/crypto/sha256/sha256.h>
|
|
|
|
#include <ccan/list/list.h>
|
|
|
|
#include <ccan/tal/tal.h>
|
2016-09-06 09:17:49 +02:00
|
|
|
|
2017-01-04 03:48:47 +01:00
|
|
|
struct invoices;
|
2016-09-06 09:17:49 +02:00
|
|
|
struct lightningd_state;
|
|
|
|
|
|
|
|
struct invoice {
|
|
|
|
struct list_node list;
|
|
|
|
const char *label;
|
2016-09-06 09:17:49 +02:00
|
|
|
u64 msatoshi;
|
2017-02-02 05:05:45 +01:00
|
|
|
struct preimage r;
|
2016-09-06 09:17:49 +02:00
|
|
|
struct sha256 rhash;
|
2016-09-06 09:17:49 +02:00
|
|
|
u64 paid_num;
|
2016-09-06 09:17:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#define INVOICE_MAX_LABEL_LEN 128
|
|
|
|
|
|
|
|
/* From database */
|
2017-01-04 03:48:47 +01:00
|
|
|
void invoice_add(struct invoices *i,
|
2017-02-02 05:05:45 +01:00
|
|
|
const struct preimage *r,
|
2016-09-06 09:17:49 +02:00
|
|
|
u64 msatoshi,
|
2016-09-06 09:17:49 +02:00
|
|
|
const char *label,
|
2016-09-06 09:17:49 +02:00
|
|
|
u64 complete);
|
2016-09-06 09:17:49 +02:00
|
|
|
|
2017-01-04 03:48:47 +01:00
|
|
|
void resolve_invoice(struct lightningd_state *dstate, struct invoice *invoice);
|
2016-09-06 09:17:49 +02:00
|
|
|
|
2017-01-04 03:48:47 +01:00
|
|
|
struct invoice *find_unpaid(struct invoices *i,
|
2016-09-06 09:17:49 +02:00
|
|
|
const struct sha256 *rhash);
|
2016-09-06 09:17:49 +02:00
|
|
|
|
2017-04-01 12:58:30 +02:00
|
|
|
struct invoices *invoices_init(const tal_t *ctx);
|
2016-09-06 09:17:49 +02:00
|
|
|
#endif /* LIGHTNING_DAEMON_INVOICE_H */
|