- From the current tip of the node, it will request headers from all its peers (which will likely be redundant), extending the best chain of headers.
- As soon as the best chain of headers is updated (extended or reorged), the node will query the block content. Block content queries are spread among all the node's peers.
- Upon reception, blocks are statically checked (block size, coinbase tx, etc..).
- The node then checks whether all transactions in the block are valid and if they are it adds them to a global index of valid transactions.
- ? I suppose you have a mechanism to mark blocks as fully validated in the header chain, to be able to trigger the final step of validation after all blocks before a certain point were fully validated ?
- Once all blocks in the best headers chain are checked (valid block + valid txs), you go through the chain to check there were no double spend.
Is that correct, as a general description? The large speedup compared to Core comes from the fact that steps 2. to 4. can be performed concurrently. Now i still need to more precisely document what indexes you keep to be able to perform this concurrently, but i wanted to make sure i had the big picture right already.