mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
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-
This commit is contained in:
@@ -64,8 +64,8 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
|
||||
entry.pushKV("blockhash", hashBlock.GetHex());
|
||||
CBlockIndex* pindex = LookupBlockIndex(hashBlock);
|
||||
if (pindex) {
|
||||
if (chainActive.Contains(pindex)) {
|
||||
entry.pushKV("confirmations", 1 + chainActive.Height() - pindex->nHeight);
|
||||
if (::ChainActive().Contains(pindex)) {
|
||||
entry.pushKV("confirmations", 1 + ::ChainActive().Height() - pindex->nHeight);
|
||||
entry.pushKV("time", pindex->GetBlockTime());
|
||||
entry.pushKV("blocktime", pindex->GetBlockTime());
|
||||
}
|
||||
@@ -184,7 +184,7 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
|
||||
if (!blockindex) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block hash not found");
|
||||
}
|
||||
in_active_chain = chainActive.Contains(blockindex);
|
||||
in_active_chain = ::ChainActive().Contains(blockindex);
|
||||
}
|
||||
|
||||
bool f_txindex_ready = false;
|
||||
@@ -274,7 +274,7 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
|
||||
for (const auto& tx : setTxids) {
|
||||
const Coin& coin = AccessByTxid(*pcoinsTip, tx);
|
||||
if (!coin.IsSpent()) {
|
||||
pblockindex = chainActive[coin.nHeight];
|
||||
pblockindex = ::ChainActive()[coin.nHeight];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -348,7 +348,7 @@ static UniValue verifytxoutproof(const JSONRPCRequest& request)
|
||||
LOCK(cs_main);
|
||||
|
||||
const CBlockIndex* pindex = LookupBlockIndex(merkleBlock.header.GetHash());
|
||||
if (!pindex || !chainActive.Contains(pindex) || pindex->nTx == 0) {
|
||||
if (!pindex || !::ChainActive().Contains(pindex) || pindex->nTx == 0) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found in chain");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user