Repository navigation
Conversation
We only allowed underpaying HTLCs on an inbound channel if protocol discovery had found the counterparty to support LSPS2. Discovery results are kept in memory, so after a restart during which the LSP could not be reached, a JIT channel opened for an earlier invoice was accepted without the override. The fee-skimmed payment was then rejected, and as the override cannot be set later, the invoice could never be paid. We now set the override for any configured LSP, as we already do when deciding whether to trust it for 0conf. The skimmed fee is still checked against the limit from the payment metadata before claiming. Co-Authored-By: HAL 9000
|
👋 Thanks for assigning @tankyleo as a reviewer! |
| } | ||
|
|
||
| #[tokio::test(flavor = "multi_thread", worker_threads = 1)] | ||
| async fn lsps2_client_receives_jit_payment_before_discovering_lsp() { |
There was a problem hiding this comment.
This test relies on a fixed 6s sleep and on the payment reaching the client before the second discovery retry (about 15s after start). On a slow runner, the retry could succeed first and the test would pass without exercising this change. Could you confirm it fails on the parent commit, or make it deterministic, e.g. assert the LSP is still undiscovered when the channel is accepted?
| if self.liquidity_source.get_lsp_config(&counterparty_node_id, 2).await.is_some() { | ||
| // This must not depend on protocol discovery having succeeded: an LSP may open a | ||
| // channel for a JIT invoice it issued before we last restarted, and the override | ||
| // cannot be set once the channel is accepted. |
There was a problem hiding this comment.
A clarification here, in the commit message, and the PR description: we can override the flag later after the channel is accepted via Node::update_channel_config right ?
We only allowed underpaying HTLCs on an inbound channel if protocol discovery had found the counterparty to support LSPS2. Discovery results are kept in memory, so after a restart during which the LSP could not be reached, a JIT channel opened for an earlier invoice was accepted without the override. The fee-skimmed payment was then rejected, and as the override cannot be set later, the invoice could never be paid.
We now set the override for any configured LSP, as we already do when deciding whether to trust it for 0conf. The skimmed fee is still checked against the limit from the payment metadata before claiming.
Co-Authored-By: HAL 9000