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

Function wait_for_resolved

onchaind/onchaind.c:1631–1698  ·  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

1629 * reorganizations.
1630 */
1631static void wait_for_resolved(struct tracked_output **outs)
1632{
1633 billboard_update(outs);
1634
1635 while (num_not_irrevocably_resolved(outs) != 0) {
1636 const u8 *msg;
1637 enum onchaind_wire mtype;
1638
1639 if (tal_count(queued_msgs)) {
1640 msg = tal_steal(outs, queued_msgs[0]);
1641 tal_arr_remove(&queued_msgs, 0);
1642 } else
1643 msg = wire_sync_read(outs, REQ_FD);
1644
1645 mtype = fromwire_peektype(msg);
1646 status_debug("Got new message %s", onchaind_wire_name(mtype));
1647
1648 switch (mtype) {
1649 case WIRE_ONCHAIND_DEPTH:
1650 handle_onchaind_depth(&outs, msg);
1651 goto handled;
1652 case WIRE_ONCHAIND_SPENT:
1653 handle_onchaind_spent(&outs, msg);
1654 goto handled;
1655 case WIRE_ONCHAIND_KNOWN_PREIMAGE:
1656 handle_onchaind_known_preimage(&outs, msg);
1657 goto handled;
1658 case WIRE_ONCHAIND_DEV_MEMLEAK:
1659 handle_dev_memleak(&outs, msg);
1660 goto handled;
1661
1662 /* Unexpected messages */
1663 case WIRE_ONCHAIND_INIT:
1664 case WIRE_ONCHAIND_HTLCS:
1665 case WIRE_ONCHAIND_SPEND_CREATED:
1666
1667 /* We send these, not receive! */
1668 case WIRE_ONCHAIND_INIT_REPLY:
1669 case WIRE_ONCHAIND_SPENT_REPLY:
1670 case WIRE_ONCHAIND_EXTRACTED_PREIMAGE:
1671 case WIRE_ONCHAIND_MISSING_HTLC_OUTPUT:
1672 case WIRE_ONCHAIND_HTLC_TIMEOUT:
1673 case WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED:
1674 case WIRE_ONCHAIND_ADD_UTXO:
1675 case WIRE_ONCHAIND_DEV_MEMLEAK_REPLY:
1676 case WIRE_ONCHAIND_ANNOTATE_TXOUT:
1677 case WIRE_ONCHAIND_ANNOTATE_TXIN:
1678 case WIRE_ONCHAIND_NOTIFY_COIN_MVT:
1679 case WIRE_ONCHAIND_NOTIFY_PENALTY_ADJ:
1680 case WIRE_ONCHAIND_SPEND_TO_US:
1681 case WIRE_ONCHAIND_SPEND_PENALTY:
1682 case WIRE_ONCHAIND_SPEND_HTLC_SUCCESS:
1683 case WIRE_ONCHAIND_SPEND_HTLC_TIMEOUT:
1684 case WIRE_ONCHAIND_SPEND_FULFILL:
1685 case WIRE_ONCHAIND_SPEND_HTLC_EXPIRED:
1686 break;
1687 }
1688 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