Commit graph

11 commits

Author SHA1 Message Date
Elle Mouton
21983bab75
rules: thread context through 2025-01-13 09:23:20 +02:00
bitromortac
f5d57f8cf1
rules: add channel open constraints
We add a new channel constraint rule that enforces limits on channel
opening for the OpenChannelSync and BatchOpenChannel end points.

The channel constraint rule takes care about:
* min channel size
* max channel size
* max push amount
* no closing address was used
2024-07-02 18:21:41 +02:00
Elle Mouton
f8a36010e2
rules: add on-chain budget
This adds an on-chain budget that handles requests and responses for the
following endpoints:

* OpenChannelSync
* BatchOpenChannel

The budget rule checks that the onchain fee rate is not violated and
that pending and confirmed amounts are handled correctly.

An edge case can occur when lit crashes or shuts down after the budget
rule has forwarded a request but didn't receive a response yet. The
pending budget is not removed in case the request didn't go through and
is not accounted towards the spent budget in case the request did go
through. To be able to handle these cases in the future we add a unique
identifier to the request, that can be checked by calling LND's channel
bookkeeping APIs. Not all of them expose the identifier yet, which is
why pending actions cannot be deleted yet. This leads to underspending
of the budget and can be fixed by user intervention by creating a new
session. The memo prefix is removed when reading forwarding the
bookkeeping requests for privacy reasons.
2024-07-02 18:21:41 +02:00
bitromortac
7489f0a0b2
rules: pass in lnd connection identifier
We pass a random lnd connection identifier to the rule enforcer that is
unique per lnd connection lifetime. It is used to generate unique
request identifiers that amend the non-unique request identifiers that
are passed from lnd.
2024-07-02 15:04:26 +02:00
bitromortac
5129b95fd5
rules+rpcserver: handle unknown rules
This is to tolerate unknown rules sent from the autopilot for the
`autopilot features` command.

Otherwise, when trying to register a feature that requires an upgrade, a
more user friendly error is returned.
2024-04-25 18:19:48 +02:00
Elle Mouton
0092435104
rules: add PeerRestrict rule 2023-01-27 06:47:12 +02:00
Elle Mouton
8425f4572d
rules: add ChannelRestrict rule 2023-01-27 06:47:12 +02:00
Elle Mouton
0629601d86
rules: add History Limit rule 2023-01-27 06:47:12 +02:00
Elle Mouton
ad9dd3e8ef
rules: add ChanPolicyBounds rule 2023-01-27 06:47:12 +02:00
Elle Mouton
042a5ee855
rules: add RateLimit rule 2023-01-27 06:47:12 +02:00
Elle Mouton
c4e7284de1
rules: add manager set 2023-01-27 06:47:12 +02:00