Skip to content

Performance decreases when using Lightning Charge and the amount of invoices increases #28

Closed
@philippgille

Description

As mentioned in the v0.5.0 release notes, the ln.charge implementation of the wall.LNclient interface currently becomes slower when the amount of invoices in the Lightning Charge server increases.

The reason is that ln-paywall currently uses the payment hash (a.k.a. preimage hash) of an invoice as ID, which works fine with lnd (and would also work with eclair). But Lightning Charge uses its own randomly generated IDs, so instead of fetching the specific ID we need, we fetch all IDs and filter out the one we're looking for by comparing the preimage hashes.

The solution is to add the implementation specific ID as field to the wall.invoiceMetaData so it can be stored, and when a client sends the final request we can still use the preimage hash to fetch the metadata from the storage, but then use the ID within that data to make the lookup on Lightning Charge.

This leads to the ID and the preimage hash fields being the same when using lnd. We could omit one of the fields and just use one of them, but this could also lead to confusion later.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions