{
 "number": 30343,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/30343",
 "title": "wallet, logging: Replace WalletLogPrintf() with LogInfo()",
 "author": "ryanofsky",
 "author_association": "MEMBER",
 "created_at": "2024-06-26T17:57:15Z",
 "updated_at": "2026-09-12T12:05:53Z",
 "age_days": 812,
 "draft": true,
 "labels": [
  "Wallet",
  "Needs rebase"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "e0986cf5c4c94bace6a90929d02cfc0430a56dd5",
 "head_ref": "pr/gwlog",
 "head_repo": "ryanofsky/bitcoin",
 "head_history": [
  {
   "t": "2024-06-27T03:49:00Z",
   "sha": "5a629a60c4739b94383596f9d040502b7b2c8b69"
  },
  {
   "t": "2024-06-27T04:34:56Z",
   "sha": "db8c6fc2ca5e1ad99aeda741e3b453f1f7bf7955"
  },
  {
   "t": "2024-06-28T14:26:23Z",
   "sha": "29eaec25af32e543df3cff091938c3cb8f7cce17"
  },
  {
   "t": "2024-07-17T23:47:06Z",
   "sha": "0260cd5ccc3120102c001b3ab6c5f29dcf184b58"
  },
  {
   "t": "2024-08-07T02:00:43Z",
   "sha": "0d49ada2b42e5b48b21bb7cb854851f09641abbb"
  },
  {
   "t": "2024-08-07T02:21:04Z",
   "sha": "f6b93a976b0127b55705dc33caf986a3344e12a4"
  },
  {
   "t": "2024-12-09T20:39:22Z",
   "sha": "4c8fe044d3241664151b3727e31ac2eaa741b717"
  },
  {
   "t": "2025-03-12T13:07:08Z",
   "sha": "e8c6095c75dead138e79a18146ce865e7fe6529a"
  },
  {
   "t": "2025-04-03T17:31:38Z",
   "sha": "af6f854df0d0dd72b05cda4d2e1ed0d1c2c00738"
  },
  {
   "t": "2025-04-04T03:37:00Z",
   "sha": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166"
  },
  {
   "t": "2025-10-15T00:42:22Z",
   "sha": "186b721e6107a0606be6c55edbdd8ec5d5fabd2b"
  },
  {
   "t": "2025-10-16T14:46:37Z",
   "sha": "df507121593d4a1cd58c80e5e63735c115c728c5"
  },
  {
   "t": "2025-11-10T23:35:15Z",
   "sha": "e84bd31c04751e968a0936b93d6cc7e639ac4409"
  },
  {
   "t": "2025-12-12T12:19:50Z",
   "sha": "75042af2053485badea67b1ff9b38bc820f3f24c"
  },
  {
   "t": "2025-12-16T02:10:58Z",
   "sha": "74bb399dfa1f0823f26fc3bfa7917f5f4fa36668"
  },
  {
   "t": "2026-01-18T17:02:17Z",
   "sha": "a08c9bc808ef19accc90335fb115f791a66e0158"
  },
  {
   "t": "2026-02-09T15:01:46Z",
   "sha": "aac55f94938aa7ac727b840a9766adb848e998ab"
  },
  {
   "t": "2026-03-02T02:46:17Z",
   "sha": "7fc95e7cbb3ee3cae14df02602ac51a3d910945c"
  },
  {
   "t": "2026-03-09T15:47:13Z",
   "sha": "524c5b8ef547700e4b5a234bf6bebd4d775d98e5"
  },
  {
   "t": "2026-04-01T20:12:49Z",
   "sha": "45ecab65d4434aebafa23195c3571b833faf47ca"
  },
  {
   "t": "2026-05-12T17:21:40Z",
   "sha": "304e4107d6f4371ee9df8ffe2f7b1a26c01f8967"
  },
  {
   "t": "2026-05-29T14:34:06Z",
   "sha": "85b9cc0a90f69ff8b9675c6cb383c14f05629f7a"
  },
  {
   "t": "2026-06-24T15:08:40Z",
   "sha": "d908afbad6db16c023bff41568b7a788ff6d737f"
  },
  {
   "t": "2026-08-18T18:26:15Z",
   "sha": "18e41c5277f7180529e80723025d2bccd164b559"
  },
  {
   "t": "2026-08-24T14:21:54Z",
   "sha": "5242a96c76a1eb26827d66627fb2365a528f58b2"
  },
  {
   "t": "2026-09-08T18:11:38Z",
   "sha": "e0986cf5c4c94bace6a90929d02cfc0430a56dd5"
  }
 ],
 "additions": 534,
 "deletions": 193,
 "changed_files": 17,
 "commit_count": 14,
 "size_bucket": "L",
 "mergeable_state": "dirty",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "stale_ack": [
     {
      "login": "adyshimony",
      "url": "https://github.com/bitcoin/bitcoin/pull/30343#issuecomment-3997066867"
     }
    ]
   },
   "conflicts": [
    {
     "number": 36197,
     "title": "kernel: Replace application log callbacks with file logging",
     "author": "w0xlt"
    },
    {
     "number": 36167,
     "title": "[RFC] Enable `-Wunused`",
     "author": "fanquake"
    },
    {
     "number": 36082,
     "title": "ci: add Guix builds to CI",
     "author": "willcl-ark"
    },
    {
     "number": 36031,
     "title": "wallet: Remove mapMasterKeys and enforce that only one encryption key can exist",
     "author": "achow101"
    },
    {
     "number": 35998,
     "title": "wallet: Handle or explicitly ignore `WalletBatch` write failures",
     "author": "achow101"
    },
    {
     "number": 35935,
     "title": "wallet: Avoid unnecessary wtxvariant rewrites",
     "author": "achow101"
    },
    {
     "number": 35752,
     "title": "wallet: make encryption state updates atomic",
     "author": "l0rinc"
    },
    {
     "number": 35716,
     "title": "wallet: Replace mapWallet and wtxOrdered with a boost::multi_index",
     "author": "achow101"
    },
    {
     "number": 35511,
     "title": "RFC: consensus: Make `CAmount` a class",
     "author": "hodlinator"
    },
    {
     "number": 35322,
     "title": "logging: streamline Logger state and drop redundant methods",
     "author": "ryanofsky"
    },
    {
     "number": 34909,
     "title": "wallet, refactor: modularise wallet by extracting out legacy wallet migration",
     "author": "rkrux"
    },
    {
     "number": 34681,
     "title": "wallet: move rescan logic into ChainScanner and wallet/scan",
     "author": "Eunovo"
    },
    {
     "number": 34193,
     "title": "wallet: make migration more robust against failures",
     "author": "furszy"
    }
   ]
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "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": [
   "adyshimony",
   "hodlinator",
   "l0rinc",
   "maflcko"
  ]
 },
 "signals": {
  "needs_rebase": true,
  "ci_failed": false,
  "mergeable_state": "dirty",
  "last_author_activity": "2026-09-08T18:11:38Z",
  "last_reviewer_activity": "2026-03-04T11:54:03Z",
  "last_reviewer": "adyshimony",
  "author_silent_days": 8,
  "waiting_on_author_days": 0,
  "days_since_update": 5
 },
 "refs": {
  "mentioned": [
   26619,
   28318,
   29256,
   30406,
   30485,
   30659,
   31061,
   34075,
   34778,
   34993,
   35512,
   35955
  ],
  "depends_on": [
   34778
  ],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 34778,
    "type": "pull",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "logging: rewrite macros to enforce restrictions at compile-time, improve efficiency and usability"
   },
   {
    "number": 28318,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-01-10",
    "title": "logging: Simplify API for level based logging"
   },
   {
    "number": 29256,
    "type": "pull",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "log, refactor: Allow log macros to accept context arguments"
   },
   {
    "number": 26619,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-09-03",
    "title": "log: expand BCLog::LogFlags (categories) to 64 bits"
   },
   {
    "number": 30406,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-07-11",
    "title": "refactor: modernize-use-equals-default"
   },
   {
    "number": 30485,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-08-06",
    "title": "log: Remove NOLINT(bitcoin-unterminated-logprintf)"
   },
   {
    "number": 30659,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-08-15",
    "title": "wallet: fix UnloadWallet thread safety assumptions"
   },
   {
    "number": 31061,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-01-15",
    "title": "refactor: Check translatable format strings at compile-time"
   },
   {
    "number": 34075,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-08-21",
    "title": "fees: Introduce Mempool Based Fee Estimation to reduce overestimation"
   },
   {
    "number": 34993,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-08-24",
    "title": "wallet: `NotifyCanGetAddressesChanged` when advancing `next_index`"
   },
   {
    "number": 35512,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-06-19",
    "title": "wallet: move fAbortRescan reset into WalletRescanReserver reserve function"
   },
   {
    "number": 35955,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-08-18",
    "title": "wallet: remove orphaned GetAffectedKeys and LegacyScriptPubKeyMan declarations"
   }
  ],
  "conflicts": [
   36197,
   36167,
   36082,
   36031,
   35998,
   35935,
   35752,
   35716,
   35511,
   35322,
   34909,
   34681,
   34193
  ]
 },
 "stack": {
  "shares_commits_with": [
   29256,
   30342,
   34778
  ],
  "based_on": [
   29256,
   34778
  ],
  "base_for": []
 },
 "review_paths": [
  "src/util/log.h",
  "src/wallet/scriptpubkeyman.h",
  "src/wallet/wallet.cpp",
  "src/wallet/wallet.h",
  "src/wallet/walletdb.cpp"
 ],
 "body": "Make new logging macros `LogDebug()`, `LogTrace()`, `LogInfo()`, `LogWarning()`, and `LogError()` compatible with wallet code and drop custom `WalletLogPrintf()` function. The new logging macros introduced in #28318 weren't previously useful in wallet code because wallet code prefixes most log messages with the wallet names to be be able to distinguish log output from multiple wallets. Fix this by introducing a new `WalletLogContext` class inheriting from `util::log::Context` which can include the wallet name in log messages.\n\nThis change makes `-logsourcelocations` usable with wallet code because it logs actual source locations instead of the `WalletLogPrintf()` location.\n\n---\n\n**This is based on #34778 + #29256.** The non-base commits are:\n\n- [`b45c6256226` wallet, logging: Replace WalletLogPrintf() with LogInfo()](https://github.com/bitcoin/bitcoin/pull/30343/commits/b45c62562261405e9c6c6986214bfd654a1f154a)\n- [`1003d69de35` wallet, logging: Switch LogInfo to LogWarning/LogError](https://github.com/bitcoin/bitcoin/pull/30343/commits/1003d69de35ae96639c6906286687c11bbaf1a66)",
 "commits": [
  {
   "sha": "963ed23bc8c466188c2be7553ae383cf182c24b4",
   "date": "2026-05-26T12:39:03Z",
   "message": "log test: verify log argument evaluation semantics\n\nTest that LogInfo/LogWarning/LogError always evaluate their arguments\neven when logging is disabled.\n\najtowns pointed out this behavior was important and could affect non-logging\ncode if changed in\nhttps://github.com/bitcoin/bitcoin/pull/34374#discussion_r2734793117\n\nCo-authored-by: l0rinc <pap.lorinc@gmail.com>"
  },
  {
   "sha": "3ea9b7cb10f0667d7fd1d2e8b4e25e8aea9932b3",
   "date": "2026-05-26T12:39:03Z",
   "message": "log test: add some test coverage on LogAcceptCategory\n\nCo-authored-by: Ryan Ofsky <ryan@ofsky.org>"
  },
  {
   "sha": "9c509ca53c0185a8f5b96c2a5aa3a5b7d73045a7",
   "date": "2026-05-26T12:39:03Z",
   "message": "log test: Add test for all accepted logging arguments\n\nAdd new logging test to call macros with all allowed combinations of macro\narguments.\n\nThe new test replaces a less comprehensive test that doesn't cover log\nstatements without format arguments. It's also moved to the top of the test\nsuite because it's a good illustration of what typical log prints look like,\nwhat logging calls are allowed and disallowed, and what the resulting log\noutput looks like."
  },
  {
   "sha": "98f3bd6242d999191f442271a77eb8cac7949ca1",
   "date": "2026-05-26T12:39:03Z",
   "message": "log refactor: Ensure categories are not logged at info and higher levels\n\nPreviously this used to be possible through the LogPrintLevel call but now that\ncall is removed, this change is just an internal refactoring and has no visible\neffect except in tests."
  },
  {
   "sha": "31f9929f3dea586104c0c11d7533385e139bdbdf",
   "date": "2026-05-26T12:39:03Z",
   "message": "log refactor: log macro rewrite\n\nRewrite log macros to fix a number of issues: unnecessary strprintf\ncalls during fuzzing, confusing error messages when macros are called\nwith the wrong arguments, duplicated code with unexplained differences\nand undocumented assumptions.\n\nSince this is a rewrite, reading the new code in log.h first should be clearer\nthan starting from the diff.\n\nSpecific benefits of the new implementation are:\n\n- Functionality is implemented once in a single `LOG_EMIT` macro instead of\n  multiple times in different macros with diverging code paths and unexplained\n  differences.\n\n- Unnecessary `strprintf` calls are now skipped when logging is disabled (in\n  bitcoind when `-noprinttoconsole -nodebuglogfile` options are used, and in\n  tests and kernel applications when DisableLogging is called). This change\n  should not affect bitcoind noticeably, but could speed up fuzz tests calling\n  functions which log.\n\n- Clearer error messages: If you pass a category to a macro which does not\n  accept it, or forget to pass a category to a macro which requires it, you\n  will see a direct message telling you to add or remove the category instead\n  of expanded macro syntax errors.\n\n- Previously it was possible to call `detail_LogWithSrcLoc` with\n  inconsistent or invalid arguments, for example bypassing ratelimiting\n  without it being explicit. New `LOG_EMIT` macro is compile-time safe\n  and enforces the exact same restrictions as other macros.\n\n- Previously \"always evaluate arguments\" behavior at Info and higher levels\n  looked accidental and was undocumented\n  (https://github.com/bitcoin/bitcoin/pull/34374#discussion_r2734793117). Now\n  the behavior is documented and explicit.\n\n- `NO_RATE_LIMIT` special case used to bypass rate limiting is dropped.\n  The `LOG_EMIT` macro can control rate limiting (and other options if\n  they are added in the future) while still using the same ratelimiting\n  defaults as other macros.\n\nCo-Authored-By: Hodlinator <172445034+hodlinator@users.noreply.github.com>\nCo-Authored-By: stickies-v <stickies-v@protonmail.com>"
  },
  {
   "sha": "f0929e1b781af5012d835f78a8b54054fb5cb21e",
   "date": "2026-05-26T12:39:03Z",
   "message": "log refactor: Drop Entry::should_ratelimit field\n\nDrop Entry::should_ratelimit field in favor of Options::ratelimit field.\n\nDropping the Entry::should_ratelimit field makes buffered log messages\nin m_msgs_before_open smaller, and avoids potential confusion because\nthe field is stored after rate limiting has been applied, so just gets\nignored. Conceptually it also makes sense to treat the ratelimit option\nas an input to the logger rather than as an attribute of the message\nbeing logged."
  },
  {
   "sha": "1ac1be8b159198d779bb0a37c4fbbbe5b5070ffb",
   "date": "2026-05-26T12:39:03Z",
   "message": "Merge branch 'pr/relog' into pr/bclog"
  },
  {
   "sha": "aa37de26b0f31d1d731fc3a3fe20ca9d99f69062",
   "date": "2026-05-26T12:39:03Z",
   "message": "log refactor: Allow log macros to accept context arguments\n\nAllow LogDebug(), LogTrace(), LogInfo(), LogWarning(), and LogError() macros to\naccept context arguments to provide more information in log messages and more\ncontrol over logging to callers.\n\nThis functionality is used in followup PRs:\n\n- https://github.com/bitcoin/bitcoin/pull/30342 - To let libbitcoinkernel send\n  output to specfic `BCLog::Logger` instances instead of a global instance, so\n  output can be disambiguated and applications can have more control over\n  logging.\n\n- https://github.com/bitcoin/bitcoin/pull/30343 - To replace custom\n  `WalletLogPrintf` calls with standard logging calls that automatically include\n  wallet names and don't log everything at info level.\n\nThis commit does not change behavior of current log prints or require them to\nbe updated. It includes tests and documentation covering the new functionality.\n\nCo-Authored-By: Hodlinator <172445034+hodlinator@users.noreply.github.com>\nCo-Authored-By: stickies-v <stickies-v@protonmail.com>"
  },
  {
   "sha": "1eedcb9db5156d36916ce4ccac49096a61d9c186",
   "date": "2026-05-26T12:39:03Z",
   "message": "doc: Add documentation about log levels and macros"
  },
  {
   "sha": "b5d3925d27468ff4d5d2e6be7e9ec0c7f8c3a05e",
   "date": "2026-05-26T12:39:03Z",
   "message": "log refactor: Add support for custom log contexts\n\nCustom log contexts allow overridding log formatting and adding metadata, such\nas request ids or wallet names to log messages, while still using standard\nmacros for logging. This is used to replace WalletLogPrintf() functions with\nLogInfo() calls in followup PR #30343."
  },
  {
   "sha": "d12352bbbc302f054e408c0ff3cfbc1c42e6f47f",
   "date": "2026-09-03T11:32:49Z",
   "message": "Merge branch 'pr/bclog' into pr/gwlog"
  },
  {
   "sha": "b45c62562261405e9c6c6986214bfd654a1f154a",
   "date": "2026-09-03T11:32:49Z",
   "message": "wallet, logging: Replace WalletLogPrintf() with LogInfo()\n\nMake new logging macros LogDebug(), LogTrace(), LogInfo(), LogWarning(), and\nLogError() compatible with wallet code and drop custom WalletLogPrintf()\nfunction. The new logging macros introduced in #28318 weren't previously useful\nin wallet code because wallet code prefixes most log messages with the wallet\nnames to be be able to distinguish log output from multiple wallets. Fix this\nby introducing a new WalletLogContext class inheriting from BCLog::Context\nwhich can include the wallet name in log messages"
  },
  {
   "sha": "1003d69de35ae96639c6906286687c11bbaf1a66",
   "date": "2026-09-03T11:32:49Z",
   "message": "wallet, logging: Switch LogInfo to LogWarning/LogError\n\nSwitch to LogWarning / LogError in obvious places where wallet code is clearly outputting warnings and errors.\n\nSuggested by hodlinator in\nhttps://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655406670\nhttps://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655407301\nhttps://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655436010"
  },
  {
   "sha": "e0986cf5c4c94bace6a90929d02cfc0430a56dd5",
   "date": "2026-09-03T11:32:49Z",
   "message": "test-each-commit: Increase fetch depth\n\nNeeded due to base PR, can be dropped before merge"
  }
 ],
 "timeline": [
  {
   "t": "2024-06-26T19:16:19Z",
   "kind": "review_comment",
   "who": "hodlinator",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.h",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": null,
   "text": "Why not rename `GetLogSource()` -> `Log()` here and in `WalletStorage` and keep `m_log` private? I tried and it compiles as of 5b30f17c22ade44d301aed5051a398fa38251ef7."
  },
  {
   "t": "2024-06-26T19:19:50Z",
   "kind": "review_comment",
   "who": "hodlinator",
   "assoc": "MEMBER",
   "path": "src/wallet/walletdb.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": null,
   "text": "Shouldn't this be a `LogError`/`LogWarning` with removed `Error: `-prefix?"
  },
  {
   "t": "2024-06-26T19:20:29Z",
   "kind": "review_comment",
   "who": "hodlinator",
   "assoc": "MEMBER",
   "path": "src/wallet/walletdb.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": null,
   "text": "`LogWarning`?"
  },
  {
   "t": "2024-06-26T19:25:04Z",
   "kind": "review_comment",
   "who": "hodlinator",
   "assoc": "MEMBER",
   "path": "src/wallet/scriptpubkeyman.h",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": null,
   "text": "nit: Should strive for alphabetical ordering?"
  },
  {
   "t": "2024-06-26T19:48:56Z",
   "kind": "review_comment",
   "who": "hodlinator",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": null,
   "text": "Should maybe have been a warning all along?"
  },
  {
   "t": "2024-06-26T19:50:01Z",
   "kind": "review_comment",
   "who": "hodlinator",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": null,
   "text": "`LogInfo(m_log, \"Error:` -> `LogError(` here and in other places?"
  },
  {
   "t": "2024-06-26T22:17:33Z",
   "kind": "review",
   "who": "hodlinator",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "5b30f17c22ade44d301aed5051a398fa38251ef7",
   "text": "Went through this and the parent PR together. It was helpful to see how that other PR's changes were used in this one."
  },
  {
   "t": "2024-06-27T03:46:38Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/scriptpubkeyman.h",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655411776,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655411776\n\n[quoted text omitted]\nYes, now piped these through `sort`"
  },
  {
   "t": "2024-06-27T03:46:45Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655436010,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655436010\n\n[quoted text omitted]\nThanks, done in a new commit (see earlier comment)"
  },
  {
   "t": "2024-06-27T03:46:52Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655434943,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655434943\n\n[quoted text omitted]\nGood catch. It actually looks to me like all of the log prints in this function should be errors. I changed them to use LogError in a new commit. It's a separate commit because the level change is a minor change in behavior, and is less obvious than other level changes."
  },
  {
   "t": "2024-06-27T03:46:59Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.h",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655403164,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655403164\n[quoted text omitted]\n\nNice suggestion, implemented. This is much cleaner looking."
  },
  {
   "t": "2024-06-27T03:47:05Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/walletdb.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655406670,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655406670\n\n[quoted text omitted]\nAgree that makes sense. I implemented it in a followup commit so the main commit is still a refactoring that does not change behavior.\n\nFor now I did not remove \"Error:\" and \"Warning:\" prefixes because it would be a more significant, possibly unwelcome change, since the prefixes could help messages stand out, and might be relied upon by tests. I'm also not sure if the decision to include warning and error prefixes has been discussed before somewhere else. But I'm happy to change this if there is more feedback in support of it."
  },
  {
   "t": "2024-06-27T03:47:11Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/walletdb.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655407301,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r1655407301\n\n[quoted text omitted]\nThanks, done in a new commit (see earlier comment)"
  },
  {
   "t": "2024-06-27T03:49:00Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "5a629a60c4739b94383596f9d040502b7b2c8b69"
  },
  {
   "t": "2024-06-27T04:13:12Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "5a629a60c4739b94383596f9d040502b7b2c8b69",
   "text": "Thanks for the review! The suggestions are a big improvement and make the logging code more succinct and clean.\n\nRebased 5b30f17c22ade44d301aed5051a398fa38251ef7 -> 5a629a60c4739b94383596f9d040502b7b2c8b69 ([`pr/gwlog.1`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.1) -> [`pr/gwlog.2`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.2), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.1-rebase..pr/gwlog.2)) on top of the updated parent PR implementing review suggestions."
  },
  {
   "t": "2024-06-27T04:34:56Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "db8c6fc2ca5e1ad99aeda741e3b453f1f7bf7955"
  },
  {
   "t": "2024-06-27T04:36:55Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated 5a629a60c4739b94383596f9d040502b7b2c8b69 -> db8c6fc2ca5e1ad99aeda741e3b453f1f7bf7955 ([`pr/gwlog.2`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.2) -> [`pr/gwlog.3`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.3), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.2..pr/gwlog.3)) fixing initialization order bug in last push"
  },
  {
   "t": "2024-06-27T05:41:17Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655434943,
   "text": "Are you sure that `LogError` is the right level? It should only be used for fatal errors where the node needs to shut down, according to the docs. This seems like a warning here, as suggested above.\n\nSome wallet code can probably use `Result` and pass errors up, possibly here as well. And the caller can decide whether to log as a warning or return over RPC (or something else)."
  },
  {
   "t": "2024-06-27T06:51:46Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.cpp",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166",
   "in_reply_to": 1655434943,
   "text": "[quoted text omitted]\n\nOh, that is interesting. The descriptions of those log levels in https://github.com/bitcoin/bitcoin/blob/b27afb7fb774809c9c075d56e44657e0b607a00c/doc/developer-notes.md#logging are much more severe than I would have expected. Based on those descriptions I would expect LogError to be called LogFatal and LogWarning to be called LogCritical. I would have expected LogError to be used for normal errors, and LogWarning to be used for normal warnings.\n\nMaybe the naming would be worth following up on, but I don't think it would be good to do in this PR. It actually seems like LogInfo is the right log level to use here, not LogWarning. Or do you disagree? Should I just drop the last two commits in this PR?"
  },
  {
   "t": "2024-06-28T14:26:23Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "29eaec25af32e543df3cff091938c3cb8f7cce17"
  },
  {
   "t": "2024-06-28T14:27:13Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated and rebased db8c6fc2ca5e1ad99aeda741e3b453f1f7bf7955 -> 29eaec25af32e543df3cff091938c3cb8f7cce17 ([`pr/gwlog.3`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.3) -> [`pr/gwlog.4`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.4), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.3-rebase..pr/gwlog.4)) with suggestion to use `constexpr`\nRebased 29eaec25af32e543df3cff091938c3cb8f7cce17 -> 0260cd5ccc3120102c001b3ab6c5f29dcf184b58 ([`pr/gwlog.4`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.4) -> [`pr/gwlog.5`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.5), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.4-rebase..pr/gwlog.5)) due to conflict with #30406\nRebased 0260cd5ccc3120102c001b3ab6c5f29dcf184b58 -> 0d49ada2b42e5b48b21bb7cb854851f09641abbb ([`pr/gwlog.5`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.5) -> [`pr/gwlog.6`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.6), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.5-rebase..pr/gwlog.6)) on top of updated base pr/bclog.20\nRebased 0d49ada2b42e5b48b21bb7cb854851f09641abbb -> f6b93a976b0127b55705dc33caf986a3344e12a4 ([`pr/gwlog.6`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.6) -> [`pr/gwlog.7`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.7), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.6-rebase..pr/gwlog.7)) due to conflict with #30485\nRebased f6b93a976b0127b55705dc33caf986a3344e12a4 -> 4c8fe044d3241664151b3727e31ac2eaa741b717 ([`pr/gwlog.7`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.7) -> [`pr/gwlog.8`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.8), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.7-rebase..pr/gwlog.8)) due to conflicts with #26619, #30659, and other PRs\nRebased 4c8fe044d3241664151b3727e31ac2eaa741b717 -> e8c6095c75dead138e79a18146ce865e7fe6529a ([`pr/gwlog.8`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.8) -> [`pr/gwlog.9`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.9), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.8-rebase..pr/gwlog.9)) due to conflicts with #31061\n\nRebased e8c6095c75dead138e79a18146ce865e7fe6529a -> af6f854df0d0dd72b05cda4d2e1ed0d1c2c00738 ([`pr/gwlog.9`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.9) -> [`pr/gwlog.10`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.10), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.9-rebase..pr/gwlog.10))\n\nRebased af6f854df0d0dd72b05cda4d2e1ed0d1c2c00738 -> 2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166 ([`pr/gwlog.10`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.10) -> [`pr/gwlog.11`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.11), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.10-rebase..pr/gwlog.11))\n\nRebased 2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166 -> 186b721e6107a0606be6c55edbdd8ec5d5fabd2b ([`pr/gwlog.11`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.11) -> [`pr/gwlog.12`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.12), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.11-rebase..pr/gwlog.12))\n\nRebased 186b721e6107a0606be6c55edbdd8ec5d5fabd2b -> df507121593d4a1cd58c80e5e63735c115c728c5 ([`pr/gwlog.12`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.12) -> [`pr/gwlog.13`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.13), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.12-rebase..pr/gwlog.13)) on updated base PR to fix CI errors (https://github.com/bitcoin/bitcoin/actions/runs/18514132530?pr=30343), also fixing wallet name formatting causing wallet_tests/CreateWallet to fail\n\nRebased df507121593d4a1cd58c80e5e63735c115c728c5 -> e84bd31c04751e968a0936b93d6cc7e639ac4409 ([`pr/gwlog.13`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.13) -> [`pr/gwlog.14`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.14), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.13-rebase..pr/gwlog.14))\n\nRebased e84bd31c04751e968a0936b93d6cc7e639ac4409 -> 75042af2053485badea67b1ff9b38bc820f3f24c ([`pr/gwlog.14`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.14) -> [`pr/gwlog.15`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.15), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.14-rebase..pr/gwlog.15))\n\nRebased 75042af2053485badea67b1ff9b38bc820f3f24c -> 74bb399dfa1f0823f26fc3bfa7917f5f4fa36668 ([`pr/gwlog.15`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.15) -> [`pr/gwlog.16`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.16), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.15-rebase..pr/gwlog.16))\n\nRebased 74bb399dfa1f0823f26fc3bfa7917f5f4fa36668 -> a08c9bc808ef19accc90335fb115f791a66e0158 ([`pr/gwlog.16`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.16) -> [`pr/gwlog.17`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.17), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.16-rebase..pr/gwlog.17)) on top of #29256 pr/bclog.34\n\nRebased a08c9bc808ef19accc90335fb115f791a66e0158 -> aac55f94938aa7ac727b840a9766adb848e998ab ([`pr/gwlog.17`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.17) -> [`pr/gwlog.18`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.18), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.17-rebase..pr/gwlog.18)) on top of #29256 pr/bclog.36\n\nRebased aac55f94938aa7ac727b840a9766adb848e998ab -> 7fc95e7cbb3ee3cae14df02602ac51a3d910945c ([`pr/gwlog.18`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.18) -> [`pr/gwlog.19`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.19), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.18-rebase..pr/gwlog.19)) on top of #29256 pr/bclog.37 with review suggestions\n\nRebased 7fc95e7cbb3ee3cae14df02602ac51a3d910945c -> 524c5b8ef547700e4b5a234bf6bebd4d775d98e5 ([`pr/gwlog.19`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.19) -> [`pr/gwlog.20`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.20), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.19-rebase..pr/gwlog.20)) on top of #29256 pr/bclog.39\n\nRebased 524c5b8ef547700e4b5a234bf6bebd4d775d98e5 -> 45ecab65d4434aebafa23195c3571b833faf47ca ([`pr/gwlog.20`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.20) -> [`pr/gwlog.21`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.21), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.20-rebase..pr/gwlog.21)) on top of #29256 pr/bclog.40\n\nRebased 45ecab65d4434aebafa23195c3571b833faf47ca -> 304e4107d6f4371ee9df8ffe2f7b1a26c01f8967 ([`pr/gwlog.21`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.21) -> [`pr/gwlog.22`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.22), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.21-rebase..pr/gwlog.22)) on top of #29256 pr/bclog.41\n\nRebased 304e4107d6f4371ee9df8ffe2f7b1a26c01f8967 -> 85b9cc0a90f69ff8b9675c6cb383c14f05629f7a ([`pr/gwlog.22`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.22) -> [`pr/gwlog.23`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.23), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.22-rebase..pr/gwlog.23)) on top of #29256 pr/bclog.42\n\nRebased 85b9cc0a90f69ff8b9675c6cb383c14f05629f7a -> 1ca4092fd86deb184bf2f0822c56266ca2aac521 ([`pr/gwlog.23`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.23) -> [`pr/gwlog.24`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.24), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.23-rebase..pr/gwlog.24)) on top of #29256 pr/bclog.42 due to conflict with #35512\n\nRebased 1ca4092fd86deb184bf2f0822c56266ca2aac521 -> d8caedeb36b8cd44a9b104d50d7606c27bdf97a9 ([`pr/gwlog.24`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.24) -> [`pr/gwlog.25`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.25), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.24-rebase..pr/gwlog.25)) on top of #29256 pr/bclog.42 due to conflict with #35955\n\nRebased d8caedeb36b8cd44a9b104d50d7606c27bdf97a9 -> 956e6b50428f72ae902470070eb058d516dd2d14 ([`pr/gwlog.25`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.25) -> [`pr/gwlog.26`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.26), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.25-rebase..pr/gwlog.26)) due to conflicts with #34075\n\nRebased 956e6b50428f72ae902470070eb058d516dd2d14 -> 1003d69de35ae96639c6906286687c11bbaf1a66 ([`pr/gwlog.26`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.26) -> [`pr/gwlog.27`](https://github.com/ryanofsky/bitcoin/commits/pr/gwlog.27), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/gwlog.26-rebase..pr/gwlog.27)) on top of #29256 pr/bclog.42 due to conflict with #34993"
  },
  {
   "t": "2024-07-17T23:47:06Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "0260cd5ccc3120102c001b3ab6c5f29dcf184b58"
  },
  {
   "t": "2024-08-07T02:00:43Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "0d49ada2b42e5b48b21bb7cb854851f09641abbb"
  },
  {
   "t": "2024-08-07T02:21:04Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "f6b93a976b0127b55705dc33caf986a3344e12a4"
  },
  {
   "t": "2024-12-09T20:39:22Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "4c8fe044d3241664151b3727e31ac2eaa741b717"
  },
  {
   "t": "2025-03-12T13:07:08Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "e8c6095c75dead138e79a18146ce865e7fe6529a"
  },
  {
   "t": "2025-04-03T17:31:38Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "af6f854df0d0dd72b05cda4d2e1ed0d1c2c00738"
  },
  {
   "t": "2025-04-04T03:37:00Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "2e4d0c3b51e2e8fbf913f28361d1a0a8d1f3e166"
  },
  {
   "t": "2025-10-15T00:42:22Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "186b721e6107a0606be6c55edbdd8ec5d5fabd2b"
  },
  {
   "t": "2025-10-16T14:46:37Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "df507121593d4a1cd58c80e5e63735c115c728c5"
  },
  {
   "t": "2025-11-10T23:35:15Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "e84bd31c04751e968a0936b93d6cc7e639ac4409"
  },
  {
   "t": "2025-12-12T12:19:50Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "75042af2053485badea67b1ff9b38bc820f3f24c"
  },
  {
   "t": "2025-12-16T02:10:58Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "74bb399dfa1f0823f26fc3bfa7917f5f4fa36668"
  },
  {
   "t": "2026-01-18T17:02:17Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "a08c9bc808ef19accc90335fb115f791a66e0158"
  },
  {
   "t": "2026-01-23T16:51:01Z",
   "kind": "comment",
   "who": "l0rinc",
   "assoc": "MEMBER",
   "text": "I wanted to push a simple scripted diff to rename `WalletLogPrintf`, to `LogInfo`, but noticed this pR already does that (in a more elaborate way).\nIs it a draft because it's based on https://github.com/bitcoin/bitcoin/pull/29256 which should be reviewed first? That one has two nacks, can you make a version of this that simply renames the leftover `LogPrintf` reference or is that just a demonstration for the usefulness of log contexts?"
  },
  {
   "t": "2026-01-23T17:48:58Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Would be curious about your scripted-diff. I don't think we want to only replace WalletLogPrintf calls with LogInfo calls, because the point of WalletLogPrintf is to include wallet names in log messages, and it would bad to lose these, and awkward to have to specify them in every log call. I think this PR takes a nice approach of allowing Loginfo and other logging macros to work in wallet code including wallet names as part of the log context.\n\nThis PR is ready to review and has had some review, but is a draft because is based on another PR and should not be merged before that one. The other PR has nacks because originally it allowed LogInfo calls to accept category constants, and there was a debate about whether it was harmful to log category information, but I eventually gave in and removed it, so I don't think the nacks are still relevant."
  },
  {
   "t": "2026-02-09T15:01:46Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "aac55f94938aa7ac727b840a9766adb848e998ab"
  },
  {
   "t": "2026-03-01T02:57:24Z",
   "kind": "review_comment",
   "who": "adyshimony",
   "assoc": "NONE",
   "path": "src/util/log.h",
   "commit": "aac55f94938aa7ac727b840a9766adb848e998ab",
   "in_reply_to": null,
   "text": "`#include <type_traits>`"
  },
  {
   "t": "2026-03-01T03:00:06Z",
   "kind": "review_comment",
   "who": "adyshimony",
   "assoc": "NONE",
   "path": "src/util/log.h",
   "commit": "7fc95e7cbb3ee3cae14df02602ac51a3d910945c",
   "in_reply_to": null,
   "text": "Block rvalue Source in compile time by deleting the overload\n\n```\ntemplate <bool take_category, typename Source>\nrequires (std::remove_cvref_t<Source>::log_source && !std::is_lvalue_reference_v<Source>)\nconst std::remove_cvref_t<Source>& GetSource(Source&&) = delete;\n```"
  },
  {
   "t": "2026-03-01T04:03:08Z",
   "kind": "review",
   "who": "adyshimony",
   "assoc": "NONE",
   "state": "COMMENTED",
   "commit": "aac55f94938aa7ac727b840a9766adb848e998ab",
   "text": "Reviewed and tested aac55f94938a.\n\nI found an issue, at log.h [LogPrint_](https://github.com/bitcoin/bitcoin/pull/30343/changes#diff-c75b427ca21222164fa8e95d82f29fefa6b60044d0510fe85f4e06e57cdc154bR160) , rvalue source arguments can be bound by reference and used after their lifetime ends. I tried to solve this in a few ways, but I think the most elegant simple one is to block rvalues at compile time by deleting the overload. I failed to find any rvalue usage that exists today. Solution suggested in inline comments.\n\nI used the following test to confirm the lifetime issue (for demo of the issue only; we don't need it if we block rvalues at compile time):\n\n```\nstruct LifetimeCheckedSource : public util::log::Source {\n    LifetimeCheckedSource(int& counter, BCLog::Logger& logger, bool& alive)\n        : Source{BCLog::VALIDATION, &logger}, m_counter{counter}, m_alive{alive}\n    {\n        m_alive = true;\n    }\n    ~LifetimeCheckedSource()\n    {\n        m_alive = false;\n    }\n    template <typename... Args>\n    std::string Format(util::ConstevalFormatString<sizeof...(Args)> fmt, const Args&... args) const\n    {\n        CHECK_NONFATAL(m_alive);\n        return tfm::format(\"Custom #%d %s\", ++m_counter, tfm::format(fmt, args...));\n    }\n    int& m_counter;\n    bool& m_alive;\n};\n\nBOOST_AUTO_TEST_CASE(logging_temporary_source_lifetime)\n{\n    BCLog::Logger logger;\n    logger.m_log_timestamps = false;\n    logger.EnableCategory(BCLog::LogFlags::ALL);\n    logger.SetLogLevel(BCLog::Level::Debug);\n    logger.StartLogging();\n\n    std::vector<std::string> messages;\n    logger.PushBackCallback([&](const std::string& s) { messages.push_back(s); });\n\n    int counter{0};\n    bool alive{false};\n    auto make_source = [&counter, &logger, &alive]() {\n        return LifetimeCheckedSource{counter, logger, alive};\n    };\n    LogDebug(make_source(), \"temporary %s\", \"source\");\n\n    BOOST_REQUIRE_EQUAL(messages.size(), 1U);\n    BOOST_CHECK_EQUAL(messages[0], \"[validation] Custom #1 temporary source\\n\");\n    BOOST_CHECK_EQUAL(counter, 1);\n}\n\n```\n\nRun build/bin/test_bitcoin --run_test=logging_tests/logging_temporary_source_lifetime to see it fail."
  },
  {
   "t": "2026-03-01T04:07:32Z",
   "kind": "review_comment",
   "who": "adyshimony",
   "assoc": "NONE",
   "path": "src/wallet/wallet.cpp",
   "commit": "aac55f94938aa7ac727b840a9766adb848e998ab",
   "in_reply_to": null,
   "text": "Isn't that a happy flow? Maybe we can use LogInfo here?"
  },
  {
   "t": "2026-03-02T02:46:17Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "7fc95e7cbb3ee3cae14df02602ac51a3d910945c"
  },
  {
   "t": "2026-03-03T00:10:45Z",
   "kind": "comment",
   "who": "adyshimony",
   "assoc": "NONE",
   "text": "Reviewe and test 7fc95e7cbb3e after the rebase.\n\nConcept ACK except this [issue](https://github.com/bitcoin/bitcoin/pull/30343/#pullrequestreview-3871171023)"
  },
  {
   "t": "2026-03-03T17:31:59Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/util/log.h",
   "commit": "aac55f94938aa7ac727b840a9766adb848e998ab",
   "in_reply_to": 2868276474,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r2868276474\n\n[quoted text omitted]\nThanks, added this!"
  },
  {
   "t": "2026-03-03T17:34:45Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/wallet/wallet.cpp",
   "commit": "aac55f94938aa7ac727b840a9766adb848e998ab",
   "in_reply_to": 2868383376,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r2868383376\n\n[quoted text omitted]\nMakes sense, and now dropped this commit since the code has changed since it was written. (It looks like the original version of this commit  5a629a60c4739b94383596f9d040502b7b2c8b69 did have the same mistake.)"
  },
  {
   "t": "2026-03-03T17:43:33Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/util/log.h",
   "commit": "7fc95e7cbb3ee3cae14df02602ac51a3d910945c",
   "in_reply_to": 2868278108,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30343#discussion_r2868278108\n\n[quoted text omitted]\nAssuming this change is intended to address the temporary lifetime issue pointed out in your other [comment](https://github.com/bitcoin/bitcoin/pull/30343#pullrequestreview-3871171023), I think this could make sense. Replied to that comment directly, though [here](https://github.com/bitcoin/bitcoin/pull/30343#pullrequestreview-3884040697)"
  },
  {
   "t": "2026-03-03T18:00:55Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "7fc95e7cbb3ee3cae14df02602ac51a3d910945c",
   "text": "Thanks for the reviews @adyshimony! Note that most of your comments apply to #29256 which this is based on (#29256 is subset of this PR), so you may be interested in reviewing that directly. Some of your comments are now addressed in recent updates to both PRs.\n\nre: https://github.com/bitcoin/bitcoin/pull/30343#pullrequestreview-3871171023\n\n[quoted text omitted]\nI think this issue is already handled by the `LIFETIMEBOUND` annotation in `GetSource()`.\n\nWhen I build your test, the compiler shows `warning: temporary bound to local reference '_source' will be destroyed at the end of the full-expression [-Wdangling]` on line `LogDebug(make_source(), \"temporary %s\", \"source\");`.\n\nSo I think any code written in that unsafe style should be caught locally or by CI, and not be an issue. Your suggestion https://github.com/bitcoin/bitcoin/pull/30343#discussion_r2868278108 to restrict `GetSource()` overloading so it can't bind to lvalues could also make sense if `LIFETIMEBOUND` warning isn't sufficient, but I feel like just using `LIFETIMEBOUND` avoids unnecessary complexity and provides a better diagnostic."
  },
  {
   "t": "2026-03-04T11:54:03Z",
   "kind": "comment",
   "who": "adyshimony",
   "assoc": "NONE",
   "text": "Ohhh, I didn\u2019t catch this earlier because I was building with GCC!\n\nAfter switching to Clang, I can see it.\nThis is Clang only flag, so reviewers using only GCC may miss it...\n\nI still think the cleaner approach is to reject temporary sources directly at compile time by deleting the rvalue overload, so it clearly says \"this usage is not allowed\".\n\nGiven the existing lvalue overload, the additional deleted overload can be simple:\n\n```\ntemplate <bool take_category, typename Source>\nrequires (Source::log_source)\nconst Source& GetSource(const Source&&) = delete;\n```\n\nIn any case, with either approach, ACK on https://github.com/bitcoin/bitcoin/commit/7fc95e7cbb3ee3cae14df02602ac51a3d910945c."
  },
  {
   "t": "2026-03-09T15:47:13Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "524c5b8ef547700e4b5a234bf6bebd4d775d98e5"
  },
  {
   "t": "2026-04-01T20:12:49Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "45ecab65d4434aebafa23195c3571b833faf47ca"
  },
  {
   "t": "2026-05-12T17:21:40Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "304e4107d6f4371ee9df8ffe2f7b1a26c01f8967"
  },
  {
   "t": "2026-05-29T14:34:06Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "85b9cc0a90f69ff8b9675c6cb383c14f05629f7a"
  },
  {
   "t": "2026-06-24T15:08:40Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "d908afbad6db16c023bff41568b7a788ff6d737f"
  },
  {
   "t": "2026-08-18T18:26:15Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "18e41c5277f7180529e80723025d2bccd164b559"
  },
  {
   "t": "2026-08-24T14:21:54Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "5242a96c76a1eb26827d66627fb2365a528f58b2"
  },
  {
   "t": "2026-09-08T18:11:38Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "e0986cf5c4c94bace6a90929d02cfc0430a56dd5"
  }
 ],
 "labels_log": [
  {
   "t": "2024-06-27T04:34:59Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-06-27T22:21:08Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-02T12:58:03Z",
   "action": "labeled",
   "label": "Wallet",
   "who": "glozow"
  },
  {
   "t": "2024-07-11T18:44:23Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-17T23:56:20Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-22T10:41:45Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-22T14:12:06Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-26T13:35:33Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-08-07T02:32:59Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-08-15T18:02:29Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-12-09T20:48:07Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-01-15T18:10:33Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-03-12T14:02:46Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-04-04T03:37:04Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-04-04T05:17:50Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-04-10T01:25:56Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-10-15T00:56:48Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-10-31T19:16:24Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-11-11T12:01:16Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-12-06T14:58:38Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-12-12T13:17:26Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-12-14T14:26:12Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-12-16T02:45:44Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-12-18T13:00:46Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-01-18T18:11:53Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-02-04T20:39:37Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-02-09T15:12:12Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-11T14:00:25Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-04-01T20:28:21Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-04-23T12:54:11Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-12T19:18:44Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-22T04:21:56Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-29T16:33:22Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-19T20:56:55Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-24T16:05:01Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-18T10:02:59Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-18T19:09:29Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-21T08:44:11Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-24T15:58:01Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-24T22:33:39Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-08T20:15:22Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-12T12:05:52Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 27049,
 "text_tokens_estimate": 6762,
 "changed_paths": [
  ".github/workflows/ci.yml",
  "doc/developer-notes.md",
  "src/logging.cpp",
  "src/logging.h",
  "src/test/logging_tests.cpp",
  "src/util/log.h",
  "src/validation.cpp",
  "src/wallet/dump.cpp",
  "src/wallet/logging.h",
  "src/wallet/receive.cpp",
  "src/wallet/scriptpubkeyman.cpp",
  "src/wallet/scriptpubkeyman.h",
  "src/wallet/spend.cpp",
  "src/wallet/wallet.cpp",
  "src/wallet/wallet.h",
  "src/wallet/walletdb.cpp",
  "src/wallet/wallettool.cpp"
 ],
 "files": [
  {
   "path": ".github/workflows/ci.yml",
   "add": 1,
   "del": 1
  },
  {
   "path": "doc/developer-notes.md",
   "add": 1,
   "del": 2
  },
  {
   "path": "src/logging.cpp",
   "add": 18,
   "del": 24
  },
  {
   "path": "src/logging.h",
   "add": 3,
   "del": 3
  },
  {
   "path": "src/test/logging_tests.cpp",
   "add": 207,
   "del": 21
  },
  {
   "path": "src/util/log.h",
   "add": 185,
   "del": 62
  },
  {
   "path": "src/validation.cpp",
   "add": 3,
   "del": 2
  },
  {
   "path": "src/wallet/dump.cpp",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/wallet/logging.h",
   "add": 29,
   "del": 0
  },
  {
   "path": "src/wallet/receive.cpp",
   "add": 2,
   "del": 1
  },
  {
   "path": "src/wallet/scriptpubkeyman.cpp",
   "add": 4,
   "del": 3
  },
  {
   "path": "src/wallet/scriptpubkeyman.h",
   "add": 5,
   "del": 9
  },
  {
   "path": "src/wallet/spend.cpp",
   "add": 5,
   "del": 3
  },
  {
   "path": "src/wallet/wallet.cpp",
   "add": 39,
   "del": 35
  },
  {
   "path": "src/wallet/wallet.h",
   "add": 9,
   "del": 10
  },
  {
   "path": "src/wallet/walletdb.cpp",
   "add": 21,
   "del": 15
  },
  {
   "path": "src/wallet/wallettool.cpp",
   "add": 1,
   "del": 1
  }
 ],
 "test_lines": 228,
 "git": {
  "head": "e0986cf5c4c94bace6a90929d02cfc0430a56dd5",
  "head_matches_backup": true,
  "base": "4ec6ff022a4b33fab46afa5656a983cda8ba3099",
  "commits": [
   {
    "sha": "963ed23bc8",
    "subject": "log test: verify log argument evaluation semantics",
    "files": 1,
    "add": 26,
    "del": 0
   },
   {
    "sha": "3ea9b7cb10",
    "subject": "log test: add some test coverage on LogAcceptCategory",
    "files": 1,
    "add": 16,
    "del": 0
   },
   {
    "sha": "9c509ca53c",
    "subject": "log test: Add test for all accepted logging arguments",
    "files": 1,
    "add": 55,
    "del": 18
   },
   {
    "sha": "98f3bd6242",
    "subject": "log refactor: Ensure categories are not logged at info and higher levels",
    "files": 2,
    "add": 4,
    "del": 2
   },
   {
    "sha": "31f9929f3d",
    "subject": "log refactor: log macro rewrite",
    "files": 5,
    "add": 163,
    "del": 78
   },
   {
    "sha": "f0929e1b78",
    "subject": "log refactor: Drop Entry::should_ratelimit field",
    "files": 4,
    "add": 15,
    "del": 19
   },
   {
    "sha": "1ac1be8b15",
    "subject": "Merge branch 'pr/relog' into pr/bclog",
    "files": 6,
    "add": 275,
    "del": 113
   },
   {
    "sha": "aa37de26b0",
    "subject": "log refactor: Allow log macros to accept context arguments",
    "files": 4,
    "add": 86,
    "del": 23
   },
   {
    "sha": "1eedcb9db5",
    "subject": "doc: Add documentation about log levels and macros",
    "files": 1,
    "add": 36,
    "del": 1
   },
   {
    "sha": "b5d3925d27",
    "subject": "log refactor: Add support for custom log contexts",
    "files": 2,
    "add": 44,
    "del": 1
   },
   {
    "sha": "d12352bbbc",
    "subject": "Merge branch 'pr/bclog' into pr/gwlog",
    "files": 6,
    "add": 417,
    "del": 114
   },
   {
    "sha": "b45c625622",
    "subject": "wallet, logging: Replace WalletLogPrintf() with LogInfo()",
    "files": 10,
    "add": 116,
    "del": 78
   },
   {
    "sha": "1003d69de3",
    "subject": "wallet, logging: Switch LogInfo to LogWarning/LogError",
    "files": 3,
    "add": 13,
    "del": 13
   },
   {
    "sha": "e0986cf5c4",
    "subject": "test-each-commit: Increase fetch depth",
    "files": 1,
    "add": 1,
    "del": 1
   }
  ],
  "patch_truncated": true
 },
 "input_hash": "6c12602210e7bea3",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}