mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
daemon/invoice: wean off dstate (a little), link into new daemon.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
d3cbde4b46
commit
eb61446ec8
@ -78,9 +78,9 @@ void invoice_add(struct invoices *invs,
|
|||||||
list_add(&invs->unpaid, &invoice->list);
|
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->unpaid);
|
||||||
list_head_init(&invs->paid);
|
list_head_init(&invs->paid);
|
||||||
|
@ -29,5 +29,5 @@ void resolve_invoice(struct lightningd_state *dstate, struct invoice *invoice);
|
|||||||
struct invoice *find_unpaid(struct invoices *i,
|
struct invoice *find_unpaid(struct invoices *i,
|
||||||
const struct sha256 *rhash);
|
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 */
|
#endif /* LIGHTNING_DAEMON_INVOICE_H */
|
||||||
|
@ -14,7 +14,7 @@ LIGHTNINGD_OLD_SRC := \
|
|||||||
daemon/chaintopology.c \
|
daemon/chaintopology.c \
|
||||||
daemon/configdir.c \
|
daemon/configdir.c \
|
||||||
daemon/dns.c \
|
daemon/dns.c \
|
||||||
daemon/netaddr.c \
|
daemon/invoice.c \
|
||||||
daemon/json.c \
|
daemon/json.c \
|
||||||
daemon/jsonrpc.c \
|
daemon/jsonrpc.c \
|
||||||
daemon/log.c \
|
daemon/log.c \
|
||||||
|
@ -30,12 +30,6 @@ char *bitcoin_datadir;
|
|||||||
|
|
||||||
#define FIXME_IMPLEMENT() errx(1, "FIXME: Implement %s", __func__)
|
#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);
|
||||||
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 */
|
/* 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 <daemon/packets.h>
|
#include <daemon/packets.h>
|
||||||
void queue_pkt_nested(struct peer *peer,
|
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->topology = ld->dstate.topology = new_topology(ld, ld->log);
|
||||||
ld->bitcoind = ld->dstate.bitcoind = new_bitcoind(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);
|
ld->dstate.invoices = invoices_init(&ld->dstate);
|
||||||
return ld;
|
return ld;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user