refactor: more const annotations for uses of CBlockIndex*

This commit is contained in:
Anthony Towns
2022-03-02 15:42:57 +10:00
committed by Carl Dong
parent 430acb7d2a
commit 5be9ee3c54
10 changed files with 26 additions and 25 deletions

View File

@@ -67,7 +67,7 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
LOCK(cs_main);
entry.pushKV("blockhash", hashBlock.GetHex());
CBlockIndex* pindex = active_chainstate.m_blockman.LookupBlockIndex(hashBlock);
const CBlockIndex* pindex = active_chainstate.m_blockman.LookupBlockIndex(hashBlock);
if (pindex) {
if (active_chainstate.m_chain.Contains(pindex)) {
entry.pushKV("confirmations", 1 + active_chainstate.m_chain.Height() - pindex->nHeight);
@@ -207,7 +207,7 @@ static RPCHelpMan getrawtransaction()
bool in_active_chain = true;
uint256 hash = ParseHashV(request.params[0], "parameter 1");
CBlockIndex* blockindex = nullptr;
const CBlockIndex* blockindex = nullptr;
if (hash == Params().GenesisBlock().hashMerkleRoot) {
// Special exception for the genesis block coinbase transaction
@@ -302,7 +302,7 @@ static RPCHelpMan gettxoutproof()
}
}
CBlockIndex* pblockindex = nullptr;
const CBlockIndex* pblockindex = nullptr;
uint256 hashBlock;
ChainstateManager& chainman = EnsureAnyChainman(request.context);
if (!request.params[1].isNull()) {