{
 "number": 36584,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36584",
 "title": "kernel: make btck_LogEntry opaque",
 "author": "stickies-v",
 "author_association": "MEMBER",
 "created_at": "2026-10-20T14:51:57Z",
 "updated_at": "2026-10-21T15:01:02Z",
 "description_hash": "becbac3182568448",
 "age_days": 12,
 "draft": false,
 "labels": [
  "Validation"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
 "head_ref": "2026-10/kernel-logentry-opaque",
 "head_repo": "stickies-v/bitcoin",
 "head_history": [],
 "additions": 175,
 "deletions": 78,
 "changed_files": 3,
 "commit_count": 1,
 "size_bucket": "M",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "sedited",
      "url": "https://github.com/bitcoin/bitcoin/pull/36584#pullrequestreview-5598238408"
     },
     {
      "login": "musaHaruna",
      "url": "https://github.com/bitcoin/bitcoin/pull/36584#pullrequestreview-5598343723"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "sedited": {
   "kind": "ack",
   "hash": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
   "t": "2026-10-21T10:21:23Z",
   "stale": false
  },
  "musaHaruna": {
   "kind": "ack",
   "hash": null,
   "t": "2026-10-21T10:31:07Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 2,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 1,
  "changes_requested": 0,
  "distinct_reviewers": [
   "musaHaruna",
   "sedited"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-10-21T10:27:32Z",
  "last_reviewer_activity": "2026-10-21T10:31:07Z",
  "last_reviewer": "musaHaruna",
  "author_silent_days": 11,
  "waiting_on_author_days": 11,
  "days_since_update": 11
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/kernel/bitcoinkernel.h"
 ],
 "body": "Makes `btck_LogEntry` an opaque type with `btck_log_entry_get_*` accessors, instead of a public struct. This allows adding or changing fields without breaking the ABI, and is consistent with ~all other kernel objects. Follow-up to https://github.com/bitcoin/bitcoin/pull/34374#discussion_r4207440088.\n\nI added a benchmark in https://github.com/bitcoin/bitcoin/compare/master...stickies-v:bitcoin:2026-10/kernel-logentry-bench, and found that performance is not meaningfully impacted either way. Some results below.\n\nPerformance stats\n\n### Performance\n\nFields are now converted only when read, at the cost of a library call per field. The [benchmark](https://github.com/bitcoin/bitcoin/compare/master...stickies-v:bitcoin:2026-10/kernel-logentry-bench) measures a kernel log statement up to and including the callback (Apple M4 Pro, static library, `-O2`, median of 2\u00d725 interleaved runs):\n\n| Callback reads | master | PR | Delta |\n|---|---:|---:|---:|\n| no fields | 57.4 ns | 55.2 ns | \u22121.6 to \u22122.5 ns |\n| message only | 57.8 ns | 56.0 ns | \u22121.4 to \u22122.0 ns |\n| all 9 fields | 57.9 ns | 62.7 ns | +4.8 to +5.4 ns |\n\nBreak-even is at 2-3 fields. Either way, the difference is small next to the ~50 ns the log statement costs before the callback, and to what a consumer typically does with the entry (formatting, I/O).",
 "commits": [
  {
   "sha": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
   "date": "2026-10-20T13:33:23Z",
   "message": "kernel: make btck_LogEntry opaque\n\nAllows adding or changing fields without breaking the ABI, consistent\nwith other kernel objects. Strings are returned as btck_StringView.\n\nFields are now only converted when read, at the cost of a library call\nper field.\n\nThe logging callback may now call the btck_log_entry_get_* functions on\nits entry. They only read the entry, so they cannot deadlock."
  }
 ],
 "timeline": [
  {
   "t": "2026-10-21T10:21:12Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/kernel/bitcoinkernel.h",
   "commit": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
   "in_reply_to": null,
   "text": "Might a one-line `///` description be better for these trivial getters?",
   "id": "rc:4335650884",
   "url": "https://github.com/bitcoin/bitcoin/pull/36584#discussion_r4335650884",
   "hash": "ac95320ee8cf9f2f",
   "edited": "2026-10-21T10:21:23Z"
  },
  {
   "t": "2026-10-21T10:21:23Z",
   "kind": "review",
   "who": "sedited",
   "assoc": "MEMBER",
   "state": "APPROVED",
   "commit": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
   "text": "ACK b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
   "id": "r:5598238408",
   "url": "https://github.com/bitcoin/bitcoin/pull/36584#pullrequestreview-5598238408",
   "hash": "502f857431620139",
   "edited": null
  },
  {
   "t": "2026-10-21T10:27:32Z",
   "kind": "review_comment",
   "who": "stickies-v",
   "assoc": "MEMBER",
   "path": "src/kernel/bitcoinkernel.h",
   "commit": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
   "in_reply_to": 4335650884,
   "text": "I personally prefer the consistency of using doxygen docstrings for all public functions, but don't care too strongly either way, so happy to change if that's what people prefer. Will leave as-is until more people chime in.",
   "id": "rc:4335706833",
   "url": "https://github.com/bitcoin/bitcoin/pull/36584#discussion_r4335706833",
   "hash": "5789db939c9794cd",
   "edited": null
  },
  {
   "t": "2026-10-21T10:31:07Z",
   "kind": "review",
   "who": "musaHaruna",
   "assoc": "CONTRIBUTOR",
   "state": "COMMENTED",
   "commit": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
   "text": "Code Review ACK [b2c0773](https://github.com/bitcoin/bitcoin/pull/36584/changes/b2c077394a585a4155bd9d7a28b9b7c7553c9dc5)\n\nTested locally, including calling all nine getters from the logging callback and checking the message, timestamp, source location, level, and category for the connection and disconnection messages.",
   "id": "r:5598343723",
   "url": "https://github.com/bitcoin/bitcoin/pull/36584#pullrequestreview-5598343723",
   "hash": "40dff95ef93e764f",
   "edited": null
  }
 ],
 "labels_log": [
  {
   "t": "2026-10-20T14:52:02Z",
   "action": "labeled",
   "label": "Validation",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 2401,
 "text_tokens_estimate": 600,
 "changed_paths": [
  "src/kernel/bitcoinkernel.cpp",
  "src/kernel/bitcoinkernel.h",
  "src/kernel/bitcoinkernel_wrapper.h"
 ],
 "files": [
  {
   "path": "src/kernel/bitcoinkernel.cpp",
   "add": 53,
   "del": 24
  },
  {
   "path": "src/kernel/bitcoinkernel.h",
   "add": 103,
   "del": 38
  },
  {
   "path": "src/kernel/bitcoinkernel_wrapper.h",
   "add": 19,
   "del": 16
  }
 ],
 "test_lines": 0,
 "git": {
  "head": "b2c077394a585a4155bd9d7a28b9b7c7553c9dc5",
  "head_matches_backup": true,
  "base": "4303f3b7f0775cdbbe77faddf142e1e44fa590ca",
  "patch_id": "4726b26348b81606",
  "commits": [
   {
    "sha": "b2c077394a",
    "subject": "kernel: make btck_LogEntry opaque",
    "files": 3,
    "add": 175,
    "del": 78
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "4726b26348b81606",
 "input_hash": "469ad41f133d68c0",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}