This modifies the entire repository to use the new formatting of doc
comments in the upcoming Go 1.19 release.
The primary motivating factors for this are:
- Builds check that files are formatted per gofmt and that will no
longer be true as of Go 1.19 without these changes
- Separating all the updates into a single commit ensures these
documentation only formatting changes do not clutter up diffs that
actually change code
For the most part, the changes are just the automated changes suggested
by the Go 1.19 version of gofmt, but there are also a few cases where
the comments were reworded a bit to play nicely with the new formatting
requirements.
For example, the new version of gofmt reformats and collapses nested
lists where as the existing version does not. Thus, instances of nested
lists have been changed to either eliminate them or use mixed markers
which produce expect results.
This modifies the header progress logging function to be concurrent safe
and modifies some comments to call out that the various functions are
concurrent safe.
This isn't strictly necessary with the current code because the function
is only ever called from a single goroutine in the network sync manager,
but the logger is intended to be concurrent safe and future code will
likely make use of it from multiple goroutines.
This modifies blockchain, progresslog, and netsync to provide a progress
percentage when logging the main chain verification process.
A new method is added to blockchain that determines the verification
progress of the current best chain based on how far along it towards the
best known header and blockchain is also modified to log the
verification progress in the initial chain state message when the
blockchain is first loaded.
In addition, the progess logger is modified to log the verification
progress instead of the timestamp of the last block and the netsync code
is updated to make use of the new verification progress func per above.
Finally, the netsync code now determines when the chain is considered
current and logs new blocks as they are connected along with their hash
and additional details. This provides a cleaner distinction between the
initial verification and catchup phase and steady state operation.
This modifies the progress logger to make it a bit more generic so that
it can support logging header sync progress in the future too and
modernizes the code while here.
This splits the block progress logging used by the block manager and
dump blockchain option to a separate internal package named progresslog
and updates its code to be more consistent with the rest of the code
base along the way.
This is a part of the overall effort to decouple the block manager from
the server so it can be split out into a separate internal netsync
package.