mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pay: Add hook for triggering storage of payments.
This commit is contained in:
@@ -365,6 +365,12 @@ static void report_routing_failure(struct log *log,
|
|||||||
tal_free(tmpctx);
|
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,
|
void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
||||||
const char *localfail)
|
const char *localfail)
|
||||||
{
|
{
|
||||||
@@ -449,7 +455,7 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Save to DB */
|
/* 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,
|
wallet_payment_set_status(ld->wallet, &hout->payment_hash,
|
||||||
PAYMENT_FAILED, NULL);
|
PAYMENT_FAILED, NULL);
|
||||||
wallet_payment_set_failinfo(ld->wallet,
|
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,
|
void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
||||||
const char *localfail);
|
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 */
|
#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 */
|
/* For our own HTLCs, we commit payment to db lazily */
|
||||||
if (hout->origin_htlc_id == 0)
|
if (hout->origin_htlc_id == 0)
|
||||||
wallet_payment_store(ld->wallet,
|
payment_store(ld,
|
||||||
&hout->payment_hash);
|
&hout->payment_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!htlc_out_update_state(channel, hout, newstate))
|
if (!htlc_out_update_state(channel, hout, newstate))
|
||||||
|
|||||||
Reference in New Issue
Block a user