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

Function wallet_htlc_sigs_save

wallet/wallet.c:3666–3684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3664}
3665
3666void wallet_htlc_sigs_save(struct wallet *w, u64 channel_id,
3667 const struct bitcoin_signature *htlc_sigs)
3668{
3669 /* Clear any existing HTLC sigs for this channel */
3670 struct db_stmt *stmt = db_prepare_v2(
3671 w->db, SQL("DELETE FROM htlc_sigs WHERE channelid = ?"));
3672 db_bind_u64(stmt, 0, channel_id);
3673 db_exec_prepared_v2(take(stmt));
3674
3675 /* Now insert the new ones */
3676 for (size_t i=0; i<tal_count(htlc_sigs); i++) {
3677 stmt = db_prepare_v2(w->db,
3678 SQL("INSERT INTO htlc_sigs (channelid, "
3679 "signature) VALUES (?, ?)"));
3680 db_bind_u64(stmt, 0, channel_id);
3681 db_bind_signature(stmt, 1, &htlc_sigs[i].s);
3682 db_exec_prepared_v2(take(stmt));
3683 }
3684}
3685
3686bool wallet_sanity_check(struct wallet *w)
3687{

Callers 1

peer_got_commitsigFunction · 0.85

Calls 3

db_bind_u64Function · 0.85
db_exec_prepared_v2Function · 0.85
db_bind_signatureFunction · 0.85

Tested by

no test coverage detected