Browse Source

pay: Add hook for triggering storage of payments.

ppa-0.6.1
ZmnSCPxj 7 years ago
committed by Rusty Russell
parent
commit
61882ed9df
  1. 8
      lightningd/pay.c
  2. 3
      lightningd/pay.h
  3. 4
      lightningd/peer_htlcs.c

8
lightningd/pay.c

@ -365,6 +365,12 @@ static void report_routing_failure(struct log *log,
tal_free(tmpctx);
}
void payment_store(struct lightningd *ld,
const struct sha256 *payment_hash)
{
wallet_payment_store(ld->wallet, payment_hash);
}
void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
const char *localfail)
{
@ -449,7 +455,7 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
}
/* Save to DB */
wallet_payment_store(ld->wallet, &hout->payment_hash);
payment_store(ld, &hout->payment_hash);
wallet_payment_set_status(ld->wallet, &hout->payment_hash,
PAYMENT_FAILED, NULL);
wallet_payment_set_failinfo(ld->wallet,

3
lightningd/pay.h

@ -69,4 +69,7 @@ void payment_succeeded(struct lightningd *ld, struct htlc_out *hout,
void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
const char *localfail);
/* Inform payment system to save the payment. */
void payment_store(struct lightningd *ld, const struct sha256 *payment_hash);
#endif /* LIGHTNING_LIGHTNINGD_PAY_H */

4
lightningd/peer_htlcs.c

@ -900,8 +900,8 @@ static bool update_out_htlc(struct channel *channel,
/* For our own HTLCs, we commit payment to db lazily */
if (hout->origin_htlc_id == 0)
wallet_payment_store(ld->wallet,
&hout->payment_hash);
payment_store(ld,
&hout->payment_hash);
}
if (!htlc_out_update_state(channel, hout, newstate))

Loading…
Cancel
Save