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

Caching Channel Balance Thresholds #680

Closed
kilrau opened this issue Nov 16, 2018 · 12 comments
Closed

Caching Channel Balance Thresholds #680

kilrau opened this issue Nov 16, 2018 · 12 comments
Assignees
Labels
enhancement New feature or request P2 mid priority

Comments

@kilrau
Copy link
Contributor

kilrau commented Nov 16, 2018

We want to cache the following values:
<coin>_channel_min_in (default 15% of total channel capacity, all channels aggregated)
<coin>_channel_min_out (default 15% of total channel capacity, all channels aggregated)

This issue is just about caching the value, we'll take care of rebalancing & other actions like sending alerts in follow-up PRs. The % should be configurable either via xud.conf/cli paramter requiring a restart, better even with a separate cli call not requiring to restart xud. The cached values should be updated every 60s and immediately after each trade.

@kilrau kilrau added this to the 1.0.0-alpha.6 milestone Nov 16, 2018
@kilrau kilrau added enhancement New feature or request lightning Lightning network & lnd integration raiden labels Nov 16, 2018
@kilrau
Copy link
Contributor Author

kilrau commented Nov 16, 2018

Since both parties of a channel will reach the threshold at the same time (assuming both use the default), there needs to be a negotiation who takes over re-balancing/splicing.

@kilrau kilrau modified the milestones: 1.0.0-alpha.6, 1.0.0-alpha.7 Dec 6, 2018
@kilrau kilrau modified the milestones: 1.0.0-alpha.7, 1.0.0-alpha.8 Jan 2, 2019
@kilrau kilrau added the question/tbd Further information or discussion needed label Jan 2, 2019
@kilrau
Copy link
Contributor Author

kilrau commented Jan 2, 2019

Could you help me think this through? @offerm @sangaman

@kilrau kilrau changed the title Channel Balance Thresholds [Concept] Channel Balance Thresholds Jan 2, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.7, 1.0.0-alpha.8 Jan 23, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.8, 1.0.0-alpha.9 Feb 5, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.9, 1.0.0-alpha.10 Feb 20, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.10, 1.0.0-alpha.12 Mar 6, 2019
@kilrau
Copy link
Contributor Author

kilrau commented Mar 26, 2019

Assigned to you since you were dealing with similar checks in #675 @erkarl

Again, this issue is just to cache the value. Please give feedback so that we can move to implementation on this soon.

@kilrau kilrau assigned ghost Mar 26, 2019
@sangaman
Copy link
Collaborator

Oh I think this would actually be closed by #850, can you confirm @erkarl ?

@ghost
Copy link

ghost commented Mar 27, 2019

@sangaman Yes, it feels pretty related.

@kilrau as of now we're caching the maximum outbound channel balance values (per currency) every 60 seconds. I'm not completely clear on the X% max in/out rule.

@sangaman
Copy link
Collaborator

Oh actually I think I overlooked that this is supposed to be dealing with rebalancing. That's a complicated issue as far as I know, could you provide more details of what you have in mind @kilrau ?

@kilrau
Copy link
Contributor Author

kilrau commented Apr 2, 2019

Sry for the super-late reply.

caching the maximum outbound channel balance

Great - I see #850 via channelBalance is already aggregating outbound (local) balances of all channels for one currency! Now we'd need the same for the inbound (remote) balances, to do a sanity check there too - added a comment.

I'm not completely clear on the X% max in/out rule.

This issue is about defining thresholds to throw alerts (not in scope of this issue, I just opened #864 for this) when one side of the channel falls below a certain percentage of the channels total (inbound+outbound) capacity. But thanks for questioning this, all channels aggregated, how I originally wrote it doesn't make sense just yet. I believe we are going for a "direct channel" approach, hence we should throw alerts if one particular channels is unbalanced. These are the proposed cached values which should be updated regularly:
<coin>_channel_min_in (15% of total channel capacity)
<coin>_channel_min_out (15% of total channel capacity)

This is what this issue is about: caching (& updating) these 2 values. General "direct channels" discussion here.

Oh actually I think I overlooked that this is supposed to be dealing with rebalancing. That's a complicated issue as far as I know, could you provide more details of what you have in mind @kilrau ?

It's just about caching the channelBalance value, not dealing with any rebalancing. That's indeed complicated and for a later stage. For now we just want to alert the exchange.

@kilrau
Copy link
Contributor Author

kilrau commented Apr 9, 2019

Does it make sense to you to cache these two values as preparation for #864 ? Or would you prefer to do it all at once - also fine! @erkarl

@ghost
Copy link

ghost commented Apr 10, 2019

Let's keep this issue for caching these values and deal with the alerts separately.

@kilrau kilrau added P3 low priority P2 mid priority and removed question/tbd Further information or discussion needed lightning Lightning network & lnd integration raiden P3 low priority labels Apr 11, 2019
@kilrau kilrau changed the title [Concept] Channel Balance Thresholds Channel Balance Thresholds Apr 11, 2019
@kilrau
Copy link
Contributor Author

kilrau commented Apr 26, 2019

Agree to skip inbound balance, because no direct lnd api call available, plus dependent on other nodes to open channels to my node anyways. So this issue is about implementing a configurable threshold on aggregated channel outbound balance. @erkarl

@kilrau kilrau modified the milestones: 1.0.0-sprint.12, post-1.0.0 May 7, 2019
@kilrau kilrau unassigned ghost May 8, 2019
@kilrau kilrau removed this from the post-1.0.0 milestone Jun 11, 2019
@rsercano rsercano self-assigned this Oct 19, 2020
@rsercano rsercano changed the title Channel Balance Thresholds Caching Channel Balance Thresholds Oct 19, 2020
@rsercano
Copy link
Collaborator

Agree to skip inbound balance, because no direct lnd api call available, plus dependent on other nodes to open channels to my node anyways. So this issue is about implementing a configurable threshold on aggregated channel outbound balance. @erkarl

Hi @kilrau is this still valid, should we cache only outbound balance's configured percentage ?

@kilrau
Copy link
Contributor Author

kilrau commented Oct 19, 2020

Hi @kilrau is this still valid, should we cache only outbound balance's configured percentage ?

LND 0.12 will return inbound balance with the channelbalance call. So we should do both. The PR is already merged, you can run lnd master to test.

@kilrau kilrau closed this as completed Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 mid priority
Projects
None yet
Development

No branches or pull requests

4 participants