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

Function wallet_inflight_save

wallet/wallet.c:1588–1624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1586}
1587
1588void wallet_inflight_save(struct wallet *w,
1589 struct channel_inflight *inflight)
1590{
1591 struct db_stmt *stmt;
1592 /* The *only* thing you can update on an
1593 * inflight is the funding PSBT (to add sigs)
1594 * and the last_tx/last_sig or locked_scid if this is for a splice */
1595 stmt = db_prepare_v2(w->db,
1596 SQL("UPDATE channel_funding_inflights SET"
1597 " funding_psbt=?"
1598 ", funding_tx_remote_sigs_received=?"
1599 ", last_tx=?"
1600 ", last_sig=?"
1601 ", locked_scid=?"
1602 " WHERE"
1603 " channel_id=?"
1604 " AND funding_tx_id=?"
1605 " AND funding_tx_outnum=?"));
1606 db_bind_psbt(stmt, inflight->funding_psbt);
1607 db_bind_int(stmt, inflight->remote_tx_sigs);
1608 if (inflight->last_tx) {
1609 db_bind_psbt(stmt, inflight->last_tx->psbt);
1610 db_bind_signature(stmt, &inflight->last_sig.s);
1611 } else {
1612 db_bind_null(stmt);
1613 db_bind_null(stmt);
1614 }
1615 if (inflight->locked_scid)
1616 db_bind_short_channel_id(stmt, *inflight->locked_scid);
1617 else
1618 db_bind_null(stmt);
1619 db_bind_u64(stmt, inflight->channel->dbid);
1620 db_bind_txid(stmt, &inflight->funding->outpoint.txid);
1621 db_bind_int(stmt, inflight->funding->outpoint.n);
1622
1623 db_exec_prepared_v2(take(stmt));
1624}
1625
1626static struct short_channel_id *db_col_optional_scid(const tal_t *ctx,
1627 struct db_stmt *stmt,

Callers 9

wallet_channel_saveFunction · 0.85
handle_peer_tx_sigs_sentFunction · 0.85
handle_peer_tx_sigs_msgFunction · 0.85
json_openchannel_signedFunction · 0.85
peer_got_commitsigFunction · 0.85
handle_update_inflightFunction · 0.85

Calls 8

db_bind_psbtFunction · 0.85
db_bind_intFunction · 0.85
db_bind_signatureFunction · 0.85
db_bind_nullFunction · 0.85
db_bind_short_channel_idFunction · 0.85
db_bind_u64Function · 0.85
db_bind_txidFunction · 0.85
db_exec_prepared_v2Function · 0.85

Tested by

no test coverage detected