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

Function wait_for_resolved

onchaind/onchaind.c:2133–2170  ·  view source on GitHub ↗

BOLT #5: * * A node: * - once it has broadcast a funding transaction OR sent a commitment signature * for a commitment transaction that contains an HTLC output: * - until all outputs are *irrevocably resolved*: * - MUST monitor the blockchain for transactions that spend any output that * is NOT *irrevocably resolved*. */

Source from the content-addressed store, hash-verified

2131 * is NOT *irrevocably resolved*.
2132 */
2133static void wait_for_resolved(struct tracked_output **outs)
2134{
2135 billboard_update(outs);
2136
2137 while (num_not_irrevocably_resolved(outs) != 0) {
2138 u8 *msg;
2139 struct bitcoin_txid txid;
2140 u32 input_num, depth, tx_blockheight;
2141 struct preimage preimage;
2142 struct tx_parts *tx_parts;
2143
2144 if (tal_count(queued_msgs)) {
2145 msg = tal_steal(outs, queued_msgs[0]);
2146 tal_arr_remove(&queued_msgs, 0);
2147 } else
2148 msg = wire_sync_read(outs, REQ_FD);
2149
2150 status_debug("Got new message %s",
2151 onchaind_wire_name(fromwire_peektype(msg)));
2152
2153 if (fromwire_onchaind_depth(msg, &txid, &depth))
2154 tx_new_depth(outs, &txid, depth);
2155 else if (fromwire_onchaind_spent(msg, msg, &tx_parts, &input_num,
2156 &tx_blockheight)) {
2157 output_spent(&outs, tx_parts, input_num, tx_blockheight);
2158 } else if (fromwire_onchaind_known_preimage(msg, &preimage))
2159 handle_preimage(outs, &preimage);
2160 else if (!handle_dev_memleak(outs, msg))
2161 master_badmsg(-1, msg);
2162
2163 billboard_update(outs);
2164 tal_free(msg);
2165 clean_tmpctx();
2166 }
2167
2168 wire_sync_write(REQ_FD,
2169 take(towire_onchaind_all_irrevocably_resolved(outs)));
2170}
2171
2172struct htlcs_info {
2173 struct htlc_stub *htlcs;

Callers 5

handle_mutual_closeFunction · 0.85
handle_our_unilateralFunction · 0.85
handle_their_cheatFunction · 0.85
handle_their_unilateralFunction · 0.85

Calls 15

onchaind_wire_nameFunction · 0.85
tx_new_depthFunction · 0.85
output_spentFunction · 0.85
tal_freeFunction · 0.85
clean_tmpctxFunction · 0.85
billboard_updateFunction · 0.70
handle_preimageFunction · 0.70
handle_dev_memleakFunction · 0.70
wire_sync_readFunction · 0.50
fromwire_peektypeFunction · 0.50
fromwire_onchaind_depthFunction · 0.50

Tested by

no test coverage detected