inflight: Add ability to delete an inflight

This commit is contained in:
Dusty Daemon 2024-01-22 17:33:47 -05:00 committed by Christian Decker
parent e102234950
commit bee46546cf
2 changed files with 24 additions and 0 deletions

View file

@ -1259,6 +1259,24 @@ void wallet_inflight_add(struct wallet *w, struct channel_inflight *inflight)
tal_free(stmt);
}
void wallet_inflight_del(struct wallet *w, struct channel *chan,
struct channel_inflight *inflight)
{
struct db_stmt *stmt;
/* Remove inflight from the channel */
stmt = db_prepare_v2(w->db, SQL("DELETE FROM channel_funding_inflights"
" WHERE channel_id = ?"
" AND funding_tx_id = ?"
" AND funding_tx_outnum = ?"));
db_bind_u64(stmt, chan->dbid);
db_bind_txid(stmt, &inflight->funding->outpoint.txid);
db_bind_int(stmt, inflight->funding->outpoint.n);
db_exec_prepared_v2(take(stmt));
tal_free(inflight);
}
void wallet_inflight_save(struct wallet *w,
struct channel_inflight *inflight)
{

View file

@ -620,6 +620,12 @@ void wallet_channel_insert(struct wallet *w, struct channel *chan);
*/
void wallet_inflight_add(struct wallet *w, struct channel_inflight *inflight);
/**
* Delete an inflight transaction for a channel
*/
void wallet_inflight_del(struct wallet *w, struct channel *chan,
struct channel_inflight *inflight);
/**
* Update an existing inflight channel transaction
*/