{
 "number": 35724,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/35724",
 "title": "cmpctblock: Improve logging of `cmpctblock` message reconstruction statistics [part of prefill series]",
 "author": "davidgumberg",
 "author_association": "MEMBER",
 "created_at": "2026-07-14T21:33:43Z",
 "updated_at": "2026-09-16T20:48:57Z",
 "age_days": 64,
 "draft": false,
 "labels": [],
 "milestone": null,
 "base": "master",
 "head_sha": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
 "head_ref": "2026-07-14-cb-logging",
 "head_repo": "davidgumberg/bitcoin",
 "head_history": [
  {
   "t": "2026-08-04T21:22:25Z",
   "sha": "43bc34af72bf09afb14b223fde81dac583956020"
  },
  {
   "t": "2026-08-28T00:52:42Z",
   "sha": "a55e3bb55ad473556e3e5011bb9782a941f26f84"
  }
 ],
 "additions": 109,
 "deletions": 14,
 "changed_files": 4,
 "commit_count": 3,
 "size_bucket": "M",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "w0xlt",
      "url": "https://github.com/bitcoin/bitcoin/pull/35724#pullrequestreview-5147413906"
     }
    ]
   },
   "conflicts": [
    {
     "number": 35558,
     "title": "p2p: Prefill compact blocks",
     "author": "davidgumberg"
    }
   ]
  }
 },
 "acks_parsed": {
  "w0xlt": {
   "kind": "ack",
   "hash": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "t": "2026-09-08T21:56:25Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 1,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "0xB10C",
   "andrewtoth",
   "l0rinc",
   "w0xlt"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-09-16T19:33:13Z",
  "last_reviewer_activity": "2026-09-16T20:48:57Z",
  "last_reviewer": "0xB10C",
  "author_silent_days": 0,
  "waiting_on_author_days": 0,
  "days_since_update": 0
 },
 "refs": {
  "mentioned": [
   35558,
   35727
  ],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 35558,
    "type": "pull",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "p2p: Prefill compact blocks"
   },
   {
    "number": 35727,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-07-21",
    "title": "blockencodings: fix extra transaction count"
   }
  ],
  "conflicts": [
   35558
  ]
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/blockencodings.cpp",
  "src/blockencodings.h",
  "src/net_processing.cpp"
 ],
 "body": "Split from #35558, this makes it easier to observe compact block reconstruction performance by:\n\n- At debuglevel=trace logging all missing TX's in a CMPCTBLOCK, and all missing TX's requested from us.\n- Logging the sizes and counts of tx's used from the prefill, mempool, and extrapool.\n- Logging the sizes and sources of redundant transactions in the prefill section of received `CMPCTBLOCK`s.",
 "commits": [
  {
   "sha": "83e2cc4fcebbc90696e784de579d1374c1f0dfbf",
   "date": "2026-08-25T22:19:36Z",
   "message": "cmpctblock: log: debuglevel=trace print TXID's of all missing tx'es.\n\nIt doesn't make that much sense to log here only when there's a few\ntransactions, since either a user is interested in what tx'es caused\nreconstruction to fail or they aren't, so log all txid's and this a\ntrace-level log message."
  },
  {
   "sha": "41e7b93723790698d979c9982efa27a4f5e72900",
   "date": "2026-08-25T22:49:02Z",
   "message": "cmpctblock: log: Log extrapool separately from mempool\n\nPreviously, in the log message and in the `InitData()` logic, the\nmempool was treated as a superset that includes the extra pool, it makes\nmore sense to treat them as separate pools.\n\nThis commit also separates the reconstruction critical logic of the\nfound transaction count from the logging specific counting of tx\nsources."
  },
  {
   "sha": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "date": "2026-08-25T22:59:12Z",
   "message": "cmpctblock: log: Print sizes of all tx types and prefill redundancies\n\nAt block reconstruction time, log the counts and sizes of prefilled\ntransactions, transactions pulled from the mempool, transactions from\nthe extrapool, and missing transactions that were acquired via\n`GETBLOCKTXN`.\n\nAlso log the count and size of prefilled transactions that were\nredundant and their source (mempool or extrapool)."
  }
 ],
 "timeline": [
  {
   "t": "2026-07-15T21:46:47Z",
   "kind": "review_comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "path": "src/blockencodings.cpp",
   "commit": "35b79db9fd51b96994329aeae029b9bb8e4ff5c4",
   "in_reply_to": null,
   "text": "If I understand correctly, removing this decrement assumes that the existing candidate came from the extrapool.\nHowever, it may have been inserted during the earlier mempool scan. Would it make sense to track the candidate\u2019s source and decrement the corresponding counter?"
  },
  {
   "t": "2026-07-15T21:52:33Z",
   "kind": "review_comment",
   "who": "l0rinc",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "35b79db9fd51b96994329aeae029b9bb8e4ff5c4",
   "in_reply_to": 3590953563,
   "text": "Seems tangentially related to https://github.com/bitcoin/bitcoin/pull/35727"
  },
  {
   "t": "2026-07-16T18:27:35Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "35b79db9fd51b96994329aeae029b9bb8e4ff5c4",
   "in_reply_to": 3590953563,
   "text": "yeah, thanks for catching @w0xlt, I'll fix this after #35727, as that will make this change easier to make correct, marking this pr as draft for now"
  },
  {
   "t": "2026-08-04T21:22:25Z",
   "kind": "force_push",
   "who": "davidgumberg",
   "commit": "43bc34af72bf09afb14b223fde81dac583956020"
  },
  {
   "t": "2026-08-04T22:45:30Z",
   "kind": "comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "text": "Reworked after https://github.com/bitcoin/bitcoin/pull/35727 merged, this is ready for review."
  },
  {
   "t": "2026-08-19T23:22:58Z",
   "kind": "review_comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "path": "src/net_processing.cpp",
   "commit": "43bc34af72bf09afb14b223fde81dac583956020",
   "in_reply_to": null,
   "text": "The code has contradictory logging levels:\n\n```c++\n  if (ShouldTraceLog(...)) {\n      LogDebug(...);\n  }\n```\n\nSuggestion:\n```diff\ndiff --git a/src/net_processing.cpp b/src/net_processing.cpp\nindex 1512a10c58..0117616314 100644\n--- a/src/net_processing.cpp\n+++ b/src/net_processing.cpp\n@@ -2850,7 +2850,7 @@ void PeerManagerImpl::SendBlockTransactions(CNode& pfrom, Peer& peer, const CBlo\n         LogDebug(BCLog::CMPCTBLOCK, \"%s sent us a GETBLOCKTXN for block %s, sending a BLOCKTXN with %u txns. (%u bytes)\", pfrom.LogPeer(), block.GetHash().ToString(), resp.txn.size(), tx_requested_size);\n         if (util::log::ShouldTraceLog(BCLog::CMPCTBLOCK)) {\n             for(const auto& txn : resp.txn) {\n-                LogDebug(BCLog::CMPCTBLOCK, \"    - txid: %s\", txn->GetHash().ToString());\n+                LogTrace(BCLog::CMPCTBLOCK, \"    - txid: %s\", txn->GetHash().ToString());\n             }\n         }\n     }\n```"
  },
  {
   "t": "2026-08-21T10:29:01Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/net_processing.cpp",
   "commit": "43bc34af72bf09afb14b223fde81dac583956020",
   "in_reply_to": 3817463631,
   "text": "Good catch @w0xlt. In addition to that, I fear the current log will be hard to analyze automatically or even grep for. It might make sense to include slightly more information than `- txid: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b` in the line, similar to the reconstruction logging you changed above. How about:\n\n\"Sending {txid} to {peer} in BLOCKTXN\"?"
  },
  {
   "t": "2026-08-21T10:30:43Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/net_processing.cpp",
   "commit": "43bc34af72bf09afb14b223fde81dac583956020",
   "in_reply_to": 3817463631,
   "text": "Alternatively, does it make sense to put all txids, maybe comma separated, into a single line?"
  },
  {
   "t": "2026-08-21T11:01:03Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/blockencodings.h",
   "commit": "43bc34af72bf09afb14b223fde81dac583956020",
   "in_reply_to": null,
   "text": "nit: tiny preference for `redundant_prefilled_mempool_count` instead of `redundant_prefilled_mp_count` (and similar) here for readability. Not sure if saving the 5 characters is worth it."
  },
  {
   "t": "2026-08-23T18:49:07Z",
   "kind": "review_comment",
   "who": "andrewtoth",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "78715aab9475b25bb10c82d2e8c1c827560b76ed",
   "in_reply_to": null,
   "text": "I'm not sure I agree with the approach of 78715aab9475b25bb10c82d2e8c1c827560b76ed. Incrementing the counts inline is very cheap. I can't see it be worth the code complexity to move these out. The next commit where the size of transactions are computed only for debug logging would make sense to do."
  },
  {
   "t": "2026-08-23T18:50:28Z",
   "kind": "review_comment",
   "who": "andrewtoth",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "78715aab9475b25bb10c82d2e8c1c827560b76ed",
   "in_reply_to": null,
   "text": "nit: prefer prefixing `++` and `--`."
  },
  {
   "t": "2026-08-23T18:53:23Z",
   "kind": "review_comment",
   "who": "andrewtoth",
   "assoc": "MEMBER",
   "path": "src/blockencodings.h",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "We should have a comment here that these will only be set if debug logging is enabled."
  },
  {
   "t": "2026-08-23T19:59:09Z",
   "kind": "review_comment",
   "who": "andrewtoth",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "I'm not sure this is the right data structure here. I think we can do this more cleanly with a `std::map<Wtxid, size_t>` and populate it below in the\n`for (size_t i = 0; i < cmpctblock.prefilledtxn.size(); i++) {` loop. Instead of calling `pool->exists` for each prefill (which takes the pool lock each time), we can take call `GetIter` after we take the pool lock later. This lets us avoid sorting the vector as well.\n\nA quick example of how it could look\n\n```diff\ndiff --git a/src/blockencodings.cpp b/src/blockencodings.cpp\nindex e2522f8781..7765353da1 100644\n--- a/src/blockencodings.cpp\n+++ b/src/blockencodings.cpp\n@@ -16,6 +16,7 @@\n #include <util/log.h>\n #include <validation.h>\n\n+#include <map>\n #include <unordered_map>\n\n CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block, uint64_t nonce)\n@@ -70,21 +71,9 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c\n     header = cmpctblock.header;\n     txn_available.resize(cmpctblock.BlockTxCount());\n\n-    std::vector<Wtxid> extra_wtxids{};\n-\n-    bool debug_log = util::log::ShouldDebugLog(BCLog::CMPCTBLOCK);\n-\n-    if (debug_log) {\n-        prefilled_count = cmpctblock.prefilledtxn.size();\n-\n-        // A sorted vec of extra_txn's for cheaply checking if prefills\n-        // were redundant with the extrapool.\n-        for (const auto& [id, tx] : extra_txn) {\n-            extra_wtxids.push_back(id);\n-        }\n-        std::sort(extra_wtxids.begin(), extra_wtxids.end());\n-    }\n-\n+    const bool debug_log{util::log::ShouldDebugLog(BCLog::CMPCTBLOCK)};\n+    // Prefills not already in the mempool, used to check extra-pool redundancy.\n+    std::map<Wtxid, size_t> leftover_prefills;\n\n     int32_t lastprefilledindex = -1;\n     for (size_t i = 0; i < cmpctblock.prefilledtxn.size(); i++) {\n@@ -102,20 +91,14 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c\n         }\n\n         if (debug_log) {\n-            size_t tx_size = cmpctblock.prefilledtxn[i].tx->ComputeTotalSize();\n+            const CTransactionRef& tx{cmpctblock.prefilledtxn[i].tx};\n+            const size_t tx_size{tx->ComputeTotalSize()};\n             prefilled_size += tx_size;\n-\n-            auto tx_wtxid =  cmpctblock.prefilledtxn[i].tx->GetWitnessHash();\n-            if (pool->exists(tx_wtxid)) {\n-                redundant_prefilled_mp_count++;\n-                redundant_prefilled_mp_size += tx_size;\n-            } else if (std::binary_search(extra_wtxids.begin(), extra_wtxids.end(), tx_wtxid)) {\n-                redundant_prefilled_ep_count++;\n-                redundant_prefilled_ep_size += tx_size;\n-            }\n+            leftover_prefills.emplace(tx->GetWitnessHash(), tx_size);\n         }\n         txn_available[lastprefilledindex] = cmpctblock.prefilledtxn[i].tx;\n     }\n+    if (debug_log) prefilled_count = cmpctblock.prefilledtxn.size();\n\n     // Calculate map of txids -> positions and check mempool to see what we have (or don't)\n     // Because well-formed cmpctblock messages will have a (relatively) uniform distribution\n@@ -148,6 +131,17 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c\n     size_t available_count = 0;\n     {\n     LOCK(pool->cs);\n+    if (debug_log) {\n+        for (auto it{leftover_prefills.begin()}; it != leftover_prefills.end();) {\n+            if (pool->GetIter(it->first)) {\n+                ++redundant_prefilled_mp_count;\n+                redundant_prefilled_mp_size += it->second;\n+                it = leftover_prefills.erase(it);\n+            } else {\n+                ++it;\n+            }\n+        }\n+    }\n     for (const auto& [wtxid, txit] : pool->txns_randomized) {\n         uint64_t shortid = cmpctblock.GetShortID(wtxid);\n         std::unordered_map<uint64_t, uint16_t>::iterator idit = shorttxids.find(shortid);\n@@ -201,7 +195,16 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c\n             break;\n     }\n\n-    if (util::log::ShouldDebugLog(BCLog::CMPCTBLOCK)) {\n+    if (debug_log) {\n+        for (const auto& [id, tx] : extra_txn) {\n+            if (!tx) continue;\n+            const auto it{leftover_prefills.find(id)};\n+            if (it == leftover_prefills.end()) continue;\n+            ++redundant_prefilled_ep_count;\n+            redundant_prefilled_ep_size += it->second;\n+            leftover_prefills.erase(it);\n+        }\n+\n         Assume(txn_available.size() == tx_source.size());\n         for (size_t i = 0; i < txn_available.size(); i++) {\n             switch (tx_source[i]) {\n```"
  },
  {
   "t": "2026-08-25T17:26:52Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "35b79db9fd51b96994329aeae029b9bb8e4ff5c4",
   "in_reply_to": 3590953563,
   "text": "marking as resolvesed since #35727 was merged and I've updated this PR based on that."
  },
  {
   "t": "2026-08-25T22:42:00Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "78715aab9475b25bb10c82d2e8c1c827560b76ed",
   "in_reply_to": 3839305247,
   "text": "I moved the count inc/dec out because I thought it made the code easier to read, not for performance.\n\nThe problem is tracking the states, e.g. when decrementing because of a collision, we will have to check whether the tx_source is mempool or extra. it is definitely possible to do it inline, but IMO it's logic that is unrelated to compactblock reconstruction right in the middle of critical and subtle code, it's nice to scope all the logging code, and even though it's ~7 lines longer as-is, I think it makes it easier to read the function.\n\nI could shorten the current thing to something like\n\n```cpp\nif (util::log::ShouldDebugLog(BCLog::CMPCTBLOCK)) {\n    for (size_t i = 0; i < txn_available.size(); i++) {\n        if (tx_source[i] == TxSource::MEMPOOL) ++mempool_count;\n        else if (tx_source[i] == TxSource::EXTRA) ++extra_count;\n    }\n}\n```\n\nbut I think it is clearer as a switch."
  },
  {
   "t": "2026-08-28T00:52:42Z",
   "kind": "force_push",
   "who": "davidgumberg",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84"
  },
  {
   "t": "2026-08-28T00:52:52Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/blockencodings.h",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": 3839314405,
   "text": "Thanks, fixed."
  },
  {
   "t": "2026-08-28T00:53:07Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "78715aab9475b25bb10c82d2e8c1c827560b76ed",
   "in_reply_to": 3839307999,
   "text": "Thanks, fixed"
  },
  {
   "t": "2026-08-28T00:53:13Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/blockencodings.h",
   "commit": "43bc34af72bf09afb14b223fde81dac583956020",
   "in_reply_to": 3829654250,
   "text": "Thanks, fixed"
  },
  {
   "t": "2026-08-28T00:53:26Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/net_processing.cpp",
   "commit": "43bc34af72bf09afb14b223fde81dac583956020",
   "in_reply_to": 3817463631,
   "text": "Thanks, I've made it one log line instead."
  },
  {
   "t": "2026-09-08T21:56:25Z",
   "kind": "review",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "state": "COMMENTED",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "text": "ACK a55e3bb55ad473556e3e5011bb9782a941f26f84"
  },
  {
   "t": "2026-09-11T18:16:22Z",
   "kind": "review_comment",
   "who": "andrewtoth",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": 3839456791,
   "text": "Hey @davidgumberg just wondering if you had any thoughts on this suggestion?\nThe main thing is that we're taking the lock inside each loop via `pool->exists` with the current approach."
  },
  {
   "t": "2026-09-16T19:21:30Z",
   "kind": "comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "text": "Doing another review pass over the code and also running it on signet a bit. Saw this log, which looks good to me:\n\n```\n2026-09-16T19:19:28Z [net_processing.cpp:3805] [LogBlockHeader] [all:info] Saw new cmpctblock header hash=00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 height=322378 peer=8\n2026-09-16T19:19:28Z [blockencodings.cpp:62] [InitData] [cmpctblock:debug] Initializing PartiallyDownloadedBlock for block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 using a cmpctblock of 664 bytes\n2026-09-16T19:19:28Z [blockencodings.cpp:224] [InitData] [cmpctblock:debug] Initialized PartiallyDownloadedBlock for block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 using a cmpctblock of 664 bytes\n2026-09-16T19:19:28Z [blockencodings.cpp:283] [FillBlock] [cmpctblock:debug] Successfully reconstructed block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 with 1 txn prefilled (261 bytes), 49 txn from mempool (21059 bytes), 0 txn from extrapool (0 bytes), and 3 txn requested (1410 bytes)\n2026-09-16T19:19:28Z [blockencodings.cpp:291] [FillBlock] [cmpctblock:debug] 0 txn (0 bytes) of the prefill were redundant, 0 txn (0 bytes) were present in the mempool, 0 txn (0 bytes) were present in the extrapool.\n2026-09-16T19:19:28Z [blockencodings.cpp:295] [FillBlock] [cmpctblock:trace] Reconstructed block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 required tx d202319768acc745cf1a2a06c6dab5f5fa70600cb6d555e101ad64dc761e274d\n2026-09-16T19:19:28Z [blockencodings.cpp:295] [FillBlock] [cmpctblock:trace] Reconstructed block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 required tx 34bbc02894b7241300ece014e6d49677f566e4677819a04c100ae1d40b00f6c9\n2026-09-16T19:19:28Z [blockencodings.cpp:295] [FillBlock] [cmpctblock:trace] Reconstructed block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 required tx e698954bcdcce6a03d3488cd5fe05cdc64d07ff4a1f1e19f420e8526b817ac88\n2026-09-16T19:19:28Z [validation.cpp:2899] [UpdateTipLog] [all:info] UpdateTip: new best=00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 height=322378 version=0x20000000 log2_work=44.068373 tx=32438805 date='2026-09-16T19:19:27Z' progress=1.000000 cache=2.4MiB(16384txo)\n2026-09-16T19:19:28Z [net_processing.cpp:2850] [SendBlockTransactions] [cmpctblock:debug] peer=10 sent us a GETBLOCKTXN for block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7, sending a BLOCKTXN with 6 txns. (3474 bytes)\n2026-09-16T19:19:28Z [net_processing.cpp:2866] [SendBlockTransactions] [cmpctblock:trace] peer=10 sent a GETBLOCKTXN for block 00000004be9bbefe39e42fc65a1565e99475c63d867e22e3aee63eb22bed8df7 requesting the following transactions: d202319768acc745cf1a2a06c6dab5f5fa70600cb6d555e101ad64dc761e274d, 34bbc02894b7241300ece014e6d49677f566e4677819a04c100ae1d40b00f6c9, d92bcbbb339e00ed279bd979ff80ced3ecad8a657a10ef2c3f8a2d0173378328, 8799967e1d8a232a075c9aeea552d7863f2b0d140b8faa4ee86b52af956c127d, 7667d142261998629b2f9caede91332fcdfcb0d80695057644d1f10a2cb3081d, e698954bcdcce6a03d3488cd5fe05cdc64d07ff4a1f1e19f420e8526b817ac88\n```\n\nBefore leaving an ACK, it would be good to have andrew's comment https://github.com/bitcoin/bitcoin/pull/35724#discussion_r3992152662 addressed/answered."
  },
  {
   "t": "2026-09-16T19:33:13Z",
   "kind": "review_comment",
   "who": "davidgumberg",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": 3839456791,
   "text": "Sorry, I did not mean to leave this unaddressed, I just have to think about how to integrate this with the other PR and haven't had a chance yet, will update soon."
  },
  {
   "t": "2026-09-16T20:04:16Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "```suggestion\n            \"%u txn (%u bytes) were present in the extrapool.\",\n```"
  },
  {
   "t": "2026-09-16T20:04:40Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "Would be good to have a block hash here too"
  },
  {
   "t": "2026-09-16T20:07:38Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "You can probably reuse `debug_log`\n\n```suggestion\n    if (debug_log) {\n```"
  },
  {
   "t": "2026-09-16T20:17:51Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "nit\n```suggestion\n    const bool debug_log{util::log::ShouldDebugLog(BCLog::CMPCTBLOCK)};\n```"
  },
  {
   "t": "2026-09-16T20:22:11Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/net_processing.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "nit: An LLM told me about this, which might be a tiny bit slower than your manual pre-reserve string construction, but might be a bit cleaner. Needs `#include <util/string.h>.`\n\n```suggestion\nconst std::string missing_txids{util::Join(resp.txn, \", \", [](const auto& tx) { return tx->GetHash().ToString(); })};\n```"
  },
  {
   "t": "2026-09-16T20:28:08Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/blockencodings.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "might make sense to change this into one long line too?"
  },
  {
   "t": "2026-09-16T20:48:57Z",
   "kind": "review_comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "path": "src/net_processing.cpp",
   "commit": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
   "in_reply_to": null,
   "text": "For anyone wondering: The length of the log message is capped by the bounds of the number of transactions in the block. While GETBLOCKTXN allows up to potentially 65k indexes, we don't log (as we call `Misbehaving()` and `return`) if a peer requests out-of-bounds indexes."
  }
 ],
 "labels_log": [
  {
   "t": "2026-07-21T21:14:59Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-04T22:55:04Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-07-14T21:33:46Z",
   "kind": "renamed",
   "who": "DrahtBot",
   "from": "cmpctblock: Improve logging of `cmpctblock` message reconstruction statistics [part of prefill series] ",
   "to": "cmpctblock: Improve logging of `cmpctblock` message reconstruction statistics [part of prefill series]"
  },
  {
   "t": "2026-07-16T18:27:41Z",
   "kind": "convert_to_draft",
   "who": "davidgumberg"
  },
  {
   "t": "2026-08-04T22:45:08Z",
   "kind": "ready_for_review",
   "who": "davidgumberg"
  }
 ],
 "text_chars": 14444,
 "text_tokens_estimate": 3611,
 "changed_paths": [
  "src/blockencodings.cpp",
  "src/blockencodings.h",
  "src/net_processing.cpp",
  "src/test/blockencodings_tests.cpp"
 ],
 "files": [
  {
   "path": "src/blockencodings.cpp",
   "add": 80,
   "del": 13
  },
  {
   "path": "src/blockencodings.h",
   "add": 11,
   "del": 0
  },
  {
   "path": "src/net_processing.cpp",
   "add": 17,
   "del": 0
  },
  {
   "path": "src/test/blockencodings_tests.cpp",
   "add": 1,
   "del": 1
  }
 ],
 "test_lines": 2,
 "git": {
  "head": "a55e3bb55ad473556e3e5011bb9782a941f26f84",
  "head_matches_backup": true,
  "base": "17c5e33e9c5418fb0240f5d4210c87f54b88cdda",
  "commits": [
   {
    "sha": "83e2cc4fce",
    "subject": "cmpctblock: log: debuglevel=trace print TXID's of all missing tx'es.",
    "files": 2,
    "add": 20,
    "del": 3
   },
   {
    "sha": "41e7b93723",
    "subject": "cmpctblock: log: Log extrapool separately from mempool",
    "files": 2,
    "add": 24,
    "del": 9
   },
   {
    "sha": "a55e3bb55a",
    "subject": "cmpctblock: log: Print sizes of all tx types and prefill redundancies",
    "files": 2,
    "add": 65,
    "del": 2
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "5f35f061759fdd0a",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}