diff --git a/wallet/wallet.c b/wallet/wallet.c index 35efec6a4..5f77bd2b6 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -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) { diff --git a/wallet/wallet.h b/wallet/wallet.h index c21f8948a..a10f7c4ae 100644 --- a/wallet/wallet.h +++ b/wallet/wallet.h @@ -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 *