backport: Merge bitcoin-core/gui#749, 28318, 29241, 29375, 29117, 28605, 28784, 29035, 24097#7049
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
41a43d5 to
a6fc4a1
Compare
5af56bf to
c5b6af0
Compare
|
Hello @knst @UdjinM6 @PastaPastaPasta , requesting review |
WalkthroughThis PR makes coordinated changes across logging, banning, wallet, and Qt UI subsystems plus tests and docs. Logging: new levels (Trace/Debug/Info/Warning/Error), removal of Level::None, new GetLogPrefix, new macros (LogInfo/LogWarning/LogError/LogDebug/LogTrace), and related callsite/test updates. BanMan: replace RecursiveMutex with Mutex, add m_banned_mutex guards, consolidate dirty-state handling, add dump_mutex, and remove BannedSetIsDirty/SetBannedSetDirty. Wallet: replace CWallet with WalletDatabase in DumpWallet, remove accept_no_keys from CheckDecryptionKey and Unlock overloads. Qt: propagate show_loading_minimized through GUI → WalletController → LoadWalletsActivity → progress dialog. Misc: many logging call and comment/text fixes, lint/test updates. Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas requiring extra attention:
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
UdjinM6
left a comment
There was a problem hiding this comment.
utACK c5b6af07fd66e9c26788ba0f2bce18f2b3bf41bf
c5b6af0 to
5f17771
Compare
|
This pull request has conflicts, please rebase. |
32db154 gui: make '-min' minimize wallet loading dialog (furszy) Pull request description: Simple fix for dashpay#748. When '-min' is enabled, no loading dialog should be presented on screen during startup. ACKs for top commit: hebasto: ACK 32db154, tested on Debian 11 + XFCE. Tree-SHA512: d08060b044938c67e8309db77b49ca645850fc21fdd7d78d5368d336fb9f602dcc66ea398a7505b00bf7d43afa07108347c7260480319fad3ec84cb41332f780
e60fc7d logging: Replace uses of LogPrintfCategory (Anthony Towns) f7ce5ac logging: add LogError, LogWarning, LogInfo, LogDebug, LogTrace (Anthony Towns) fbd7642 logging: add -loglevelalways=1 option (Anthony Towns) 782bb6a logging: treat BCLog::ALL like BCLog::NONE (Anthony Towns) 667ce3e logging: Drop BCLog::Level::None (Anthony Towns) ab34dc6 logging: Log Info messages unconditionally (Anthony Towns) dfe98b6 logging: make [cat:debug] and [info] implicit (Anthony Towns) c5c76dc logging: refactor: pull prefix code out (Anthony Towns) Pull request description: Replace `LogPrint*` functions with severity based logging functions: * `LogInfo(...)`, `LogWarning(...)`, `LogError(...)` for unconditional (uncategorised) logging (replaces `LogPrintf`) * `LogDebug(CATEGORY, ...)` and `LogTrace(CATEGORY, ...)` for conditional logging (replaces `LogPrint`) * `LogPrintLevel(CATEGORY, LEVEL, ...)` for when the level isn't known in advance, or a category needs to be added for an info/warning/error log message (mostly unchanged, but rarely needed) Logs look roughly as they do now with `LogInfo` not having an `[info]` prefix, and `LogDebug` having a `[cat]` prefix, rather than a `[cat:debug]` prefix. This removes `BCLog::Level::None` entirely -- for `LogFlags::NONE` just use `Level::Info`, for any actual category, use `Level::Debug`. Adds docs to developer-notes about when to use which level. Adds `-loglevelalways=1` option so that you get `[net:debug]`, `[all:info]`, `[all:warning]` etc, which might be helpful for automated parsing, or just if you like everything to be consistent. Defaults to off to reduce noise in the default config, and to avoid unnecessary changes on upgrades. Changes the behaviour of `LogPrintLevel(CATEGORY, BCLog::Level::Info, ...)` to be logged unconditionally, rather than only being an additional optional logging level in addition to trace and debug. Does not change the behaviour of `LogPrintLevel(NONE, Debug, ...)` and `LogPrintLevel(NONE, Trace, ...)` being no-ops. ACKs for top commit: maflcko: re-ACK e60fc7d 🌚 achow101: ACK e60fc7d stickies-v: ACK e60fc7d jamesob: ACK e60fc7d ([`jamesob/ackr/28318.1.ajtowns.logging_simplify_api_for`](https://github.com/jamesob/bitcoin/tree/ackr/28318.1.ajtowns.logging_simplify_api_for)) Tree-SHA512: e7a4588779b148242495b7b6f64198a00c314cd57100affab11c43e9d39c9bbf85118ee2002792087fdcffdea08c84576e20844b3079f27083e26ddd7ca15d7f
…ging section c003562 doc: Add missing backtick in developer notes logging section (Fabian Jahr) Pull request description: Newly added logging section from bitcoin#28318 is missing a single backtick. Also fixes some minor punctuation errors in that section. ACKs for top commit: jonatack: ACK c003562 alfonsoromanz: ACK c003562 Tree-SHA512: 2f75f9472d212ce7c7ebf3e7404f86b3bd8c695f63e2a7447d7a55bb54dcdb5e3bfd15e8eac5b92efbdcf1216c4e8d699cae0250d021f72b9d1c32a7db91989d
…decryption process 2bb25ce wallet: remove unused 'accept_no_keys' arg from decryption process (furszy) Pull request description: Found it while reviewing other PR. Couldn't contain myself from cleaning it up. The wallet decryption process (`CheckDecryptionKey()` and `Unlock()`) contains an arg 'accept_no_keys,' introduced in bitcoin#13926, that has never been used. Additionally, this also removes the unimplemented `SplitWalletPath` function. ACKs for top commit: delta1: ACK 2bb25ce epiccurious: utACK 2bb25ce. achow101: ACK 2bb25ce theStack: Code-review ACK 2bb25ce Tree-SHA512: e0537c994be19ca0032551d8a64cf1755c8997e04d21ee0522b31de26ad90b9eb02a8b415448257b60bced484b9d2a23b37586e12dc5ff6e35bdd8ff2165c6bf
…tabase d83bea4 wallettool: Don't create CWallet when dumping DB (Andrew Chow) 40c80e3 wallettool: Don't unilaterally reset wallet_instance if loading error (Ava Chow) Pull request description: bitcoin#29109 (comment) reports that a wallet with noncritical errors cannot be dumped with `bitcoin-wallet dump`. This was caused by an erroneous reset of the wallet pointer when the loading the wallet returns something other than `LOAD_OK`. Not all errors are errors that require aborting, so unilaterally resetting the pointer at that time is incorrect. The first commit resolves this issue. Furthermore, if a wallet has loading errors, that should not prevent the wallet tool from dumping the wallet. The wallet application logic should not get in the way of performing such a low level database operation, especially when it's primary usage is for debugging potentially corrupted wallets. The 2nd commit is taken from bitcoin#28710 and changes the `dump` to stop at making a `WalletDatabase` rather than making a `CWallet` only to retrieve the underlying `WalletDatabase`. ACKs for top commit: furszy: Code review ACK d83bea4 BrandonOdiwuor: Code Review ACK d83bea4 Tree-SHA512: 425d712dfff1002bd81272aca0bae1016f9126a3c89506f8cb7cf0a0ec9f33d0c03b8d03896394f3a45c2998e59047e19218dfd08dc8a5f40e8625134e886b0f
43de4d3 doc: fix typos (Sjors Provoost) Pull request description: This PR fixes typos found by lint-spelling.py using codespell 2.2.6. Our CI linter job uses codespell 2.2.5 and found fewer typos that I did locally. In any case it's happy now. ACKs for top commit: pablomartin4btc: re ACK 43de4d3 Tree-SHA512: c032fe86cb49c924a468385653b31f309a9db68c478d70335bba3e65a1ff3826abe80284fe00a090ab5a509e1edbf17e476f6922fb15d055e50f1103dad2ccb0
7cb9367 rpc: keep .cookie if it was not generated (Roman Zeyde) Pull request description: Otherwise, starting bitcoind twice may cause the `.cookie` file generated by the first instance to be deleted by the second instance shutdown (after failing to obtain a lock). ACKs for top commit: willcl-ark: re-ACK 7cb9367 achow101: ACK 7cb9367 kristapsk: re-ACK 7cb9367 stickies-v: ACK 7cb9367 Tree-SHA512: 0960dbc457975b0e0535f3d814824a879d7f85c9f1191537415b3fc253429a316a8e4badde56c8bc139778f132392983cec5fbe03891fb15ff61d3bc3f6e681b
…penBSD fd0bde2 test: fix `addnode` functional test failure on OpenBSD (Sebastian Falbesoner) Pull request description: This is the functional test counterpart of PR bitcoin#28891 / commit 007d6f0 (unfortunately, I missed it back then and only ran the unit tests -- sorry for the noise). master branch on OpenBSD 7.4: ``` $ ./test/functional/rpc_net.py 2023-12-08T17:29:05.057000Z TestFramework (INFO): PRNG seed is: 6024296850131317403 2023-12-08T17:29:05.058000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_au3zchif 2023-12-08T17:29:05.618000Z TestFramework (INFO): Test getconnectioncount 2023-12-08T17:29:05.618000Z TestFramework (INFO): Test getpeerinfo 2023-12-08T17:29:06.643000Z TestFramework (INFO): Check getpeerinfo output before a version message was sent 2023-12-08T17:29:06.709000Z TestFramework (INFO): Test getnettotals 2023-12-08T17:29:06.773000Z TestFramework (INFO): Test getnetworkinfo 2023-12-08T17:29:06.978000Z TestFramework (INFO): Test addnode and getaddednodeinfo 2023-12-08T17:29:06.980000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/home/thestack/bitcoin/test/functional/test_framework/test_framework.py", line 131, in main self.run_test() File "/home/thestack/bitcoin/./test/functional/rpc_net.py", line 65, in run_test self.test_addnode_getaddednodeinfo() File "/home/thestack/bitcoin/./test/functional/rpc_net.py", line 224, in test_addnode_getaddednodeinfo assert_raises_rpc_error(-23, "Node already added", self.nodes[0].addnode, node=ip_port2, command='add') File "/home/thestack/bitcoin/test/functional/test_framework/util.py", line 131, in assert_raises_rpc_error assert try_rpc(code, message, fun, *args, **kwds), "No exception raised" AssertionError: No exception raised ``` On the PR branch, the same call succeeds. ACKs for top commit: kevkevinpal: ACK [fd0bde2](bitcoin@fd0bde2) Tree-SHA512: ae20816fa4025c212e115ebd267b5e5784bfcdf0051219eb686faaade47ec4f91a3947af6d24258b159290000d2dcc3f6e65e788b83b8a9297282945dbdafbfb
…nd rename it 37d150d refactor: Add more negative `!m_banned_mutex` thread safety annotations (Hennadii Stepanov) 0fb2908 refactor: replace RecursiveMutex m_banned_mutex with Mutex (w0xlt) 784c316 scripted-diff: rename m_cs_banned -> m_banned_mutex (w0xlt) 46709c5 refactor: Get rid of `BanMan::SetBannedSetDirty()` (Hennadii Stepanov) d88c0d8 refactor: Get rid of `BanMan::BannedSetIsDirty()` (Hennadii Stepanov) Pull request description: This PR is an alternative to bitcoin#24092. Last two commit have been cherry-picked from the latter. ACKs for top commit: maflcko: ACK 37d150d 🎾 achow101: ACK 37d150d theStack: Code-review ACK 37d150d vasild: ACK 37d150d Tree-SHA512: 5e9d40101a09af6e0645a6ede67432ea68631a1b960f9e6af0ad07415ca7718a30fcc1aad5182d1d5265dc54c26aba2008fc9973840255c09adbab8fedf10075
5f17771 to
12a96f7
Compare
|
requesting review @UdjinM6 @knst @PastaPastaPasta |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/rpc/request.cpp (1)
135-138: LGTM: Conditional deletion prevents removing externally-created cookies.The guard correctly ensures only cookies generated by the current process are deleted, improving safety when multiple processes might use the same cookie path. The existing error handling is preserved.
Note:
g_generated_cookielacks atomic or synchronization protection, but is safe in practice sinceGenerateAuthCookieis called during single-threaded initialization andDeleteAuthCookieis called during shutdown after RPC is stopped. This backport matches the upstream Bitcoin design.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 5f177719396b14f84aef27c2e5e3384a5cfc4467 and 12a96f7.
📒 Files selected for processing (40)
ci/README.md(1 hunks)depends/description.md(1 hunks)doc/developer-notes.md(3 hunks)src/banman.cpp(10 hunks)src/banman.h(1 hunks)src/httpserver.cpp(2 hunks)src/init.cpp(1 hunks)src/init/common.cpp(2 hunks)src/logging.cpp(4 hunks)src/logging.h(5 hunks)src/net_processing.cpp(3 hunks)src/qt/bitcoin.cpp(1 hunks)src/qt/bitcoingui.cpp(2 hunks)src/qt/bitcoingui.h(1 hunks)src/qt/transactiontablemodel.cpp(1 hunks)src/qt/walletcontroller.cpp(3 hunks)src/qt/walletcontroller.h(2 hunks)src/rpc/request.cpp(3 hunks)src/rpc/server.cpp(1 hunks)src/test/fuzz/FuzzedDataProvider.h(1 hunks)src/test/logging_tests.cpp(2 hunks)src/test/orphanage_tests.cpp(1 hunks)src/test/script_tests.cpp(1 hunks)src/test/versionbits_tests.cpp(1 hunks)src/torcontrol.cpp(2 hunks)src/txmempool.h(1 hunks)src/wallet/db.h(0 hunks)src/wallet/dump.cpp(2 hunks)src/wallet/dump.h(1 hunks)src/wallet/scriptpubkeyman.cpp(4 hunks)src/wallet/scriptpubkeyman.h(3 hunks)src/wallet/spend.cpp(2 hunks)src/wallet/wallet.cpp(3 hunks)src/wallet/wallet.h(3 hunks)src/wallet/wallettool.cpp(1 hunks)test/functional/feature_filelock.py(2 hunks)test/functional/rpc_net.py(2 hunks)test/functional/test_framework/blockfilter.py(1 hunks)test/lint/lint-format-strings.py(1 hunks)test/lint/spelling.ignore-words.txt(1 hunks)
💤 Files with no reviewable changes (1)
- src/wallet/db.h
✅ Files skipped from review due to trivial changes (1)
- src/test/versionbits_tests.cpp
🚧 Files skipped from review as they are similar to previous changes (20)
- src/qt/transactiontablemodel.cpp
- src/wallet/spend.cpp
- src/rpc/server.cpp
- src/qt/walletcontroller.cpp
- ci/README.md
- test/functional/test_framework/blockfilter.py
- src/banman.cpp
- src/net_processing.cpp
- src/torcontrol.cpp
- test/functional/feature_filelock.py
- test/lint/lint-format-strings.py
- src/wallet/dump.cpp
- src/init.cpp
- src/txmempool.h
- src/test/fuzz/FuzzedDataProvider.h
- depends/description.md
- src/httpserver.cpp
- src/wallet/dump.h
- src/test/orphanage_tests.cpp
- src/logging.cpp
🧰 Additional context used
📓 Path-based instructions (6)
src/**/*.{cpp,h,hpp,cc}
📄 CodeRabbit inference engine (CLAUDE.md)
Dash Core implementation must be written in C++20, requiring at least Clang 16 or GCC 11.1
Files:
src/test/logging_tests.cppsrc/wallet/wallet.hsrc/wallet/wallettool.cppsrc/qt/walletcontroller.hsrc/logging.hsrc/wallet/wallet.cppsrc/init/common.cppsrc/qt/bitcoin.cppsrc/qt/bitcoingui.hsrc/banman.hsrc/qt/bitcoingui.cppsrc/rpc/request.cppsrc/wallet/scriptpubkeyman.hsrc/test/script_tests.cppsrc/wallet/scriptpubkeyman.cpp
src/{test,wallet/test}/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Unit tests in src/test/ and src/wallet/test/ must use Boost::Test framework
Files:
src/test/logging_tests.cppsrc/test/script_tests.cpp
src/wallet/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Wallet implementation must use Berkeley DB and SQLite
Files:
src/wallet/wallet.hsrc/wallet/wallettool.cppsrc/wallet/wallet.cppsrc/wallet/scriptpubkeyman.hsrc/wallet/scriptpubkeyman.cpp
{guix-build*,releases,**/guix-build*,releases/**,.github/**,depends/**,ci/**,contrib/**,doc/**}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not make changes to build system files (guix-build*), release artifacts, or avoid changes to .github, depends, ci, contrib, and doc directories unless specifically prompted
Files:
doc/developer-notes.md
src/qt/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
GUI implementation in src/qt/ must use Qt 5
Files:
src/qt/walletcontroller.hsrc/qt/bitcoin.cppsrc/qt/bitcoingui.hsrc/qt/bitcoingui.cpp
test/functional/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Functional tests in test/functional/ must be written in Python (minimum version specified in .python-version) and depend on dashd and dash-node
Files:
test/functional/rpc_net.py
🧠 Learnings (8)
📓 Common learnings
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/{masternode,evo,llmq,governance,coinjoin}/**/*.{cpp,h} : Use Dash-specific database implementations: CFlatDB for persistent storage (MasternodeMetaStore, GovernanceStore, SporkStore, NetFulfilledRequestStore) and CDBWrapper extensions for Evolution/DKG/InstantSend/Quorum/RecoveredSigs data
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/wallet/**/*.{cpp,h} : Wallet implementation must use Berkeley DB and SQLite
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/wallet/wallet.hsrc/wallet/wallettool.cppsrc/wallet/wallet.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/wallet/**/*.{cpp,h} : Wallet implementation must use Berkeley DB and SQLite
Applied to files:
src/wallet/wallet.hsrc/wallet/wallettool.cppdoc/developer-notes.md
📚 Learning: 2025-02-14T15:19:17.218Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Applied to files:
src/wallet/wallet.hsrc/wallet/wallettool.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/{masternode,evo,llmq,governance,coinjoin}/**/*.{cpp,h} : Use Dash-specific database implementations: CFlatDB for persistent storage (MasternodeMetaStore, GovernanceStore, SporkStore, NetFulfilledRequestStore) and CDBWrapper extensions for Evolution/DKG/InstantSend/Quorum/RecoveredSigs data
Applied to files:
src/wallet/wallettool.cpp
📚 Learning: 2025-10-03T11:27:54.178Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6838
File: src/governance/signing.cpp:89-95
Timestamp: 2025-10-03T11:27:54.178Z
Learning: In the Dash codebase, `LogPrint` uses tinyformat internally, which is a type-safe formatting library that handles format specifiers and type conversions automatically. Unlike traditional printf-style functions, tinyformat does not require matching format specifiers (like %lld for int64_t) with argument types, making manual casting unnecessary.
Applied to files:
doc/developer-notes.md
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
test/functional/rpc_net.pysrc/test/script_tests.cpp
📚 Learning: 2025-09-09T21:36:11.833Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:0-0
Timestamp: 2025-09-09T21:36:11.833Z
Learning: In RawSender class (src/stats/rawsender.cpp), cs_net is the appropriate mutex for protecting socket access (m_sock) and network operations, not additional custom locks. The implementation correctly uses cs_net with GUARDED_BY annotations and EXCLUSIVE_LOCKS_REQUIRED to synchronize socket access between SendDirectly() and ReconnectThread().
Applied to files:
src/banman.h
🧬 Code graph analysis (10)
src/test/logging_tests.cpp (1)
src/logging.h (1)
LogPrintf_(264-273)
src/wallet/wallet.h (1)
src/wallet/wallet.cpp (4)
Unlock(3687-3718)Unlock(3687-3687)Unlock(3720-3734)Unlock(3720-3720)
src/wallet/wallettool.cpp (2)
src/wallet/walletdb.cpp (2)
MakeDatabase(1165-1250)MakeDatabase(1165-1165)src/wallet/dump.cpp (2)
DumpWallet(23-102)DumpWallet(23-23)
src/qt/walletcontroller.h (1)
src/qt/walletcontroller.cpp (4)
showProgressDialog(197-214)showProgressDialog(197-197)load(452-469)load(452-452)
src/logging.h (1)
src/logging.cpp (4)
GetLogPrefix(431-455)GetLogPrefix(431-431)LogLevelToStr(218-233)LogLevelToStr(218-218)
test/functional/rpc_net.py (2)
test/functional/test_framework/util.py (2)
p2p_port(359-361)assert_raises_rpc_error(132-148)src/rpc/net.cpp (2)
addnode(303-364)addnode(303-303)
src/init/common.cpp (1)
src/logging.cpp (2)
LogInstance(19-38)LogInstance(19-19)
src/qt/bitcoingui.h (1)
src/qt/bitcoingui.cpp (2)
setWalletController(920-941)setWalletController(920-920)
src/banman.h (1)
src/banman.cpp (28)
Ban(127-131)Ban(127-127)Ban(139-163)Ban(139-139)sub_net(129-129)sub_net(167-167)Discourage(133-137)Discourage(133-133)ClearBanned(71-80)ClearBanned(71-71)ClearDiscouraged(82-90)ClearDiscouraged(82-82)IsBanned(98-111)IsBanned(98-98)IsBanned(113-125)IsBanned(113-113)IsDiscouraged(92-96)IsDiscouraged(92-92)Unban(165-169)Unban(165-165)Unban(171-181)Unban(171-171)GetBanned(183-189)GetBanned(183-183)DumpBanlist(47-69)DumpBanlist(47-47)SweepBanned(191-215)SweepBanned(191-191)
src/wallet/scriptpubkeyman.h (1)
src/wallet/scriptpubkeyman.cpp (4)
CheckDecryptionKey(188-238)CheckDecryptionKey(188-188)CheckDecryptionKey(1871-1902)CheckDecryptionKey(1871-1871)
🪛 LanguageTool
doc/developer-notes.md
[style] ~747-~747: To form a complete sentence, be sure to include a subject.
Context: ...LogDebug. - LogInfo(fmt, params...)` should only be used rarely, e.g. for startup ...
(MISSING_IT_THERE)
[style] ~754-~754: To form a complete sentence, be sure to include a subject.
Context: ...LogInfo. - LogError(fmt, params...)should be used in place ofLogInfo` for sev...
(MISSING_IT_THERE)
[style] ~758-~758: To form a complete sentence, be sure to include a subject.
Context: ...space). - LogWarning(fmt, params...) should be used in place of LogInfo for sev...
(MISSING_IT_THERE)
[style] ~763-~763: To form a complete sentence, be sure to include a subject.
Context: ...Trace(BCLog::CATEGORY, fmt, params...)should be used in place of LogDebug` for lo...
(MISSING_IT_THERE)
[style] ~943-~943: In American English, abbreviations like “etc.” require a period.
Context: ...For strprintf, LogInfo, LogDebug, etc formatting characters don't need size s...
(ETC_PERIOD)
🔇 Additional comments (32)
src/test/script_tests.cpp (1)
1051-1051: LGTM! Comment clarity improvement.The hyphen removal in the comment ("re-use" → "reuse") improves consistency with standard English usage. This cosmetic change has no functional impact.
src/qt/walletcontroller.h (2)
99-99: LGTM - API extension for minimized progress dialog.The optional
show_minimizedparameter with a default offalsemaintains backward compatibility for existing callers while enabling the new minimized loading behavior.
155-155: LGTM - Parameter propagation for minimized loading.The new
show_loading_minimizedparameter aligns with the updatedshowProgressDialogsignature and enables the wallet loading UI to start minimized when the application is launched with-min.src/qt/bitcoingui.cpp (1)
920-941: LGTM - Correct propagation of minimized loading state.The
show_loading_minimizedparameter is correctly forwarded toLoadWalletsActivity::load(), completing the chain from startup argument to progress dialog display.src/qt/bitcoin.cpp (1)
406-427: LGTM - Well-structured minimized startup logic.The three-way display logic correctly handles:
- Normal startup (show window)
- Minimized with tray (tray icon manages visibility)
- Minimized without tray (show minimized window)
The
windowShownsignal is appropriately emitted in all cases to signal initialization completion.src/qt/bitcoingui.h (1)
84-84: LGTM - Declaration matches implementation.The updated signature correctly requires the
show_loading_minimizedparameter, ensuring callers explicitly specify the startup behavior.test/lint/spelling.ignore-words.txt (1)
8-8: The addition of "debbugs" to the ignore list is correct."debbugs" is the Debian bug tracking system (debbugs.gnu.org), a legitimate technical term that appears in the codebase (src/secp256k1/configure.ac and contrib/guix/INSTALL.md). Adding it to the spelling ignore list prevents false positives from the linter. This is a straightforward, appropriate addition for a backport PR.
src/wallet/wallettool.cpp (1)
216-224: LGTM! Clean refactoring to use WalletDatabase directly.The refactoring correctly simplifies the dump operation by using
WalletDatabasedirectly instead of creating a fullCWalletinstance. The implementation properly handles database creation failure, and the dereference ofdatabaseon line 224 is safe due to the null check on line 219.src/banman.h (3)
63-81: LGTM: Thread safety annotations correctly applied to public API.The consistent use of
EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)across all public methods is correct. The negative lock requirement ensures callers don't hold the lock when calling these methods, which prevents potential deadlocks. The implementation snippets confirm that each method acquiresm_banned_mutexinternally, and the delegation pattern (e.g.,Ban(CNetAddr)→Ban(CSubNet)) correctly avoids recursive locking, making the switch fromRecursiveMutextoMutexsafe.
84-86: LGTM: Private method lock requirements correctly differentiated.The asymmetric lock requirements are correct:
LoadBanlist()requires!m_banned_mutex(acquires lock internally)SweepBanned()requiresm_banned_mutex(caller must hold lock)This design is efficient:
GetBanned()can lock once, callSweepBanned()to clean expired entries, copy the data, and unlock, avoiding repeated lock acquisitions. The implementation'sAssertLockHeld(m_banned_mutex)inSweepBanned()matches the annotation.
88-94: LGTM: Mutex replacement and guard annotations correctly updated.The replacement of
RecursiveMutex m_cs_bannedwithMutex m_banned_mutexis an improvement. Non-recursive mutexes are preferred when recursive locking isn't required, as they help detect potential design issues at compile time. AllGUARDED_BYannotations are consistently updated to referencem_banned_mutex, ensuring proper thread safety analysis form_banned,m_is_dirty, andm_discouraged.test/functional/rpc_net.py (1)
19-19: LGTM! Platform-specific guard for OpenBSD.The OpenBSD platform check correctly skips the IPv4 shorthand notation test (
127.1:port) since OpenBSD doesn't support this notation with omitted zero-bytes. The import and conditional logic are properly implemented.Also applies to: 245-248
src/init/common.cpp (1)
73-73: LGTM! New-loglevelalwaysflag properly integrated.The new command-line argument follows the established pattern for logging options, using
GetBoolArgwith theDEFAULT_LOGLEVELALWAYSconstant and correctly wiring tom_always_print_category_level.Also applies to: 87-87
doc/developer-notes.md (2)
733-772: LGTM! Comprehensive logging documentation.The new "Logging" section clearly documents the usage patterns for all logging macros (
LogInfo,LogDebug,LogTrace,LogWarning,LogError), including:
- When to use each macro
- Deprecation notices for
LogPrint/LogPrintfaliases- Important warning about avoiding side-effects in
LogDebug/LogTraceparameters since they're only evaluated when the category is enabled
943-943: LGTM! Formatting guidance updated for new macros.The string formatting notes now correctly reference the expanded set of logging macros.
Also applies to: 955-955
src/logging.h (3)
28-28: LGTM! Logging level infrastructure properly defined.The new
DEFAULT_LOGLEVELALWAYSconstant and expandedLevelenum withTrace,Debug,Info,Warning,Errorlevels provide a clear severity hierarchy with appropriate comments explaining each level's intended use.Also applies to: 96-103
145-145: LGTM! Logger class extensions.The new
m_always_print_category_levelmember,GetLogPrefixmethod, and makingLogLevelToStrstatic are clean additions that support the new per-category/per-level formatting behavior.Also applies to: 150-151, 222-222
281-306: LGTM! New and deprecated logging macros properly defined.The macro structure is well-organized:
- Unconditional macros (
LogInfo,LogWarning,LogError) useBCLog::LogFlags::ALLto ensure messages are always logged- Conditional macros (
LogDebug,LogTrace) wrapLogPrintLevelwith the appropriate severity- Deprecated aliases (
LogPrintf→LogInfo,LogPrint→LogDebug) maintain backward compatibilitysrc/test/logging_tests.cpp (3)
94-116: LGTM! Comprehensive LogPrintf_ test coverage.The updated test cases correctly exercise the new prefix formatting logic:
[net]for category with implicit Debug level[net:info]for category with explicit non-Debug level[debug]for ALL category with Debug level- Empty prefix for ALL category with Info level (the default case)
- NONE flag treated as ALL per the
GetLogPrefiximplementation
119-144: LGTM! Deprecated macros test properly renamed and updated.The test is appropriately renamed to
logging_LogPrintMacrosDeprecatedto distinguish it from the new macro tests. The expected outputs correctly reflect the updated formatting behavior for the legacyLogPrintf,LogPrint,LogPrintLevel, andLogPrintfCategorymacros.
146-165: LGTM! New logging macros test added.The new
logging_LogPrintMacrostest properly exercises the new macro API:
- Verifies
LogTraceis correctly filtered when log level is Debug- Verifies
LogDebuglogs with[net]prefix- Verifies
LogInfologs without prefix (default behavior)- Verifies
LogWarningandLogErrorlog with[warning]and[error]prefixessrc/wallet/wallet.h (3)
170-170: LGTM: Documentation wording update.The minor documentation change is consistent with upstream backport conventions.
265-265: LGTM: API simplification.The removal of the
accept_no_keysparameter from the privateUnlockmethod is consistent with the broader API simplification in this backport. The implementation in wallet.cpp has been updated accordingly.
608-608: LGTM: Public API simplification confirmed.The removal of the
accept_no_keysparameter from the publicUnlockmethod signatures has been correctly applied. Both method overloads (SecureString and CKeyingMaterial versions) in wallet.h and their implementations in wallet.cpp have been updated consistently, and all call sites across the codebase now use the new signature without the removed parameter.src/wallet/scriptpubkeyman.cpp (4)
188-188: LGTM: Signature update consistent with header.The removal of the
accept_no_keysparameter fromLegacyScriptPubKeyMan::CheckDecryptionKeymatches the declaration in scriptpubkeyman.h and is part of the coordinated API simplification.
188-238: LGTM: Logic simplified with accept_no_keys removal.The updated logic at line 224 removes the
accept_no_keyscondition, now requiring either successful key decryption or an encrypted HD chain. This simplification is consistent with the API change and matches the expected upstream behavior.The function correctly:
- Validates that encrypted keys can be decrypted with the provided master key
- Handles partial decryption failures (throws runtime_error)
- Validates HD chain decryption when present
1871-1871: LGTM: Signature update consistent with header.The removal of the
accept_no_keysparameter fromDescriptorScriptPubKeyMan::CheckDecryptionKeymatches the declaration in scriptpubkeyman.h and is part of the coordinated API simplification.
1871-1902: LGTM: Logic simplified with accept_no_keys removal.The updated logic at line 1897 removes the
accept_no_keyscondition, simplifying toif (keyFail || !keyPass). This ensures that decryption validation now always requires successful key decryption when encrypted keys are present, consistent with the API simplification.The function correctly:
- Validates that all encrypted descriptor keys can be decrypted
- Handles partial decryption failures (throws runtime_error)
- Sets the thorough check flag on success
src/wallet/scriptpubkeyman.h (1)
184-184: LGTM: Coordinated API simplification across class hierarchy.The removal of the
accept_no_keysparameter fromCheckDecryptionKeyis consistently applied across:
- Base class
ScriptPubKeyMan(line 184)- Derived class
LegacyScriptPubKeyMan(line 344)- Derived class
DescriptorScriptPubKeyMan(line 585)All declarations match their corresponding implementations in scriptpubkeyman.cpp, ensuring proper polymorphism and API consistency.
Also applies to: 344-344, 585-585
src/wallet/wallet.cpp (1)
3687-3718: The signature consistency across related files is confirmed. BothCWallet::Unlockoverloads and allScriptPubKeyMan::CheckDecryptionKeycalls have been properly coordinated:
Unlockdeclarations in wallet.h (lines 265, 608) do not includeaccept_no_keysCheckDecryptionKeydeclarations in scriptpubkeyman.h (lines 184, 344, 585) do not includeaccept_no_keys- All call sites (wallet.cpp lines 792, 3725, 3891, and line 3703 in the reviewed code) pass only the master key parameter
The parameter removal is consistent across all related files.
src/rpc/request.cpp (2)
81-82: LGTM: Cookie generation tracking flag added.The static flag correctly tracks whether the current process generated the RPC authentication cookie, enabling proper cleanup semantics in
DeleteAuthCookie.
108-108: LGTM: Flag correctly set after successful cookie generation.The flag is set only after
RenameOversucceeds, ensuringDeleteAuthCookiewill only remove cookies that were fully generated by this process.
|
Hello @knst @PastaPastaPasta , requesting review |
Bitcoin backports