mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
wallet: Track outgoing payments in the database
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
6ceb375650
commit
e0d86376e2
@ -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)
|
||||
|
@ -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…
Reference in New Issue
Block a user