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

Function update_resolution_depth

onchaind/onchaind.c:1876–1911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1874}
1875
1876static void update_resolution_depth(struct tracked_output *out, u32 depth)
1877{
1878 bool reached_reasonable_depth;
1879
1880 status_debug("%s/%s->%s depth %u",
1881 tx_type_name(out->tx_type),
1882 output_type_name(out->output_type),
1883 tx_type_name(out->resolved->tx_type),
1884 depth);
1885
1886 /* We only set this once. */
1887 reached_reasonable_depth = (out->resolved->depth < reasonable_depth
1888 && depth >= reasonable_depth);
1889
1890 /* BOLT #5:
1891 *
1892 * - if the commitment transaction HTLC output has *timed out* and
1893 * hasn't been *resolved*:
1894 * - MUST *resolve* the output by spending it using the HTLC-timeout
1895 * transaction.
1896 * - once the resolving transaction has reached reasonable depth:
1897 * - MUST fail the corresponding incoming HTLC (if any).
1898 */
1899 if ((out->resolved->tx_type == OUR_HTLC_TIMEOUT_TX
1900 || out->resolved->tx_type == OUR_HTLC_TIMEOUT_TO_US)
1901 && reached_reasonable_depth) {
1902 u8 *msg;
1903 status_debug("%s/%s reached reasonable depth %u",
1904 tx_type_name(out->tx_type),
1905 output_type_name(out->output_type),
1906 depth);
1907 msg = towire_onchaind_htlc_timeout(out, &out->htlc);
1908 wire_sync_write(REQ_FD, take(msg));
1909 }
1910 out->resolved->depth = depth;
1911}
1912
1913static void tx_new_depth(struct tracked_output **outs,
1914 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