Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backport] Add log output during initial header sync
Co-Authored-By: Calin Culianu <calin.culianu@gmail.com> Summary --- This is a backport of core #15615. It adds logging on initial header synch so that users monitoring the log know what is happening. It actually was always a pet peeve of mine that when synching a brand new chain, you end up having bitcoind sit there doing nothing for a while in the beginning. It is actually downloading headers during this time but the log file has no new progress until it finishes, at which point it proceeds to download blocks. This backport fixes this. It adds progress information as it initially downloads headers. Note that the original core backport was modified: - Made the code easier to read - The core version was holding `cs_main` needlessly -- this version does not hold `cs_main` while it composes and prints the log message. This is because it is not necessary to hold `cs_main` here (working with CBlockIndex references is always lock-free in this codebase). Test Plan --- - `ninja check check-functional` - Start a new testnet synch and monitor the log. You should see messages like so on initial header synch: 2020-11-04T03:13:59Z Synchronizing headers, height: 78000, progress: 16.6% 2020-11-04T03:13:59Z Synchronizing headers, height: 80000, progress: 16.9% 2020-11-04T03:14:00Z Synchronizing headers, height: 82000, progress: 17.3% These new header-download-progress messages only appear during IBD, and never during normal operation.
- Loading branch information