mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
52b1ba2992
We didn't write to db immediately, but waited until it the actual HTLC got added (or failed). That way we didn't have a separate transaction to write the payment into the db, but the complexity is not worth it: it makes the next refactors harder, since we can't use the normal iterator patterns like we do with the rest of the db (as we have to add the unstored ones). We might as well also make sendpay return immediately: we used to return once the HTLC had been confirmed sent, since we entered it in the db at that point, but we can keep it simple now. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
53 lines
1.6 KiB
C
53 lines
1.6 KiB
C
#ifndef LIGHTNING_LIGHTNINGD_PAY_H
|
|
#define LIGHTNING_LIGHTNINGD_PAY_H
|
|
#include "config.h"
|
|
#include <common/errcode.h>
|
|
#include <wallet/wallet.h>
|
|
|
|
struct htlc_out;
|
|
struct lightningd;
|
|
struct onionreply;
|
|
struct preimage;
|
|
struct sha256;
|
|
struct json_stream;
|
|
struct wallet_payment;
|
|
struct routing_failure;
|
|
|
|
void payment_succeeded(struct lightningd *ld,
|
|
const struct sha256 *payment_hash,
|
|
u64 partid, u64 groupid,
|
|
const struct preimage *rval);
|
|
|
|
/* hout->failmsg or hout->failonion must be set. */
|
|
void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
|
const char *localfail);
|
|
|
|
/* This json will be also used in 'sendpay_success' notifictaion. */
|
|
void json_add_payment_fields(struct json_stream *response,
|
|
const struct wallet_payment *t);
|
|
|
|
/* This json will be also used in 'sendpay_failure' notifictaion. */
|
|
void json_sendpay_fail_fields(struct json_stream *js,
|
|
const struct wallet_payment *t,
|
|
enum jsonrpc_errcode pay_errcode,
|
|
const struct onionreply *onionreply,
|
|
const struct routing_failure *fail);
|
|
|
|
/* wait() hooks in here */
|
|
void sendpay_index_deleted(struct lightningd *ld,
|
|
const struct sha256 *payment_hash,
|
|
u64 partid,
|
|
u64 groupid,
|
|
enum payment_status status);
|
|
u64 sendpay_index_created(struct lightningd *ld,
|
|
const struct sha256 *payment_hash,
|
|
u64 partid,
|
|
u64 groupid,
|
|
enum payment_status status);
|
|
u64 sendpay_index_update_status(struct lightningd *ld,
|
|
const struct sha256 *payment_hash,
|
|
u64 partid,
|
|
u64 groupid,
|
|
enum payment_status status);
|
|
#endif /* LIGHTNING_LIGHTNINGD_PAY_H */
|