Commit bf34a8b
committed
event: drop peer on counterparty or on-chain close
When the counterparty drives closure or a commitment transaction
confirms on chain, no further channel state can be recovered with
the peer. Retaining them in the peer store would only spin the
reconnection task forever. Remove the peer once their last channel
with us reaches one of these terminal states:
- `CounterpartyForceClosed`
- `CounterpartyInitiatedCooperativeClosure`
- `CommitmentTxConfirmed`
`CommitmentTxConfirmed` covers the case where a remote commitment
confirms while we are disconnected; LDK may also report our own
commitment confirming under the same variant, but the channel is
gone on chain in either case.
`HolderForceClosed` is intentionally excluded so the reconnection
loop can keep driving `channel_reestablish` recovery (handled in
`Node::close_channel_internal`).
`counterparty_node_id` is unwrapped with `expect` since LDK has
always populated it on `ChannelClosed` from 0.0.117 onward, well
before the minimum version this crate targets. If peer removal
fails we now return `ReplayEvent` so the event is retried instead
of being silently dropped.1 parent 1b82103 commit bf34a8b
1 file changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1613 | 1613 | | |
1614 | 1614 | | |
1615 | 1615 | | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1616 | 1655 | | |
1617 | 1656 | | |
1618 | 1657 | | |
1619 | | - | |
| 1658 | + | |
1620 | 1659 | | |
1621 | 1660 | | |
1622 | 1661 | | |
| |||
0 commit comments