dcrd/internal/netsync
Dave Collins afe1ba5692
netsync: Rework next block download logic.
Currently, the next blocks that need to be downloaded are determined in
blockchain and returned via a new slice by using a lookahead method
along with allowing the caller to specify a map of blocks to exclude for
the blocks that have already been requested.

While this method works fine for a single peer, it does not lend itself
well to parallel block downloads.  Further, the lookahead mechanism
imposes an artificial limit on the number of outstanding requests which
is not something that it should be concerned with and it also is not
particularly efficient since it results in new allocations every time it
is queried.

Consequently, this reworks the logic such that the function in
blockchain accepts a backing array from the caller that is populated via
an allocation-free windowing mechanism and the sync manager now
maintains that array along with additional logic to detect when to
update it.  Not only is the new approach quite a bit more efficient, it
removes the artificial limits on outstanding requests so they can be
tuned as needed by the sync manager.
2021-11-24 23:53:45 -06:00
..
doc.go netsync: Add package documentation. 2020-12-15 13:26:57 -06:00
interface.go netsync/server: Update peer heights directly. 2021-01-07 17:15:36 -06:00
log.go multi: Add chain verify progress percentage. 2021-01-21 23:30:35 -06:00
manager.go netsync: Rework next block download logic. 2021-11-24 23:53:45 -06:00
README.md netsync: Add package documentation. 2020-12-15 13:26:57 -06:00

netsync

Build Status ISC License Doc

Package netsync implements a concurrency safe block syncing protocol.

Overview

The provided implementation of SyncManager communicates with connected peers to perform an initial block download, keep the chain in sync, and announce new blocks connected to the chain. Currently the sync manager selects a single sync peer that it downloads all blocks from until it is up to date with the longest chain the sync peer is aware of.

License

Package netsync is licensed under the copyfree ISC License.