-
Notifications
You must be signed in to change notification settings - Fork 942
Reduce rescanning on startup #1179
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
Comments
Ping @rustyrussell and @ZmnSCPxj |
The "best" solution I can think, is indeed to save onchaind state ondisk. I think it should be possible to design a DB table for onchaind state and have well-defined changes to that table. However we would need to almost rewrite onchaind; instead of writing to in-memory structures, perform DB updates. The alternative easier solution is indeed to log ondisk the messages that got sent intermediately. This feels like a hackish solution.... The issue is that when we save ondisk, we will be practically committing ourselves to support that form, or at least be able to upgrade from that form. We could start with the "message log" solution though. We could add some kind of versioning (similar to |
So I guess one final solution would be to adjust the first_blocknum logic to just start before the first ever funding_tx spend, which would maintain the current behavior and would add minimal code changes. It's quick and easy, but it may result in us rescanning up to 2016 blocks with some settings. At 6 blocks processing per second on my machine that's still 5.6 minutes. |
i would love if this issue was prioritised. it takes one of my nodes over a week to catch up with all blocks from the oldest channel. throwing more cpu and ram on the node did little improvement. |
still can't get my node in sync because of constant crashes (#1308) . |
@robtex are you sure |
Promoting to 0.6, it is affecting people paying SLEEPYARK and slowing down Blockstream world domination. |
Limited the rescan on SLEEPYARK, but that's just a stopgap solution. |
@cdecker is that something i can try? otherwise i think my node has caught up in less than a week from now, it has stopped crashing. touch wood.
|
@Sjors
|
@robtex I'm working on the patch now, but it's hard since we were replaying some of the state from on-chain to drive |
If you update to the latest commit the rescan will not go below the blockheight of the first mainnet channels (504500) so that'll at least limit the rescan time considerably. I'll ping you as soon as I have the no-rescan PR ready. |
great, thanks! appreciate your work and looking forward to the PR! |
Now that we have blockchain tracking with #1117 it would be nice to reduce the need to rescan from a fixed blockheight on every startup. The main issue that I see is that we have
onchaind
that may be running, triggered by seeing a spend on-chain, and not getting triggered after the restart.A simple proposal would be to have a relative rescan period that is larger than the maximum
onchaind
lifetime, e.g., 288 blocks. However, that period may need to be rather large, also due to HTLCs timeouts.The more involved solution would be to remember the state of
onchaind
across restarts, though I'm not clear about how much we'd need to remember there, and what format we could use. Again, a simple solution would be to just store the messages we sent toonchaind
in an append-only log in the DB and pruning onceonchaind
is happy and closes on its own.What do you guys think makes the most sense in this situation? I have reports from users that take hours to catch up with the blockchain and I think it may also be causing a few of the
awaiting funding locking
issues that get reported (funding depth callback not being triggered on the remote end).The text was updated successfully, but these errors were encountered: