| 4138 | } |
| 4139 | |
| 4140 | void 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 | |
| 4175 | static |
| 4176 | struct wallet_payment *wallet_payment_new(const tal_t *ctx, |
no test coverage detected