aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-03-06 17:14:53 -0500
committerMatt Corallo <git@bluematt.me>2017-04-07 11:53:42 +0200
commit29e6e231c88904d0e17187b116db5a958d952bcf (patch)
treefee4b48b6eec4c540ce14fb7b622b6385bef08ef
parent822000cf82ce78954209df0bcf56b90c0f42e9b4 (diff)
downloadbitcoin-29e6e231c88904d0e17187b116db5a958d952bcf.tar.xz
Make ConnectTrace::blocksConnected private, hide behind accessors
-rw-r--r--src/validation.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index ff38f60813..f2c90e028b 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<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 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++)