feat: Circular Rebalance of channels
Description
Circular Rebalance
Lightning Network channel rebalancing tool that allows users to redistribute liquidity between their own channels by creating a circular payment from a source channel to a destination channel.
Helps Lightning node operators optimize channel liquidity by moving funds from channels with excess outbound capacity to channels needing more outbound liquidity, improving payment routing success rates and fee earning potential.
Technical Implementation:
- Creates invoice on destination channel
- Executes payment from source channel with
allow_self_paymentenabled - Uses
last_hop_pubkeyto ensure payment routes through destination channel - Supports configurable fee limits and timeout
Please find the demo of the circular rebalance implementation over here : https://drive.google.com/file/d/1SKCE7l5bJShQld-ZyVS-RxGsMHrqnpYt/view?usp=drive_link
Relates to issue: #2157
This pull request is categorized as a:
- [x] New feature
- [ ] Bug fix
- [ ] Code refactor
- [ ] Configuration change
- [x] Locales update
- [ ] Quality assurance
- [ ] Other
Checklist
- [x] I’ve run
yarn run tscand made sure my code compiles correctly - [x] I’ve run
yarn run lintand made sure my code didn’t contain any problematic patterns - [ ] I’ve run
yarn run prettierand made sure my code is formatted correctly - [x] I’ve run
yarn run testand made sure all of the tests pass
Testing
If you modified or added a utility file, did you add new unit tests?
- [ ] No, I’m a fool
- [ ] Yes
- [x] N/A
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
- [x] Android
- [ ] iOS
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
- [ ] Embedded LND
- [x] LND (REST)
- [ ] LND (Lightning Node Connect)
- [ ] Core Lightning (CLNRest)
- [ ] Nostr Wallet Connect
- [ ] LndHub
Locales
- [ ] I’ve added new locale text that requires translations
- [ ] I’m aware that new translations should be made on the ZEUS Transfix page and not directly to this repo
Third Party Dependencies and Packages
- [ ] Contributors will need to run
yarnafter this PR is merged in - [ ] 3rd party dependencies have been modified:
- verify that
package.jsonandyarn.lockhave been properly updated - verify that dependencies are installed for both iOS and Android platforms
- verify that
Other:
- [ ] Changes were made that require an update to the README
- [ ] Changes were made that require an update to onboarding
Let's move the link off the Channels list view and under Menu > Tools
Can we also have a separate view to show successful rebalances? Maybe something that displays the amount rebalanced and the channels involved.
We still want to allow source and dest picking. Disabling channels based on direction and 0 amounts does make sense. Recording rebalance history is also a good idea.
please check so many locales are not defined in here
The white 'Rebalance Amount:' text here is hard to read. Have the color match the color of the amount.
@cherry-1729-9090 can you please test against embedded LND, LNC, and CLNRest and update the PR description with them once you do?
Having some issues rebalancing with CLNRest in my tests. The self-payment is successful but it's not landing in the destination channel.
When we hit Try Again after a failed rebalance, it would be nice to have all the fields still populated with the values you originally set.
When we hit
Try Againafter a failed rebalance, it would be nice to have all the fields still populated with the values you originally set.
Hmm, sometimes this holds true, but other times it doesn't. Maybe my dev env or is it dependent on which error you hit?
EDIT: at least on LND REST, timeout errors clear the form, whereas insufficient balance errors do not.
Have we done any further testing of CLN rebalancing? If it's not reliable, we should undo the changes for it and disable the functionality.
Curious to hear results from more thorough testing.
Have we done any further testing of CLN rebalancing? If it's not reliable, we should undo the changes for it and disable the functionality.
Curious to hear results from more thorough testing.
I have implemented the CLN rebalancing changes and tested the functionality - the amount transfers between channels are working as expected.
@cherry-1729-9090 The "Rebalance Amount" text color is still not updated; it should match the amount color.
tACK