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

Function wallet_payment_delete

wallet/wallet.c:4145–4178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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