mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +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:
committed by
Christian Decker
parent
0f8f273410
commit
ae1d72b978
@@ -1273,6 +1273,20 @@ bool wallet_payment_add(struct wallet *wallet,
|
|||||||
return true;
|
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,
|
static struct wallet_payment *wallet_stmt2payment(const tal_t *ctx,
|
||||||
sqlite3_stmt *stmt)
|
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,
|
bool wallet_payment_add(struct wallet *wallet,
|
||||||
struct wallet_payment *payment);
|
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
|
* wallet_payment_by_hash - Retrieve a specific payment
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user