mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-03-10 20:51:30 +00:00
Make ConnectTrace::blocksConnected private, hide behind accessors
This commit is contained in:
parent
822000cf82
commit
29e6e231c8
@ -2212,7 +2212,17 @@ static int64_t nTimePostConnect = 0;
|
|||||||
* part of a single ActivateBestChainStep call.
|
* part of a single ActivateBestChainStep call.
|
||||||
*/
|
*/
|
||||||
struct ConnectTrace {
|
struct ConnectTrace {
|
||||||
|
private:
|
||||||
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > > blocksConnected;
|
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > > blocksConnected;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void BlockConnected(CBlockIndex* pindex, std::shared_ptr<const CBlock> pblock) {
|
||||||
|
blocksConnected.emplace_back(pindex, std::move(pblock));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > >& GetBlocksConnected() {
|
||||||
|
return blocksConnected;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2270,7 +2280,7 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
|
|||||||
LogPrint(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
|
LogPrint(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
|
||||||
LogPrint(BCLog::BENCH, "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001);
|
LogPrint(BCLog::BENCH, "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001);
|
||||||
|
|
||||||
connectTrace.blocksConnected.emplace_back(pindexNew, std::move(pthisBlock));
|
connectTrace.BlockConnected(pindexNew, std::move(pthisBlock));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2499,7 +2509,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
|||||||
} // MemPoolConflictRemovalTracker destroyed and conflict evictions are notified
|
} // MemPoolConflictRemovalTracker destroyed and conflict evictions are notified
|
||||||
|
|
||||||
// Transactions in the connected block are notified
|
// Transactions in the connected block are notified
|
||||||
for (const auto& pair : connectTrace.blocksConnected) {
|
for (const auto& pair : connectTrace.GetBlocksConnected()) {
|
||||||
assert(pair.second);
|
assert(pair.second);
|
||||||
const CBlock& block = *(pair.second);
|
const CBlock& block = *(pair.second);
|
||||||
for (unsigned int i = 0; i < block.vtx.size(); i++)
|
for (unsigned int i = 0; i < block.vtx.size(); i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user