mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
pay: Add hook for triggering storage of payments.
This commit is contained in:
parent
24ee5d0437
commit
61882ed9df
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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…
Reference in New Issue
Block a user