Skip to content

Commit f18b8ec

Browse files
committed
Make sure LogPrintf strings are line-terminated
Fix the cases where LogPrint[f] was accidentally called without line terminator, which resulted in concatenated log lines. (see e.g. #6492)
1 parent 86cfd23 commit f18b8ec

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3398,7 +3398,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
33983398
}
33993399
}
34003400
} catch (const std::exception& e) {
3401-
LogPrintf("%s: Deserialize or I/O error - %s", __func__, e.what());
3401+
LogPrintf("%s: Deserialize or I/O error - %s\n", __func__, e.what());
34023402
}
34033403
}
34043404
} catch (const std::runtime_error& e) {

src/policy/fees.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ unsigned int TxConfirmStats::NewTx(unsigned int nBlockHeight, double val)
249249
unsigned int bucketindex = bucketMap.lower_bound(val)->second;
250250
unsigned int blockIndex = nBlockHeight % unconfTxs.size();
251251
unconfTxs[blockIndex][bucketindex]++;
252-
LogPrint("estimatefee", "adding to %s\n", dataTypeString);
252+
LogPrint("estimatefee", "adding to %s", dataTypeString);
253253
return bucketindex;
254254
}
255255

@@ -390,8 +390,9 @@ void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, boo
390390
mapMemPoolTxs[hash].bucketIndex = feeStats.NewTx(txHeight, (double)feeRate.GetFeePerK());
391391
}
392392
else {
393-
LogPrint("estimatefee", "not adding\n");
393+
LogPrint("estimatefee", "not adding");
394394
}
395+
LogPrint("estimatefee", "\n");
395396
}
396397

397398
void CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, const CTxMemPoolEntry& entry)

src/rpcserver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,14 +752,14 @@ void StopRPCThreads()
752752
{
753753
acceptor->cancel(ec);
754754
if (ec)
755-
LogPrintf("%s: Warning: %s when cancelling acceptor", __func__, ec.message());
755+
LogPrintf("%s: Warning: %s when cancelling acceptor\n", __func__, ec.message());
756756
}
757757
rpc_acceptors.clear();
758758
BOOST_FOREACH(const PAIRTYPE(std::string, boost::shared_ptr<deadline_timer>) &timer, deadlineTimers)
759759
{
760760
timer.second->cancel(ec);
761761
if (ec)
762-
LogPrintf("%s: Warning: %s when cancelling timer", __func__, ec.message());
762+
LogPrintf("%s: Warning: %s when cancelling timer\n", __func__, ec.message());
763763
}
764764
deadlineTimers.clear();
765765

src/txmempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const
348348
minerPolicyEstimator->Write(fileout);
349349
}
350350
catch (const std::exception&) {
351-
LogPrintf("CTxMemPool::WriteFeeEstimates(): unable to write policy estimator data (non-fatal)");
351+
LogPrintf("CTxMemPool::WriteFeeEstimates(): unable to write policy estimator data (non-fatal)\n");
352352
return false;
353353
}
354354
return true;
@@ -367,7 +367,7 @@ CTxMemPool::ReadFeeEstimates(CAutoFile& filein)
367367
minerPolicyEstimator->Read(filein);
368368
}
369369
catch (const std::exception&) {
370-
LogPrintf("CTxMemPool::ReadFeeEstimates(): unable to read policy estimator data (non-fatal)");
370+
LogPrintf("CTxMemPool::ReadFeeEstimates(): unable to read policy estimator data (non-fatal)\n");
371371
return false;
372372
}
373373
return true;

src/wallet/crypter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
186186
}
187187
if (keyPass && keyFail)
188188
{
189-
LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.");
189+
LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n");
190190
assert(false);
191191
}
192192
if (keyFail || !keyPass)

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
21092109
if (!wtxNew.AcceptToMemoryPool(false))
21102110
{
21112111
// This must not fail. The transaction has already been signed and recorded.
2112-
LogPrintf("CommitTransaction(): Error: Transaction not valid");
2112+
LogPrintf("CommitTransaction(): Error: Transaction not valid\n");
21132113
return false;
21142114
}
21152115
wtxNew.RelayWalletTransaction();

0 commit comments

Comments
 (0)