@@ -1895,7 +1895,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
18951895 BlockTransactions resp;
18961896 vRecv >> resp;
18971897
1898- CBlock block ;
1898+ std::shared_ptr< CBlock> pblock = std::make_shared<CBlock>() ;
18991899 bool fBlockRead = false ;
19001900 {
19011901 LOCK (cs_main);
@@ -1908,7 +1908,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
19081908 }
19091909
19101910 PartiallyDownloadedBlock& partialBlock = *it->second .second ->partialBlock ;
1911- ReadStatus status = partialBlock.FillBlock (block , resp.txn );
1911+ ReadStatus status = partialBlock.FillBlock (*pblock , resp.txn );
19121912 if (status == READ_STATUS_INVALID) {
19131913 MarkBlockAsReceived (resp.blockhash ); // Reset in-flight state in case of whitelist
19141914 Misbehaving (pfrom->GetId (), 100 );
@@ -1951,7 +1951,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
19511951 bool fNewBlock = false ;
19521952 // Since we requested this block (it was in mapBlocksInFlight), force it to be processed,
19531953 // even if it would not be a candidate for new tip (missing previous block, chain not long enough, etc)
1954- ProcessNewBlock (chainparams, &block , true , NULL , &fNewBlock );
1954+ ProcessNewBlock (chainparams, pblock , true , NULL , &fNewBlock );
19551955 if (fNewBlock )
19561956 pfrom->nLastBlockTime = GetTime ();
19571957 }
@@ -2112,17 +2112,17 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
21122112
21132113 else if (strCommand == NetMsgType::BLOCK && !fImporting && !fReindex ) // Ignore blocks received while importing
21142114 {
2115- CBlock block ;
2116- vRecv >> block ;
2115+ std::shared_ptr< CBlock> pblock = std::make_shared<CBlock>() ;
2116+ vRecv >> *pblock ;
21172117
2118- LogPrint (" net" , " received block %s peer=%d\n " , block. GetHash ().ToString (), pfrom->id );
2118+ LogPrint (" net" , " received block %s peer=%d\n " , pblock-> GetHash ().ToString (), pfrom->id );
21192119
21202120 // Process all blocks from whitelisted peers, even if not requested,
21212121 // unless we're still syncing with the network.
21222122 // Such an unrequested block may still be processed, subject to the
21232123 // conditions in AcceptBlock().
21242124 bool forceProcessing = pfrom->fWhitelisted && !IsInitialBlockDownload ();
2125- const uint256 hash (block. GetHash ());
2125+ const uint256 hash (pblock-> GetHash ());
21262126 {
21272127 LOCK (cs_main);
21282128 // Also always process if we requested the block explicitly, as we may
@@ -2133,7 +2133,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
21332133 mapBlockSource.emplace (hash, std::make_pair (pfrom->GetId (), true ));
21342134 }
21352135 bool fNewBlock = false ;
2136- ProcessNewBlock (chainparams, &block , forceProcessing, NULL , &fNewBlock );
2136+ ProcessNewBlock (chainparams, pblock , forceProcessing, NULL , &fNewBlock );
21372137 if (fNewBlock )
21382138 pfrom->nLastBlockTime = GetTime ();
21392139 }
0 commit comments