refactor: rename chainActive #15948

pull jamesob wants to merge 4 commits into bitcoin:master from jamesob:2019-05-au-chainactive changing 27 files +307 −304
  1. jamesob commented at 6:54 pm on May 3, 2019: member

    This is part of the assumeutxo project:

    Parent PR: #15606 Issue: #15605 Specification: https://github.com/jamesob/assumeutxo-docs/tree/2019-04-proposal/proposal


    This change refactors the chainActive reference into a ::ChainActive() call. It also distinguishes CChainState’s CChain data member as m_chain instead of the current chainActive, which makes it easily confused with the global data.

    The active chain must be obtained via function because its reference will be swapped at some point during runtime after loading a UTXO snapshot.

    This change, though lengthy, should be pretty easy to review since most of it is contained within a scripted-diff. Once merged, the parent PR should be easier to review.

  2. rename: CChainState.chainActive -> m_chain
    This can't be a scripted-diff due to the confusion of the global
    chainActive and the CChainState member of the same name.
    
    This specific rename makes the following chainActive -> ::ChainActive() diff
    scriptable.
    1b6e6fcfd2
  3. refactoring: introduce unused ChainActive()
    in preparation for the following scripted-diff commit.
    a3a609079c
  4. MarcoFalke commented at 7:01 pm on May 3, 2019: member

    You might have to put the files after sed?

    sed ...foobar.. $(git grep -l "chainActive" | grep -E '(h|cpp)$')

  5. scripted-diff: replace chainActive -> ::ChainActive()
    Though at the moment ChainActive() simply references `g_chainstate.m_chain`,
    doing this change now clears the way for multiple chainstate usage and allows
    us to script the diff.
    
    -BEGIN VERIFY SCRIPT-
    git grep -l "chainActive" | grep -E '(h|cpp)$' | xargs sed -i '/chainActive =/b; /extern CChain& chainActive/b; s/\(::\)\{0,1\}chainActive/::ChainActive()/g'
    -END VERIFY SCRIPT-
    631940aab2
  6. refactoring: remove unused chainActive 486c1eea86
  7. jamesob force-pushed on May 3, 2019
  8. jamesob commented at 7:03 pm on May 3, 2019: member
    Oops, missed an xargs. Thanks @MarcoFalke.
  9. jnewbery added this to the "In progress" column in a project

  10. DrahtBot added the label GUI on May 3, 2019
  11. DrahtBot added the label Mempool on May 3, 2019
  12. DrahtBot added the label Mining on May 3, 2019
  13. DrahtBot added the label P2P on May 3, 2019
  14. DrahtBot added the label Refactoring on May 3, 2019
  15. DrahtBot added the label RPC/REST/ZMQ on May 3, 2019
  16. DrahtBot added the label Tests on May 3, 2019
  17. DrahtBot added the label TX fees and policy on May 3, 2019
  18. DrahtBot added the label UTXO Db and Indexes on May 3, 2019
  19. DrahtBot added the label Validation on May 3, 2019
  20. DrahtBot added the label Wallet on May 3, 2019
  21. DrahtBot commented at 7:21 pm on May 3, 2019: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #15946 (Allow maintaining the blockfilterindex when using prune by jonasschnelli)
    • #15933 (Make chain state immutable outside of validation by MarcoFalke)
    • #15931 (Remove GetDepthInMainChain dependency on locked chain interface by ariard)
    • #15855 ([refactor] interfaces: Add missing LockAnnotation for cs_main by MarcoFalke)
    • #14193 (validation: Add missing mempool locks by MarcoFalke)
    • #13713 (Ignore new blocks when -stopatheight target has been reached by jonasschnelli)
    • #13582 (Extract AppInitLoadBlockIndex from AppInitMain by Empact)
    • #13045 ([p2p] getblock for 1-block reorgs in response to compact block message by instagibbs)
    • #9381 (Remove CWalletTx merging logic from AddToWallet by ryanofsky)

    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.

  22. fanquake removed the label GUI on May 4, 2019
  23. fanquake removed the label Mempool on May 4, 2019
  24. fanquake removed the label Mining on May 4, 2019
  25. fanquake removed the label P2P on May 4, 2019
  26. fanquake removed the label RPC/REST/ZMQ on May 4, 2019
  27. fanquake removed the label TX fees and policy on May 4, 2019
  28. fanquake removed the label Tests on May 4, 2019
  29. fanquake removed the label UTXO Db and Indexes on May 4, 2019
  30. fanquake removed the label Wallet on May 4, 2019
  31. Sjors commented at 10:29 am on May 4, 2019: member
    utACK 486c1ee
  32. practicalswift commented at 11:44 am on May 4, 2019: contributor
    @jamesob Should ::ChainActive() be annotated EXCLUSIVE_LOCKS_REQUIRED(cs_main)?
  33. MarcoFalke commented at 2:47 pm on May 6, 2019: member
    @practicalswift No, I don’t think that compiles right now
  34. promag commented at 3:09 pm on May 6, 2019: member
    utACK 486c1ee.
  35. practicalswift commented at 3:48 pm on May 6, 2019: contributor
    utACK 486c1eea863a41e597ae4fddc392f446f2518b4b
  36. MarcoFalke commented at 6:47 pm on May 6, 2019: member
    This will be merged tomorrow unless there are objections
  37. MarcoFalke merged this on May 7, 2019
  38. MarcoFalke closed this on May 7, 2019

  39. MarcoFalke referenced this in commit b2a6b02161 on May 7, 2019
  40. jnewbery moved this from the "In progress" to the "Done" column in a project

  41. morcos commented at 7:17 pm on May 7, 2019: member
    @jamesob Can you clean up the comments/help text that got modified by the scripted diff?
  42. jamesob commented at 7:21 pm on May 7, 2019: member
    @morcos are you saying change the “::ChainActive()” back to something else in comments? Personally I don’t mind them that way (since the old comments referred to a particular symbol, i.e. “chainActive”). What were you thinking in terms of a replacement?
  43. morcos commented at 7:46 pm on May 7, 2019: member
    discussed offline, i guess the comments aren’t bad, the help text bugs me slightly, but not sure i have a better solution…
  44. sidhujag referenced this in commit dced7ccc66 on May 7, 2019
  45. deadalnix referenced this in commit d357fa5a29 on Mar 2, 2020
  46. ftrader referenced this in commit ddfb4f23aa on May 19, 2020
  47. kittywhiskers referenced this in commit 4bc579f98d on Oct 9, 2021
  48. kittywhiskers referenced this in commit c838bb898d on Oct 10, 2021
  49. kittywhiskers referenced this in commit 8e5e9224f5 on Oct 16, 2021
  50. kittywhiskers referenced this in commit 659f765516 on Oct 16, 2021
  51. kittywhiskers referenced this in commit e1203b18d9 on Oct 16, 2021
  52. kittywhiskers referenced this in commit 00e2f62a15 on Oct 21, 2021
  53. kittywhiskers referenced this in commit 1f436f8aee on Oct 22, 2021
  54. PastaPastaPasta referenced this in commit 29dbe98ee2 on Oct 23, 2021
  55. pravblockc referenced this in commit bc8c423926 on Nov 18, 2021
  56. MarcoFalke 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: 2024-11-21 15:12 UTC

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