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

Configure min|max channel size #74

Closed
wants to merge 2 commits into from

Conversation

willcl-ark
Copy link
Contributor

This PR aims to allow users to configure {min|max} channel sizes that CLBOSS should open. Motivation is wanting to permit CLBOSS to open larger channels.

This is presented as an advanced configuration option passed to lighthingd and if unset the current defaults remain.

Currently untested (CLBOSS doesn't seem to like my tiny regtest network of 2 nodes!) and no tests written. These may be added to this PR shortly if there is interest.

@ZmnSCPxj interested in your feedback on whether you want to see advanced config options like this in CLBOSS at all? The other alternative is to add some interior logic which opens larger channels if there is a large wallet balance in lightningd, or perhaps even uses a target "number of channels" to open e.g. ~5 channels. If you drop 0.1 BTC in, there won't be any wumbo channels, but if you drop 1 BTC in it might open one or two wumbo channels?

The final alternative is to do nothing at all, and CLBOSS will simply keep making many channels under the previous soft channel limit of 0.16...btc.

Fixed in:
Boss/Msg/ManifestHook.hpp
Boss/Msg/ManifestNotification.hpp
@willcl-ark
Copy link
Contributor Author

This implementation is not yet complete, you'd ideally like to guarantee that your counterparty also has some large-capacity channels so that your liquidity is not locked up wastefully.

As we already check for nodes with "too little capacity to be worth channeling with", this would want to be extended to consider increased capacities of potential wumbo peers.

Boss/Mod/ChannelCreator/Manager.cpp Outdated Show resolved Hide resolved
>([this, &custom_max_amount](Msg::Option const& o) {
if (o.name != "clboss-max-channel-size")
return Ev::lift();
custom_max_amount = Ln::Amount::sat((double) o.value);
Copy link
Owner

Choose a reason for hiding this comment

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

Why not just:

max_amount = Ln::Amount::sat((double) o.value);

and remove the custom_* variiables completely?

Also I prefer the casting style double(o.value) over (double) o.value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes a lot more sense. Now updated (and fixed indentation inside the lambdas to match your style, I think!)

@willcl-ark willcl-ark force-pushed the channel-size branch 2 times, most recently from dc4957f to 521e38f Compare October 6, 2021 09:01
* Permit modification of ChannelCreator {min|max}_amount

* Change the minimum and maximum channel sizes CLBOSS will try to create
using `clboss-{min|max}-channel-size` flags with lightningd

Signed-off-by: willcl-ark <[email protected]>
Copy link
Owner

@ZmnSCPxj ZmnSCPxj left a comment

Choose a reason for hiding this comment

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

Code itself looks fairly good; what are your further plans?

Re: indent: I use tabstop=8 and actual tab chars, not spaces.

, Json::Out::direct(min_amount.to_sat())
, "Minimum channel size CLBOSS will create. "
"Set to an integer number of satoshis. "
"default=500000"
Copy link
Owner

Choose a reason for hiding this comment

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

ManifestOption accepts a std::string in this position, so it should be possible to get this from the default_max_amount value with some amount of + and std::string concatenation.

@jonasnick
Copy link

Just want to state that I'd like to open larger channels. So this would be useful.

@willcl-ark
Copy link
Contributor Author

OK I got #reckless and ran this patch on mainnet where it successfully opened channels only between the sizes specified in the config file 👍🏼

@ZmnSCPxj I wonder if we want to as part of this PR bump the default max size of a channel to somewhere in the range 1,000,000 - 2,000,000 satoshis, as this is what certain services (e.g. LNRouter, maybe also lightning.terminal -- not sure) are "expecting" for a "good" routing channel?

@ZmnSCPxj
Copy link
Owner

ZmnSCPxj commented Dec 2, 2021

default max size of a channel to somewhere in the range 1,000,000 - 2,000,000 satoshis

You want to lower the MAX size from 16,777,215sats to just 2,000,000 sats? That seems restrictive --- I would expect such secondary tools to actually prefer larger channels?

@willcl-ark
Copy link
Contributor Author

Youre right I have it backwards-- I would not like to do that! But in perhaps default min_amount should be increased to 2,000,000 or 1,000,000?

Opening channels of a lesser size than that does not seem optimal nowadays.

@ZmnSCPxj
Copy link
Owner

ZmnSCPxj commented Dec 3, 2021

1,000,000sats for now please. An issue is that triggering of channel creation may also need rethinking as well due to this minimum channel size --- ChannelCreationDecider currently triggers on 1,000,000 sats onchain, theminimum channel size may need to affect that module too.

It might be better to move those settings to ChannelCreationDecider, and have it trigger on min_channel + reserve instead. And send the min_channel and max_channel settings via the Boss::Msg::RequestChannelCreation message (i.e. modify the message to include those fields) to ChannelCreator, and have its manager extract the settings from the message.

@ZmnSCPxj
Copy link
Owner

ZmnSCPxj commented Dec 3, 2021

We probably also want to impose 500000sat <= min_channel < max_channel <= 16777215sat.

@ZmnSCPxj
Copy link
Owner

Closing since similar behavior already exists

@ZmnSCPxj ZmnSCPxj closed this Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants