Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lnrpc: rejects positive inbound fees by default #8627

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

feelancer21
Copy link
Contributor

Positive inbound are now rejected by default. The user can enable positive inbound fees with the option 'no-reject-positive-inbound-fees'.

Change Description

Description of change / link to associated issue.

Steps to Test

Tested with lncli updatechanpolicy with positive and negative inbound fees and with enabled and disabled option

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

Copy link

coderabbitai bot commented Apr 6, 2024

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent update introduces a configuration option allowing lnd to accept positive inbound fees, a move from the default rejection. It involves updating validation checks to ensure fee parameters are within a specific range and adding a flag to toggle the acceptance of positive inbound fees, aiming to expand and experiment with fee acceptance behavior.

Changes

Files Change Summary
cmd/lncli/commands.go, rpcserver.go Updated validation for inbound fees to use math.MaxInt32 and added check for positive fees.
config.go Added NoRejectPositiveInboundFees field to control acceptance of positive inbound fees.
sample-lnd.conf Introduced no-reject-positive-inbound-fees config option to allow positive inbound fees.

Possibly related issues

🐰✨
In the land of code and lightning,
A change was made, quite exciting.
Positive fees, once turned away,
Now find a place they might just stay.
With a hop, skip, and a config tweak,
Our rabbit's work reaches its peak.
🌟🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Actionable comments outside the diff hunks (7)
cmd/lncli/commands.go (1)

Line range hint 2332-2333: The error message for missing channel backup in parseChanBackups function could be more user-friendly by suggesting possible solutions or corrections.

-	var errMissingChanBackup = errors.New("missing channel backup")
+	var errMissingChanBackup = errors.New("missing channel backup, please specify one of --single_backup, --multi_backup, --single_file, or --multi_file")
config.go (6)

Line range hint 1035-1055: LGTM! The CleanAndExpandPath function correctly expands environment variables and the user's home directory, and cleans the path.


Line range hint 1057-1118: LGTM! The supplyEnvValue function correctly handles various formats for environment variable references and returns the appropriate values.


Line range hint 1120-1158: Consider using a buffered reader instead of ioutil.ReadAll to handle large configuration files more efficiently.

- configContents, err := ioutil.ReadAll(btcdConfigFile)
+ configContents, err := bufio.NewReader(btcdConfigFile).ReadBytes('\n')

Line range hint 1160-1257: Consider using a buffered reader instead of ioutil.ReadAll for reading the bitcoind configuration file to handle large files more efficiently, similar to the suggestion for extractBtcdRPCParams.

- configContents, err := ioutil.ReadAll(bitcoindConfigFile)
+ configContents, err := bufio.NewReader(bitcoindConfigFile).ReadBytes('\n')

Line range hint 1259-1365: LGTM! The configToFlatMap function correctly uses reflection to build a flat map of configuration options and identify deprecated options.


Line range hint 1367-1379: LGTM! The logWarningsForDeprecation function effectively logs warnings for deprecated config options.

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6377f98 and 9b1b841.
Files selected for processing (4)
  • cmd/lncli/commands.go (1 hunks)
  • config.go (1 hunks)
  • rpcserver.go (1 hunks)
  • sample-lnd.conf (1 hunks)
Additional comments not posted (2)
sample-lnd.conf (1)

441-445: The addition of the no-reject-positive-inbound-fees configuration option is well-implemented and aligns with the PR objectives. The cautionary note about its experimental nature is appropriate and helps inform users of the potential risks. This change provides users with the flexibility to tailor their fee acceptance policy according to their operational preferences.

cmd/lncli/commands.go (1)

2376-2389: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [2375-2376]

The check for inboundBaseFeeMsat being within math.MinInt32 and math.MaxInt32 is redundant since inboundBaseFeeMsat is of type int64 and these checks will always pass.

-	if inboundBaseFeeMsat < math.MinInt32 ||
-		inboundBaseFeeMsat > math.MaxInt32 {
+	if false {

rpcserver.go Outdated Show resolved Hide resolved
cmd/lncli/commands.go Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Actionable comments outside the diff hunks (3)
docs/release-notes/release-notes-0.18.0.md (3)

Line range hint 27-112: The "Bug Fixes" section is well-structured and clearly documents the fixes in this release. Great job maintaining clarity and providing direct links to the relevant pull requests.


Line range hint 251-312: The "Improvements" section clearly outlines the enhancements made across different components of the project, contributing to better functionality and user experience.


Line range hint 373-435: The "Technical and Architectural Updates" section effectively communicates significant changes and improvements in the project's architecture and technical specifications. The updates are well-documented and provide valuable insights into the project's evolution.

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6377f98 and 62d4cbc.
Files selected for processing (5)
  • cmd/lncli/commands.go (1 hunks)
  • config.go (1 hunks)
  • docs/release-notes/release-notes-0.18.0.md (2 hunks)
  • rpcserver.go (1 hunks)
  • sample-lnd.conf (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • cmd/lncli/commands.go
  • config.go
  • rpcserver.go
  • sample-lnd.conf
Additional comments not posted (2)
docs/release-notes/release-notes-0.18.0.md (2)

120-128: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [116-189]

The "New Features" section effectively communicates the enhancements introduced in this release, including the notable addition of handling for inbound routing fees. The descriptions are concise and informative.


450-456: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [446-467]

The "Contributors" section appropriately acknowledges the individuals who contributed to this release, fostering a sense of community and appreciation for their efforts.

@feelancer21 feelancer21 marked this pull request as draft April 6, 2024 17:58
@feelancer21 feelancer21 marked this pull request as ready for review April 6, 2024 19:57
@saubyk saubyk added inbound fee Changes related to inbound routing fee config Parameters/arguments/config file related issues/PRs labels Apr 7, 2024
@saubyk saubyk added this to the v0.18.0 milestone Apr 7, 2024
Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR 🙌, I propose a different naming for the lnd-config, apart from that it's ready to ship it.

sample-lnd.conf Outdated Show resolved Hide resolved
sample-lnd.conf Outdated Show resolved Hide resolved
docs/release-notes/release-notes-0.18.0.md Outdated Show resolved Hide resolved
config.go Outdated Show resolved Hide resolved
config.go Outdated Show resolved Hide resolved
@feelancer21 feelancer21 force-pushed the inbound-fees-reject branch 2 times, most recently from 958a148 to cb1eb5b Compare April 11, 2024 21:14
Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

LGTM ⚡️

@joostjager
Copy link
Collaborator

Linking alternative option to enable on the api level, for completeness.

#8605 (comment)

@saubyk saubyk requested a review from bitromortac April 18, 2024 15:21
Copy link
Collaborator

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

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

I agree that the argument of unintentional use via third party tools is a valid one. If we'd add an RPC flag to enable positive fees, we'd offload the user education part onto a third party dev. Also, experimentation capabilities are increased here because of the removal of lncli limitations.

An API user could check via GetDebugInfo if the config value is set to know beforehand whether positive inbound fees are supported, which was an issue that I could see.

All of the three options we have would be fine in my opinion, keeping it as is, reject with config or reject with an api flag. But to be extra careful, the most consistent one is to choose this approach I think.

Have some remarks for improvements, otherwise this looks good!

sample-lnd.conf Show resolved Hide resolved
sample-lnd.conf Outdated Show resolved Hide resolved
sample-lnd.conf Outdated Show resolved Hide resolved
Positive inbound are now rejected by default. The user can enable positive
inbound fees with the option 'accept-positive-inbound-fees'.
Copy link
Collaborator

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@guggero guggero merged commit 73fd389 into lightningnetwork:master Apr 22, 2024
25 of 27 checks passed
@feelancer21 feelancer21 deleted the inbound-fees-reject branch May 5, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Parameters/arguments/config file related issues/PRs inbound fee Changes related to inbound routing fee
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants