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.
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
refactoring: introduce unused ChainActive()
in preparation for the following scripted-diff commit.
a3a609079c
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)$')
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
refactoring: remove unused chainActive486c1eea86
jamesob force-pushed
on May 3, 2019
jamesob
commented at 7:03 pm on May 3, 2019:
member
jnewbery added this to the "In progress" column in a project
DrahtBot added the label
GUI
on May 3, 2019
DrahtBot added the label
Mempool
on May 3, 2019
DrahtBot added the label
Mining
on May 3, 2019
DrahtBot added the label
P2P
on May 3, 2019
DrahtBot added the label
Refactoring
on May 3, 2019
DrahtBot added the label
RPC/REST/ZMQ
on May 3, 2019
DrahtBot added the label
Tests
on May 3, 2019
DrahtBot added the label
TX fees and policy
on May 3, 2019
DrahtBot added the label
UTXO Db and Indexes
on May 3, 2019
DrahtBot added the label
Validation
on May 3, 2019
DrahtBot added the label
Wallet
on May 3, 2019
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.
fanquake removed the label
GUI
on May 4, 2019
fanquake removed the label
Mempool
on May 4, 2019
fanquake removed the label
Mining
on May 4, 2019
fanquake removed the label
P2P
on May 4, 2019
fanquake removed the label
RPC/REST/ZMQ
on May 4, 2019
fanquake removed the label
TX fees and policy
on May 4, 2019
fanquake removed the label
Tests
on May 4, 2019
fanquake removed the label
UTXO Db and Indexes
on May 4, 2019
fanquake removed the label
Wallet
on May 4, 2019
Sjors
commented at 10:29 am on May 4, 2019:
member
utACK486c1ee
practicalswift
commented at 11:44 am on May 4, 2019:
contributor
@jamesob Should ::ChainActive() be annotated EXCLUSIVE_LOCKS_REQUIRED(cs_main)?
MarcoFalke
commented at 2:47 pm on May 6, 2019:
member
promag
commented at 3:09 pm on May 6, 2019:
member
utACK486c1ee.
practicalswift
commented at 3:48 pm on May 6, 2019:
contributor
utACK486c1eea863a41e597ae4fddc392f446f2518b4b
MarcoFalke
commented at 6:47 pm on May 6, 2019:
member
This will be merged tomorrow unless there are objections
MarcoFalke merged this
on May 7, 2019
MarcoFalke closed this
on May 7, 2019
MarcoFalke referenced this in commit
b2a6b02161
on May 7, 2019
jnewbery moved this from the "In progress" to the "Done" column in a project
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?
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?
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…
sidhujag referenced this in commit
dced7ccc66
on May 7, 2019
deadalnix referenced this in commit
d357fa5a29
on Mar 2, 2020
ftrader referenced this in commit
ddfb4f23aa
on May 19, 2020
kittywhiskers referenced this in commit
4bc579f98d
on Oct 9, 2021
kittywhiskers referenced this in commit
c838bb898d
on Oct 10, 2021
kittywhiskers referenced this in commit
8e5e9224f5
on Oct 16, 2021
kittywhiskers referenced this in commit
659f765516
on Oct 16, 2021
kittywhiskers referenced this in commit
e1203b18d9
on Oct 16, 2021
kittywhiskers referenced this in commit
00e2f62a15
on Oct 21, 2021
kittywhiskers referenced this in commit
1f436f8aee
on Oct 22, 2021
PastaPastaPasta referenced this in commit
29dbe98ee2
on Oct 23, 2021
pravblockc referenced this in commit
bc8c423926
on Nov 18, 2021
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-12-22 00:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me