Skip to content

Commit 29e6e23

Browse files
committed
Make ConnectTrace::blocksConnected private, hide behind accessors
1 parent 822000c commit 29e6e23

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/validation.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,17 @@ static int64_t nTimePostConnect = 0;
22122212
* part of a single ActivateBestChainStep call.
22132213
*/
22142214
struct ConnectTrace {
2215+
private:
22152216
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > > blocksConnected;
2217+
2218+
public:
2219+
void BlockConnected(CBlockIndex* pindex, std::shared_ptr<const CBlock> pblock) {
2220+
blocksConnected.emplace_back(pindex, std::move(pblock));
2221+
}
2222+
2223+
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > >& GetBlocksConnected() {
2224+
return blocksConnected;
2225+
}
22162226
};
22172227

22182228
/**
@@ -2270,7 +2280,7 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
22702280
LogPrint(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
22712281
LogPrint(BCLog::BENCH, "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001);
22722282

2273-
connectTrace.blocksConnected.emplace_back(pindexNew, std::move(pthisBlock));
2283+
connectTrace.BlockConnected(pindexNew, std::move(pthisBlock));
22742284
return true;
22752285
}
22762286

@@ -2499,7 +2509,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
24992509
} // MemPoolConflictRemovalTracker destroyed and conflict evictions are notified
25002510

25012511
// Transactions in the connected block are notified
2502-
for (const auto& pair : connectTrace.blocksConnected) {
2512+
for (const auto& pair : connectTrace.GetBlocksConnected()) {
25032513
assert(pair.second);
25042514
const CBlock& block = *(pair.second);
25052515
for (unsigned int i = 0; i < block.vtx.size(); i++)

0 commit comments

Comments
 (0)