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

Function tx_new_depth

onchaind/onchaind.c:1913–1958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1911}
1912
1913static void tx_new_depth(struct tracked_output **outs,
1914 const struct bitcoin_txid *txid, u32 depth)
1915{
1916 size_t i;
1917
1918 /* Special handling for commitment tx reaching depth */
1919 if (bitcoin_txid_eq(&outs[0]->resolved->txid, txid)
1920 && depth >= reasonable_depth
1921 && missing_htlc_msgs) {
1922 status_debug("Sending %zu missing htlc messages",
1923 tal_count(missing_htlc_msgs));
1924 for (i = 0; i < tal_count(missing_htlc_msgs); i++)
1925 wire_sync_write(REQ_FD, missing_htlc_msgs[i]);
1926 /* Don't do it again. */
1927 missing_htlc_msgs = tal_free(missing_htlc_msgs);
1928 }
1929
1930 for (i = 0; i < tal_count(outs); i++) {
1931 /* Update output depth. */
1932 if (bitcoin_txid_eq(&outs[i]->outpoint.txid, txid))
1933 outs[i]->depth = depth;
1934
1935 /* Is this tx resolving an output? */
1936 if (outs[i]->resolved) {
1937 if (bitcoin_txid_eq(&outs[i]->resolved->txid, txid)) {
1938 update_resolution_depth(outs[i], depth);
1939 }
1940 continue;
1941 }
1942
1943 /* Otherwise, is this something we have a pending
1944 * resolution for? */
1945 if (outs[i]->proposal
1946 && bitcoin_txid_eq(&outs[i]->outpoint.txid, txid)
1947 && depth >= outs[i]->proposal->depth_required) {
1948 proposal_meets_depth(outs[i]);
1949 }
1950
1951 /* Otherwise, is this an output whose proposed resolution
1952 * we should RBF? */
1953 if (outs[i]->proposal
1954 && bitcoin_txid_eq(&outs[i]->outpoint.txid, txid)
1955 && proposal_is_rbfable(outs[i]->proposal))
1956 proposal_should_rbf(outs[i]);
1957 }
1958}
1959
1960/* BOLT #5:
1961 *

Callers 1

wait_for_resolvedFunction · 0.85

Calls 6

tal_freeFunction · 0.85
update_resolution_depthFunction · 0.85
proposal_meets_depthFunction · 0.85
proposal_is_rbfableFunction · 0.85
proposal_should_rbfFunction · 0.85
wire_sync_writeFunction · 0.50

Tested by

no test coverage detected