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: member

    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. TheBlueMatt commented at 8:28 PM on September 3, 2019: member

    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.

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

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

    Thanks!

  14. MarcoFalke referenced this in commit ae3e3bd151 on Sep 6, 2019
  15. decryp2kanon referenced this in commit 5f47eb615a on Sep 16, 2020
  16. decryp2kanon referenced this in commit 6734681dce on Sep 16, 2020
  17. jasonbcox referenced this in commit 17cefa6f94 on Sep 29, 2020
  18. kittywhiskers referenced this in commit 560c730d88 on Nov 3, 2021
  19. PastaPastaPasta referenced this in commit ee34678d94 on Nov 12, 2021
  20. humbleDasher referenced this in commit 2996f593ef on Nov 13, 2021
  21. humbleDasher referenced this in commit 4bf53b1931 on Nov 13, 2021
  22. pravblockc referenced this in commit 0b4f279949 on Nov 18, 2021
  23. pravblockc referenced this in commit c6ea021589 on Nov 18, 2021
  24. DrahtBot 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-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me