From 29e6e231c88904d0e17187b116db5a958d952bcf Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 6 Mar 2017 17:14:53 -0500 Subject: [PATCH] Make ConnectTrace::blocksConnected private, hide behind accessors --- src/validation.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index ff38f608133..f2c90e028b8 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2212,7 +2212,17 @@ static int64_t nTimePostConnect = 0; * part of a single ActivateBestChainStep call. */ struct ConnectTrace { +private: std::vector > > blocksConnected; + +public: + void BlockConnected(CBlockIndex* pindex, std::shared_ptr pblock) { + blocksConnected.emplace_back(pindex, std::move(pblock)); + } + + std::vector > >& 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 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; } @@ -2499,7 +2509,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, } // MemPoolConflictRemovalTracker destroyed and conflict evictions are notified // Transactions in the connected block are notified - for (const auto& pair : connectTrace.blocksConnected) { + for (const auto& pair : connectTrace.GetBlocksConnected()) { assert(pair.second); const CBlock& block = *(pair.second); for (unsigned int i = 0; i < block.vtx.size(); i++)