Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validation: assumeutxo params for testnet and signet #28516

Closed
wants to merge 26 commits into from

Commits on Sep 17, 2023

  1. net_processing: Request assumeutxo background chain blocks

    Add new PeerManagerImpl::TryDownloadingHistoricalBlocks method and use it to
    request background chain blocks in addition to blocks normally requested by
    FindNextBlocksToDownload.
    
    Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
    Co-authored-by: James O'Beirne <james.obeirne@gmail.com>
    3 people committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    a9ea542 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e9aa43d View commit details
    Browse the repository at this point in the history
  3. assumeutxo: remove snapshot during -reindex{-chainstate}

    Removing a snapshot chainstate from disk (and memory) is consistent with
    existing reindex operations.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    0012979 View commit details
    Browse the repository at this point in the history
  4. chainparams: add blockhash to AssumeutxoData

    This allows us to reference assumeutxo configuration by blockhash as
    well as height; this is helpful in future changes when we want to
    reference assumeutxo configurations before the block index is loaded.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    4ac7dd2 View commit details
    Browse the repository at this point in the history
  5. validation: MaybeRebalanceCaches when chain leaves IBD

    Check to see if we need to rebalance caches across chainstates when
    a chain leaves IBD.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    3661b4b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6d5aca2 View commit details
    Browse the repository at this point in the history
  7. validation: only call UpdatedBlockTip for active chainstate

    This notification isn't needed for background chainstates.
    
    `kernel::Notifications::blockTip` are also skipped.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    03a348c View commit details
    Browse the repository at this point in the history
  8. validation: pass ChainstateRole for validationinterface calls

    This allows consumers to decide how to handle events from background or
    assumedvalid chainstates.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    ac53194 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    b2117a1 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    e2c5c5d View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    40d5ca3 View commit details
    Browse the repository at this point in the history
  12. validation: indexing changes for assumeutxo

    When using an assumedvalid chainstate, only process validationinterface
    callbacks from the background chainstate within indexes. This ensures
    that all indexes are built in-order.
    
    Later, we can possibly designate indexes which can be built out of order
    and continue their operation during snapshot use.
    
    Once the background sync has completed, restart the indexes so that
    they continue to index the now-validated snapshot chainstate.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    e144e6b View commit details
    Browse the repository at this point in the history
  13. validation: pruning for multiple chainstates

    Introduces ChainstateManager::GetPruneRange().
    
    The prune budget is split evenly between the number of chainstates,
    however the prune budget may be exceeded if the resulting shares are
    beneath `MIN_DISK_SPACE_FOR_BLOCK_FILES`.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    8cfd271 View commit details
    Browse the repository at this point in the history
  14. test: adjust chainstate tests to use recognized snapshot base

    In future commits, loading the block index while making use of a
    snapshot is contingent on the snapshot being recognized by chainparams.
    
    Ensure all existing unittests that use snapshots use a recognized
    snapshot (at height 110).
    
    Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
    jamesob and ryanofsky committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    14fcb1b View commit details
    Browse the repository at this point in the history
  15. validation: populate nChainTx value for assumedvalid chainstates

    Use the expected AssumeutxoData in order to bootstrap nChainTx values
    for assumedvalid blockindex entries in the snapshot chainstate. This
    is necessary because nChainTx is normally built up from nTx values,
    which are populated using blockdata which the snapshot chainstate
    does not yet have.
    jamesob committed Sep 17, 2023
    Configuration menu
    Copy the full SHA
    a7a5deb View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2023

  1. blockstorage: segment normal/assumedvalid blockfiles

    When using an assumedvalid (snapshot) chainstate along with a background
    chainstate, we are syncing two very different regions of the chain
    simultaneously. If we use the same blockfile space for both of these
    syncs, wildly different height blocks will be stored alongside one
    another, making pruning ineffective.
    
    This change implements a separate blockfile cursor for the assumedvalid
    chainstate when one is in use.
    jamesob committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    bd770ff View commit details
    Browse the repository at this point in the history
  2. validation: assumeutxo: swap m_mempool on snapshot activation

    Otherwise we will not receive transactions during background sync until
    restart.
    jamesob committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    0f34fc7 View commit details
    Browse the repository at this point in the history
  3. validation: do not activate snapshot if behind active chain

    Most easily reviewed with
    
      git show --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
    
    Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
    jamesob and ryanofsky committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    126d717 View commit details
    Browse the repository at this point in the history
  4. rpc: add loadtxoutset

    Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
    jamesob and theStack committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    4193ef8 View commit details
    Browse the repository at this point in the history
  5. refuse to activate a UTXO snapshot if mempool not empty

    This ensures that we avoid any unexpected conditions inherent in
    transferring non-empty mempools across chainstates.
    
    Note that this should never happen in practice given that snapshot
    activation will not occur outside of IBD, based upon the height checks
    in `loadtxoutset`.
    jamesob committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    89bbb22 View commit details
    Browse the repository at this point in the history
  6. rpc: add getchainstates

    Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
    jamesob and ryanofsky committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    fb87f83 View commit details
    Browse the repository at this point in the history
  7. test: add feature_assumeutxo functional test

    Most ideas for test improvements (TODOs) provided by Russ Yanofsky.
    jamesob committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    afc9093 View commit details
    Browse the repository at this point in the history
  8. contrib: add script to demo/test assumeutxo

    Add the script to the shellcheck exception list since the
    quoted variables rule needs to be violated in order to get
    bitcoind to pick up on $CHAIN_HACK_FLAGS.
    jamesob committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    ef55d7b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    32b797f View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2023

  1. Configuration menu
    Copy the full SHA
    d55cc7f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d5f83a7 View commit details
    Browse the repository at this point in the history