@@ -2787,7 +2787,7 @@ static int64_t nTimePostConnect = 0;
2787
2787
* Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock
2788
2788
* corresponding to pindexNew, to bypass loading it again from disk.
2789
2789
*/
2790
- bool static ConnectTip (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock, std::list<CTransaction> &txConflicted, std::vector<std::tuple<CTransaction,CBlockIndex*,int > > &txChanged)
2790
+ bool static ConnectTip (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock, std::list<CTransaction> &txConflicted, std::vector<std::tuple<CTransaction,CBlockIndex*,int >> &txChanged)
2791
2791
{
2792
2792
assert (pindexNew->pprev == chainActive.Tip ());
2793
2793
// Read block from disk.
@@ -2829,7 +2829,7 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
2829
2829
UpdateTip (pindexNew, chainparams);
2830
2830
2831
2831
for (unsigned int i=0 ; i < pblock->vtx .size (); i++)
2832
- txChanged.push_back ( std::make_tuple ( pblock->vtx [i], pindexNew, i) );
2832
+ txChanged.emplace_back ( pblock->vtx [i], pindexNew, i);
2833
2833
2834
2834
int64_t nTime6 = GetTimeMicros (); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
2835
2835
LogPrint (" bench" , " - Connect postprocess: %.2fms [%.2fs]\n " , (nTime6 - nTime5) * 0.001 , nTimePostConnect * 0.000001 );
@@ -2911,7 +2911,7 @@ static void PruneBlockIndexCandidates() {
2911
2911
* Try to make some progress towards making pindexMostWork the active block.
2912
2912
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork.
2913
2913
*/
2914
- static bool ActivateBestChainStep (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const CBlock* pblock, bool & fInvalidFound , std::list<CTransaction>& txConflicted, std::vector<std::tuple<CTransaction,CBlockIndex*,int > >& txChanged)
2914
+ static bool ActivateBestChainStep (CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const CBlock* pblock, bool & fInvalidFound , std::list<CTransaction>& txConflicted, std::vector<std::tuple<CTransaction,CBlockIndex*,int >>& txChanged)
2915
2915
{
2916
2916
AssertLockHeld (cs_main);
2917
2917
const CBlockIndex *pindexOldTip = chainActive.Tip ();
@@ -3013,14 +3013,17 @@ static void NotifyHeaderTip() {
3013
3013
bool ActivateBestChain (CValidationState &state, const CChainParams& chainparams, const CBlock *pblock, CConnman* connman) {
3014
3014
CBlockIndex *pindexMostWork = NULL ;
3015
3015
CBlockIndex *pindexNewTip = NULL ;
3016
+ std::vector<std::tuple<CTransaction,CBlockIndex*,int >> txChanged;
3017
+ if (pblock)
3018
+ txChanged.reserve (pblock->vtx .size ());
3016
3019
do {
3020
+ txChanged.clear ();
3017
3021
boost::this_thread::interruption_point ();
3018
3022
if (ShutdownRequested ())
3019
3023
break ;
3020
3024
3021
3025
const CBlockIndex *pindexFork;
3022
3026
std::list<CTransaction> txConflicted;
3023
- std::vector<std::tuple<CTransaction,CBlockIndex*,int > > txChanged;
3024
3027
bool fInitialDownload ;
3025
3028
int nNewHeight;
3026
3029
{
0 commit comments