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

Feature: Just-in-time rebalance for pay #2683

Open
4 tasks
ZmnSCPxj opened this issue May 27, 2019 · 0 comments
Open
4 tasks

Feature: Just-in-time rebalance for pay #2683

ZmnSCPxj opened this issue May 27, 2019 · 0 comments

Comments

@ZmnSCPxj
Copy link
Collaborator

If all our channels are too low to pay an invoice, but the sum of the spendable on those channels should be high enough, we should rebalance on the next pay attempt to consolidate our funds.

We need these:

  • Suggestion: lower-level "paycode" below "invoice" level #2666 Suggestion: lower-level "paycode" below "invoice" level - to not interfere with our own incoming invoices being watched by waitanyinvoice.
  • ensurepayable <channel> <amount_msat> <fee_budget_msat> -> success/fail - Ensure that the specific channel has a spendable amount greater or equal to amount_msat, spending at most fee_budget_msat to rebalance. This (and plugin: Implement the htlc_accepted hook #2267) can be used later by JIT-routing by @renepickhardt.
  • selectconnectedchannel [<min_capacity_msat>] [<node>] -> {'channel': <channel>}/fail - Select a well-connected local channel. If min_capacity_msat is specified, only select a channel whose capacity is at least the given capacity. If node is specified, prefer channels that are well-connected to this (possibly very remote) node. I think the "RouteBoost" code in invoice can work for the initial version of this; ignore node for now, but leave it as a future point for improvement later.
  • In the pay loop that creates the initial excludes, if all local channels get excluded, check if the total spendable is above the payment amount + fee budget. If so, selectconnectedchannel to the destination node and ensurepayable the returned channel, with a fraction of our own fee budget.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant