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

Function update_resolution_depth

onchaind/onchaind.c:1341–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1339}
1340
1341static void update_resolution_depth(struct tracked_output *out, u32 depth)
1342{
1343 bool reached_reasonable_depth;
1344
1345 status_debug("%s/%s->%s depth %u",
1346 tx_type_name(out->tx_type),
1347 output_type_name(out->output_type),
1348 tx_type_name(out->resolved->tx_type),
1349 depth);
1350
1351 /* We only set this once. */
1352 reached_reasonable_depth = (out->resolved->depth < reasonable_depth
1353 && depth >= reasonable_depth);
1354
1355 /* BOLT #5:
1356 *
1357 * - if the commitment transaction HTLC output has *timed out* and
1358 * hasn't been *resolved*:
1359 * - MUST *resolve* the output by spending it using the HTLC-timeout
1360 * transaction.
1361 * - once the resolving transaction has reached reasonable depth:
1362 * - MUST fail the corresponding incoming HTLC (if any).
1363 */
1364 if ((out->resolved->tx_type == OUR_HTLC_TIMEOUT_TX
1365 || out->resolved->tx_type == OUR_HTLC_TIMEOUT_TO_US)
1366 && reached_reasonable_depth) {
1367 u8 *msg;
1368 status_debug("%s/%s reached reasonable depth %u",
1369 tx_type_name(out->tx_type),
1370 output_type_name(out->output_type),
1371 depth);
1372 msg = towire_onchaind_htlc_timeout(out, &out->htlc);
1373 wire_sync_write(REQ_FD, take(msg));
1374 }
1375 out->resolved->depth = depth;
1376}
1377
1378static void tx_new_depth(struct tracked_output **outs,
1379 const struct bitcoin_txid *txid, u32 depth)

Callers 1

tx_new_depthFunction · 0.85

Calls 4

tx_type_nameFunction · 0.85
output_type_nameFunction · 0.85
wire_sync_writeFunction · 0.50

Tested by

no test coverage detected