We want to cache the following values:
<coin>_channel_min_in (default 15% of total channel capacity, all
<coin>_channel_min_out (default 15% of total channel capacity, all
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.
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.
Could you help me think this through? @offerm @sangaman
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.
Oh I think this would actually be closed by #850, can you confirm @erkarl ?
@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.
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 ?
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.
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
Let's keep this issue for caching these values and deal with the alerts separately.
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
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 ?
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.