@ -309,7 +309,7 @@ bool AddOrphanTx(const CTransaction& tx)
unsigned int sz = tx . GetSerializeSize ( SER_NETWORK , CTransaction : : CURRENT_VERSION ) ;
unsigned int sz = tx . GetSerializeSize ( SER_NETWORK , CTransaction : : CURRENT_VERSION ) ;
if ( sz > 5000 )
if ( sz > 5000 )
{
{
LogPrint ( " mempool " , " ignoring large orphan tx (size: %u, hash: %s) \n " , sz , hash . ToString ( ) . c_str ( ) ) ;
LogPrint ( " mempool " , " ignoring large orphan tx (size: %u, hash: %s) \n " , sz , hash . ToString ( ) ) ;
return false ;
return false ;
}
}
@ -317,7 +317,7 @@ bool AddOrphanTx(const CTransaction& tx)
BOOST_FOREACH ( const CTxIn & txin , tx . vin )
BOOST_FOREACH ( const CTxIn & txin , tx . vin )
mapOrphanTransactionsByPrev [ txin . prevout . hash ] . insert ( hash ) ;
mapOrphanTransactionsByPrev [ txin . prevout . hash ] . insert ( hash ) ;
LogPrint ( " mempool " , " stored orphan tx %s (mapsz % " PRIszu " ) \n " , hash . ToString ( ) . c_str ( ) ,
LogPrint ( " mempool " , " stored orphan tx %s (mapsz % " PRIszu " ) \n " , hash . ToString ( ) ,
mapOrphanTransactions . size ( ) ) ;
mapOrphanTransactions . size ( ) ) ;
return true ;
return true ;
}
}
@ -693,7 +693,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
string reason ;
string reason ;
if ( Params ( ) . NetworkID ( ) = = CChainParams : : MAIN & & ! IsStandardTx ( tx , reason ) )
if ( Params ( ) . NetworkID ( ) = = CChainParams : : MAIN & & ! IsStandardTx ( tx , reason ) )
return state . DoS ( 0 ,
return state . DoS ( 0 ,
error ( " AcceptToMemoryPool : nonstandard transaction: %s " , reason . c_str ( ) ) ,
error ( " AcceptToMemoryPool : nonstandard transaction: %s " , reason ) ,
REJECT_NONSTANDARD , reason ) ;
REJECT_NONSTANDARD , reason ) ;
// is it already in the memory pool?
// is it already in the memory pool?
@ -771,7 +771,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
int64_t txMinFee = GetMinFee ( tx , nSize , true , GMF_RELAY ) ;
int64_t txMinFee = GetMinFee ( tx , nSize , true , GMF_RELAY ) ;
if ( fLimitFree & & nFees < txMinFee )
if ( fLimitFree & & nFees < txMinFee )
return state . DoS ( 0 , error ( " AcceptToMemoryPool : not enough fees %s, % " PRId64 " < % " PRId64 ,
return state . DoS ( 0 , error ( " AcceptToMemoryPool : not enough fees %s, % " PRId64 " < % " PRId64 ,
hash . ToString ( ) . c_str ( ) , nFees , txMinFee ) ,
hash . ToString ( ) , nFees , txMinFee ) ,
REJECT_INSUFFICIENTFEE , " insufficient fee " ) ;
REJECT_INSUFFICIENTFEE , " insufficient fee " ) ;
// Continuously rate-limit free transactions
// Continuously rate-limit free transactions
@ -800,14 +800,14 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
if ( fRejectInsaneFee & & nFees > CTransaction : : nMinRelayTxFee * 10000 )
if ( fRejectInsaneFee & & nFees > CTransaction : : nMinRelayTxFee * 10000 )
return error ( " AcceptToMemoryPool: : insane fees %s, % " PRId64 " > % " PRId64 ,
return error ( " AcceptToMemoryPool: : insane fees %s, % " PRId64 " > % " PRId64 ,
hash . ToString ( ) . c_str ( ) ,
hash . ToString ( ) ,
nFees , CTransaction : : nMinRelayTxFee * 10000 ) ;
nFees , CTransaction : : nMinRelayTxFee * 10000 ) ;
// Check against previous transactions
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if ( ! CheckInputs ( tx , state , view , true , SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC ) )
if ( ! CheckInputs ( tx , state , view , true , SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC ) )
{
{
return error ( " AcceptToMemoryPool: : ConnectInputs failed %s " , hash . ToString ( ) . c_str ( ) ) ;
return error ( " AcceptToMemoryPool: : ConnectInputs failed %s " , hash . ToString ( ) ) ;
}
}
// Store transaction in memory
// Store transaction in memory
pool . addUnchecked ( hash , entry ) ;
pool . addUnchecked ( hash , entry ) ;
@ -1101,8 +1101,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
/// debug print
/// debug print
LogPrintf ( " GetNextWorkRequired RETARGET \n " ) ;
LogPrintf ( " GetNextWorkRequired RETARGET \n " ) ;
LogPrintf ( " nTargetTimespan = % " PRId64 " nActualTimespan = % " PRId64 " \n " , nTargetTimespan , nActualTimespan ) ;
LogPrintf ( " nTargetTimespan = % " PRId64 " nActualTimespan = % " PRId64 " \n " , nTargetTimespan , nActualTimespan ) ;
LogPrintf ( " Before: %08x %s \n " , pindexLast - > nBits , CBigNum ( ) . SetCompact ( pindexLast - > nBits ) . getuint256 ( ) . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " Before: %08x %s \n " , pindexLast - > nBits , CBigNum ( ) . SetCompact ( pindexLast - > nBits ) . getuint256 ( ) . ToString ( ) ) ;
LogPrintf ( " After: %08x %s \n " , bnNew . GetCompact ( ) , bnNew . getuint256 ( ) . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " After: %08x %s \n " , bnNew . GetCompact ( ) , bnNew . getuint256 ( ) . ToString ( ) ) ;
return bnNew . GetCompact ( ) ;
return bnNew . GetCompact ( ) ;
}
}
@ -1176,8 +1176,8 @@ void CheckForkWarningConditions()
if ( pindexBestForkTip )
if ( pindexBestForkTip )
{
{
LogPrintf ( " CheckForkWarningConditions: Warning: Large valid fork found \n forking the chain at height %d (%s) \n lasting to height %d (%s). \n Chain state database corruption likely. \n " ,
LogPrintf ( " CheckForkWarningConditions: Warning: Large valid fork found \n forking the chain at height %d (%s) \n lasting to height %d (%s). \n Chain state database corruption likely. \n " ,
pindexBestForkBase - > nHeight , pindexBestForkBase - > phashBlock - > ToString ( ) . c_str ( ) ,
pindexBestForkBase - > nHeight , pindexBestForkBase - > phashBlock - > ToString ( ) ,
pindexBestForkTip - > nHeight , pindexBestForkTip - > phashBlock - > ToString ( ) . c_str ( ) ) ;
pindexBestForkTip - > nHeight , pindexBestForkTip - > phashBlock - > ToString ( ) ) ;
fLargeWorkForkFound = true ;
fLargeWorkForkFound = true ;
}
}
else
else
@ -1237,12 +1237,12 @@ void static InvalidChainFound(CBlockIndex* pindexNew)
uiInterface . NotifyBlocksChanged ( ) ;
uiInterface . NotifyBlocksChanged ( ) ;
}
}
LogPrintf ( " InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s \n " ,
LogPrintf ( " InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s \n " ,
pindexNew - > GetBlockHash ( ) . ToString ( ) . c_str ( ) , pindexNew - > nHeight ,
pindexNew - > GetBlockHash ( ) . ToString ( ) , pindexNew - > nHeight ,
log ( pindexNew - > nChainWork . getdouble ( ) ) / log ( 2.0 ) , DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " ,
log ( pindexNew - > nChainWork . getdouble ( ) ) / log ( 2.0 ) , DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " ,
pindexNew - > GetBlockTime ( ) ) . c_str ( ) ) ;
pindexNew - > GetBlockTime ( ) ) ) ;
LogPrintf ( " InvalidChainFound: current best=%s height=%d log2_work=%.8g date=%s \n " ,
LogPrintf ( " InvalidChainFound: current best=%s height=%d log2_work=%.8g date=%s \n " ,
chainActive . Tip ( ) - > GetBlockHash ( ) . ToString ( ) . c_str ( ) , chainActive . Height ( ) , log ( chainActive . Tip ( ) - > nChainWork . getdouble ( ) ) / log ( 2.0 ) ,
chainActive . Tip ( ) - > GetBlockHash ( ) . ToString ( ) , chainActive . Height ( ) , log ( chainActive . Tip ( ) - > nChainWork . getdouble ( ) ) / log ( 2.0 ) ,
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , chainActive . Tip ( ) - > GetBlockTime ( ) ) . c_str ( ) ) ;
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , chainActive . Tip ( ) - > GetBlockTime ( ) ) ) ;
CheckForkWarningConditions ( ) ;
CheckForkWarningConditions ( ) ;
}
}
@ -1350,7 +1350,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach
bool CScriptCheck : : operator ( ) ( ) const {
bool CScriptCheck : : operator ( ) ( ) const {
const CScript & scriptSig = ptxTo - > vin [ nIn ] . scriptSig ;
const CScript & scriptSig = ptxTo - > vin [ nIn ] . scriptSig ;
if ( ! VerifyScript ( scriptSig , scriptPubKey , * ptxTo , nIn , nFlags , nHashType ) )
if ( ! VerifyScript ( scriptSig , scriptPubKey , * ptxTo , nIn , nFlags , nHashType ) )
return error ( " CScriptCheck() : % s VerifySignature failed " , ptxTo->GetHash().ToString().c_str() ) ;
return error ( " CScriptCheck() : % s VerifySignature failed " , ptxTo->GetHash().ToString()) ;
return true ;
return true ;
}
}
@ -1369,7 +1369,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCach
// This doesn't trigger the DoS code on purpose; if it did, it would make it easier
// This doesn't trigger the DoS code on purpose; if it did, it would make it easier
// for an attacker to attempt to split the network.
// for an attacker to attempt to split the network.
if ( ! inputs . HaveInputs ( tx ) )
if ( ! inputs . HaveInputs ( tx ) )
return state . Invalid ( error ( " CheckInputs() : %s inputs unavailable " , tx . GetHash ( ) . ToString ( ) . c_str ( ) ) ) ;
return state . Invalid ( error ( " CheckInputs() : %s inputs unavailable " , tx . GetHash ( ) . ToString ( ) ) ) ;
// While checking, GetBestBlock() refers to the parent block.
// While checking, GetBestBlock() refers to the parent block.
// This is also true for mempool checks.
// This is also true for mempool checks.
@ -1399,13 +1399,13 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCach
}
}
if ( nValueIn < tx . GetValueOut ( ) )
if ( nValueIn < tx . GetValueOut ( ) )
return state . DoS ( 100 , error ( " CheckInputs() : %s value in < value out " , tx . GetHash ( ) . ToString ( ) . c_str ( ) ) ,
return state . DoS ( 100 , error ( " CheckInputs() : %s value in < value out " , tx . GetHash ( ) . ToString ( ) ) ,
REJECT_INVALID , " in < out " ) ;
REJECT_INVALID , " in < out " ) ;
// Tally transaction fees
// Tally transaction fees
int64_t nTxFee = nValueIn - tx . GetValueOut ( ) ;
int64_t nTxFee = nValueIn - tx . GetValueOut ( ) ;
if ( nTxFee < 0 )
if ( nTxFee < 0 )
return state . DoS ( 100 , error ( " CheckInputs() : %s nTxFee < 0 " , tx . GetHash ( ) . ToString ( ) . c_str ( ) ) ,
return state . DoS ( 100 , error ( " CheckInputs() : %s nTxFee < 0 " , tx . GetHash ( ) . ToString ( ) ) ,
REJECT_INVALID , " fee < 0 " ) ;
REJECT_INVALID , " fee < 0 " ) ;
nFees + = nTxFee ;
nFees + = nTxFee ;
if ( ! MoneyRange ( nFees ) )
if ( ! MoneyRange ( nFees ) )
@ -1766,8 +1766,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
reverse ( vConnect . begin ( ) , vConnect . end ( ) ) ;
reverse ( vConnect . begin ( ) , vConnect . end ( ) ) ;
if ( vDisconnect . size ( ) > 0 ) {
if ( vDisconnect . size ( ) > 0 ) {
LogPrintf ( " REORGANIZE: Disconnect % " PRIszu " blocks; %s... \n " , vDisconnect . size ( ) , pfork - > GetBlockHash ( ) . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " REORGANIZE: Disconnect % " PRIszu " blocks; %s... \n " , vDisconnect . size ( ) , pfork - > GetBlockHash ( ) . ToString ( ) ) ;
LogPrintf ( " REORGANIZE: Connect % " PRIszu " blocks; ...%s \n " , vConnect . size ( ) , pindexNew - > GetBlockHash ( ) . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " REORGANIZE: Connect % " PRIszu " blocks; ...%s \n " , vConnect . size ( ) , pindexNew - > GetBlockHash ( ) . ToString ( ) ) ;
}
}
// Disconnect shorter branch
// Disconnect shorter branch
@ -1778,7 +1778,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
return state . Abort ( _ ( " Failed to read block " ) ) ;
return state . Abort ( _ ( " Failed to read block " ) ) ;
int64_t nStart = GetTimeMicros ( ) ;
int64_t nStart = GetTimeMicros ( ) ;
if ( ! DisconnectBlock ( block , state , pindex , view ) )
if ( ! DisconnectBlock ( block , state , pindex , view ) )
return error ( " SetBestBlock() : DisconnectBlock % s failed " , pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " SetBestBlock() : DisconnectBlock % s failed " , pindex->GetBlockHash().ToString()) ;
if ( fBenchmark )
if ( fBenchmark )
LogPrintf ( " - Disconnect: %.2fms \n " , ( GetTimeMicros ( ) - nStart ) * 0.001 ) ;
LogPrintf ( " - Disconnect: %.2fms \n " , ( GetTimeMicros ( ) - nStart ) * 0.001 ) ;
@ -1802,7 +1802,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
InvalidChainFound ( pindexNew ) ;
InvalidChainFound ( pindexNew ) ;
InvalidBlockFound ( pindex ) ;
InvalidBlockFound ( pindex ) ;
}
}
return error ( " SetBestBlock() : ConnectBlock % s failed " , pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " SetBestBlock() : ConnectBlock % s failed " , pindex->GetBlockHash().ToString()) ;
}
}
if ( fBenchmark )
if ( fBenchmark )
LogPrintf ( " - Connect: %.2fms \n " , ( GetTimeMicros ( ) - nStart ) * 0.001 ) ;
LogPrintf ( " - Connect: %.2fms \n " , ( GetTimeMicros ( ) - nStart ) * 0.001 ) ;
@ -1868,8 +1868,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
nTimeBestReceived = GetTime ( ) ;
nTimeBestReceived = GetTime ( ) ;
mempool . AddTransactionsUpdated ( 1 ) ;
mempool . AddTransactionsUpdated ( 1 ) ;
LogPrintf ( " SetBestChain: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f \n " ,
LogPrintf ( " SetBestChain: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f \n " ,
chainActive . Tip ( ) - > GetBlockHash ( ) . ToString ( ) . c_str ( ) , chainActive . Height ( ) , log ( chainActive . Tip ( ) - > nChainWork . getdouble ( ) ) / log ( 2.0 ) , ( unsigned long ) pindexNew - > nChainTx ,
chainActive . Tip ( ) - > GetBlockHash ( ) . ToString ( ) , chainActive . Height ( ) , log ( chainActive . Tip ( ) - > nChainWork . getdouble ( ) ) / log ( 2.0 ) , ( unsigned long ) pindexNew - > nChainTx ,
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , chainActive . Tip ( ) - > GetBlockTime ( ) ) . c_str ( ) ,
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , chainActive . Tip ( ) - > GetBlockTime ( ) ) ,
Checkpoints : : GuessVerificationProgress ( chainActive . Tip ( ) ) ) ;
Checkpoints : : GuessVerificationProgress ( chainActive . Tip ( ) ) ) ;
// Check the version of the last 100 blocks to see if we need to upgrade:
// Check the version of the last 100 blocks to see if we need to upgrade:
@ -1907,7 +1907,7 @@ bool AddToBlockIndex(CBlock& block, CValidationState& state, const CDiskBlockPos
// Check for duplicate
// Check for duplicate
uint256 hash = block . GetHash ( ) ;
uint256 hash = block . GetHash ( ) ;
if ( mapBlockIndex . count ( hash ) )
if ( mapBlockIndex . count ( hash ) )
return state . Invalid ( error ( " AddToBlockIndex() : %s already exists " , hash . ToString ( ) . c_str ( ) ) ) ;
return state . Invalid ( error ( " AddToBlockIndex() : %s already exists " , hash . ToString ( ) ) ) ;
// Construct new block index object
// Construct new block index object
CBlockIndex * pindexNew = new CBlockIndex ( block ) ;
CBlockIndex * pindexNew = new CBlockIndex ( block ) ;
@ -1970,7 +1970,7 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd
}
}
} else {
} else {
while ( infoLastBlockFile . nSize + nAddSize > = MAX_BLOCKFILE_SIZE ) {
while ( infoLastBlockFile . nSize + nAddSize > = MAX_BLOCKFILE_SIZE ) {
LogPrintf ( " Leaving block file %i: %s \n " , nLastBlockFile , infoLastBlockFile . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " Leaving block file %i: %s \n " , nLastBlockFile , infoLastBlockFile . ToString ( ) ) ;
FlushBlockFile ( true ) ;
FlushBlockFile ( true ) ;
nLastBlockFile + + ;
nLastBlockFile + + ;
infoLastBlockFile . SetNull ( ) ;
infoLastBlockFile . SetNull ( ) ;
@ -2252,9 +2252,9 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl
// Check for duplicate
// Check for duplicate
uint256 hash = pblock - > GetHash ( ) ;
uint256 hash = pblock - > GetHash ( ) ;
if ( mapBlockIndex . count ( hash ) )
if ( mapBlockIndex . count ( hash ) )
return state . Invalid ( error ( " ProcessBlock() : already have block %d %s " , mapBlockIndex [ hash ] - > nHeight , hash . ToString ( ) . c_str ( ) ) ) ;
return state . Invalid ( error ( " ProcessBlock() : already have block %d %s " , mapBlockIndex [ hash ] - > nHeight , hash . ToString ( ) ) ) ;
if ( mapOrphanBlocks . count ( hash ) )
if ( mapOrphanBlocks . count ( hash ) )
return state . Invalid ( error ( " ProcessBlock() : already have block (orphan) %s " , hash . ToString ( ) . c_str ( ) ) ) ;
return state . Invalid ( error ( " ProcessBlock() : already have block (orphan) %s " , hash . ToString ( ) ) ) ;
// Preliminary checks
// Preliminary checks
if ( ! CheckBlock ( * pblock , state ) )
if ( ! CheckBlock ( * pblock , state ) )
@ -2285,7 +2285,7 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl
// If we don't already have its previous block, shunt it off to holding area until we get it
// If we don't already have its previous block, shunt it off to holding area until we get it
if ( pblock - > hashPrevBlock ! = 0 & & ! mapBlockIndex . count ( pblock - > hashPrevBlock ) )
if ( pblock - > hashPrevBlock ! = 0 & & ! mapBlockIndex . count ( pblock - > hashPrevBlock ) )
{
{
LogPrintf ( " ProcessBlock: ORPHAN BLOCK, prev=%s \n " , pblock - > hashPrevBlock . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " ProcessBlock: ORPHAN BLOCK, prev=%s \n " , pblock - > hashPrevBlock . ToString ( ) ) ;
// Accept orphans as long as there is a node to request its parents from
// Accept orphans as long as there is a node to request its parents from
if ( pfrom ) {
if ( pfrom ) {
@ -2502,7 +2502,7 @@ uint256 CPartialMerkleTree::ExtractMatches(std::vector<uint256> &vMatch) {
bool AbortNode ( const std : : string & strMessage ) {
bool AbortNode ( const std : : string & strMessage ) {
strMiscWarning = strMessage ;
strMiscWarning = strMessage ;
LogPrintf ( " *** %s \n " , strMessage . c_str ( ) ) ;
LogPrintf ( " *** %s \n " , strMessage ) ;
uiInterface . ThreadSafeMessageBox ( strMessage , " " , CClientUIInterface : : MSG_ERROR ) ;
uiInterface . ThreadSafeMessageBox ( strMessage , " " , CClientUIInterface : : MSG_ERROR ) ;
StartShutdown ( ) ;
StartShutdown ( ) ;
return false ;
return false ;
@ -2529,12 +2529,12 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
if ( ! file & & ! fReadOnly )
if ( ! file & & ! fReadOnly )
file = fopen ( path . string ( ) . c_str ( ) , " wb+ " ) ;
file = fopen ( path . string ( ) . c_str ( ) , " wb+ " ) ;
if ( ! file ) {
if ( ! file ) {
LogPrintf ( " Unable to open file %s \n " , path . string ( ) . c_str ( ) ) ;
LogPrintf ( " Unable to open file %s \n " , path . string ( ) ) ;
return NULL ;
return NULL ;
}
}
if ( pos . nPos ) {
if ( pos . nPos ) {
if ( fseek ( file , pos . nPos , SEEK_SET ) ) {
if ( fseek ( file , pos . nPos , SEEK_SET ) ) {
LogPrintf ( " Unable to seek to position %u of %s \n " , pos . nPos , path . string ( ) . c_str ( ) ) ;
LogPrintf ( " Unable to seek to position %u of %s \n " , pos . nPos , path . string ( ) ) ;
fclose ( file ) ;
fclose ( file ) ;
return NULL ;
return NULL ;
}
}
@ -2601,7 +2601,7 @@ bool static LoadBlockIndexDB()
pblocktree - > ReadLastBlockFile ( nLastBlockFile ) ;
pblocktree - > ReadLastBlockFile ( nLastBlockFile ) ;
LogPrintf ( " LoadBlockIndexDB(): last block file = %i \n " , nLastBlockFile ) ;
LogPrintf ( " LoadBlockIndexDB(): last block file = %i \n " , nLastBlockFile ) ;
if ( pblocktree - > ReadBlockFileInfo ( nLastBlockFile , infoLastBlockFile ) )
if ( pblocktree - > ReadBlockFileInfo ( nLastBlockFile , infoLastBlockFile ) )
LogPrintf ( " LoadBlockIndexDB(): last block file info: %s \n " , infoLastBlockFile . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " LoadBlockIndexDB(): last block file info: %s \n " , infoLastBlockFile . ToString ( ) ) ;
// Check whether we need to continue reindexing
// Check whether we need to continue reindexing
bool fReindexing = false ;
bool fReindexing = false ;
@ -2618,8 +2618,8 @@ bool static LoadBlockIndexDB()
return true ;
return true ;
chainActive . SetTip ( it - > second ) ;
chainActive . SetTip ( it - > second ) ;
LogPrintf ( " LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s \n " ,
LogPrintf ( " LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s \n " ,
chainActive . Tip ( ) - > GetBlockHash ( ) . ToString ( ) . c_str ( ) , chainActive . Height ( ) ,
chainActive . Tip ( ) - > GetBlockHash ( ) . ToString ( ) , chainActive . Height ( ) ,
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , chainActive . Tip ( ) - > GetBlockTime ( ) ) . c_str ( ) ) ;
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , chainActive . Tip ( ) - > GetBlockTime ( ) ) ) ;
return true ;
return true ;
}
}
@ -2649,24 +2649,24 @@ bool VerifyDB(int nCheckLevel, int nCheckDepth)
CBlock block ;
CBlock block ;
// check level 0: read from disk
// check level 0: read from disk
if ( ! ReadBlockFromDisk ( block , pindex ) )
if ( ! ReadBlockFromDisk ( block , pindex ) )
return error ( " VerifyDB() : * * * ReadBlockFromDisk failed at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " VerifyDB() : * * * ReadBlockFromDisk failed at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString()) ;
// check level 1: verify block validity
// check level 1: verify block validity
if ( nCheckLevel > = 1 & & ! CheckBlock ( block , state ) )
if ( nCheckLevel > = 1 & & ! CheckBlock ( block , state ) )
return error ( " VerifyDB() : * * * found bad block at % d , hash = % s \ n " , pindex->nHeight, pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " VerifyDB() : * * * found bad block at % d , hash = % s \ n " , pindex->nHeight, pindex->GetBlockHash().ToString()) ;
// check level 2: verify undo validity
// check level 2: verify undo validity
if ( nCheckLevel > = 2 & & pindex ) {
if ( nCheckLevel > = 2 & & pindex ) {
CBlockUndo undo ;
CBlockUndo undo ;
CDiskBlockPos pos = pindex - > GetUndoPos ( ) ;
CDiskBlockPos pos = pindex - > GetUndoPos ( ) ;
if ( ! pos . IsNull ( ) ) {
if ( ! pos . IsNull ( ) ) {
if ( ! undo . ReadFromDisk ( pos , pindex - > pprev - > GetBlockHash ( ) ) )
if ( ! undo . ReadFromDisk ( pos , pindex - > pprev - > GetBlockHash ( ) ) )
return error ( " VerifyDB() : * * * found bad undo data at % d , hash = % s \ n " , pindex->nHeight, pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " VerifyDB() : * * * found bad undo data at % d , hash = % s \ n " , pindex->nHeight, pindex->GetBlockHash().ToString()) ;
}
}
}
}
// check level 3: check for inconsistencies during memory-only disconnect of tip blocks
// check level 3: check for inconsistencies during memory-only disconnect of tip blocks
if ( nCheckLevel > = 3 & & pindex = = pindexState & & ( coins . GetCacheSize ( ) + pcoinsTip - > GetCacheSize ( ) ) < = 2 * nCoinCacheSize + 32000 ) {
if ( nCheckLevel > = 3 & & pindex = = pindexState & & ( coins . GetCacheSize ( ) + pcoinsTip - > GetCacheSize ( ) ) < = 2 * nCoinCacheSize + 32000 ) {
bool fClean = true ;
bool fClean = true ;
if ( ! DisconnectBlock ( block , state , pindex , coins , & fClean ) )
if ( ! DisconnectBlock ( block , state , pindex , coins , & fClean ) )
return error ( " VerifyDB() : * * * irrecoverable inconsistency in block data at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " VerifyDB() : * * * irrecoverable inconsistency in block data at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString()) ;
pindexState = pindex - > pprev ;
pindexState = pindex - > pprev ;
if ( ! fClean ) {
if ( ! fClean ) {
nGoodTransactions = 0 ;
nGoodTransactions = 0 ;
@ -2686,9 +2686,9 @@ bool VerifyDB(int nCheckLevel, int nCheckDepth)
pindex = chainActive . Next ( pindex ) ;
pindex = chainActive . Next ( pindex ) ;
CBlock block ;
CBlock block ;
if ( ! ReadBlockFromDisk ( block , pindex ) )
if ( ! ReadBlockFromDisk ( block , pindex ) )
return error ( " VerifyDB() : * * * ReadBlockFromDisk failed at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " VerifyDB() : * * * ReadBlockFromDisk failed at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString()) ;
if ( ! ConnectBlock ( block , state , pindex , coins ) )
if ( ! ConnectBlock ( block , state , pindex , coins ) )
return error ( " VerifyDB() : * * * found unconnectable block at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString().c_str() ) ;
return error ( " VerifyDB() : * * * found unconnectable block at % d , hash = % s " , pindex->nHeight, pindex->GetBlockHash().ToString()) ;
}
}
}
}
@ -2796,7 +2796,7 @@ void PrintBlockTree()
LogPrintf ( " %d (blk%05u.dat:0x%x) %s tx % " PRIszu " " ,
LogPrintf ( " %d (blk%05u.dat:0x%x) %s tx % " PRIszu " " ,
pindex - > nHeight ,
pindex - > nHeight ,
pindex - > GetBlockPos ( ) . nFile , pindex - > GetBlockPos ( ) . nPos ,
pindex - > GetBlockPos ( ) . nFile , pindex - > GetBlockPos ( ) . nPos ,
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , block . GetBlockTime ( ) ) . c_str ( ) ,
DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , block . GetBlockTime ( ) ) ,
block . vtx . size ( ) ) ;
block . vtx . size ( ) ) ;
// put the main time-chain first
// put the main time-chain first
@ -2999,10 +2999,10 @@ void Misbehaving(NodeId pnode, int howmuch)
state - > nMisbehavior + = howmuch ;
state - > nMisbehavior + = howmuch ;
if ( state - > nMisbehavior > = GetArg ( " -banscore " , 100 ) )
if ( state - > nMisbehavior > = GetArg ( " -banscore " , 100 ) )
{
{
LogPrintf ( " Misbehaving: %s (%d -> %d) BAN THRESHOLD EXCEEDED \n " , state - > name . c_str ( ) , state - > nMisbehavior - howmuch , state - > nMisbehavior ) ;
LogPrintf ( " Misbehaving: %s (%d -> %d) BAN THRESHOLD EXCEEDED \n " , state - > name , state - > nMisbehavior - howmuch , state - > nMisbehavior ) ;
state - > fShouldBan = true ;
state - > fShouldBan = true ;
} else
} else
LogPrintf ( " Misbehaving: %s (%d -> %d) \n " , state - > name . c_str ( ) , state - > nMisbehavior - howmuch , state - > nMisbehavior ) ;
LogPrintf ( " Misbehaving: %s (%d -> %d) \n " , state - > name , state - > nMisbehavior - howmuch , state - > nMisbehavior ) ;
}
}
void static ProcessGetData ( CNode * pfrom )
void static ProcessGetData ( CNode * pfrom )
@ -3120,7 +3120,7 @@ void static ProcessGetData(CNode* pfrom)
bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv )
bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv )
{
{
RandAddSeedPerfmon ( ) ;
RandAddSeedPerfmon ( ) ;
LogPrint ( " net " , " received: %s (% " PRIszu " bytes) \n " , strCommand . c_str ( ) , vRecv . size ( ) ) ;
LogPrint ( " net " , " received: %s (% " PRIszu " bytes) \n " , strCommand , vRecv . size ( ) ) ;
if ( mapArgs . count ( " -dropmessagestest " ) & & GetRand ( atoi ( mapArgs [ " -dropmessagestest " ] ) ) = = 0 )
if ( mapArgs . count ( " -dropmessagestest " ) & & GetRand ( atoi ( mapArgs [ " -dropmessagestest " ] ) ) = = 0 )
{
{
LogPrintf ( " dropmessagestest DROPPING RECV MESSAGE \n " ) ;
LogPrintf ( " dropmessagestest DROPPING RECV MESSAGE \n " ) ;
@ -3149,7 +3149,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if ( pfrom - > nVersion < MIN_PEER_PROTO_VERSION )
if ( pfrom - > nVersion < MIN_PEER_PROTO_VERSION )
{
{
// disconnect from peers older than this proto version
// disconnect from peers older than this proto version
LogPrintf ( " partner %s using obsolete version %i; disconnecting \n " , pfrom - > addr . ToString ( ) . c_str ( ) , pfrom - > nVersion ) ;
LogPrintf ( " partner %s using obsolete version %i; disconnecting \n " , pfrom - > addr . ToString ( ) , pfrom - > nVersion ) ;
pfrom - > PushMessage ( " reject " , strCommand , REJECT_OBSOLETE ,
pfrom - > PushMessage ( " reject " , strCommand , REJECT_OBSOLETE ,
strprintf ( " Version must be %d or greater " , MIN_PEER_PROTO_VERSION ) ) ;
strprintf ( " Version must be %d or greater " , MIN_PEER_PROTO_VERSION ) ) ;
pfrom - > fDisconnect = true ;
pfrom - > fDisconnect = true ;
@ -3180,7 +3180,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// Disconnect if we connected to ourself
// Disconnect if we connected to ourself
if ( nNonce = = nLocalHostNonce & & nNonce > 1 )
if ( nNonce = = nLocalHostNonce & & nNonce > 1 )
{
{
LogPrintf ( " connected to self at %s, disconnecting \n " , pfrom - > addr . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " connected to self at %s, disconnecting \n " , pfrom - > addr . ToString ( ) ) ;
pfrom - > fDisconnect = true ;
pfrom - > fDisconnect = true ;
return true ;
return true ;
}
}
@ -3230,7 +3230,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
pfrom - > fSuccessfullyConnected = true ;
pfrom - > fSuccessfullyConnected = true ;
LogPrintf ( " receive version message: %s: version %d, blocks=%d, us=%s, them=%s, peer=%s \n " , pfrom - > cleanSubVer . c_str ( ) , pfrom - > nVersion , pfrom - > nStartingHeight , addrMe . ToString ( ) . c_str ( ) , addrFrom . ToString ( ) . c_str ( ) , pfrom - > addr . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " receive version message: %s: version %d, blocks=%d, us=%s, them=%s, peer=%s \n " , pfrom - > cleanSubVer , pfrom - > nVersion , pfrom - > nStartingHeight , addrMe . ToString ( ) , addrFrom . ToString ( ) , pfrom - > addr . ToString ( ) ) ;
AddTimeData ( pfrom - > addr , nTime ) ;
AddTimeData ( pfrom - > addr , nTime ) ;
@ -3349,7 +3349,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
pfrom - > AddInventoryKnown ( inv ) ;
pfrom - > AddInventoryKnown ( inv ) ;
bool fAlreadyHave = AlreadyHave ( inv ) ;
bool fAlreadyHave = AlreadyHave ( inv ) ;
LogPrint ( " net " , " got inventory: %s %s \n " , inv . ToString ( ) . c_str ( ) , fAlreadyHave ? " have " : " new " ) ;
LogPrint ( " net " , " got inventory: %s %s \n " , inv . ToString ( ) , fAlreadyHave ? " have " : " new " ) ;
if ( ! fAlreadyHave ) {
if ( ! fAlreadyHave ) {
if ( ! fImporting & & ! fReindex )
if ( ! fImporting & & ! fReindex )
@ -3362,7 +3362,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// this situation and push another getblocks to continue.
// this situation and push another getblocks to continue.
PushGetBlocks ( pfrom , mapBlockIndex [ inv . hash ] , uint256 ( 0 ) ) ;
PushGetBlocks ( pfrom , mapBlockIndex [ inv . hash ] , uint256 ( 0 ) ) ;
if ( fDebug )
if ( fDebug )
LogPrintf ( " force request: %s \n " , inv . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " force request: %s \n " , inv . ToString ( ) ) ;
}
}
// Track requests for our stuff
// Track requests for our stuff
@ -3385,7 +3385,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
LogPrint ( " net " , " received getdata (% " PRIszu " invsz) \n " , vInv . size ( ) ) ;
LogPrint ( " net " , " received getdata (% " PRIszu " invsz) \n " , vInv . size ( ) ) ;
if ( ( fDebug & & vInv . size ( ) > 0 ) | | ( vInv . size ( ) = = 1 ) )
if ( ( fDebug & & vInv . size ( ) > 0 ) | | ( vInv . size ( ) = = 1 ) )
LogPrint ( " net " , " received getdata for: %s \n " , vInv [ 0 ] . ToString ( ) . c_str ( ) ) ;
LogPrint ( " net " , " received getdata for: %s \n " , vInv [ 0 ] . ToString ( ) ) ;
pfrom - > vRecvGetData . insert ( pfrom - > vRecvGetData . end ( ) , vInv . begin ( ) , vInv . end ( ) ) ;
pfrom - > vRecvGetData . insert ( pfrom - > vRecvGetData . end ( ) , vInv . begin ( ) , vInv . end ( ) ) ;
ProcessGetData ( pfrom ) ;
ProcessGetData ( pfrom ) ;
@ -3407,12 +3407,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if ( pindex )
if ( pindex )
pindex = chainActive . Next ( pindex ) ;
pindex = chainActive . Next ( pindex ) ;
int nLimit = 500 ;
int nLimit = 500 ;
LogPrint ( " net " , " getblocks %d to %s limit %d \n " , ( pindex ? pindex - > nHeight : - 1 ) , hashStop . ToString ( ) . c_str ( ) , nLimit ) ;
LogPrint ( " net " , " getblocks %d to %s limit %d \n " , ( pindex ? pindex - > nHeight : - 1 ) , hashStop . ToString ( ) , nLimit ) ;
for ( ; pindex ; pindex = chainActive . Next ( pindex ) )
for ( ; pindex ; pindex = chainActive . Next ( pindex ) )
{
{
if ( pindex - > GetBlockHash ( ) = = hashStop )
if ( pindex - > GetBlockHash ( ) = = hashStop )
{
{
LogPrint ( " net " , " getblocks stopping at %d %s \n " , pindex - > nHeight , pindex - > GetBlockHash ( ) . ToString ( ) . c_str ( ) ) ;
LogPrint ( " net " , " getblocks stopping at %d %s \n " , pindex - > nHeight , pindex - > GetBlockHash ( ) . ToString ( ) ) ;
break ;
break ;
}
}
pfrom - > PushInventory ( CInv ( MSG_BLOCK , pindex - > GetBlockHash ( ) ) ) ;
pfrom - > PushInventory ( CInv ( MSG_BLOCK , pindex - > GetBlockHash ( ) ) ) ;
@ -3420,7 +3420,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
{
// When this block is requested, we'll send an inv that'll make them
// When this block is requested, we'll send an inv that'll make them
// getblocks the next batch of inventory.
// getblocks the next batch of inventory.
LogPrint ( " net " , " getblocks stopping at limit %d %s \n " , pindex - > nHeight , pindex - > GetBlockHash ( ) . ToString ( ) . c_str ( ) ) ;
LogPrint ( " net " , " getblocks stopping at limit %d %s \n " , pindex - > nHeight , pindex - > GetBlockHash ( ) . ToString ( ) ) ;
pfrom - > hashContinue = pindex - > GetBlockHash ( ) ;
pfrom - > hashContinue = pindex - > GetBlockHash ( ) ;
break ;
break ;
}
}
@ -3456,7 +3456,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
vector < CBlock > vHeaders ;
vector < CBlock > vHeaders ;
int nLimit = 2000 ;
int nLimit = 2000 ;
LogPrint ( " net " , " getheaders %d to %s \n " , ( pindex ? pindex - > nHeight : - 1 ) , hashStop . ToString ( ) . c_str ( ) ) ;
LogPrint ( " net " , " getheaders %d to %s \n " , ( pindex ? pindex - > nHeight : - 1 ) , hashStop . ToString ( ) ) ;
for ( ; pindex ; pindex = chainActive . Next ( pindex ) )
for ( ; pindex ; pindex = chainActive . Next ( pindex ) )
{
{
vHeaders . push_back ( pindex - > GetBlockHeader ( ) ) ;
vHeaders . push_back ( pindex - > GetBlockHeader ( ) ) ;
@ -3491,8 +3491,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
LogPrint ( " mempool " , " AcceptToMemoryPool: %s %s : accepted %s (poolsz % " PRIszu " ) \n " ,
LogPrint ( " mempool " , " AcceptToMemoryPool: %s %s : accepted %s (poolsz % " PRIszu " ) \n " ,
pfrom - > addr . ToString ( ) . c_str ( ) , pfrom - > cleanSubVer . c_str ( ) ,
pfrom - > addr . ToString ( ) , pfrom - > cleanSubVer ,
tx . GetHash ( ) . ToString ( ) . c_str ( ) ,
tx . GetHash ( ) . ToString ( ) ,
mempool . mapTx . size ( ) ) ;
mempool . mapTx . size ( ) ) ;
// Recursively process any orphan transactions that depended on this one
// Recursively process any orphan transactions that depended on this one
@ -3513,7 +3513,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if ( AcceptToMemoryPool ( mempool , stateDummy , orphanTx , true , & fMissingInputs2 ) )
if ( AcceptToMemoryPool ( mempool , stateDummy , orphanTx , true , & fMissingInputs2 ) )
{
{
LogPrint ( " mempool " , " accepted orphan tx %s \n " , orphanHash . ToString ( ) . c_str ( ) ) ;
LogPrint ( " mempool " , " accepted orphan tx %s \n " , orphanHash . ToString ( ) ) ;
RelayTransaction ( orphanTx , orphanHash ) ;
RelayTransaction ( orphanTx , orphanHash ) ;
mapAlreadyAskedFor . erase ( CInv ( MSG_TX , orphanHash ) ) ;
mapAlreadyAskedFor . erase ( CInv ( MSG_TX , orphanHash ) ) ;
vWorkQueue . push_back ( orphanHash ) ;
vWorkQueue . push_back ( orphanHash ) ;
@ -3523,7 +3523,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
{
// invalid or too-little-fee orphan
// invalid or too-little-fee orphan
vEraseQueue . push_back ( orphanHash ) ;
vEraseQueue . push_back ( orphanHash ) ;
LogPrint ( " mempool " , " removed orphan tx %s \n " , orphanHash . ToString ( ) . c_str ( ) ) ;
LogPrint ( " mempool " , " removed orphan tx %s \n " , orphanHash . ToString ( ) ) ;
}
}
mempool . check ( pcoinsTip ) ;
mempool . check ( pcoinsTip ) ;
}
}
@ -3544,9 +3544,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
int nDoS = 0 ;
int nDoS = 0 ;
if ( state . IsInvalid ( nDoS ) )
if ( state . IsInvalid ( nDoS ) )
{
{
LogPrint ( " mempool " , " %s from %s %s was not accepted into the memory pool: %s \n " , tx . GetHash ( ) . ToString ( ) . c_str ( ) ,
LogPrint ( " mempool " , " %s from %s %s was not accepted into the memory pool: %s \n " , tx . GetHash ( ) . ToString ( ) ,
pfrom - > addr . ToString ( ) . c_str ( ) , pfrom - > cleanSubVer . c_str ( ) ,
pfrom - > addr . ToString ( ) , pfrom - > cleanSubVer ,
state . GetRejectReason ( ) . c_str ( ) ) ;
state . GetRejectReason ( ) ) ;
pfrom - > PushMessage ( " reject " , strCommand , state . GetRejectCode ( ) ,
pfrom - > PushMessage ( " reject " , strCommand , state . GetRejectCode ( ) ,
state . GetRejectReason ( ) , inv . hash ) ;
state . GetRejectReason ( ) , inv . hash ) ;
if ( nDoS > 0 )
if ( nDoS > 0 )
@ -3560,7 +3560,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
CBlock block ;
CBlock block ;
vRecv > > block ;
vRecv > > block ;
LogPrint ( " net " , " received block %s \n " , block . GetHash ( ) . ToString ( ) . c_str ( ) ) ;
LogPrint ( " net " , " received block %s \n " , block . GetHash ( ) . ToString ( ) ) ;
// block.print();
// block.print();
CInv inv ( MSG_BLOCK , block . GetHash ( ) ) ;
CInv inv ( MSG_BLOCK , block . GetHash ( ) ) ;
@ -3682,9 +3682,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if ( ! ( sProblem . empty ( ) ) ) {
if ( ! ( sProblem . empty ( ) ) ) {
LogPrint ( " net " , " pong %s %s: %s, % " PRIx64 " expected, % " PRIx64 " received, % " PRIszu " bytes \n " ,
LogPrint ( " net " , " pong %s %s: %s, % " PRIx64 " expected, % " PRIx64 " received, % " PRIszu " bytes \n " ,
pfrom - > addr . ToString ( ) . c_str ( ) ,
pfrom - > addr . ToString ( ) ,
pfrom - > cleanSubVer . c_str ( ) ,
pfrom - > cleanSubVer ,
sProblem . c_str ( ) ,
sProblem ,
pfrom - > nPingNonceSent ,
pfrom - > nPingNonceSent ,
nonce ,
nonce ,
nAvail ) ;
nAvail ) ;
@ -3793,7 +3793,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// Truncate to reasonable length and sanitize before printing:
// Truncate to reasonable length and sanitize before printing:
string s = ss . str ( ) ;
string s = ss . str ( ) ;
if ( s . size ( ) > 111 ) s . erase ( 111 , string : : npos ) ;
if ( s . size ( ) > 111 ) s . erase ( 111 , string : : npos ) ;
LogPrint ( " net " , " Reject %s \n " , SanitizeString ( s ) . c_str ( ) ) ;
LogPrint ( " net " , " Reject %s \n " , SanitizeString ( s ) ) ;
}
}
}
}
@ -3866,7 +3866,7 @@ bool ProcessMessages(CNode* pfrom)
CMessageHeader & hdr = msg . hdr ;
CMessageHeader & hdr = msg . hdr ;
if ( ! hdr . IsValid ( ) )
if ( ! hdr . IsValid ( ) )
{
{
LogPrintf ( " \n \n PROCESSMESSAGE: ERRORS IN HEADER %s \n \n \n " , hdr . GetCommand ( ) . c_str ( ) ) ;
LogPrintf ( " \n \n PROCESSMESSAGE: ERRORS IN HEADER %s \n \n \n " , hdr . GetCommand ( ) ) ;
continue ;
continue ;
}
}
string strCommand = hdr . GetCommand ( ) ;
string strCommand = hdr . GetCommand ( ) ;
@ -3882,7 +3882,7 @@ bool ProcessMessages(CNode* pfrom)
if ( nChecksum ! = hdr . nChecksum )
if ( nChecksum ! = hdr . nChecksum )
{
{
LogPrintf ( " ProcessMessages(%s, %u bytes) : CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x \n " ,
LogPrintf ( " ProcessMessages(%s, %u bytes) : CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x \n " ,
strCommand . c_str ( ) , nMessageSize , nChecksum , hdr . nChecksum ) ;
strCommand , nMessageSize , nChecksum , hdr . nChecksum ) ;
continue ;
continue ;
}
}
@ -3899,12 +3899,12 @@ bool ProcessMessages(CNode* pfrom)
if ( strstr ( e . what ( ) , " end of data " ) )
if ( strstr ( e . what ( ) , " end of data " ) )
{
{
// Allow exceptions from under-length message on vRecv
// Allow exceptions from under-length message on vRecv
LogPrintf ( " ProcessMessages(%s, %u bytes) : Exception '%s' caught, normally caused by a message being shorter than its stated length \n " , strCommand . c_str ( ) , nMessageSize , e . what ( ) ) ;
LogPrintf ( " ProcessMessages(%s, %u bytes) : Exception '%s' caught, normally caused by a message being shorter than its stated length \n " , strCommand , nMessageSize , e . what ( ) ) ;
}
}
else if ( strstr ( e . what ( ) , " size too large " ) )
else if ( strstr ( e . what ( ) , " size too large " ) )
{
{
// Allow exceptions from over-long size
// Allow exceptions from over-long size
LogPrintf ( " ProcessMessages(%s, %u bytes) : Exception '%s' caught \n " , strCommand . c_str ( ) , nMessageSize , e . what ( ) ) ;
LogPrintf ( " ProcessMessages(%s, %u bytes) : Exception '%s' caught \n " , strCommand , nMessageSize , e . what ( ) ) ;
}
}
else
else
{
{
@ -3921,7 +3921,7 @@ bool ProcessMessages(CNode* pfrom)
}
}
if ( ! fRet )
if ( ! fRet )
LogPrintf ( " ProcessMessage(%s, %u bytes) FAILED \n " , strCommand . c_str ( ) , nMessageSize ) ;
LogPrintf ( " ProcessMessage(%s, %u bytes) FAILED \n " , strCommand , nMessageSize ) ;
break ;
break ;
}
}
@ -4027,7 +4027,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
if ( State ( pto - > GetId ( ) ) - > fShouldBan ) {
if ( State ( pto - > GetId ( ) ) - > fShouldBan ) {
if ( pto - > addr . IsLocal ( ) )
if ( pto - > addr . IsLocal ( ) )
LogPrintf ( " Warning: not banning local node %s! \n " , pto - > addr . ToString ( ) . c_str ( ) ) ;
LogPrintf ( " Warning: not banning local node %s! \n " , pto - > addr . ToString ( ) ) ;
else {
else {
pto - > fDisconnect = true ;
pto - > fDisconnect = true ;
CNode : : Ban ( pto - > addr ) ;
CNode : : Ban ( pto - > addr ) ;
@ -4109,7 +4109,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
if ( ! AlreadyHave ( inv ) )
if ( ! AlreadyHave ( inv ) )
{
{
if ( fDebug )
if ( fDebug )
LogPrint ( " net " , " sending getdata: %s \n " , inv . ToString ( ) . c_str ( ) ) ;
LogPrint ( " net " , " sending getdata: %s \n " , inv . ToString ( ) ) ;
vGetData . push_back ( inv ) ;
vGetData . push_back ( inv ) ;
if ( vGetData . size ( ) > = 1000 )
if ( vGetData . size ( ) > = 1000 )
{
{