diff options
| author | MarcoFalke <[email protected]> | 2019-05-07 11:51:21 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2019-05-07 11:51:30 -0400 |
| commit | b2a6b0216192b6e8428f1a80b47f5178fccb961a (patch) | |
| tree | 6e397aede60bf6e930e09a255fff386579281b39 /src/interfaces/node.cpp | |
| parent | Merge #14266: refactor: Lift prevector default vals to the member declaration (diff) | |
| parent | refactoring: remove unused chainActive (diff) | |
| download | discoin-b2a6b0216192b6e8428f1a80b47f5178fccb961a.tar.xz discoin-b2a6b0216192b6e8428f1a80b47f5178fccb961a.zip | |
Merge #15948: refactor: rename chainActive
486c1eea86 refactoring: remove unused chainActive (James O'Beirne)
631940aab2 scripted-diff: replace chainActive -> ::ChainActive() (James O'Beirne)
a3a609079c refactoring: introduce unused ChainActive() (James O'Beirne)
1b6e6fcfd2 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 486c1eea863a41e597ae4fddc392f446f2518b4b
Tree-SHA512: 06ed8f9e77f2d25fc9bea0ba86436d80dbbce90a1e8be23e37ec4eeb26060483e60b4a5c4fba679cb1867f61e3921c24abeb9cabdfb4d0a9b1c4ddd77b17456a
Diffstat (limited to 'src/interfaces/node.cpp')
| -rw-r--r-- | src/interfaces/node.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index f3ee8fe36..618cd02ea 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -178,13 +178,13 @@ public: int getNumBlocks() override { LOCK(::cs_main); - return ::chainActive.Height(); + return ::ChainActive().Height(); } int64_t getLastBlockTime() override { LOCK(::cs_main); - if (::chainActive.Tip()) { - return ::chainActive.Tip()->GetBlockTime(); + if (::ChainActive().Tip()) { + return ::ChainActive().Tip()->GetBlockTime(); } return Params().GenesisBlock().GetBlockTime(); // Genesis block's time of current network } @@ -193,7 +193,7 @@ public: const CBlockIndex* tip; { LOCK(::cs_main); - tip = ::chainActive.Tip(); + tip = ::ChainActive().Tip(); } return GuessVerificationProgress(Params().TxData(), tip); } |