mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
wallet: add routine to delete a payment.
We do this instead of updating, if we've got an old failed one. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0f8f273410
commit
ae1d72b978
2 changed files with 22 additions and 0 deletions
|
@ -1273,6 +1273,20 @@ bool wallet_payment_add(struct wallet *wallet,
|
|||
return true;
|
||||
}
|
||||
|
||||
void wallet_payment_delete(struct wallet *wallet,
|
||||
const struct sha256 *payment_hash)
|
||||
{
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
stmt = db_prepare(
|
||||
wallet->db,
|
||||
"DELETE FROM payments WHERE payment_hash = ?");
|
||||
|
||||
sqlite3_bind_sha256(stmt, 1, payment_hash);
|
||||
|
||||
db_exec_prepared(wallet->db, stmt);
|
||||
}
|
||||
|
||||
static struct wallet_payment *wallet_stmt2payment(const tal_t *ctx,
|
||||
sqlite3_stmt *stmt)
|
||||
{
|
||||
|
|
|
@ -537,6 +537,14 @@ struct htlc_stub *wallet_htlc_stubs(const tal_t *ctx, struct wallet *wallet,
|
|||
bool wallet_payment_add(struct wallet *wallet,
|
||||
struct wallet_payment *payment);
|
||||
|
||||
/**
|
||||
* wallet_payment_delete - Remove a payment
|
||||
*
|
||||
* Removes the payment from the database.
|
||||
*/
|
||||
void wallet_payment_delete(struct wallet *wallet,
|
||||
const struct sha256 *payment_hash);
|
||||
|
||||
/**
|
||||
* wallet_payment_by_hash - Retrieve a specific payment
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue