Skip to content

simln-lib: enforce HTLC policy limits against the correct party - #315

Open
elnosh wants to merge 1 commit into
bitcoin-dev-project:mainfrom
elnosh:policy-check
Open

simln-lib: enforce HTLC policy limits against the correct party#315
elnosh wants to merge 1 commit into
bitcoin-dev-project:mainfrom
elnosh:policy-check

Conversation

@elnosh

@elnosh elnosh commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

check_outgoing_addition previously checked every limit against the sending node's own policy. Split each limit to the party that owns it:

  • htlc_minimum_msat / htlc_maximum_msat are forwarder-advertised fields of the sender's own gossiped channel_update (populated into the graph from self.policy), so they are enforced against self.policy.
  • max_accepted_htlcs / max_htlc_value_in_flight_msat are receiver- negotiated (BOLT-2 channel open, never gossiped), so they are enforced against the counterparty's policy. Keeping this at add time means the final recipient's inbound limits are enforced too, since it never adds an outgoing HTLC.

@carlaKC carlaKC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Could you update the readme's Advanced Usage section to make note of how these will be used?

`check_outgoing_addition` previously checked every limit against the
sending node's own policy. Split each limit to the party that owns it:

* htlc_minimum_msat / htlc_maximum_msat are forwarder-advertised fields
  of the sender's own gossiped channel_update (populated into the graph
  from `self.policy`), so they are enforced against `self.policy`.
* max_accepted_htlcs / max_htlc_value_in_flight_msat are receiver-
  negotiated (BOLT-2 channel open, never gossiped), so they are enforced
  against the counterparty's policy. Keeping this at add time means
  the final recipient's inbound limits are enforced too, since it never
  adds an outgoing HTLC.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@elnosh

elnosh commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

Could you update the readme's Advanced Usage section to make note of how these will be used?

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants