Change fee settings from UI#516
Conversation
…mplement it in LightningClientService
…age channel fee policies
…s to manage channel fee policies
…s in ChannelRepository and Lightning services
Jossec101
left a comment
There was a problem hiding this comment.
Please introduce validation so:
- Inbound base and fee rate are negative only
- In abs terms, both inbound base and fee rate cannot be bigger than it's counterparter (you cannot surcharge positively a routing, only discount)
- The ui shall require negatives values
- Introduce a default for CLTV (40 blocks its ok), add to constants pls
- Also modify channel request view to set fee rates at creation https://lightning.engineering/api-docs/api/lnd/lightning/open-channel/#lnrpcopenchannelrequest
db6c3ba to
1859a5a
Compare
@markettes I guess you are still on this |
- Introduced a new column `RequestMetadata` in the `ChannelOperationRequests` table to store additional request information. - Updated the `ApplicationDbContextModelSnapshot` to reflect the new `RequestMetadata` column. - Enhanced the Channel Requests page to include fields for setting the initial channel base fee and fee rate. - Implemented logic in the `LightningService` to handle the new fee policy parameters when creating open channel requests. - Added unit tests to verify the creation of open channel requests with the initial channel fee policy.
Yep, you can check now |
There was a problem hiding this comment.
Pull request overview
Adds UI and backend support for configuring Lightning channel fee policy both at channel creation time (initial routing policy) and for existing channels (fee policy management), persisting new request metadata to survive approval/execution.
Changes:
- Persist initial channel fee policy (base fee / fee rate) on
ChannelOperationRequestvia a newRequestMetadatacolumn and expose it throughNotMappedconvenience properties. - Apply initial fee policy values when building LND
OpenChannelRequestinLightningService, with range validation. - Extend the Channels UI with a “Fee Policy” management tab (incl. inbound fee policy fields) and add UI fields to Channel Requests for initial fee policy input/display.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/NodeGuard.Tests/Services/LightningServiceTests.cs | Adds a test covering OpenChannelRequest creation when initial fee policy is provided. |
| src/Services/LightningService.cs | Applies optional initial fee policy values onto LND OpenChannelRequest with validation. |
| src/Pages/Channels.razor | Adds a tabbed channel management modal with a new Fee Policy form and save flow. |
| src/Pages/ChannelRequests.razor | Adds UI to enter/display initial channel fee policy values on open-channel requests. |
| src/Data/Models/ChannelOperationRequest.cs | Introduces RequestMetadata persistence and InitialChannel* accessors backed by JSON. |
| src/Helpers/Constants.cs | Adds configurable default timelock delta constant for fee policy form defaults. |
| src/Migrations/20260522125854_AddRequestMetadata.cs | Migration adding RequestMetadata to ChannelOperationRequests. |
| src/Migrations/20260522125854_AddRequestMetadata.Designer.cs | EF migration designer snapshot for the added column. |
| src/Migrations/ApplicationDbContextModelSnapshot.cs | Updates model snapshot to include RequestMetadata on ChannelOperationRequest. |
Files not reviewed (1)
- src/Migrations/20260522125854_AddRequestMetadata.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Created a new migration to add InitialChannelBaseFeeMsat and InitialChannelFeeRatePpm columns to the ChannelOperationRequests table. - Updated the ApplicationDbContextModelSnapshot to reflect the new columns in the ChannelOperationRequests entity.
| <Validation Validator="ValidateChannelFeeRatePpm"> | ||
| <FieldLabel>Fee rate (ppm)</FieldLabel> | ||
| <FieldHelp>Outbound proportional fee in parts per million.</FieldHelp> | ||
| <NumericEdit TValue="long?" Min="0L" Max="@((long)uint.MaxValue)" | ||
| @bind-Value="_channelFeePolicy.FeeRatePpm"> | ||
| <Feedback> | ||
| <ValidationError /> | ||
| </Feedback> | ||
| </NumericEdit> | ||
| </Validation> |
There was a problem hiding this comment.
@markettes can we please add here the current channel fee rate? same for inbound
| var defaultChannelFeePolicyTimelockDeltaBlocks = Environment.GetEnvironmentVariable("DEFAULT_CHANNEL_FEE_POLICY_TIMELOCK_DELTA_BLOCKS"); | ||
| if (defaultChannelFeePolicyTimelockDeltaBlocks != null) DEFAULT_CHANNEL_FEE_POLICY_TIMELOCK_DELTA_BLOCKS = int.Parse(defaultChannelFeePolicyTimelockDeltaBlocks); |
There was a problem hiding this comment.
Could also add defaults for fee policies? so we dont rely on LND conf (harder to change)
There was a problem hiding this comment.
wdyt about setting this at node level?
There was a problem hiding this comment.
Done 🏁
Maybe the idea of setting the default fees at node level in NG can be implemented in the future
| <FieldHelp>CLTV delta advertised for forwarded HTLCs on this channel.</FieldHelp> | ||
| <NumericEdit TValue="long?" Min="0L" Max="@((long)uint.MaxValue)" | ||
| @bind-Value="_channelFeePolicy.TimeLockDelta"> | ||
| <Feedback> |
There was a problem hiding this comment.
Can we add to this list in the datagrid also a way to see really quick PPM? both inbound and outbound but also what they charge to us (peer policy?) Perhaps peer policy is a tooltip or something, its dense info i let you figure but I think it adds value
Enhance the UI for changing fee settings.