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

Support new on-the-fly funding #632

Merged
merged 25 commits into from
Oct 4, 2024
Merged

Support new on-the-fly funding #632

merged 25 commits into from
Oct 4, 2024

Conversation

dpad85
Copy link
Member

@dpad85 dpad85 commented Oct 1, 2024

This PR adds support for the new on-the-fly funding based on liquidity ads.

For the user, it's an UI change : the cost that is sometimes incurred when receiving payments is (in some cases) not displayed as fees anymore ; instead it's displayed as a separate automated liquidity payment.

The liquidity payment details screen shows links to the incoming payments that triggered the liquidity payment. This will help user track the source of the liquidity purchases.

Notes:

Rationale

This update will allow for more options regarding liquidity and funding in the future. For example, opportunistically request additional funding on-the-fly. It also demonstrates how liquidity works, and should help users make informed decisions about how they want liquidity to be managed by the wallet.

More details can be found here:

Screenshots

image image image

- Updated the liquidity policy (see NodeParamsManager). We
are using a policy that does not target additional liquidity
and that does not use fee credit yet.

- Removed the code updating the peer's swap feerate (it's now
provided by the LSP)

- Updated the received-with database object with new types:
incoming LN payments may contain a funding fee ; payments may
be received through a fee credit (not enabled for now).

- Updated the liquidity-purchase database objects with new
purchase & payment-details type. The lease data are now
legacy and are removed wherever possible.

Note: for the inbound liquidity db objects, we are moving
away from the type_version pattern for serialisation. Instead
the json data type is embedded inside the json by the kotlinx
serialisation library. This makes the code less verbose.

- Added a liquidity purchase wrapper for cloud data.

- Updated the Notification types with new rejection options.
We try to match in this update the serialisation pattern that
was mentioned above.
With the new on-the-fly mechanism, the automated liquidity
operation necesssary to receive some payments are stored as
specific payments. That is, the incoming payments related
to this operation do not have a fee, instead there's a
payment row in the payments history specific to the liquidity
purchase. The operation also has its own payment details page
just like the (already existing) manual liquidity purchase.

The splash screen file has been split into several files, one
for each payment types. This makes the code more flexible.

The liquidity policy objects set in the channels management
screen have been updated to match the NodeParamsManager value.

This commit is a WIP, especially for wording and localisation.
Depends on lightning-kmp master minus kotlin-2.0
This is useful to track the fees incurred by an incoming payments
because of a liquidity purchase.

Also fixed payments history ordering. The sort logic is now:
- created_at for outgoing payments
- received_at for incoming payments

Also improved descriptions for CSV writer to be more neutral and
more informative.
… is shown or not

See ACINQ/lightning-kmp#706

Methods feePaidFromChannelBalance and feePaidFromFutureHtlc have been added
to check whether an inbound liquidity purchase is paid from balance or future
htlc. This is used to know when to display a liquidity fee or not, and to get
the liquidity fee for an incoming payment.

Also fixed some UI issues with descriptions and improved txid and channel id
buttons in technical screen.
Also fixed several UI issues.
Also added 2 helper extensions methods in shared module.
Also removed channel-funding notification which is replaced
by a generic error.
@dpad85 dpad85 marked this pull request as ready for review October 2, 2024 15:41
dpad85 added 3 commits October 3, 2024 11:49
The business variable should be set asap to allow proper
cancelling if the worker is cancelled early.
@dpad85 dpad85 requested a review from robbiehanson October 4, 2024 13:52
@dpad85 dpad85 merged commit 5fbe04e into master Oct 4, 2024
@dpad85 dpad85 deleted the new-otf2 branch October 4, 2024 15:19
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.

2 participants