initialblockdownload set to false prematurely #26432

issue sander2 openend this issue on November 1, 2022
  1. sander2 commented at 11:41 am on November 1, 2022: none

    Expected behavior

    getblockchaininfo.initialblockdownload stays true until all blocks are imported

    Actual behavior

    getblockchaininfo.initialblockdownload becomes false before before all blocks are imported:

    02022-11-01T11:16:39Z UpdateTip: new best=00000000000000000006f01ad0649cefc26c86c24a2808109c584bdcdc0d5293 height=761091 version=0x20f0c000 log2_work=93.816484 tx=776463417 date='2022-10-31T11:13:46Z' progress=0.999730 cache=338.3MiB(2269631txo)
    12022-11-01T11:16:39Z Leaving InitialBlockDownload (latching to false)
    22022-11-01T11:16:42Z UpdateTip: new best=000000000000000000078315da1efb6937a0d06015891b0412164dc2531e3004 height=761092 version=0x20c00000 log2_work=93.816497 tx=776466523 date='2022-10-31T11:29:40Z' progress=0.999733 cache=338.7MiB(2273000txo)
    3<snip 162 lines of UpdateTip>
    42022-11-01T11:16:57Z UpdateTip: new best=00000000000000000004656d346fbac96ddcec6ee31b6abd696a241cd6994181 height=761255 version=0x2e4a6000 log2_work=93.818629 tx=776748676 date='2022-11-01T11:09:42Z' progress=0.999999 cache=375.6MiB(2573669txo)
    

    Observe the 15 seconds it took my (reasonably fast) machine to import the remaining blocks. This is a problem for me since my application relies on this field to determine if syncing is complete. We can not rely on getblockchaininfo.verificationprogress either due to #26433

    To reproduce

    Start a node that hasn’t been synced in a while and observe the log output.

    System information

    Observed on version 22 from the website.

  2. sander2 added the label Bug on Nov 1, 2022
  3. maflcko removed the label Bug on Nov 1, 2022
  4. maflcko added the label RPC/REST/ZMQ on Nov 1, 2022
  5. maflcko added the label Questions and Help on Nov 1, 2022
  6. maflcko commented at 11:51 am on November 1, 2022: member
    IBD does not indicate whether your node is synced. As the RPC help indicates, this is only debug information for developers or users that want to debug P2P behavior.
  7. willcl-ark commented at 12:25 pm on November 1, 2022: contributor

    Whilst it might be debug information only, it does appear to me also that IsInitialBlockDownload() should be returning as True during reindexing:

    https://github.com/bitcoin/bitcoin/blob/5668ccec1d3785632caf4b74c1701019ecc88f41/src/rpc/blockchain.cpp#L1255

    https://github.com/bitcoin/bitcoin/blob/5668ccec1d3785632caf4b74c1701019ecc88f41/src/validation.cpp#L1528-L1538

    So perhaps what is happening here is that the node finishes importing before it has made a connection and receives new headers, so leaves IBD, then learns of a new header tip and starts processing those blocks as normal? Due to the DEFAULT_MAX_TIP_AGE check this should only be able to happen if the tip is less than 24h old. @sander2 If you are going to be turning the node on and off for <24h and need this check then perhaps you want to consider a different approach, such as comparing your tip/height to the tip served by some public block explorers’ APIs?

  8. maflcko commented at 7:12 am on November 2, 2022: member
    Closing for now. Let us know if you have any other questions.
  9. maflcko closed this on Nov 2, 2022

  10. bitcoin locked this on Nov 2, 2023

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: 2024-07-01 10:13 UTC

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