Commit graph

17 commits

Author SHA1 Message Date
jiangmencity
fb9d3f51f7 chore: fix some typos in comment
Signed-off-by: jiangmencity <jiangmen@52it.net>
2025-01-20 19:57:29 +08:00
Elle Mouton
21983bab75
rules: thread context through 2025-01-13 09:23:20 +02:00
bitromortac
a36d6c0296
rules: restrict initial channel fee parameters
Channel policy boundaries are enforced for channel openings.
2024-07-02 18:21:41 +02:00
bitromortac
9911052fd7
rules: restrict channel open peers
We add a peer restriction for channel opening for OpenChannelSync and
BatchOpenChannel.
2024-07-02 18:21:41 +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
bitromortac
1636bb2bd6
firewall+rules: map with privacy flags
We change the rule mapping to accept the newly added privacy flags. Peer
and channel restrictions can be controlled with privacy flags.
2024-04-25 14:49:46 +02:00
Elle Mouton
8b5289953a
rules: let RealToPseudo take in a PrivacyMapReader
This commit expands the RealToPseudo methods to take in a privacy map db
reader. This allows the methods to check if the privacy map db already
contains an entry for a "real" string before generating a new one.

For now, only an empty PrivacyMapReader is ever provided to the
RealToPseudo call. This will be changed in the following commit.
2023-08-31 16:56:59 +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
Elle Mouton
b5d5682a67
rules: add Rule interface 2023-01-27 06:47:12 +02:00