Browse Source

wallet: Track outgoing payments in the database

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
e0d86376e2
  1. 2
      lightningd/lightningd.c
  2. 3
      lightningd/pay.c

2
lightningd/lightningd.c

@ -194,6 +194,7 @@ static void shutdown_subdaemons(struct lightningd *ld)
{
struct peer *p;
db_begin_transaction(ld->wallet->db);
/* Let everyone shutdown cleanly. */
close(ld->hsm_fd);
subd_shutdown(ld->gossip, 10);
@ -202,6 +203,7 @@ static void shutdown_subdaemons(struct lightningd *ld)
while ((p = list_top(&ld->peers, struct peer, list)) != NULL)
tal_free(p);
db_commit_transaction(ld->wallet->db);
}
struct chainparams *get_chainparams(const struct lightningd *ld)

3
lightningd/pay.c

@ -68,6 +68,7 @@ void payment_succeeded(struct lightningd *ld, struct htlc_out *hout,
const struct preimage *rval)
{
assert(!hout->pay_command->rval);
wallet_payment_set_status(ld->wallet, &hout->payment_hash, PAYMENT_COMPLETE);
hout->pay_command->rval = tal_dup(hout->pay_command,
struct preimage, rval);
json_pay_success(hout->pay_command->cmd, rval);
@ -81,6 +82,8 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
enum onion_type failcode;
struct onionreply *reply;
wallet_payment_set_status(ld->wallet, &hout->payment_hash, PAYMENT_FAILED);
/* This gives more details than a generic failure message,
* and also the failuremsg here is unencrypted */
if (localfail) {

Loading…
Cancel
Save