diff --git a/daemon/invoice.c b/daemon/invoice.c index f54d56d8f..7699ff8f0 100644 --- a/daemon/invoice.c +++ b/daemon/invoice.c @@ -78,9 +78,9 @@ void invoice_add(struct invoices *invs, list_add(&invs->unpaid, &invoice->list); } -struct invoices *invoices_init(struct lightningd_state *dstate) +struct invoices *invoices_init(const tal_t *ctx) { - struct invoices *invs = tal(dstate, struct invoices); + struct invoices *invs = tal(ctx, struct invoices); list_head_init(&invs->unpaid); list_head_init(&invs->paid); diff --git a/daemon/invoice.h b/daemon/invoice.h index 832364e65..9c72c9e21 100644 --- a/daemon/invoice.h +++ b/daemon/invoice.h @@ -29,5 +29,5 @@ void resolve_invoice(struct lightningd_state *dstate, struct invoice *invoice); struct invoice *find_unpaid(struct invoices *i, const struct sha256 *rhash); -struct invoices *invoices_init(struct lightningd_state *dstate); +struct invoices *invoices_init(const tal_t *ctx); #endif /* LIGHTNING_DAEMON_INVOICE_H */ diff --git a/lightningd/Makefile b/lightningd/Makefile index 1328d2d72..2f95c0b02 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -14,7 +14,7 @@ LIGHTNINGD_OLD_SRC := \ daemon/chaintopology.c \ daemon/configdir.c \ daemon/dns.c \ - daemon/netaddr.c \ + daemon/invoice.c \ daemon/json.c \ daemon/jsonrpc.c \ daemon/log.c \ diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 9955e9d4f..14d126097 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -30,12 +30,6 @@ char *bitcoin_datadir; #define FIXME_IMPLEMENT() errx(1, "FIXME: Implement %s", __func__) -/* FIXME: Implement */ -struct invoices *invoices_init(struct lightningd_state *dstate) -{ - return NULL; -} - struct peer *find_peer(struct lightningd_state *dstate, const struct pubkey *id); struct peer *find_peer(struct lightningd_state *dstate, const struct pubkey *id) { @@ -70,6 +64,34 @@ void notify_new_block(struct chain_topology *topo, u32 height) /* FIXME */ } +void db_resolve_invoice(struct lightningd_state *dstate, + const char *label, u64 paid_num); +void db_resolve_invoice(struct lightningd_state *dstate, + const char *label, u64 paid_num) +{ + /* FIXME */ +} + +bool db_new_invoice(struct lightningd_state *dstate, + u64 msatoshi, + const char *label, + const struct preimage *r); +bool db_new_invoice(struct lightningd_state *dstate, + u64 msatoshi, + const char *label, + const struct preimage *r) +{ + /* FIXME */ + return true; +} + +bool db_remove_invoice(struct lightningd_state *dstate, const char *label); +bool db_remove_invoice(struct lightningd_state *dstate, + const char *label) +{ + /* FIXME */ + return true; +} #include void queue_pkt_nested(struct peer *peer, @@ -108,6 +130,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx) ld->topology = ld->dstate.topology = new_topology(ld, ld->log); ld->bitcoind = ld->dstate.bitcoind = new_bitcoind(ld, ld->log); + /* FIXME: Move into invoice daemon. */ ld->dstate.invoices = invoices_init(&ld->dstate); return ld; }