mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-16 16:32:47 +00:00
log: fix minor formatting in debug logs
Tidy a few debug log strings to avoid double spaces, concatenated status words, and mismatched format specifiers. Co-authored-by: naiyoma <lankas.aurelia@gmail.com>
This commit is contained in:
parent
9cf82bed32
commit
736b17c0f0
@ -204,7 +204,7 @@ util::Result<std::unique_ptr<AddrMan>> LoadAddrman(const NetGroupManager& netgro
|
||||
const auto path_addr{args.GetDataDirNet() / "peers.dat"};
|
||||
try {
|
||||
DeserializeFileDB(path_addr, *addrman);
|
||||
LogInfo("Loaded %i addresses from peers.dat %dms", addrman->Size(), Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
|
||||
LogInfo("Loaded %i addresses from peers.dat %dms", addrman->Size(), Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
|
||||
} catch (const DbNotFoundError&) {
|
||||
// Addrman can be in an inconsistent state after failure, reset it
|
||||
addrman = std::make_unique<AddrMan>(netgroupman, deterministic, /*consistency_check_ratio=*/check_addrman);
|
||||
|
||||
@ -36,7 +36,7 @@ void BanMan::LoadBanlist()
|
||||
if (m_ban_db.Read(m_banned)) {
|
||||
SweepBanned(); // sweep out unused entries
|
||||
|
||||
LogDebug(BCLog::NET, "Loaded %d banned node addresses/subnets %dms\n", m_banned.size(),
|
||||
LogDebug(BCLog::NET, "Loaded %d banned node addresses/subnets %dms", m_banned.size(),
|
||||
Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
|
||||
} else {
|
||||
LogInfo("Recreating the banlist database");
|
||||
@ -65,7 +65,7 @@ void BanMan::DumpBanlist()
|
||||
m_is_dirty = true;
|
||||
}
|
||||
|
||||
LogDebug(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms\n", banmap.size(),
|
||||
LogDebug(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms", banmap.size(),
|
||||
Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
|
||||
}
|
||||
|
||||
|
||||
@ -2397,7 +2397,7 @@ void CConnman::DumpAddresses()
|
||||
|
||||
DumpPeerAddresses(::gArgs, addrman);
|
||||
|
||||
LogDebug(BCLog::NET, "Flushed %d addresses to peers.dat %dms\n",
|
||||
LogDebug(BCLog::NET, "Flushed %d addresses to peers.dat %dms",
|
||||
addrman.get().Size(), Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
|
||||
}
|
||||
|
||||
|
||||
@ -2851,8 +2851,8 @@ void PeerManagerImpl::HeadersDirectFetchBlocks(CNode& pfrom, const Peer& peer, c
|
||||
uint32_t nFetchFlags = GetFetchFlags(peer);
|
||||
vGetData.emplace_back(MSG_BLOCK | nFetchFlags, pindex->GetBlockHash());
|
||||
BlockRequested(pfrom.GetId(), *pindex);
|
||||
LogDebug(BCLog::NET, "Requesting block %s from peer=%d\n",
|
||||
pindex->GetBlockHash().ToString(), pfrom.GetId());
|
||||
LogDebug(BCLog::NET, "Requesting block %s from peer=%d",
|
||||
pindex->GetBlockHash().ToString(), pfrom.GetId());
|
||||
}
|
||||
if (vGetData.size() > 1) {
|
||||
LogDebug(BCLog::NET, "Downloading blocks toward %s (%d) via headers direct fetch\n",
|
||||
@ -3799,7 +3799,7 @@ void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string
|
||||
|
||||
auto new_peer_msg = [&]() {
|
||||
const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
|
||||
return strprintf("New %s peer connected: transport: %s, version: %d, blocks=%d peer=%d%s%s\n",
|
||||
return strprintf("New %s peer connected: transport: %s, version: %d, blocks=%d, peer=%d%s%s",
|
||||
pfrom.ConnectionTypeAsString(),
|
||||
TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
|
||||
pfrom.nVersion.load(), peer.m_starting_height,
|
||||
@ -4125,7 +4125,7 @@ void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string
|
||||
|
||||
if (inv.IsMsgBlk()) {
|
||||
const bool fAlreadyHave = AlreadyHaveBlock(inv.hash);
|
||||
LogDebug(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
||||
LogDebug(BCLog::NET, "got inv: %s %s peer=%d", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
||||
|
||||
UpdateBlockAvailability(pfrom.GetId(), inv.hash);
|
||||
if (!fAlreadyHave && !m_chainman.m_blockman.LoadingBlocks() && !IsBlockRequested(inv.hash)) {
|
||||
@ -4148,7 +4148,7 @@ void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string
|
||||
|
||||
if (!m_chainman.IsInitialBlockDownload()) {
|
||||
const bool fAlreadyHave{m_txdownloadman.AddTxAnnouncement(pfrom.GetId(), gtxid, current_time)};
|
||||
LogDebug(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
||||
LogDebug(BCLog::NET, "got inv: %s %s peer=%d", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
||||
}
|
||||
} else {
|
||||
LogDebug(BCLog::NET, "Unknown inv type \"%s\" received from peer=%d\n", inv.ToString(), pfrom.GetId());
|
||||
@ -4281,7 +4281,7 @@ void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string
|
||||
{
|
||||
if (pindex->GetBlockHash() == hashStop)
|
||||
{
|
||||
LogDebug(BCLog::NET, " getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
LogDebug(BCLog::NET, " getblocks stopping at %d %s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
break;
|
||||
}
|
||||
// If pruning, don't inv blocks unless we have on disk and are likely to still have
|
||||
@ -4295,7 +4295,7 @@ void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string
|
||||
if (--nLimit <= 0) {
|
||||
// When this block is requested, we'll send an inv that'll
|
||||
// trigger the peer to getblocks the next batch of inventory.
|
||||
LogDebug(BCLog::NET, " getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
LogDebug(BCLog::NET, " getblocks stopping at limit %d %s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
WITH_LOCK(peer.m_block_inv_mutex, {peer.m_continuation_block = pindex->GetBlockHash();});
|
||||
break;
|
||||
}
|
||||
|
||||
@ -780,7 +780,7 @@ void CTxMemPool::RemoveUnbroadcastTx(const Txid& txid, const bool unchecked) {
|
||||
|
||||
if (m_unbroadcast_txids.erase(txid))
|
||||
{
|
||||
LogDebug(BCLog::MEMPOOL, "Removed %i from set of unbroadcast txns%s\n", txid.GetHex(), (unchecked ? " before confirmation that txn was sent out" : ""));
|
||||
LogDebug(BCLog::MEMPOOL, "Removed %s from set of unbroadcast txns%s", txid.GetHex(), (unchecked ? " before confirmation that txn was sent out" : ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1971,12 +1971,12 @@ void Chainstate::InvalidChainFound(CBlockIndex* pindexNew)
|
||||
m_chainman.RecalculateBestHeader();
|
||||
}
|
||||
|
||||
LogInfo("%s: invalid block=%s height=%d log2_work=%f date=%s\n", __func__,
|
||||
LogInfo("%s: invalid block=%s height=%d log2_work=%f date=%s", __func__,
|
||||
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight,
|
||||
log(pindexNew->nChainWork.getdouble())/log(2.0), FormatISO8601DateTime(pindexNew->GetBlockTime()));
|
||||
CBlockIndex *tip = m_chain.Tip();
|
||||
assert (tip);
|
||||
LogInfo("%s: current best=%s height=%d log2_work=%f date=%s\n", __func__,
|
||||
LogInfo("%s: current best=%s height=%d log2_work=%f date=%s", __func__,
|
||||
tip->GetBlockHash().ToString(), m_chain.Height(), log(tip->nChainWork.getdouble())/log(2.0),
|
||||
FormatISO8601DateTime(tip->GetBlockTime()));
|
||||
CheckForkWarningConditions();
|
||||
|
||||
@ -1106,7 +1106,11 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const TxState& state, const
|
||||
}
|
||||
|
||||
//// debug print
|
||||
WalletLogPrintf("AddToWallet %s %s%s %s\n", hash.ToString(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : ""), TxStateString(state));
|
||||
std::string status{"no-change"};
|
||||
if (fInsertedNew || fUpdated) {
|
||||
status = fInsertedNew ? (fUpdated ? "new, update" : "new") : "update";
|
||||
}
|
||||
WalletLogPrintf("AddToWallet %s %s %s", hash.ToString(), status, TxStateString(state));
|
||||
|
||||
// Write to disk
|
||||
if (fInsertedNew || fUpdated)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user