Pay: Notify 'sendpay_success' and 'sendpay_failure' when sendpay succeeds and fails

This commit is contained in:
trueptolemy
2019-06-25 16:32:53 +08:00
committed by Rusty Russell
parent 82e8db4ba4
commit 086f096b86

View File

@@ -12,6 +12,7 @@
#include <lightningd/jsonrpc.h>
#include <lightningd/lightningd.h>
#include <lightningd/log.h>
#include <lightningd/notification.h>
#include <lightningd/options.h>
#include <lightningd/peer_control.h>
#include <lightningd/peer_htlcs.h>
@@ -113,6 +114,7 @@ static struct command_result *sendpay_success(struct command *cmd,
assert(payment->status == PAYMENT_COMPLETE);
notify_sendpay_success(cmd->ld, payment);
response = json_stream_success(cmd);
json_add_payment_fields(response, payment);
return command_success(cmd, response);
@@ -183,6 +185,13 @@ sendpay_fail(struct command *cmd,
details);
}
notify_sendpay_failure(cmd->ld,
payment,
pay_errcode,
onionreply,
fail,
errmsg);
data = json_stream_fail(cmd, pay_errcode,
errmsg);
json_sendpay_fail_fields(data,