2017-04-02 22:37:56 +02:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_PAY_H
|
|
|
|
#define LIGHTNING_LIGHTNINGD_PAY_H
|
|
|
|
#include "config.h"
|
2019-06-25 09:55:09 +02:00
|
|
|
#include <ccan/short_types/short_types.h>
|
2017-04-02 22:37:56 +02:00
|
|
|
|
2017-06-20 07:53:03 +02:00
|
|
|
struct htlc_out;
|
2017-04-02 22:37:56 +02:00
|
|
|
struct lightningd;
|
2019-01-17 16:25:32 +01:00
|
|
|
struct preimage;
|
2018-02-15 04:32:03 +01:00
|
|
|
struct sha256;
|
plugin: A new notification type, 'sendpay_success'
`sendpay_success`
A notification for topic `sendpay_success` is sent every time a sendpay
success(with `complete` status). The json is same as the return value of
command `sendpay`/`waitsendpay` when these cammand succeeds.
```json
{
"sendpay_success": {
"id": 1,
"payment_hash": "5c85bf402b87d4860f4a728e2e58a2418bda92cd7aea0ce494f11670cfbfb206",
"destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
"msatoshi": 100000000,
"amount_msat": "100000000msat",
"msatoshi_sent": 100001001,
"amount_sent_msat": "100001001msat",
"created_at": 1561390572,
"status": "complete",
"payment_preimage": "9540d98095fd7f37687ebb7759e733934234d4f934e34433d4998a37de3733ee"
}
}
```
`sendpay` doesn't wait for the result of sendpay and `waitsendpay`
returns the result of sendpay in specified time or timeout, but
`sendpay_success` will always return the result anytime when sendpay
successes if is was subscribed.
2019-06-25 09:27:35 +02:00
|
|
|
struct json_stream;
|
|
|
|
struct wallet_payment;
|
2019-06-25 09:55:09 +02:00
|
|
|
struct routing_failure;
|
2017-04-02 22:37:56 +02:00
|
|
|
|
2017-06-20 07:53:03 +02:00
|
|
|
void payment_succeeded(struct lightningd *ld, struct htlc_out *hout,
|
2017-04-02 22:37:56 +02:00
|
|
|
const struct preimage *rval);
|
|
|
|
|
2017-06-20 08:12:03 +02:00
|
|
|
void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
|
|
|
const char *localfail);
|
2017-04-02 22:37:56 +02:00
|
|
|
|
2018-03-10 07:39:11 +01:00
|
|
|
/* Inform payment system to save the payment. */
|
|
|
|
void payment_store(struct lightningd *ld, const struct sha256 *payment_hash);
|
|
|
|
|
plugin: A new notification type, 'sendpay_success'
`sendpay_success`
A notification for topic `sendpay_success` is sent every time a sendpay
success(with `complete` status). The json is same as the return value of
command `sendpay`/`waitsendpay` when these cammand succeeds.
```json
{
"sendpay_success": {
"id": 1,
"payment_hash": "5c85bf402b87d4860f4a728e2e58a2418bda92cd7aea0ce494f11670cfbfb206",
"destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
"msatoshi": 100000000,
"amount_msat": "100000000msat",
"msatoshi_sent": 100001001,
"amount_sent_msat": "100001001msat",
"created_at": 1561390572,
"status": "complete",
"payment_preimage": "9540d98095fd7f37687ebb7759e733934234d4f934e34433d4998a37de3733ee"
}
}
```
`sendpay` doesn't wait for the result of sendpay and `waitsendpay`
returns the result of sendpay in specified time or timeout, but
`sendpay_success` will always return the result anytime when sendpay
successes if is was subscribed.
2019-06-25 09:27:35 +02:00
|
|
|
/* This json will be also used in 'sendpay_success' notifictaion. */
|
|
|
|
void json_add_payment_fields(struct json_stream *response,
|
|
|
|
const struct wallet_payment *t);
|
|
|
|
|
2019-06-25 09:55:09 +02:00
|
|
|
/* This json will be also used in 'sendpay_failure' notifictaion. */
|
|
|
|
void json_sendpay_fail_fields(struct json_stream *js,
|
|
|
|
int pay_errcode,
|
|
|
|
const u8 *onionreply,
|
|
|
|
const struct routing_failure *fail);
|
|
|
|
|
2017-04-02 22:37:56 +02:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_PAY_H */
|