@ -3278,6 +3278,8 @@ void static ProcessGetData(CNode* pfrom)
@@ -3278,6 +3278,8 @@ void static ProcessGetData(CNode* pfrom)
vector < CInv > vNotFound ;
LOCK ( cs_main ) ;
while ( it ! = pfrom - > vRecvGetData . end ( ) ) {
// Don't bother if send buffer is too full to respond anyway
if ( pfrom - > nSendSize > = SendBufferSize ( ) )
@ -3450,7 +3452,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3450,7 +3452,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
pfrom - > fClient = ! ( pfrom - > nServices & NODE_NETWORK ) ;
AddTimeData ( pfrom - > addr , nTime ) ;
// Change version
pfrom - > PushMessage ( " verack " ) ;
@ -3492,6 +3493,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3492,6 +3493,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
LogPrintf ( " receive version message: version %d, blocks=%d, us=%s, them=%s, peer=%s \n " , pfrom - > nVersion , pfrom - > nStartingHeight , addrMe . ToString ( ) . c_str ( ) , addrFrom . ToString ( ) . c_str ( ) , pfrom - > addr . ToString ( ) . c_str ( ) ) ;
LOCK ( cs_main ) ;
AddTimeData ( pfrom - > addr , nTime ) ;
cPeerBlockCounts . input ( pfrom - > nStartingHeight ) ;
}
@ -3595,6 +3598,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3595,6 +3598,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
break ;
}
}
LOCK ( cs_main ) ;
for ( unsigned int nInv = 0 ; nInv < vInv . size ( ) ; nInv + + )
{
const CInv & inv = vInv [ nInv ] ;
@ -3652,6 +3658,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3652,6 +3658,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
uint256 hashStop ;
vRecv > > locator > > hashStop ;
LOCK ( cs_main ) ;
// Find the last block the caller has in the main chain
CBlockIndex * pindex = locator . GetBlockIndex ( ) ;
@ -3686,6 +3694,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3686,6 +3694,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
uint256 hashStop ;
vRecv > > locator > > hashStop ;
LOCK ( cs_main ) ;
CBlockIndex * pindex = NULL ;
if ( locator . IsNull ( ) )
{
@ -3728,6 +3738,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3728,6 +3738,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
CInv inv ( MSG_TX , tx . GetHash ( ) ) ;
pfrom - > AddInventoryKnown ( inv ) ;
LOCK ( cs_main ) ;
bool fMissingInputs = false ;
CValidationState state ;
if ( mempool . accept ( state , tx , true , & fMissingInputs ) )
@ -3802,6 +3814,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3802,6 +3814,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
CInv inv ( MSG_BLOCK , block . GetHash ( ) ) ;
pfrom - > AddInventoryKnown ( inv ) ;
LOCK ( cs_main ) ;
CValidationState state ;
if ( ProcessBlock ( state , pfrom , & block ) )
mapAlreadyAskedFor . erase ( inv ) ;
@ -3823,6 +3837,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
@@ -3823,6 +3837,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
else if ( strCommand = = " mempool " )
{
LOCK ( cs_main ) ;
std : : vector < uint256 > vtxid ;
LOCK2 ( mempool . cs , pfrom - > cs_filter ) ;
mempool . queryHashes ( vtxid ) ;
@ -4088,10 +4104,7 @@ bool ProcessMessages(CNode* pfrom)
@@ -4088,10 +4104,7 @@ bool ProcessMessages(CNode* pfrom)
bool fRet = false ;
try
{
{
LOCK ( cs_main ) ;
fRet = ProcessMessage ( pfrom , strCommand , vRecv ) ;
}
fRet = ProcessMessage ( pfrom , strCommand , vRecv ) ;
boost : : this_thread : : interruption_point ( ) ;
}
catch ( std : : ios_base : : failure & e )