| 2587 | } |
| 2588 | |
| 2589 | static enum watch_result funding_depth_cb(struct lightningd *ld, |
| 2590 | unsigned int depth, |
| 2591 | struct channel *channel) |
| 2592 | { |
| 2593 | channel->depth = depth; |
| 2594 | |
| 2595 | log_debug(channel->log, "Funding tx %s depth %u of %u", |
| 2596 | fmt_bitcoin_txid(tmpctx, &channel->funding.txid), |
| 2597 | depth, channel->minimum_depth); |
| 2598 | |
| 2599 | switch (channel->state) { |
| 2600 | /* We should not be in the callback! */ |
| 2601 | case DUALOPEND_AWAITING_LOCKIN: |
| 2602 | case DUALOPEND_OPEN_INIT: |
| 2603 | case DUALOPEND_OPEN_COMMIT_READY: |
| 2604 | case DUALOPEND_OPEN_COMMITTED: |
| 2605 | abort(); |
| 2606 | |
| 2607 | case AWAITING_UNILATERAL: |
| 2608 | case CHANNELD_SHUTTING_DOWN: |
| 2609 | case CLOSINGD_SIGEXCHANGE: |
| 2610 | case CLOSINGD_COMPLETE: |
| 2611 | case FUNDING_SPEND_SEEN: |
| 2612 | case ONCHAIN: |
| 2613 | case CLOSED: |
| 2614 | /* If not awaiting lockin/announce, it doesn't care any more */ |
| 2615 | log_debug(channel->log, |
| 2616 | "Funding tx %s confirmed, but peer in state %s", |
| 2617 | fmt_bitcoin_txid(tmpctx, &channel->funding.txid), |
| 2618 | channel_state_name(channel)); |
| 2619 | return DELETE_WATCH; |
| 2620 | |
| 2621 | case CHANNELD_AWAITING_LOCKIN: |
| 2622 | /* This may be redundant, and may be public later, but |
| 2623 | * make sure we tell gossipd at least once */ |
| 2624 | if (depth >= channel->minimum_depth |
| 2625 | && channel->remote_channel_ready) { |
| 2626 | lockin_complete(channel, CHANNELD_AWAITING_LOCKIN); |
| 2627 | } |
| 2628 | /* Fall thru */ |
| 2629 | case CHANNELD_NORMAL: |
| 2630 | case CHANNELD_AWAITING_SPLICE: |
| 2631 | channeld_tell_depth(channel, &channel->funding.txid, depth); |
| 2632 | |
| 2633 | if (depth < ANNOUNCE_MIN_DEPTH || depth < channel->minimum_depth) |
| 2634 | return KEEP_WATCHING; |
| 2635 | /* Normal state and past announce depth? Stop bothering us! */ |
| 2636 | return DELETE_WATCH; |
| 2637 | } |
| 2638 | abort(); |
| 2639 | } |
| 2640 | |
| 2641 | void channel_watch_depth(struct lightningd *ld, |
| 2642 | u32 blockheight, |
nothing calls this directly
no test coverage detected