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*. */
| 2131 | * is NOT *irrevocably resolved*. |
| 2132 | */ |
| 2133 | static 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 | |
| 2172 | struct htlcs_info { |
| 2173 | struct htlc_stub *htlcs; |
no test coverage detected