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

Function wallet_payment_delete

wallet/wallet.c:4103–4136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4101}
4102
4103void 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
4138static
4139struct 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