| 1330 | } |
| 1331 | |
| 1332 | static struct bitcoin_signature * |
| 1333 | wallet_htlc_sigs_load(const tal_t *ctx, struct wallet *w, u64 channelid, |
| 1334 | bool option_anchors) |
| 1335 | { |
| 1336 | struct db_stmt *stmt; |
| 1337 | struct bitcoin_signature *htlc_sigs = tal_arr(ctx, struct bitcoin_signature, 0); |
| 1338 | |
| 1339 | stmt = db_prepare_v2( |
| 1340 | w->db, SQL("SELECT signature FROM htlc_sigs WHERE channelid = ?" |
| 1341 | " AND inflight_tx_id is NULL")); |
| 1342 | db_bind_u64(stmt, channelid); |
| 1343 | db_query_prepared(stmt); |
| 1344 | |
| 1345 | while (db_step(stmt)) { |
| 1346 | struct bitcoin_signature sig; |
| 1347 | db_col_signature(stmt, "signature", &sig.s); |
| 1348 | /* BOLT #3: |
| 1349 | * ## HTLC-Timeout and HTLC-Success Transactions |
| 1350 | *... |
| 1351 | * * if `option_anchors` applies to this commitment |
| 1352 | * transaction, `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is |
| 1353 | * used as described in [BOLT #5] |
| 1354 | */ |
| 1355 | if (option_anchors) |
| 1356 | sig.sighash_type = SIGHASH_SINGLE|SIGHASH_ANYONECANPAY; |
| 1357 | else |
| 1358 | sig.sighash_type = SIGHASH_ALL; |
| 1359 | tal_arr_expand(&htlc_sigs, sig); |
| 1360 | } |
| 1361 | tal_free(stmt); |
| 1362 | |
| 1363 | log_debug(w->log, "Loaded %zu HTLC signatures from DB", |
| 1364 | tal_count(htlc_sigs)); |
| 1365 | return htlc_sigs; |
| 1366 | } |
| 1367 | |
| 1368 | bool wallet_remote_ann_sigs_load(struct wallet *w, |
| 1369 | const struct channel *chan, |
no test coverage detected