Skip to content

Add PersistToDisk property to ChainService #36

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

buck54321
Copy link
Contributor

lightninglabs/neutrino#194

Previously PersisToDisk is an option to GetCFilter.
The problem is that the option is not working well with the in-memory
FilterCache. The biggest problem is that if there are two calls of
GetCFilter, the first one without the PersistToDisk option, and the second
one with the PersistToDisk option, the second one returns the filter from
the cache and doesn't write it persistently to the disk.
Consequently, if a filter was already queried, there is no way to write it
to disk. So for instance if a neutrino user (mainly lnd) is closed before
it is fully synchronized, it need to re-download all the filters when it
runs again.
When handling the PersistToDisk in the ChainService itself, the caller of
NewChainService decides in _one place_ if the filters need to be stored
in the disk, and that will not depend on the order of calls to
GetCFilter.

buck54321 and others added 7 commits August 4, 2022 22:59
This is useful for enabling shorter timeouts than we would use in a
production environment in testing environments, resulting in shorter
test execution times. If a timeout isn't provided, we'll use the default
of 5 seconds.
We do this to ensure the address manager contains live addresses.
Previously, addresses with which we established connections with would
not be marked as connected because it would be done once we disconnect
peers. Given that we don't process all of the disconnect logic when
we're shutting down, addresses of stable and good peers would never be
marked as connected unless the connection was lost during operation.
neutrino: refactor OnVersion to instead add peers within OnVerAck
server: Actively prevent regnet network discovery
Previously PersisToDisk is an option to GetCFilter.
The problem is that the option is not working well with the in-memory
FilterCache. The biggest problem is that if there are two calls of
GetCFilter, the first one without the PersistToDisk option, and the second
one with the PersistToDisk option, the second one returns the filter from
the cache and doesn't write it persistently to the disk.
Consequently, if a filter was already queried, there is no way to write it
to disk. So for instance if a neutrino user (mainly lnd) is closed before
it is fully synchronized, it need to re-download all the filters when it
runs again.
When handling the PersistToDisk in the ChainService itself, the caller of
NewChainService decides in _one place_ if the filters need to be stored
in the disk, and that will not depend on the order of calls to
GetCFilter.
@zquestz
Copy link
Contributor

zquestz commented Jan 4, 2025

Sorry for the long delay. We are finally getting this project back up and running and love the changes. That being said they need to be rebased against the latest code.

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.

5 participants