diff options
author | glozow <gloriajzhao@gmail.com> | 2022-09-13 15:37:26 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2022-09-13 15:42:18 +0100 |
commit | 3a7e0a210c86e3c1750c7e04e3d1d689cf92ddaa (patch) | |
tree | 594be180eeafc3cccd0e44f3941a97078228dc59 /src/rpc | |
parent | 141540a71f510f26e8aa8b551139a978dae2be84 (diff) | |
parent | 00eeb31c7660e2c28f189f77a6905dee946ef408 (diff) | |
download | bitcoin-3a7e0a210c86e3c1750c7e04e3d1d689cf92ddaa.tar.xz |
Merge bitcoin/bitcoin#24513: CChainState -> Chainstate
00eeb31c7660e2c28f189f77a6905dee946ef408 scripted-diff: rename CChainState -> Chainstate (James O'Beirne)
Pull request description:
Alright alright alright, I know: we hate refactors. We especially hate cosmetic refactors.
Nobody knows better than I that changing broad swaths of code out from under our already-abused collaborators, only to send a cascade of rebase bankruptcies, is annoying at best and sadistic at worst. And for a rename! The indignation!
But just for a second, imagine yourself. Programming `bitcoin/bitcoin`, on a sandy beach beneath a lapis lazuli sky. You go to type the name of what is probably the most commonly used data structure in the codebase, and you *only hit shift once*.
What could you do in such a world? You could do anything. [The only limit is yourself.](https://zombo.com/)
---
So maybe you like the idea of this patch but really don't want to deal with rebasing. You're in luck!
Here're the commands that will bail you out of rebase bankruptcy:
```sh
git rebase -i $(git merge-base HEAD master) \
-x 'sed -i "s/CChainState/Chainstate/g" $(git ls-files | grep -E ".*\.(py|cpp|h)$") && git commit --amend --no-edit'
# <commit changed?>
git add -u && git rebase --continue
```
---
~~Anyway I'm not sure how serious I am about this, but I figured it was worth proposing.~~ I have decided I am very serious about this.
Maybe we can have nice things every once in a while?
ACKs for top commit:
MarcoFalke:
cr ACK 00eeb31c7660e2c28f189f77a6905dee946ef408
hebasto:
ACK 00eeb31c7660e2c28f189f77a6905dee946ef408
glozow:
ACK 00eeb31c7660e2c28f189f77a6905dee946ef408, thanks for being the one to propose this
w0xlt:
ACK https://github.com/bitcoin/bitcoin/pull/24513/commits/00eeb31c7660e2c28f189f77a6905dee946ef408
Tree-SHA512: b828a99780614a9b74f7a9c347ce0687de6f8d75232840f5ffc26e02bbb25a3b1f5f9deabbe44f82ada01459586ee8452a3ee2da05d1b3c48558c8df6f49e1b1
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/blockchain.cpp | 16 | ||||
-rw-r--r-- | src/rpc/blockchain.h | 4 | ||||
-rw-r--r-- | src/rpc/mempool.cpp | 4 | ||||
-rw-r--r-- | src/rpc/mining.cpp | 2 | ||||
-rw-r--r-- | src/rpc/rawtransaction.cpp | 2 | ||||
-rw-r--r-- | src/rpc/txoutproof.cpp | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index bf6a94afcb..d1daf06732 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -767,7 +767,7 @@ static RPCHelpMan pruneblockchain() ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); CChain& active_chain = active_chainstate.m_chain; int heightParam = request.params[0].getInt<int>(); @@ -908,7 +908,7 @@ static RPCHelpMan gettxoutsetinfo() NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); active_chainstate.ForceFlushStateToDisk(); CCoinsView* coins_view; @@ -1048,7 +1048,7 @@ static RPCHelpMan gettxout() fMempool = request.params[2].get_bool(); Coin coin; - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); CCoinsViewCache* coins_view = &active_chainstate.CoinsTip(); if (fMempool) { @@ -1105,7 +1105,7 @@ static RPCHelpMan verifychain() ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); return CVerifyDB().VerifyDB( active_chainstate, chainman.GetParams().GetConsensus(), active_chainstate.CoinsTip(), check_level, check_depth); }, @@ -1233,7 +1233,7 @@ RPCHelpMan getblockchaininfo() const ArgsManager& args{EnsureAnyArgsman(request.context)}; ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); const CBlockIndex& tip{*CHECK_NONFATAL(active_chainstate.m_chain.Tip())}; const int height{tip.nHeight}; @@ -1328,7 +1328,7 @@ static RPCHelpMan getdeploymentinfo() { const ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); - const CChainState& active_chainstate = chainman.ActiveChainstate(); + const Chainstate& active_chainstate = chainman.ActiveChainstate(); const CBlockIndex* blockindex; if (request.params[0].isNull()) { @@ -2148,7 +2148,7 @@ static RPCHelpMan scantxoutset() { ChainstateManager& chainman = EnsureChainman(node); LOCK(cs_main); - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); active_chainstate.ForceFlushStateToDisk(); pcursor = CHECK_NONFATAL(active_chainstate.CoinsDB().Cursor()); tip = CHECK_NONFATAL(active_chainstate.m_chain.Tip()); @@ -2328,7 +2328,7 @@ static RPCHelpMan dumptxoutset() UniValue CreateUTXOSnapshot( NodeContext& node, - CChainState& chainstate, + Chainstate& chainstate, AutoFile& afile, const fs::path& path, const fs::path& temppath) diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h index a332fd4892..6cdb5fa48b 100644 --- a/src/rpc/blockchain.h +++ b/src/rpc/blockchain.h @@ -20,7 +20,7 @@ extern RecursiveMutex cs_main; class CBlock; class CBlockIndex; -class CChainState; +class Chainstate; class UniValue; namespace node { struct NodeContext; @@ -54,7 +54,7 @@ void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], */ UniValue CreateUTXOSnapshot( node::NodeContext& node, - CChainState& chainstate, + Chainstate& chainstate, AutoFile& afile, const fs::path& path, const fs::path& tmppath); diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index db09a0c7b6..5c1770704d 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -168,7 +168,7 @@ static RPCHelpMan testmempoolaccept() NodeContext& node = EnsureAnyNodeContext(request.context); CTxMemPool& mempool = EnsureMemPool(node); ChainstateManager& chainman = EnsureChainman(node); - CChainState& chainstate = chainman.ActiveChainstate(); + Chainstate& chainstate = chainman.ActiveChainstate(); const PackageMempoolAcceptResult package_result = [&] { LOCK(::cs_main); if (txns.size() > 1) return ProcessNewPackage(chainstate, mempool, txns, /*test_accept=*/true); @@ -810,7 +810,7 @@ static RPCHelpMan submitpackage() NodeContext& node = EnsureAnyNodeContext(request.context); CTxMemPool& mempool = EnsureMemPool(node); - CChainState& chainstate = EnsureChainman(node).ActiveChainstate(); + Chainstate& chainstate = EnsureChainman(node).ActiveChainstate(); const auto package_result = WITH_LOCK(::cs_main, return ProcessNewPackage(chainstate, mempool, txns, /*test_accept=*/ false)); // First catch any errors. diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 1ad704a490..354af22ef4 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -598,7 +598,7 @@ static RPCHelpMan getblocktemplate() std::string strMode = "template"; UniValue lpval = NullUniValue; std::set<std::string> setClientRules; - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); CChain& active_chain = active_chainstate.m_chain; if (!request.params[0].isNull()) { diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 7ffb499330..f365de7d0c 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -51,7 +51,7 @@ using node::GetTransaction; using node::NodeContext; using node::PSBTAnalysis; -static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry, CChainState& active_chainstate) +static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry, Chainstate& active_chainstate) { // Call into TxToUniv() in bitcoin-common to decode the transaction hex. // diff --git a/src/rpc/txoutproof.cpp b/src/rpc/txoutproof.cpp index dcf6c6bee1..cd8b49bfe1 100644 --- a/src/rpc/txoutproof.cpp +++ b/src/rpc/txoutproof.cpp @@ -66,7 +66,7 @@ static RPCHelpMan gettxoutproof() } } else { LOCK(cs_main); - CChainState& active_chainstate = chainman.ActiveChainstate(); + Chainstate& active_chainstate = chainman.ActiveChainstate(); // Loop through txids and try to find which block they're in. Exit loop once a block is found. for (const auto& tx : setTxids) { |