Avoid unnecessary "Synchronizing blockheaders" log messages #16774

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2019/09/hdr_log changing 1 files +3 −3
  1. jonasschnelli commented at 8:05 PM on August 31, 2019: contributor

    Fixes #16773

    I'm not entirely sure why 16773 happend, but probably due to headers fallback in a compact block.

    However, this PR should fix it and should have been included in #15615.

  2. Avoid unnecessary "Synchronizing blockheaders" log messages dcc448e3d2
  3. jonasschnelli added the label Utils/log/libs on Aug 31, 2019
  4. fanquake approved
  5. fanquake commented at 6:35 AM on September 3, 2019: member

    ACK dcc448e3d2b97f7e4e23f5ed174762cec3530306

    The extra messages appear when we receive a headers message:

    2019-09-03T05:57:30Z ProcessNewBlock
    2019-09-03T05:57:30Z NotifyHeaderTip: pindexHeader->height: 593016
    2019-09-03T05:57:30Z ProcessMessage: NetMsgType::HEADERS
    2019-09-03T05:57:30Z ProcessHeadersMessage
    2019-09-03T05:57:30Z ProcessNewBlockHeaders
    2019-09-03T05:57:30Z NotifyHeaderTip: pindexHeader->height: 593016
    2019-09-03T05:57:30Z Synchronizing blockheaders, height: 593016 (~100.00%)
    2019-09-03T05:57:30Z ProcessNewBlock
    2019-09-03T05:57:30Z NotifyHeaderTip: pindexHeader->height: 593016
    

    Adjusting NotifyHeaderTip to return a bool, and using that to determine the Synchronizing blockheaders logging seems ok, and aligns this logging with other header tip notifications (although this only logs during IBD).

    The other callers of NotifyHeaderTip (ProcessNewBlock and LoadExternalBlockFile) do not use the return value.

  6. ajtowns commented at 7:12 AM on September 3, 2019: contributor

    ACK dcc448e3d2b97f7e4e23f5ed174762cec3530306 ; code review only, haven't compiled or tested.

    I'm not entirely sure why 16773 happend, but probably due to headers fallback in a compact block.

    I think it's that you only choose a couple of peers for compact blocks, and then the rest will send you a headers message instead when a new block is found, which will then trigger ProcessNewBlockHeaders; so if your node is down for a while, when you start back up you'll do a header sync and get a message about the new current tip, then you'll set yourself into IBD to catch back up, and if more new blocks come in while you're doing that, you'll get a log message for each new block for each non-compact-block peer you're connected to.

    After this patch I think you should still get a single log message for each new block discovered by the network while you're in IBD. If IBD takes 24 hours, that might be an additional 144 log messages, so that doesn't seem too crazy.

  7. promag commented at 2:16 PM on September 3, 2019: member

    ACK dcc448e3d2b97f7e4e23f5ed174762cec3530306.

  8. promag cross-referenced this on Sep 3, 2019 from issue refactor: Avoid locking cs_main in ProcessNewBlockHeaders by promag
  9. promag cross-referenced this on Sep 3, 2019 from issue refactor: Avoid locking cs_main in ProcessNewBlockHeaders by promag
  10. TheBlueMatt commented at 8:28 PM on September 3, 2019: contributor

    utACK dcc448e3d2b97f7e4e23f5ed174762cec3530306. Went and read how pindexBestHeader is handled and this code looks correct (worst case it breaks a LogPrint, so whatever). I also ran into this on #16762.

  11. MarcoFalke referenced this in commit 8e00a68552 on Sep 3, 2019
  12. MarcoFalke merged this on Sep 3, 2019
  13. MarcoFalke closed this on Sep 3, 2019

  14. sidhujag referenced this in commit b3459434c9 on Sep 3, 2019
  15. laanwj commented at 9:12 AM on September 4, 2019: member

    Thanks!

  16. MarcoFalke referenced this in commit ae3e3bd151 on Sep 6, 2019
  17. decryp2kanon cross-referenced this on Aug 31, 2020 from issue Add: sync header message on CLI by decryp2kanon
  18. decryp2kanon referenced this in commit 5f47eb615a on Sep 16, 2020
  19. decryp2kanon cross-referenced this on Sep 16, 2020 from issue Add: log output during initial header sync by decryp2kanon
  20. decryp2kanon referenced this in commit 6734681dce on Sep 16, 2020
  21. jasonbcox referenced this in commit 17cefa6f94 on Sep 29, 2020
  22. kwvg referenced this in commit 560c730d88 on Nov 3, 2021
  23. PastaPastaPasta referenced this in commit ee34678d94 on Nov 12, 2021
  24. humbleDasher referenced this in commit 2996f593ef on Nov 13, 2021
  25. humbleDasher referenced this in commit 4bf53b1931 on Nov 13, 2021
  26. pravblockc referenced this in commit 0b4f279949 on Nov 18, 2021
  27. pravblockc referenced this in commit c6ea021589 on Nov 18, 2021
  28. bitcoin locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:54 UTC