MCPcopy Create free account
hub / github.com/ElementsProject/lightning / wallet_payment_delete

Function wallet_payment_delete

wallet/wallet.c:4140–4173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4138}
4139
4140void wallet_payment_delete(struct wallet *wallet,
4141 const struct sha256 *payment_hash,
4142 const u64 *groupid, const u64 *partid,
4143 const enum payment_status *status)
4144{
4145 struct db_stmt *stmt;
4146
4147 assert(status);
4148 if (groupid) {
4149 assert(partid);
4150 stmt = db_prepare_v2(wallet->db,
4151 SQL("DELETE FROM payments"
4152 " WHERE payment_hash = ?"
4153 " AND groupid = ?"
4154 " AND partid = ?"
4155 " AND status = ?"));
4156 db_bind_sha256(stmt, payment_hash);
4157 db_bind_u64(stmt, *groupid);
4158 db_bind_u64(stmt, *partid);
4159 db_bind_u64(stmt, *status);
4160 sendpay_index_deleted(wallet->ld, payment_hash, *partid, *groupid,
4161 *status);
4162 } else {
4163 assert(!partid);
4164 stmt = db_prepare_v2(wallet->db,
4165 SQL("DELETE FROM payments"
4166 " WHERE payment_hash = ?"
4167 " AND status = ?"));
4168 db_bind_sha256(stmt, payment_hash);
4169 db_bind_u64(stmt, *status);
4170 /* FIXME: Increment deleted appropriately! */
4171 }
4172 db_exec_prepared_v2(take(stmt));
4173}
4174
4175static
4176struct wallet_payment *wallet_payment_new(const tal_t *ctx,

Callers 1

json_delpayFunction · 0.85

Calls 4

db_bind_sha256Function · 0.85
db_bind_u64Function · 0.85
db_exec_prepared_v2Function · 0.85
sendpay_index_deletedFunction · 0.50

Tested by

no test coverage detected