| 4101 | } |
| 4102 | |
| 4103 | void wallet_payment_delete(struct wallet *wallet, |
| 4104 | const struct sha256 *payment_hash, |
| 4105 | const u64 *groupid, const u64 *partid, |
| 4106 | const enum payment_status *status) |
| 4107 | { |
| 4108 | struct db_stmt *stmt; |
| 4109 | |
| 4110 | assert(status); |
| 4111 | if (groupid) { |
| 4112 | assert(partid); |
| 4113 | stmt = db_prepare_v2(wallet->db, |
| 4114 | SQL("DELETE FROM payments" |
| 4115 | " WHERE payment_hash = ?" |
| 4116 | " AND groupid = ?" |
| 4117 | " AND partid = ?" |
| 4118 | " AND status = ?")); |
| 4119 | db_bind_sha256(stmt, payment_hash); |
| 4120 | db_bind_u64(stmt, *groupid); |
| 4121 | db_bind_u64(stmt, *partid); |
| 4122 | db_bind_u64(stmt, *status); |
| 4123 | sendpay_index_deleted(wallet->ld, payment_hash, *partid, *groupid, |
| 4124 | *status); |
| 4125 | } else { |
| 4126 | assert(!partid); |
| 4127 | stmt = db_prepare_v2(wallet->db, |
| 4128 | SQL("DELETE FROM payments" |
| 4129 | " WHERE payment_hash = ?" |
| 4130 | " AND status = ?")); |
| 4131 | db_bind_sha256(stmt, payment_hash); |
| 4132 | db_bind_u64(stmt, *status); |
| 4133 | /* FIXME: Increment deleted appropriately! */ |
| 4134 | } |
| 4135 | db_exec_prepared_v2(take(stmt)); |
| 4136 | } |
| 4137 | |
| 4138 | static |
| 4139 | struct wallet_payment *wallet_payment_new(const tal_t *ctx, |
no test coverage detected