rkfg / regolancer

lnd channel rebalancer written in Go
MIT License
47 stars 9 forks source link

Inappropriate rebalances being selected #6

Closed mcsnubbs closed 2 years ago

mcsnubbs commented 2 years ago

I'm currently testing with the config file settings:

econ_ratio: 0.5 lost_profit: true

... and have run the rebalancer with no further parameters specified via command line. Each time, it has selected routes that are inappropriate. For instance, rebalancing a target channel that I currently charge 30ppm with a source currently charging 200ppm.

Also, I've attempted to specify a source channel via command line without any further parameters, hoping regolancer would attempt to find an appropriate rebalance with any possible target channels fitting the liquidity criteria specified in config.json; however, it throws error "No source channels selected." Am I missing something here?

Thanks!

rkfg commented 2 years ago

What was the max fee reported for the route? Does it match the formula here? Are you sure you specified the options correctly? Currently unknown options are ignored, I think it should be fixed to prevent mistakes.

however, it throws error "No source channels selected."

The default liquidity limit is 50%, does your source channel have more than 50% balance on your side considering the amount that will be deducted after successful rebalance? If you want to use it no matter what you should specify --pfrom=100 (or any target above 50) and --allow-unbalance-from.

mcsnubbs commented 2 years ago

I'm sure I'm missing something... heres an example.

config file is:

{
    "macaroon_dir": "/home/regolancer/.lnd/data/chain/bitcoin/mainnet/",
    "macaroon_filename": "admin.macaroon",
    "network": "mainnet",
    "tlscert": "/home/regolancer/.lnd/tls.cert",
    "econ_ratio": 0.2,
    "amount": 10000,
    "min_amount": 5000,
    "probe_steps": 5,
    "pfrom": 10,
    "pto": 30,
    "stat": "stats.csv",
    "lost_profit": true,
    "exclude_channels_in": [
    ],
    "exclude_channels_out": [
    ],
    "exclude_channels": [
    ],
    "exclude_nodes": [
    ]
}
$ go/bin/regolancer -f /home/regolancer/config.json
2022/10/02 06:53:59 Attempt #2, amount: 10000 (max fee: 0)
Total fee: 1
826396237984169984        [allyourbankarebelongtous|75ch|2.96,267,124sat|035fed4182fbd0725264f8a0018cabb6b25514dd231291162ac8dd63afb278e9e8]
825335209304981506 1000   [Xolotl âš¡ LND|47ch|3.82,000,000sat|033b277b17cf7c70fd4de5cbe8dcaeda0cd63d44fcd680f82f76dcac2ebad10c2f]
825424269808435201 10     [Stone Of Jordan|135ch|13.04,996,386sat|02bce4f7ae5b2d51c18575b3f277e296d9df800a54d749d7a3145c9e40237e4011]
815450599751221249 0      [zero fee routing | CLN|1387ch|84.74,988,554sat|038fe1bd966b5cb0545963490c631eaa1924e2c4c0ea4e7dcb5d4582a1e7f2f1a5]
811015169933639681 0      [Thrash.at|134ch|3.77,192,869sat|03ac61c971d146787a036f75e80a9fbede238a75d0c396f1fe996def00f0ac5dbe]
816899756183846912 251    [Milky*Cilia|230ch|25.15,165,870sat|022a03c83e94ab037a64dd71e54f1796db185f21b1d88ceea5486a274ec257e995]

2022/10/02 06:54:13 Success! Paid 1 in fees

... telegram bot reports I paid 126 ppm to rebalance from allyourbanks (currently I charge 50ppm) to Thrash.at (currently I charge 30ppm)

rkfg commented 2 years ago

Yeah, that looks wrong. Do you use the latest version from master? #5 was fixed, when the max fee becomes negative lnd simply ignores this restriction and uses whatever route it finds. In your case it says 0 but if the actual fee is less than 1 sat (and more than -1 sat) it could've been rounded up to zero.

I think I'll add displaying the fee in msats if it's less than 1 sat for clarity. Otherwise the user might think it's free. Always displaying msats is noisy and confusing but in this particular case it's worth it.

mcsnubbs commented 2 years ago

Got it.. Not as familiar w the workings of github, branches/etc… followed this guide with exception of changing version to 1.2.0

https://github.com/satsHIVE/miscellaneous/tree/main/regolancer

On Sun, Oct 2, 2022 at 7:19 AM, rkfg @.***> wrote:

Yeah, that looks wrong. Do you use the latest version from master? #5 was fixed, when the max fee becomes negative lnd simply ignores this restriction and uses whatever route it finds. In your case it says 0 but if the actual fee is less than 1 sat (and more than -1 sat) it could've been rounded up to zero.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

rkfg commented 2 years ago

Yep, could be confusing. Maybe it's better to install with go install github.com/rkfg/regolancer@master instead of @latest. I'm not good at versioning admittedly 😅. Btw cool guide, I didn't expect someone to write it for my software! Feels extremely rewarding, thanks!

mcsnubbs commented 2 years ago

Will give it a try - satsHive did the guide for raspibolt. Thank you

On Sun, Oct 2, 2022 at 7:27 AM, rkfg @.***> wrote:

Yep, could be confusing. Maybe it's better to install with go install @.*** instead of @latest. I'm not good at versioning admittedly 😅. Btw cool guide, I didn't expect someone to write it for my software! Feels extremely rewarding, thanks!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

mcsnubbs commented 2 years ago

The default liquidity limit is 50%, does your source channel have more than 50% balance on your side considering the amount that will be deducted after successful rebalance? If you want to use it no matter what you should specify --pfrom=100 (or any target above 50) and --allow-unbalance-from.

@master worked! Thank you

Using your suggestions above I also tried -pfrom and --allow-unbalance-from in an attempt to force a rebalance with a max ppm as:

$ go/bin/regolancer -f /home/regolancer/config.json pfrom=100 --allow-unbalance-from --fee-limit-ppm=25  --from=828274203871412225

however it still says no source channels exist... that particular channel has about 50% outbound currently. Am I missing any other required flags/attributes? Thank again

mcsnubbs commented 2 years ago

Disregard .... needed --pfrom=100

It works; crazy fast thank you! Will continue experimenting with this

rkfg commented 2 years ago

Glad it worked, I also added displaying msat fees, hopefully everywhere they're shown. They look like 0.350 and such, I tried 350msat but it was lowkey ugly and confusing. And unknown flags should result in descriptive errors now.

rkfg commented 2 years ago

@mcsnubbs Is this still a problem or can be closed?