Move BlockManager to node/blockstorage #23581

pull MarcoFalke wants to merge 2 commits into bitcoin:master from MarcoFalke:2111-blockstorage changing 4 files +455 −453
  1. MarcoFalke commented at 7:55 PM on November 23, 2021: member

    BlockManager is responsible for reading and writing block(headers). So move it to the existing blockstorage module in node. Also, move validation code unrelated to block-storage out from BlockManager.

  2. MarcoFalke added the label Refactoring on Nov 23, 2021
  3. MarcoFalke force-pushed on Nov 23, 2021
  4. MarcoFalke force-pushed on Nov 24, 2021
  5. DrahtBot commented at 2:17 PM on November 24, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #23810 (refactor: destroy all C-style casts; use modern C++ casts, enforce via -Wold-style-cast by PastaPastaPasta)
    • #22932 (Guard CBlockIndex::nStatus by cs_main, require GetBlockPos/GetUndoPos to hold cs_main by jonatack)
    • #21726 (Improve Indices on pruned nodes via prune blockers by fjahr)
    • #20827 (During IBD, prune as much as possible until we get close to where we will eventually keep blocks by luke-jr)

    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.

  6. DrahtBot cross-referenced this on Nov 24, 2021 from issue validation: have LoadBlockIndex account for snapshot use by jamesob
  7. DrahtBot cross-referenced this on Nov 24, 2021 from issue Add CBlockIndex lock annotations, guard nStatus/nFile/nDataPos/nUndoPos by cs_main by jonatack
  8. DrahtBot cross-referenced this on Nov 25, 2021 from issue Move CBlockTreeDB to node/blockstorage by MarcoFalke
  9. DrahtBot cross-referenced this on Nov 25, 2021 from issue During IBD, prune as much as possible until we get close to where we will eventually keep blocks by luke-jr
  10. in src/validation.cpp:721 in fa646a5ae9 outdated
     717 | @@ -718,7 +718,9 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
     718 |      if (!CheckSequenceLocks(m_active_chainstate.m_chain.Tip(), m_view, tx, STANDARD_LOCKTIME_VERIFY_FLAGS, &lp))
     719 |          return state.Invalid(TxValidationResult::TX_PREMATURE_SPEND, "non-BIP68-final");
     720 |  
     721 | -    if (!Consensus::CheckTxInputs(tx, state, m_view, m_active_chainstate.m_blockman.GetSpendHeight(m_view), ws.m_base_fees)) {
     722 | +    assert(m_active_chainstate.m_blockman.LookupBlockIndex(m_view.GetBestBlock()) == m_active_chainstate.m_chain.Tip());
    


    promag commented at 9:36 AM on November 25, 2021:

    fa646a5ae9b39b7987d5701aec55a54ae4ec80ed

    nit, move after L706.


    MarcoFalke commented at 11:35 AM on November 25, 2021:

    thx, done

  11. DrahtBot cross-referenced this on Nov 25, 2021 from issue Wallet passive startup by ryanofsky
  12. in src/validation.h:431 in faabaa8654 outdated
     427 | @@ -427,6 +428,7 @@ class BlockManager
     428 |       *                                     which we've downloaded all transactions.
     429 |       */
     430 |      bool LoadBlockIndex(
     431 | +        CBlockIndex*& best_invalid,
    


    promag commented at 9:46 AM on November 25, 2021:

    faabaa8654c9446846e79ac5ae2edf70e0ae6d98

    Update doc above? Make it the 2nd arg?


    MarcoFalke commented at 11:36 AM on November 25, 2021:

    thx, done

  13. promag commented at 9:48 AM on November 25, 2021: member

    Concept ACK.

  14. MarcoFalke force-pushed on Nov 25, 2021
  15. DrahtBot cross-referenced this on Dec 2, 2021 from issue refactor, consensus: remove calls to global `Params()` in validation layer by lsilva01
  16. DrahtBot cross-referenced this on Dec 3, 2021 from issue Remove GetSpendHeight by MarcoFalke
  17. DrahtBot added the label Needs rebase on Dec 3, 2021
  18. MarcoFalke force-pushed on Dec 3, 2021
  19. DrahtBot removed the label Needs rebase on Dec 3, 2021
  20. DrahtBot cross-referenced this on Dec 5, 2021 from issue Improve Indices on pruned nodes via prune blockers by fjahr
  21. DrahtBot added the label Needs rebase on Dec 15, 2021
  22. MarcoFalke cross-referenced this on Dec 15, 2021 from issue refactor: Move stuff to ChainstateManager by MarcoFalke
  23. MarcoFalke force-pushed on Jan 2, 2022
  24. Move BlockManager to node/blockstorage
    Can be reviewed with --color-moved=dimmed-zebra
    fade2a44f4
  25. Fixup style of moved code
    Can be reviewed with --word-diff-regex=. -U0 --ignore-all-space
    fa7efc915b
  26. MarcoFalke force-pushed on Jan 2, 2022
  27. MarcoFalke commented at 5:00 PM on January 2, 2022: member

    Rebased

  28. DrahtBot removed the label Needs rebase on Jan 2, 2022
  29. DrahtBot cross-referenced this on Jan 2, 2022 from issue docs: avoid C-style casts; use modern C++ casts by PastaPastaPasta
  30. ryanofsky approved
  31. ryanofsky commented at 8:29 PM on January 3, 2022: contributor

    Code review obvious ACK fa7efc915b87ec56ca1cc0bad7d8f79591bfa099

  32. fanquake merged this on Jan 4, 2022
  33. fanquake closed this on Jan 4, 2022

  34. MarcoFalke deleted the branch on Jan 4, 2022
  35. sidhujag referenced this in commit 81d78ac374 on Jan 4, 2022
  36. ryanofsky cross-referenced this on Jan 4, 2022 from issue Add `src/node/` and `src/wallet/` code to `node::` and `wallet::` namespaces by ryanofsky
  37. Fabcien referenced this in commit 65330d5b88 on Nov 16, 2022
  38. bitcoin locked this on Jan 4, 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: 2026-05-20 06:53 UTC