Skip to content

Commit

Permalink
refactor: add some const
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta authored and UdjinM6 committed Dec 19, 2023
1 parent e1a4cec commit cced193
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/llmq/chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void CChainLocksHandler::ProcessNewChainLock(const NodeId from, const llmq::CCha
return;
}

CBlockIndex* pindex = WITH_LOCK(cs_main, return m_chainstate.m_blockman.LookupBlockIndex(clsig.getBlockHash()));
const CBlockIndex* pindex = WITH_LOCK(cs_main, return m_chainstate.m_blockman.LookupBlockIndex(clsig.getBlockHash()));

{
LOCK(cs);
Expand Down Expand Up @@ -424,14 +424,14 @@ CChainLocksHandler::BlockTxs::mapped_type CChainLocksHandler::GetBlockTxs(const
uint32_t blockTime;
{
LOCK(cs_main);
auto* pindex = m_chainstate.m_blockman.LookupBlockIndex(blockHash);
const auto* pindex = m_chainstate.m_blockman.LookupBlockIndex(blockHash);
CBlock block;
if (!ReadBlockFromDisk(block, pindex, Params().GetConsensus())) {
return nullptr;
}

ret = std::make_shared<std::unordered_set<uint256, StaticSaltedHasher>>();
for (auto& tx : block.vtx) {
for (const auto& tx : block.vtx) {
if (tx->IsCoinBase() || tx->vin.empty()) {
continue;
}
Expand Down Expand Up @@ -630,7 +630,7 @@ void CChainLocksHandler::Cleanup()
}

for (auto it = blockTxs.begin(); it != blockTxs.end(); ) {
auto* pindex = m_chainstate.m_blockman.LookupBlockIndex(it->first);
const auto* pindex = m_chainstate.m_blockman.LookupBlockIndex(it->first);
if (InternalHasChainLock(pindex->nHeight, pindex->GetBlockHash())) {
for (const auto& txid : *it->second) {
txFirstSeenTime.erase(txid);
Expand All @@ -649,7 +649,7 @@ void CChainLocksHandler::Cleanup()
// tx has vanished, probably due to conflicts
it = txFirstSeenTime.erase(it);
} else if (!hashBlock.IsNull()) {
auto* pindex = m_chainstate.m_blockman.LookupBlockIndex(hashBlock);
const auto* pindex = m_chainstate.m_blockman.LookupBlockIndex(hashBlock);
if (m_chainstate.m_chain.Tip()->GetAncestor(pindex->nHeight) == pindex && m_chainstate.m_chain.Height() - pindex->nHeight >= 6) {
// tx got confirmed >= 6 times, so we can stop keeping track of it
it = txFirstSeenTime.erase(it);
Expand Down

0 comments on commit cced193

Please sign in to comment.