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

Function wait_for_resolved

onchaind/onchaind.c:1645–1712  ·  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*. * - MUST *resolve* all outputs, as specified below. *

Source from the content-addressed store, hash-verified

1643 * reorganizations.
1644 */
1645static void wait_for_resolved(struct tracked_output **outs)
1646{
1647 billboard_update(outs);
1648
1649 while (num_not_irrevocably_resolved(outs) != 0) {
1650 const u8 *msg;
1651 enum onchaind_wire mtype;
1652
1653 if (tal_count(queued_msgs)) {
1654 msg = tal_steal(outs, queued_msgs[0]);
1655 tal_arr_remove(&queued_msgs, 0);
1656 } else
1657 msg = wire_sync_read(outs, REQ_FD);
1658
1659 mtype = fromwire_peektype(msg);
1660 status_debug("Got new message %s", onchaind_wire_name(mtype));
1661
1662 switch (mtype) {
1663 case WIRE_ONCHAIND_DEPTH:
1664 handle_onchaind_depth(&outs, msg);
1665 goto handled;
1666 case WIRE_ONCHAIND_SPENT:
1667 handle_onchaind_spent(&outs, msg);
1668 goto handled;
1669 case WIRE_ONCHAIND_KNOWN_PREIMAGE:
1670 handle_onchaind_known_preimage(&outs, msg);
1671 goto handled;
1672 case WIRE_ONCHAIND_DEV_MEMLEAK:
1673 handle_dev_memleak(&outs, msg);
1674 goto handled;
1675
1676 /* Unexpected messages */
1677 case WIRE_ONCHAIND_INIT:
1678 case WIRE_ONCHAIND_HTLCS:
1679 case WIRE_ONCHAIND_SPEND_CREATED:
1680
1681 /* We send these, not receive! */
1682 case WIRE_ONCHAIND_INIT_REPLY:
1683 case WIRE_ONCHAIND_SPENT_REPLY:
1684 case WIRE_ONCHAIND_EXTRACTED_PREIMAGE:
1685 case WIRE_ONCHAIND_MISSING_HTLC_OUTPUT:
1686 case WIRE_ONCHAIND_HTLC_TIMEOUT:
1687 case WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED:
1688 case WIRE_ONCHAIND_ADD_UTXO:
1689 case WIRE_ONCHAIND_DEV_MEMLEAK_REPLY:
1690 case WIRE_ONCHAIND_ANNOTATE_TXOUT:
1691 case WIRE_ONCHAIND_ANNOTATE_TXIN:
1692 case WIRE_ONCHAIND_NOTIFY_COIN_MVT:
1693 case WIRE_ONCHAIND_NOTIFY_PENALTY_ADJ:
1694 case WIRE_ONCHAIND_SPEND_TO_US:
1695 case WIRE_ONCHAIND_SPEND_PENALTY:
1696 case WIRE_ONCHAIND_SPEND_HTLC_SUCCESS:
1697 case WIRE_ONCHAIND_SPEND_HTLC_TIMEOUT:
1698 case WIRE_ONCHAIND_SPEND_FULFILL:
1699 case WIRE_ONCHAIND_SPEND_HTLC_EXPIRED:
1700 break;
1701 }
1702 master_badmsg(-1, msg);

Callers 5

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

Calls 14

fromwire_peektypeFunction · 0.85
onchaind_wire_nameFunction · 0.85
handle_onchaind_depthFunction · 0.85
handle_onchaind_spentFunction · 0.85
tal_freeFunction · 0.85
clean_tmpctxFunction · 0.85
billboard_updateFunction · 0.70
handle_dev_memleakFunction · 0.70
wire_sync_readFunction · 0.50

Tested by

no test coverage detected