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

[Memory] Persist counterparty_claimable_outpoints out of channel_monitor #3049

Open
5 of 9 tasks
G8XSU opened this issue May 7, 2024 · 2 comments
Open
5 of 9 tasks
Assignees

Comments

@G8XSU
Copy link
Contributor

G8XSU commented May 7, 2024

Problem:
After every commitment signed, counterparty_claimable_outpoints keeps on growing without bounds within a channel_monitor, with a new hashmap entry for each commitment_tx.

It poses two problems mainly:

  1. Increased memory footprint, since all the active channel_monitors are stored in-memory.
  2. Increased channel_monitor on-disk size, where these are currently stored.

We don't want to keep on storing outpoints which will only be used for revoked_tx / funding_spend, instead we would like to store them in cold storage and read them only when required.

Ideal outcome: After doing this, Ldk's memory footprint should be drastically decreased owing to removed in-memory hashmap entries of counterparty_claimable_outpoints

@G8XSU G8XSU self-assigned this May 7, 2024
@G8XSU
Copy link
Contributor Author

G8XSU commented May 7, 2024

@G8XSU
Copy link
Contributor Author

G8XSU commented May 17, 2024

++

  • Remove watched_outputs dependency on per_commitment_claimable_data. (because if they depend on claimable_data, we won't outputs untill user provides us with ClaimInfo, and they won't be returned from tx_confirmed)
  • In case when no htlcs have been forwarded, counterparty_claimable_outpoints will not have ClaimInfo. We don't want to treat missing ClaimInfo as acceptable, hence we need to write empty ClaimInfo so that user can always provide us with Some() ClaimInfo after ClaimInfoRequest.

G8XSU added a commit to G8XSU/rust-lightning that referenced this issue Jun 1, 2024
This removes dependency of watched_outputs from
per_commitment_claimable_outpoints, it is required since we will
no longer have direct access to per_commitment_claimable_outpoints
once we start publishing PersistClaimInfo as part of lightningdevkit#3049.
G8XSU added a commit to G8XSU/rust-lightning that referenced this issue Jun 1, 2024
This removes dependency of watched_outputs from
per_commitment_claimable_outpoints, it is required since we will
no longer have direct access to per_commitment_claimable_outpoints
once we start publishing PersistClaimInfo as part of lightningdevkit#3049.
G8XSU added a commit to G8XSU/rust-lightning that referenced this issue Jun 3, 2024
This removes dependency of watched_outputs from
per_commitment_claimable_outpoints, it is required since we will
no longer have direct access to per_commitment_claimable_outpoints
once we start publishing PersistClaimInfo as part of lightningdevkit#3049.
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

No branches or pull requests

1 participant