-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: rename chainActive #15948
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
refactor: rename chainActive #15948
Conversation
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.
in preparation for the following scripted-diff commit.
You might have to put the files after sed?
|
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-
8e39159
to
486c1ee
Compare
Oops, missed an |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
utACK 486c1ee |
@jamesob Should |
@practicalswift No, I don't think that compiles right now |
utACK 486c1ee. |
utACK 486c1ee |
This will be merged tomorrow unless there are objections |
486c1ee refactoring: remove unused chainActive (James O'Beirne) 631940a scripted-diff: replace chainActive -> ::ChainActive() (James O'Beirne) a3a6090 refactoring: introduce unused ChainActive() (James O'Beirne) 1b6e6fc rename: CChainState.chainActive -> m_chain (James O'Beirne) Pull request description: 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. ACKs for commit 486c1e: Sjors: utACK 486c1ee promag: utACK 486c1ee. practicalswift: utACK 486c1ee Tree-SHA512: 06ed8f9e77f2d25fc9bea0ba86436d80dbbce90a1e8be23e37ec4eeb26060483e60b4a5c4fba679cb1867f61e3921c24abeb9cabdfb4d0a9b1c4ddd77b17456a
@jamesob Can you clean up the comments/help text that got modified by the scripted diff? |
@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? |
discussed offline, i guess the comments aren't bad, the help text bugs me slightly, but not sure i have a better solution... |
486c1ee refactoring: remove unused chainActive (James O'Beirne) 631940a scripted-diff: replace chainActive -> ::ChainActive() (James O'Beirne) a3a6090 refactoring: introduce unused ChainActive() (James O'Beirne) 1b6e6fc rename: CChainState.chainActive -> m_chain (James O'Beirne) Pull request description: This is part of the assumeutxo project: Parent PR: bitcoin#15606 Issue: bitcoin#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. ACKs for commit 486c1e: Sjors: utACK 486c1ee promag: utACK 486c1ee. practicalswift: utACK 486c1ee Tree-SHA512: 06ed8f9e77f2d25fc9bea0ba86436d80dbbce90a1e8be23e37ec4eeb26060483e60b4a5c4fba679cb1867f61e3921c24abeb9cabdfb4d0a9b1c4ddd77b17456a
Summary: 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- Depends on D5056 Partial backport of Core [[bitcoin/bitcoin#15948 | PR15948]] bitcoin/bitcoin@631940a bitcoin/bitcoin@486c1ee Test Plan: ninja check Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5373
Summary: 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- Depends on D5056 Partial backport of Core [[bitcoin/bitcoin#15948 | PR15948]] bitcoin/bitcoin@631940a bitcoin/bitcoin@486c1ee Test Plan: ninja check Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5373
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
merge bitcoin#15948, bitcoin#15976, bitcoin#16194...: assumeutxo project backports (part 1)
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
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 distinguishesCChainState
'sCChain
data member asm_chain
instead of the currentchainActive
, 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.