Browse Source

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>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
ae1d72b978
  1. 14
      wallet/wallet.c
  2. 8
      wallet/wallet.h

14
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)
{

8
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
*

Loading…
Cancel
Save