Skip to content

Conversation

hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Oct 8, 2025

This PR adds an option to parameters.go to exclude peers from easy autoloop swap attemtps, and also an option to re-enable all peers. --excludeeasypeer and --includealleasypeers.

Test command:

loop --network=regtest setparams --autoloop=true --easyautoloop=true --localbalancesat 2000000 --excludeeasypeer 0245
c883ac41278641ed68950000a3d27f21c2bcdc54114908bdae7da4a2d53700 --excludeeasypeer 032301a33c921aebc2520c84f51d133f83749cba6ba77e29f06853012325e83a1b --excludeeasypeer 0344022248ad5e8355a73fc047d40be32c1c1cfed0ebfb1ba1c8093bef69957f23

Result:

2025-10-09 10:43:39.073 [DBG] LQDY: easy autoloop: local_total=0.22993060 BTC, target=0.02000000 BTC, attempting to loop out 0.10000000 BTC
2025-10-09 10:43:39.073 [DBG] LQDY: Channel 124244814135296 cannot be used for easy autoloop: peer 303234356338383361633431323738363431656436383935303030306133643237663231633262636463353431313439303862646165376461346132643533373030 excluded
2025-10-09 10:43:39.073 [DBG] LQDY: Channel 125344325763072 cannot be used for easy autoloop: peer 303332333031613333633932316165626332353230633834663531643133336638333734396362613662613737653239663036383533303132333235653833613162 excluded
2025-10-09 10:43:39.073 [DBG] LQDY: Channel 125344325828608 cannot be used for easy autoloop: peer 303334343032323234386164356538333535613733666330343764343062653332633163316366656430656266623162613163383039336265663639393537663233 excluded
2025-10-09 10:43:39.073 [ERR] LQDY: easy autoloop failed: no eligible channel for easy autoloop

Reset all excluded peers to re-enable auto-swapping:

loop --network=regtest setparams --includealleasypeers

Copy link

Summary of Changes

Hello @hieblmi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This PR introduces the ability to exclude specific peers from easyautoloop swap attempts, enhancing user control over liquidity management. It adds a CLI option, updates internal parameter handling, modifies channel selection logic to respect exclusions, and extends the RPC and API definitions accordingly.

Highlights

  • Intent: This pull request introduces a new feature to easyautoloop that allows users to specify a list of peer public keys to be excluded from automatic swap attempts. This provides more granular control over which channels easyautoloop can utilize.
  • Key Changes: The core changes involve adding a new configuration option (easyexcludepeer) to the loop command-line interface, extending the internal LiquidityParameters structure to store excluded peers, and modifying the easyautoloop channel selection logic to filter out channels connected to these excluded peers. RPC and Swagger definitions are also updated to support this new parameter.
  • Detailed Changes: - cmd/loop/liquidity.go: Adds a new easyexcludepeer string slice flag to the setParamsCommand to allow specifying multiple peer public keys for exclusion. The setParams function is updated to parse these public keys, validate them, and store them in the EasyAutoloopExcludedPeers parameter.
  • liquidity/liquidity.go: The pickEasyAutoloopChannel function now creates a lookup map for excluded peers. Before considering a channel for an easy autoloop swap, it checks if the channel's remote peer is in the excluded list and skips it if a match is found.
  • liquidity/parameters.go: A new field EasyAutoloopExcludedPeers (a slice of route.Vertex) is added to the Parameters struct. The RpcToParameters and ParametersToRpc functions are updated to correctly serialize and deserialize this new field between internal structures and RPC messages.
  • looprpc/client.proto: The LiquidityParameters message is extended with a new repeated bytes easy_autoloop_excluded_peers field to expose this configuration option through the RPC interface.
  • looprpc/client.swagger.json: The Swagger definition for LiquidityParameters is updated to reflect the addition of easy_autoloop_excluded_peers, ensuring API documentation is current.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a useful feature to exclude peers from easy autoloop swap attempts. The implementation is well-structured, with changes spanning the CLI, RPC, and core liquidity management logic. The code is clear and follows existing patterns.

I've identified a few areas where performance can be improved by pre-allocating slices and maps. These are minor optimizations but are good practice in Go to avoid unnecessary memory reallocations, especially when dealing with lists that could be large. I've provided specific suggestions for these improvements.

@hieblmi hieblmi force-pushed the easy-exclude-peers branch from e0f137c to 981eac1 Compare October 9, 2025 10:00
@hieblmi hieblmi requested review from sputn1ck and starius October 9, 2025 10:01
@sputn1ck
Copy link
Member

sputn1ck commented Oct 9, 2025

I think some test coverage would be nice

@hieblmi hieblmi force-pushed the easy-exclude-peers branch from 0a7e245 to ea29ace Compare October 9, 2025 11:54
@hieblmi
Copy link
Collaborator Author

hieblmi commented Oct 9, 2025

I think some test coverage would be nice

Added a unit test.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants