mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
The channel-restriction rule was previously fragile because it failed to initialize when a restricted channel was closed while the session was inactive. This often caused unnecessary session invalidation and blocked users from managing their nodes. This change makes the rule resilient by allowing it to start even if some channels in the deny-list are missing from the node's current active set. To maintain high performance, this implements a negative cache that tracks unknown channel IDs, shielding LND from redundant RPC calls during request evaluation. Only having a negative cache without invalidation can be a security problem. Someone could apply a rule with a future guessed channel id such that the channel restriction populates the checkedIDs map with it. After the channel was opened, we'd then allow making actions on the channel because we don't know about the channel's id in the getChannelID check. To ensure security isn't compromised by the cache, this adds a self-healing retry mechanism. If the firewall encounters an unknown channel outpoint while it still has unmapped restricted IDs, it clears the negative cache and forces a single retry in the next RPC call. This ensures that any newly opened restricted channels are correctly identified and blocked without adding latency to the common path. Note: This approach deliberately accepts potential cache thrashing in the edge case where a user repeatedly requests an unknown channel point while a permanently missing ID exists in the deny list. This trade-off is accepted to prioritize security (fail close) over performance in this specific invalid state. |
||
|---|---|---|
| .. | ||
| docs | ||
| chan_policy_bounds.go | ||
| chan_policy_bounds_test.go | ||
| channel_constraints.go | ||
| channel_constraints_test.go | ||
| channel_restrictions.go | ||
| channel_restrictions_test.go | ||
| config.go | ||
| history_limit.go | ||
| history_limit_test.go | ||
| interfaces.go | ||
| log.go | ||
| manager_set.go | ||
| mock.go | ||
| onchain_budget.go | ||
| onchain_budget_test.go | ||
| peer_restrictions.go | ||
| peer_restrictions_test.go | ||
| rate_limit.go | ||
| rate_limit_test.go | ||