assumeUTXO: snapshot load, update VERSION msg height #30418

pull furszy wants to merge 1 commits into bitcoin:master from furszy:2024_assumeUTXO_update_starting_height changing 2 files +24 −0
  1. furszy commented at 10:15 PM on July 9, 2024: member

    Due to a missing height update; the node sends its pre-snapshot height to any peer connecting after the snapshot load but before the node receive a new tip block.

    This does not make any difference for us because we are not using the VERSION msg height field but it does not seem consistent plus other software might be using the field.

  2. assumeUTXO: snapshot load, update VERSION msg height
    Due to a missing height update; the node sends its
    pre-snapshot height to any peer connecting after
    the snapshot load but before the node receives a
    new tip block.
    35c3efbd60
  3. DrahtBot commented at 10:15 PM on July 9, 2024: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #30598 (assumeutxo: Drop block height from metadata by fjahr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. in src/rpc/blockchain.cpp:2841 in 35c3efbd60
    2835 | @@ -2836,6 +2836,10 @@ static RPCHelpMan loadtxoutset()
    2836 |          throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Unable to load UTXO snapshot: %s. (%s)", util::ErrorString(activation_result).original, path.utf8string()));
    2837 |      }
    2838 |  
    2839 | +    // Update peer manager best block
    2840 | +    const auto& tip = WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip());
    2841 | +    node.peerman->SetBestBlock(tip->nHeight, std::chrono::seconds{tip->GetBlockTime()});
    


    fjahr commented at 9:31 AM on July 10, 2024:

    Are you sure this is the best place for this in the RPC? Looking at the other calls to SetBestBlock() they all seem to be happening in validation.cpp.


    fjahr commented at 9:33 AM on July 10, 2024:

    nit: You can also get the height out of metadata without the mutex (see below).

  5. fjahr commented at 10:01 AM on July 10, 2024: contributor

    I am still undecided if we want this and need to think about it a little more.

    We send this usually when we have a new block but the loading of the snapshot does not necessarily mean that we have the block, right? We only need the header for that. So we should probably set it when we get block itself I think.

  6. maflcko commented at 10:49 AM on August 7, 2024: member

    I agree with all the feedback by @fjahr from last month.

    Are you still working on this? Maybe turn it into a draft in the meantime?

  7. furszy commented at 10:58 PM on August 7, 2024: member

    Thanks for the review fjahr! Sorry for the delay. And thanks for the ping maflcko.

    We send this usually when we have a new block but the loading of the snapshot does not necessarily mean that we have the block, right? We only need the header for that. So we should probably set it when we get block itself I think.

    Yeah, we set this field when a new tip block is connected and only send it during the peer connection's initial handshake. I initially found it odd because brand new nodes running AssumeUTXO would connect to a peer, signal their best block height as 0, and then start requesting blocks above the snapshot height due to the tip sync priority. But yeah, signaling the snapshot height as the node's best block doesn't help as the node does not have the previous blocks anyway. All good, closing. Thanks!

  8. furszy closed this on Aug 7, 2024

  9. bitcoin locked this on Aug 7, 2025

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-16 00:13 UTC

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