Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 2,312 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* This class is single-use, once you call GetBlocksConnected() you have to | * This class is single-use, once you call GetBlocksConnected() you have to | ||||
* throw it away and make a new one. | * throw it away and make a new one. | ||||
*/ | */ | ||||
class ConnectTrace { | class ConnectTrace { | ||||
private: | private: | ||||
std::vector<PerBlockConnectTrace> blocksConnected; | std::vector<PerBlockConnectTrace> blocksConnected; | ||||
CTxMemPool &pool; | CTxMemPool &pool; | ||||
boost::signals2::scoped_connection m_connNotifyEntryRemoved; | |||||
public: | public: | ||||
explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) { | explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) { | ||||
pool.NotifyEntryRemoved.connect( | m_connNotifyEntryRemoved = pool.NotifyEntryRemoved.connect( | ||||
boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); | |||||
} | |||||
~ConnectTrace() { | |||||
pool.NotifyEntryRemoved.disconnect( | |||||
boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); | boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); | ||||
} | } | ||||
void BlockConnected(CBlockIndex *pindex, | void BlockConnected(CBlockIndex *pindex, | ||||
std::shared_ptr<const CBlock> pblock) { | std::shared_ptr<const CBlock> pblock) { | ||||
assert(!blocksConnected.back().pindex); | assert(!blocksConnected.back().pindex); | ||||
assert(pindex); | assert(pindex); | ||||
assert(pblock); | assert(pblock); | ||||
▲ Show 20 Lines • Show All 3,405 Lines • Show Last 20 Lines |