You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: sync faster using stored state from last time. #1168
It takes only a fraction of a second to crash lightningd, but many hours to sync. I'd prefer if it at least attempt to save some of the sync state so that when it recovers, it can resume syncing at a less drastically long sync size.
I understand that one of the things you don't want with Lightning Network is a node using old state on a channel.
The hardball way to get around that is to do periodic saves of state, and then when restarting, load the state from a fresh perspective and sync from that periodic save point. The only items that need to be saved are those items that the node would recover upon a restart by scanning the blocks. One idea is to simply save every relevant transaction in the blockchain as the node runs, and then know the last fully saved transaction block, and upon restart, load all of those transactions instead of parsing full blocks; that is slower than saving a state and resuming from that state, but it might just be faster than going through full blocks and the code would be less intense. A hybrid approach of doing both would work, too. As implementation, both could be programmed, with attention paid to the journaling of transactions first, and get it running first, then keep saving state but not using it to resume, slowly implementing a background "what if" state checker that checks to see if saved state equals journaled transaction state recovery, just to test the idea. Ideas?
The main blocking issue before we can just continue at the last height minus some overlap is described in #1179, as soon as we get that fixed we can speed this up a lot.
Activity
Ulmo commentedon Mar 4, 2018
I'm trying to understand the scanning functions. Here's one function I'm reading in lightningd/watch.c:
Where is txwatch_hash_first and txwatch_hash_next defined? Aha, found it:
Would implementing a journaling function of relevent transactions to sync from be good in this function?
Ulmo commentedon Mar 4, 2018
All the table hashing is interfering with my reading of it. I'll get back to this later. What's being table hashed?
cdecker commentedon Mar 4, 2018
I profiled the block sync for #1117, which also attempts what you are describing:
https://www.dropbox.com/s/d0sevdhbdmz5gm9/lightning-perf-20180304.svg
Most of the time is spent parsing the block (no surprise there, they're sort of big), and computing the txid.
cdecker commentedon Mar 6, 2018
The main blocking issue before we can just continue at the last height minus some overlap is described in #1179, as soon as we get that fixed we can speed this up a lot.
cdecker commentedon Mar 29, 2018
Duplicate of #1179