mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-19 13:17:32 +02:00
In this commit, we add three focused unit tests in contractcourt plus an itest that exercises the regression end-to-end. The chain watcher harness gains an opt-in early-dispatch capture that records every notifyEarlyCoopClose invocation so tests can assert how many fired and what summaries they carried. On top of that: TestEarlyDispatchCoopClose verifies the headline behavior. An async-path coop close fires exactly one early dispatch with IsPending=true and the post-N-conf flow still produces the regular CooperativeCloseInfo downstream. TestEarlyDispatchForceCloseNotInvoked guards the carve-out: force closes never fire the early dispatch since their CLOSED_CHANNEL event timing is intentionally unchanged. TestEarlyDispatchReorgRefiresOnReReplacement nails down the reorg path. Once a deep reorg removes the close, the early-dispatch flag is cleared and the next coop close re-fires the early event with its own summary, so a subscriber observes each distinct close attempt. testZeroConfCoopCloseSubscribeEvents brings up a zero-conf channel between Alice and Bob with --dev.force-channel-close-confs=3 so the chain watcher takes the async multi-confirmation path. Alice subscribes to channel events, initiates a cooperative close, and the test asserts that CLOSED_CHANNEL fires after only one confirmation of the close tx (not after the full three) and that FULLY_RESOLVED_CHANNEL arrives once the close has reached three confirmations. A quiet-window assertion at the end verifies that exactly one CLOSED_CHANNEL event is delivered. If the suppression in MarkChannelClosed broke and let it re-fire NotifyClosedChannel at N confs, this assertion would catch the duplicate. |
||
|---|---|---|
| .. | ||
| alloy-models | ||
| grpc | ||
| release-notes | ||
| rest | ||
| testing-guides/v0.21.0 | ||
| backport-workflow.md | ||
| benchmark_perf_loop.md | ||
| code_contribution_guidelines.md | ||
| configuring_tor.md | ||
| db_migration_guide.md | ||
| debugging_lnd.md | ||
| development_guidelines.md | ||
| DOCKER.md | ||
| estimate_route_fee.md | ||
| forwarding_history_privacy.md | ||
| fuzz.md | ||
| gossip_rate_limiting.md | ||
| INSTALL.md | ||
| key_import.md | ||
| leader_election.md | ||
| macaroons.md | ||
| MAKEFILE.md | ||
| musig2.md | ||
| onion_message_rate_limiting.md | ||
| postgres.md | ||
| psbt.md | ||
| recovery.md | ||
| release.md | ||
| release_branch_management.md | ||
| remote-signing.md | ||
| review.md | ||
| safety.md | ||
| signing_release_candidate.md | ||
| SphinxReplayDB.md | ||
| sqlite.md | ||
| wallet.md | ||
| watchtower.md | ||
| zero_conf_channels.md | ||