From 83df64d7491b8271f7dfa2aea30f055102e3ff39 Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Wed, 21 May 2025 18:36:21 -0700 Subject: [PATCH] log: Stats when fulfilling GETBLOCKTXN --- src/net_processing.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 78e97b66840..ead69f086df 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2495,14 +2495,17 @@ uint32_t PeerManagerImpl::GetFetchFlags(const Peer& peer) const void PeerManagerImpl::SendBlockTransactions(CNode& pfrom, Peer& peer, const CBlock& block, const BlockTransactionsRequest& req) { BlockTransactions resp(req); + unsigned int tx_requested_size = 0; for (size_t i = 0; i < req.indexes.size(); i++) { if (req.indexes[i] >= block.vtx.size()) { Misbehaving(peer, "getblocktxn with out-of-bounds tx indices"); return; } resp.txn[i] = block.vtx[req.indexes[i]]; + tx_requested_size += resp.txn[i]->GetTotalSize(); } + LogDebug(BCLog::CMPCTBLOCK, "Peer %d sent us a GETBLOCKTXN for block %s, sending a BLOCKTXN with %u txns. (%u bytes)\n", pfrom.GetId(), block.GetHash().ToString(), resp.txn.size(), tx_requested_size); MakeAndPushMessage(pfrom, NetMsgType::BLOCKTXN, resp); }