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
This issue is intended to be a running checklist of several of the planned and necessary refactors in order to properly support efficient multi-peer parallel downloads. It will be a multi-month effort and is being provided in order to help prevent duplication of effort and to avoid merge conflicts if anyone was also thinking of working in the referenced areas.
Given how drastic the overall changes will be, some of these will very likely need to be updated as the work proceeds since unexpected things invariably come up during large development efforts such as this.
More accurately reflects its purpose of testing block template proposals and uses this fact to be more restrictive about the allowed inputs and to avoid performing the proof of work check. In particular, the provided block template must only build from the current tip or its parent or an error should be returned.
Since every block node will be in memory, the code which reconstructs headers from block nodes means that all headers will always be served from memory which will be important since the network will be moving to header-based semantics
Several of the error paths can be removed since they will no longer be necessary
It will no longer be expensive to calculate CSV sequence locks or median times of blocks way in the past
It will be much less expensive to calculate the initial states for the various intervals such as the stake and voter version
It will be possible to create much more efficient iteration and simplified views of the overall index
Since the entire block index will be in memory, this code can be significantly optimized to use a node that is already in memory versus requiring the entire block
The block locator code can be significantly optimized once the full block index is in memory since it will no longer be necessary to consult the database
The code to discover inventory can be significantly optimized once the full block index is in memory since it will no longer be necessary to consult the database
Since headers can be reconstructed from a block index node and the full block index will be in memory, it will no longer be necessary to consult the database
This will be a major optimization for several functions because they will no longer have to first consult the database (which is incredibly slow in many cases due to the way leveldb splits all of the information across files) to perform lookups and determine if blocks are in the main chain
Chain views can take advantage of the fact that all block nodes will be in memory to provide a flat view of a specific chain of blocks (a specific branch of the overall block tree) from a given tip all the way back to the genesis block
An example of some benefits are:
Efficiently comparing two views
Quickly finding the fork point (if any) between two views
O(1) lookups of nodes at a specific height
Possibility for more efficient block locator code through the use of the aforementioned O(1) height lookups
Possibility for efficient skip lists for ancestor iteration
This will further speed up areas such as best chain selection, best chain membership testing, fork finding, and block locator generation
It will also simplify some of the more challenging parts of the code since it will more cleanly separate the chain-specific logic from the block index logic
This will help ensure that no more than one attempt is made to reorganize to an invalid chain and valid blocks are not evaluated more than once during reorganizations
It will avoid a lot of potential unnecessary extra work when moving to parallel insertion in the future
It will allow more accurate reporting on the order in which historical side chains tips (aka orphaned blocks) were handled
The logic is currently backwards in that the current UTXO set does not include the tip block until it is approved by voters which leads to a plethora of undesirable behavior
This will allow all UTXO-related code to be significantly simplified
Since connection is necessarily linear and all inputs reference previous outputs, performing the updates in memory with periodic writes to the database will allow intermediate states to effectively be skipped
This will allow the headers to be stored independently and ensure they all connect as well as providing all of the information needed to determine exactly which blocks comprise the chain with the most work without relying on checkpoints
This will break the reliance on blindly requesting newer blocks from peers
It will also pave the way towards implementing the logic necessary to request blocks from multiple peers
Modify the block download logic to request blocks from multiple peers in parallel
Track the best known block announced by each peer as an efficient mechanism to discover which blocks are available to download from each peer -- Implemented by PR netsync: Track best known blocks per peer. #3443
Refactor the header sync peer to be part of the header sync state
Request blocks from multiple peers in parallel using the information added by the previous steps
Deprecate all code related to the notion of a sync peer
This will also involve several other steps such re-requesting any data that has not been delivered after a certain time, weighting towards faster peers, and blacklisting misbehaving peers
This issue is intended to be a running checklist of several of the planned and necessary refactors in order to properly support efficient multi-peer parallel downloads. It will be a multi-month effort and is being provided in order to help prevent duplication of effort and to avoid merge conflicts if anyone was also thinking of working in the referenced areas.
Given how drastic the overall changes will be, some of these will very likely need to be updated as the work proceeds since unexpected things invariably come up during large development efforts such as this.
CheckConnectBlocktoCheckConnectBlockTemplate-- Implemented by PR blockchain: CheckConnectBlockTemplate with tests. #1086CSVsequence locks or median times of blocks way in the pastleveldbsplits all of the information across files) to perform lookups and determine if blocks are in the main chainCheckTransactionInputs-- Implemented by PRs blockchain: Separate tx input stake checks. #1452, blockchain: Ensure no stake opcodes in tx sanity. #1453, multi: No stake height checks in check tx inputs. #1457, and multi: Cleanup and optimize tx input check code. #1468blockchainpackagenetsyncpackage -- Implemented by PR netsync: Split blockmanager into separate package. #2500serverPeer-- Implemented by PR blockmanager: remove serverPeer from blockmanager completely. #1735