| 4143 | } |
| 4144 | |
| 4145 | void 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 | |
| 4180 | static |
| 4181 | struct wallet_payment *wallet_payment_new(const tal_t *ctx, |
no test coverage detected