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

Function wallet_htlc_sigs_load

wallet/wallet.c:857–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857static struct bitcoin_signature *
858wallet_htlc_sigs_load(const tal_t *ctx, struct wallet *w, u64 channelid,
859 bool option_anchor_outputs)
860{
861 struct db_stmt *stmt;
862 struct bitcoin_signature *htlc_sigs = tal_arr(ctx, struct bitcoin_signature, 0);
863
864 stmt = db_prepare_v2(
865 w->db, SQL("SELECT signature FROM htlc_sigs WHERE channelid = ?"));
866 db_bind_u64(stmt, 0, channelid);
867 db_query_prepared(stmt);
868
869 while (db_step(stmt)) {
870 struct bitcoin_signature sig;
871 db_col_signature(stmt, "signature", &sig.s);
872 /* BOLT #3:
873 * ## HTLC-Timeout and HTLC-Success Transactions
874 *...
875 * * if `option_anchors` applies to this commitment
876 * transaction, `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is
877 * used as described in [BOLT #5]
878 */
879 if (option_anchor_outputs)
880 sig.sighash_type = SIGHASH_SINGLE|SIGHASH_ANYONECANPAY;
881 else
882 sig.sighash_type = SIGHASH_ALL;
883 tal_arr_expand(&htlc_sigs, sig);
884 }
885 tal_free(stmt);
886
887 log_debug(w->log, "Loaded %zu HTLC signatures from DB",
888 tal_count(htlc_sigs));
889 return htlc_sigs;
890}
891
892bool wallet_remote_ann_sigs_load(const tal_t *ctx, struct wallet *w, u64 id,
893 secp256k1_ecdsa_signature **remote_ann_node_sig,

Callers 1

wallet_stmt2channelFunction · 0.85

Calls 5

db_bind_u64Function · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
db_col_signatureFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected