@ -4134,8 +4134,7 @@ bool ProcessMessages(CNode* pfrom)
bool SendMessages ( CNode * pto , bool fSendTrickle )
bool SendMessages ( CNode * pto , bool fSendTrickle )
{
{
TRY_LOCK ( cs_main , lockMain ) ;
{
if ( lockMain ) {
// Don't send anything until we get their version message
// Don't send anything until we get their version message
if ( pto - > nVersion = = 0 )
if ( pto - > nVersion = = 0 )
return true ;
return true ;
@ -4170,20 +4169,6 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
}
}
}
}
// Start block sync
if ( pto - > fStartSync & & ! fImporting & & ! fReindex ) {
pto - > fStartSync = false ;
PushGetBlocks ( pto , chainActive . Tip ( ) , uint256 ( 0 ) ) ;
}
// Resend wallet transactions that haven't gotten in a block yet
// Except during reindex, importing and IBD, when old wallet
// transactions become unconfirmed and spams other nodes.
if ( ! fReindex & & ! fImporting & & ! IsInitialBlockDownload ( ) )
{
ResendWalletTransactions ( ) ;
}
// Address refresh broadcast
// Address refresh broadcast
static int64 nLastRebroadcast ;
static int64 nLastRebroadcast ;
if ( ! IsInitialBlockDownload ( ) & & ( GetTime ( ) - nLastRebroadcast > 24 * 60 * 60 ) )
if ( ! IsInitialBlockDownload ( ) & & ( GetTime ( ) - nLastRebroadcast > 24 * 60 * 60 ) )
@ -4234,6 +4219,23 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
pto - > PushMessage ( " addr " , vAddr ) ;
pto - > PushMessage ( " addr " , vAddr ) ;
}
}
TRY_LOCK ( cs_main , lockMain ) ;
if ( ! lockMain )
return true ;
// Start block sync
if ( pto - > fStartSync & & ! fImporting & & ! fReindex ) {
pto - > fStartSync = false ;
PushGetBlocks ( pto , chainActive . Tip ( ) , uint256 ( 0 ) ) ;
}
// Resend wallet transactions that haven't gotten in a block yet
// Except during reindex, importing and IBD, when old wallet
// transactions become unconfirmed and spams other nodes.
if ( ! fReindex & & ! fImporting & & ! IsInitialBlockDownload ( ) )
{
ResendWalletTransactions ( ) ;
}
//
//
// Message: inventory
// Message: inventory