-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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]: reduce rescan bandwidth for mobile #9299
Comments
Noting here that on Breez large chunks of neutrino filters are removed on disk to save storage space. So where otherwise neutrino could load previously loaded filters from disk, in the mobile case they will have to be fetched from a remote peer instead. |
Are you disabling the height hint cache? It's purpose is to checkpoint where the last scan ended, to prevent starting from scratch each time. |
We currently implement that by deleting the channel state once things are fully added to the graph: Lines 1246 to 1255 in 94f7ed4
So then it should fail here on restart: Lines 1115 to 1124 in 94f7ed4
|
No. it's not disabled.
I see. I think the issue is then that that point is simply never reached. Scanning 100k blocks backwards on a mobile device is pretty much impossible because users tend to close the app before that's complete. I think the main issue here is that it's scanning the chain backwards. I cannot see how the height hint cache helps here, because there would never be any progress on the start height? |
Is your feature request related to a problem? Please describe.
LND does historical rescans for spent utxos on startup. This happens on every startup, regardless of the state of the previous rescan. For mobile devices this is problematic, because it costs a lot of bandwidth. With Breez, we're seeing users apps consuming gigabytes of data in a matter minutes due to these historical rescans.
The culprit, I believe, is in the funding manager. Let me walk you through the process.
We're discussing zero conf channels here, as context.
advanceFundingState
for every channel.stateStep
based on the current channel state.addedToGraph
, and the channel is a zero conf channel, it will callwaitForZeroConfChannel
.waitForFundingWithTimeout
waitForFundingConfirmation
RegisterConfirmationsNtfn
In this case we're using neutrino.
RegisterConf
on the tx notifierHistoricalConfDispatch
herenotificationRegistry
historicalConfDetails
are requestedNote that this will happen on EVERY start. Regardless of whether LND has seen the funding transaction being confirmed before. If the user has a channel created 100k blocks ago, this will rescan the chain 100k blocks, costing gigabytes of data in a short period of time. The state machine switched on here has
addedToGraph
as its final state. There is no "we have seen the funding transaction before, don't worry about it" state, which I think should be added if the confirmation of the funding transaction is already known.Describe the solution you'd like
Please ensure that restarts with zero conf channels and neutrino don't rescan the chain on every restart.
The text was updated successfully, but these errors were encountered: