Outcomes
What happened to findings after review.
Addressed after review
Best-effort automated assessment of whether later PR updates addressed findings from previous reviews. This is not a causal claim or human validation.
477 assessed findings from 477 published findings across 104 source reviews.
| Status | Findings |
|---|---|
| addressed | 221 |
| partially_addressed | 15 |
| still_present | 105 |
| unclear | 136 |
Assessment jobs: 69
Assessment usage: 137 request records; 7,038,937 (partial) input tokens; 112,194 (partial) output tokens.
Finding assessments
| PR | Finding | Outcome | Evidence |
|---|---|---|---|
| gui#1142 | A rejected fee-bump commit is incorrectly reported as Uncertainqml/walletbump.cpp | still_present | AssessmentA false commitBumpTransaction result is still mapped to Error::Commit, and the excerpt provides no change to the reported downstream Uncertain handling. new_source: qml/walletbump.cpp [
{
"bounded": true,
"end_line": 228,
"evidence_id": "5c1f6da878e24a62acb331d92481af5d",
"finding_id": "finding:9",
"kind": "new_source",
"line": 176,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/walletbump.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " bool signed_replacement{false};\n try { signed_replacement = wallet.signBumpTransaction(signed_tx); } catch (...) {}\n if (!signed_replacement) { result.error = Error::Sign; return finishAfterRelock(); }\n if (!MatchesUnsignedTransaction(review.transaction, signed_tx)) { result.error = Error::Changed; return finishAfterRelock(); }\n if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n }\n if (const auto scope_error = CheckApprovedScope(wallet, review); scope_error != Error::None) {\n result.error = scope_error; return finishAfterRelock();\n }\n // No further key operation is needed. Restore authorization before\n // commit, and never publish a successful spend with failed restoration.\n restoreWalletLock(); passphrase.reset();\n if (result.relock_failed) return result;\n if (services.admission) {\n const auto exact = MakeTransactionRef(signed_tx);\n const auto decision = psbtpolicy::Evaluate(services.admission(exact, review.new_fee));\n if (decision.state == psbtpolicy::State::Blocked) {\n result.error = Error::Policy;\n result.message = decision.explanation;\n return result;\n }\n }\n std::vector<bilingual_str> errors;\n Txid txid;\n const CTransaction exact{signed_tx};\n result.candidate_txid = exact.GetHash();\n result.candidate_wtxid = exact.GetWitnessHash();\n result.commit_attempted = true;\n if (!wallet.commitBumpTransaction(review.original, std::move(signed_tx), errors, txid)) {\n result.error = Error::Commit; result.message = Message(errors); return result;\n }\n result.txid = txid;\n result.committed = true;\n Observe(wallet, result);\n } catch (const secretinput::Failure&) {\n result.error = Error::Invalid; result.message = QObject::tr(\"The wallet password could not be prepared. No fee bump was submitted.\");\n } catch (...) { result.error = Error::Uncertain; }\n return finishAfterRelock();\n}\nCommit ObserveOutcome(interfaces::Wallet& wallet, const Commit& original)\n{\n auto result = original;\n result.record = Record::Unknown;\n result.submission = Submission::Unknown;\n if (!original.commit_attempted || original.candidate_txid == Txid{}) return result;\n result.txid = original.candidate_txid;\n Observe(wallet, result, true);\n // Observing a record cannot manufacture the original call's missing\n // persistence/replacement-metadata receipt. Keep its uncertainty explicit.\n return result;\n}\n} // namespace walletbump",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The Receive editor no longer offers Copy addressqml/components/ReceiveEditorFields.qml | addressed | AssessmentReceiveEditorFields now provides a visible Copy address button when an address is present, with a clipboard action; the new test exercises copying. path_diff: qml/components/ReceiveEditorFields.qml; new_source: qml/components/ReceiveEditorFields.qml [
{
"evidence_id": "a10be1e5d14b40d8a4b7de6ec6373295",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/components/ReceiveEditorFields.qml",
"source_generation": 24,
"source_job_id": 3164,
"text": "diff --git a/qml/components/ReceiveEditorFields.qml b/qml/components/ReceiveEditorFields.qml\nindex 2a367a0fc6..a1b8eb5339 100644\n--- a/qml/components/ReceiveEditorFields.qml\n+++ b/qml/components/ReceiveEditorFields.qml\n@@ -17,7 +17,22 @@ ColumnLayout {\n value: ApplicationModels.optionsModel.displayUnit\n when: root.editor !== null\n }\n- CoreText { Layout.fillWidth: true; text: root.editor ? root.editor.address : \"\"; wrapMode: Text.WrapAnywhere }\n+ RowLayout {\n+ Layout.fillWidth: true\n+ spacing: 8\n+ CoreText {\n+ objectName: \"receiveEditorAddressText\"\n+ Layout.fillWidth: true\n+ text: root.editor ? root.editor.address : \"\"\n+ wrapMode: Text.WrapAnywhere\n+ }\n+ NeutralButton {\n+ objectName: \"receiveCopyAddressButton\"\n+ text: qsTr(\"Copy address\")\n+ visible: root.editor !== null && root.editor.address.length > 0\n+ onClicked: Clipboard.setText(root.editor.address)\n+ }\n+ }\n CoreText {\n Layout.fillWidth: true\n visible: root.editor !== null && root.editor.historicallyUsed\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 111,
"evidence_id": "21151147f8a64f1baec9d2c211705e10",
"finding_id": "finding:8",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/components/ReceiveEditorFields.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\nimport QtQuick 2.15\nimport QtQml 2.15\nimport QtQuick.Layouts 1.15\nimport org.bitcoincore.qt 1.0\nimport \"../controls\"\n\nColumnLayout {\n id: root\n required property PaymentRequestEditorModel editor\n spacing: 16\n Binding {\n target: root.editor ? root.editor.amount : null\n property: \"unit\"\n value: ApplicationModels.optionsModel.displayUnit\n when: root.editor !== null\n }\n RowLayout {\n Layout.fillWidth: true\n spacing: 8\n CoreText {\n objectName: \"receiveEditorAddressText\"\n Layout.fillWidth: true\n text: root.editor ? root.editor.address : \"\"\n wrapMode: Text.WrapAnywhere\n }\n NeutralButton {\n objectName: \"receiveCopyAddressButton\"\n text: qsTr(\"Copy address\")\n visible: root.editor !== null && root.editor.address.length > 0\n onClicked: Clipboard.setText(root.editor.address)\n }\n }\n CoreText {\n Layout.fillWidth: true\n visible: root.editor !== null && root.editor.historicallyUsed\n text: qsTr(\"This address has been used. Public payment details are read only; the private note can still be edited.\")\n }\n BitcoinAmountInputField {\n amount: root.editor ? root.editor.amount : null\n readOnly: root.editor === null || !root.editor.publicFieldsEditable || root.editor.busy\n inputObjectName: \"receiveAmountInput\"\n unitToggleObjectName: \"receiveAmountUnitButton\"\n }\n TextFieldRow {\n Layout.fillWidth: true\n title: qsTr(\"Recipient name\")\n fieldObjectName: \"receivePublicLabelInput\"\n textInput: root.editor ? root.editor.publicLabel : null\n maximumLength: 16384\n readOnly: root.editor === null || !root.editor.publicFieldsEditable || root.editor.busy\n }\n TextFieldRow {\n Layout.fillWidth: true\n title: qsTr(\"Public message\")\n fieldObjectName: \"receiveMessageInput\"\n textInput: root.editor ? root.editor.message : null\n maximumLength: 16384\n readOnly: root.editor === null || !root.editor.publicFieldsEditable || root.editor.busy\n }\n TextFieldRow {\n Layout.fillWidth: true\n title: qsTr(\"Note to self\")\n fieldObjectName: \"receivePrivateNoteInput\"\n textInput: root.editor ? root.editor.privateNote : null\n maximumLength: 16384\n readOnly: root.editor === null || !root.editor.available || root.editor.busy\n }\n Repeater {\n model: root.editor ? root.editor.conflicts : []\n delegate: RowLayout {\n id: conflictRow\n required property var modelData\n CoreText { Layout.fillWidth: true; text: conflictRow.modelData.fieldId + \": \" + conflictRow.modelData.committedText }\n NeutralButton {\n text: qsTr(\"Use current\")\n onClicked: root.editor.resolveConflict(conflictRow.modelData.fieldId, TextEditSessionModel.UseCurrent)\n }\n NeutralButton {\n text: qsTr(\"Keep edit\")\n enabled: root.editor !== null && (root.editor.publicFieldsEditable || conflictRow.modelData.fieldId === \"note\")\n onClicked: root.editor.resolveConflict(conflictRow.modelData.fieldId, TextEditSessionModel.KeepEdit)\n }\n }\n }\n CoreText {\n objectName: \"receiveEditorError\"\n Layout.fillWidth: true\n visible: text.length > 0\n text: root.editor ? root.editor.error.message : \"\"\n color: Theme.color.dangerText\n }\n RowLayout {\n PrimaryButton {\n objectName: \"receiveSaveRequestButton\"\n text: root.editor && root.editor.mutationKind === PaymentRequestEditorModel.Create ? qsTr(\"Create request\") : qsTr(\"Update request\")\n enabled: root.editor !== null && root.editor.canSave\n busy: root.editor !== null && root.editor.busy\n onClicked: root.editor.save()\n }\n NeutralButton {\n objectName: \"receiveDiscardEditsButton\"\n text: qsTr(\"Discard edits\")\n enabled: root.editor !== null && root.editor.canDiscard\n onClicked: root.editor.discard()\n }\n }\n ReceiveEditorCloseQuestion { Layout.fillWidth: true; editor: root.editor }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Close leaves the inline Receive editor visible but unusableqml/components/ReceiveRequestEditorCard.qml | addressed | AssessmentThe inline ReceivePage now sets closable: false, hiding the Close button for the affected inline editor. The card retains the button for other contexts. path_diff: qml/components/ReceiveRequestEditorCard.qml; new_source: qml/components/ReceiveRequestEditorCard.qml [
{
"evidence_id": "071783efc44849389c1c32ae387158d5",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/components/ReceiveRequestEditorCard.qml",
"source_generation": 24,
"source_job_id": 3164,
"text": "diff --git a/qml/components/ReceiveRequestEditorCard.qml b/qml/components/ReceiveRequestEditorCard.qml\nindex 1d0b30a9e5..f0af8be559 100644\n--- a/qml/components/ReceiveRequestEditorCard.qml\n+++ b/qml/components/ReceiveRequestEditorCard.qml\n@@ -21,6 +21,7 @@ Pane {\n // A question belongs to the request it was asked about.\n onEditorChanged: deletion.reset()\n property bool viewActive: true\n+ property bool closable: true\n readonly property RequestSharingModel sharing: receive && editor && editor.requestId.length > 0 ? receive.sharing(editor, root) : null\n signal closeRequested()\n signal requestAgain(string id)\n@@ -93,7 +94,7 @@ Pane {\n }\n ReceiveEditorCloseQuestion { Layout.fillWidth: true; editor: root.deleteEditor }\n CoreText { Layout.fillWidth: true; text: deletion.error; visible: text.length > 0; color: Theme.color.dangerText }\n- NeutralButton { objectName: \"savedRequestCloseButton\"; text: qsTr(\"Close\"); enabled: root.editor !== null; onClicked: root.editor.requestClose() }\n+ NeutralButton { objectName: \"savedRequestCloseButton\"; visible: root.closable; text: qsTr(\"Close\"); enabled: root.editor !== null; onClicked: root.editor.requestClose() }\n }\n Connections {\n target: root.editor\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 103,
"evidence_id": "d46a394d36764fd484d9ccacc003f644",
"finding_id": "finding:7",
"kind": "new_source",
"line": 66,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/components/ReceiveRequestEditorCard.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " // A different editor identity destroys the old native text/undo\n // context. Amount canonical state remains in that editor's model.\n Repeater {\n model: root.editor ? [root.editor] : []\n delegate: ReceiveEditorFields {\n required property PaymentRequestEditorModel modelData\n Layout.fillWidth: true\n editor: modelData\n }\n }\n Repeater {\n model: root.sharing ? [root.sharing] : []\n delegate: SavedRequestSharing {\n required property RequestSharingModel modelData\n Layout.fillWidth: true\n sharing: modelData\n interested: root.viewActive && root.visible\n }\n }\n RowLayout {\n visible: root.editor !== null && root.editor.requestId.length > 0\n NeutralButton { objectName: \"savedRequestAgainButton\"; text: qsTr(\"Request again\"); onClicked: root.requestAgain(root.editor.requestId) }\n NeutralButton {\n objectName: \"savedRequestDeleteButton\"\n text: qsTr(\"Delete request\")\n enabled: root.receive !== null && root.editor !== null && !root.editor.busy && root.deleteEditor === null\n onClicked: deletion.request(root.editor.requestId)\n }\n }\n ReceiveEditorCloseQuestion { Layout.fillWidth: true; editor: root.deleteEditor }\n CoreText { Layout.fillWidth: true; text: deletion.error; visible: text.length > 0; color: Theme.color.dangerText }\n NeutralButton { objectName: \"savedRequestCloseButton\"; visible: root.closable; text: qsTr(\"Close\"); enabled: root.editor !== null; onClicked: root.editor.requestClose() }\n }\n Connections {\n target: root.editor\n function onClosed(editorId) { if (root.editor && editorId === root.editor.editorId) root.closeRequested() }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The macOS Core-thread stack safeguard was droppedqml/executor.cpp | still_present | AssessmentThe new Worker still constructs its thread with plain std::thread; the supplied new-head excerpt shows no macOS-specific stack-size safeguard. new_source: qml/executor.cpp [
{
"bounded": true,
"end_line": 150,
"evidence_id": "eca9704c37574701855d31ed1a7815ba",
"finding_id": "finding:6",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/executor.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/executor.h>\n\n#include <qml/execution.h>\n\n#include <algorithm>\n#include <atomic>\n#include <cassert>\n#include <condition_variable>\n#include <deque>\n#include <mutex>\n#include <thread>\n#include <utility>\n#include <vector>\n\nnamespace execution {\nnamespace {\nusing Callback = std::function<void()>;\n\nclass Worker\n{\npublic:\n Worker() : m_thread([this] { run(); }) {}\n ~Worker()\n {\n close();\n join();\n }\n\n bool post(Callback callback)\n {\n {\n std::lock_guard lock{m_mutex};\n if (m_closed) return false;\n m_tasks.push_back(std::move(callback));\n }\n m_ready.notify_one();\n return true;\n }\n\n void close()\n {\n {\n std::lock_guard lock{m_mutex};\n m_closed = true;\n }\n m_ready.notify_one();\n }\n\n void join()\n {\n if (m_thread.joinable()) m_thread.join();\n }\n\nprivate:\n void run()\n {\n for (;;) {\n Callback callback;\n {\n std::unique_lock lock{m_mutex};\n m_ready.wait(lock, [this] { return m_closed || !m_tasks.empty(); });\n if (m_tasks.empty()) return;\n callback.swap(m_tasks.front());\n m_tasks.pop_front();\n }\n callback();\n }\n }\n\n std::mutex m_mutex;\n std::condition_variable m_ready;\n std::deque<Callback> m_tasks;\n bool m_closed{false};\n std::thread m_thread;\n};\n\nstruct Workers {\n Worker core, priority, rpc, io, signer, cleanup;\n\n bool post(Lane lane, UtilityWorker utility, Callback callback)\n {\n switch (lane) {\n case Lane::Core: return core.post(std::move(callback));\n case Lane::Priority: return priority.post(std::move(callback));\n case Lane::Rpc: return rpc.post(std::move(callback));\n case Lane::Utility:\n switch (utility) {\n case UtilityWorker::IO: return io.post(std::move(callback));\n case UtilityWorker::Signer: return signer.post(std::move(callback));\n case UtilityWorker::Cleanup: return cleanup.post(std::move(callback));\n }\n return false;\n case Lane::Domain:\n case Lane::Control:\n case Lane::Cleanup: return false;\n }\n return false;\n }\n\n void stopAndJoin()\n {\n for (auto* worker : {&core, &priority, &rpc, &io, &signer, &cleanup}) worker->close();\n for (auto* worker : {&core, &priority, &rpc, &io, &signer, &cleanup}) worker->join();\n }\n};\n} // namespace\n\nstruct SerialQueue::State : std::enable_shared_from_this<SerialQueue::State> {\n State(Executor::Dispatch dispatch, Lane lane, UtilityWorker utility)\n : dispatch(std::move(dispatch)), lane(lane), utility(utility) {}\n\n void run()\n {\n {\n std::lock_guard lock{mutex};\n admission = nullptr;\n }\n changed.notify_all();\n\n for (;;) {\n Callback task;\n std::vector<Callback> ready;\n {\n std::lock_guard lock{mutex};\n if (tasks.empty()) {\n active = false;\n ready = takeListeners();\n } else {\n task.swap(tasks.front());\n tasks.pop_front();\n }\n }\n if (!task) {\n changed.notify_all();\n notify(std::move(ready));\n return;\n }\n // Destroy captures before the next idle check, outside the mutex.\n task();\n task = {};\n {\n std::lock_guard lock{mutex};\n if (tasks.empty()) continue;\n }\n // An inline dispatcher resumes this loop without growing the stack.\n static thread_local State* posting{};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | PSBT file import rejects files above 4 MiB that export permitsqml/paymentimport.cpp | addressed | AssessmentThe new head changes MAX_FILE from 4 MiB to MAX_FILE_SIZE_PSBT, removing the reported 4 MiB file-input ceiling. path_diff: qml/paymentimport.cpp; new_source: qml/paymentimport.cpp [
{
"evidence_id": "66834bd5e065438e8ce839f381a913e7",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/paymentimport.cpp",
"source_generation": 24,
"source_job_id": 3164,
"text": "diff --git a/qml/paymentimport.cpp b/qml/paymentimport.cpp\nindex f39ff5ef6a..1e2a91a7c4 100644\n--- a/qml/paymentimport.cpp\n+++ b/qml/paymentimport.cpp\n@@ -26,7 +26,7 @@\n \n namespace paymentimport {\n namespace {\n-constexpr qsizetype MAX_TEXT{1024 * 1024}, MAX_FILE{4 * 1024 * 1024};\n+constexpr qsizetype MAX_TEXT{1024 * 1024}, MAX_FILE{MAX_FILE_SIZE_PSBT};\n constexpr auto RETRY{std::chrono::milliseconds{100}};\n Inspection Invalid(const QString& error) { Inspection result; result.error = error.left(4096); return result; }\n QString PaymentIdentity(const senddraft::PaymentRequest& payment)\n@@ -132,22 +132,22 @@ struct Owner::Delivery {\n Reply reply;\n };\n std::shared_ptr<Cell> cell;\n- std::function<void()> deliver;\n+ std::shared_ptr<void> outcome;\n ReplyKind kind;\n std::optional<Child> child;\n uint64_t identity{0}, source{0}, target{0};\n void complete(Reply value)\n {\n- std::function<void()> notify;\n+ std::shared_ptr<void> release;\n {\n std::lock_guard lock{cell->mutex};\n if (!cell->ready) {\n cell->reply = std::move(value);\n cell->ready = true;\n- notify = std::move(deliver);\n+ release = std::move(outcome);\n }\n }\n- if (notify) notify();\n+ release.reset();\n }\n };\n struct Owner::State {\n@@ -309,7 +309,7 @@ std::shared_ptr<Owner::Delivery> Owner::reserve(ReplyKind kind, std::optional<Ch\n };\n auto outcome = m_outcomes->hold([take, consume] { consume(take()); });\n if (!outcome) return {};\n- delivery->deliver = [outcome = std::move(outcome)]() mutable { outcome.reset(); };\n+ delivery->outcome = std::move(outcome);\n try {\n state.deliveries.emplace(identity, delivery);\n } catch (...) {\n@@ -490,6 +490,7 @@ execution::SubmitResult Owner::close()\n m_presentation_allowed->store(false);\n if (!m_close_requested.exchange(true)) {\n auto post = std::move(m_post_close);\n+ m_post_close = {};\n if (!post) return {{}, execution::Rejection::Closed};\n post(shared_from_this());\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 150,
"evidence_id": "9f09947d68b24e1d9e1fd8128f39344a",
"finding_id": "finding:4",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/paymentimport.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/paymentimport.h>\n#include <qml/executor.h>\n#include <qml/retainedvalue.h>\n#include <qml/models/bitcoinuri.h>\n#include <qml/psbtwork.h>\n\n#include <QCryptographicHash>\n#include <QFile>\n#include <QFileInfo>\n#include <QUrl>\n#include <key_io.h>\n#include <psbt.h>\n\n#include <atomic>\n#include <algorithm>\n#include <limits>\n#include <map>\n#include <mutex>\n#include <stdexcept>\n#include <span>\n#include <utility>\n\nnamespace paymentimport {\nnamespace {\nconstexpr qsizetype MAX_TEXT{1024 * 1024}, MAX_FILE{MAX_FILE_SIZE_PSBT};\nconstexpr auto RETRY{std::chrono::milliseconds{100}};\nInspection Invalid(const QString& error) { Inspection result; result.error = error.left(4096); return result; }\nQString PaymentIdentity(const senddraft::PaymentRequest& payment)\n{\n const auto destination = DecodeDestination(payment.address.toStdString());\n const auto address = IsValidDestination(destination) ? QString::fromStdString(EncodeDestination(destination)) : payment.address;\n QByteArray bytes;\n for (const auto& field : {address, payment.amount ? QString::number(*payment.amount) : QStringLiteral(\"absent\"), payment.label, payment.message}) {\n const auto encoded = field.toUtf8(); bytes += QByteArray::number(encoded.size()) + ':' + encoded;\n }\n return QString::fromLatin1(QCryptographicHash::hash(bytes, QCryptographicHash::Sha256).toHex());\n}\n}\n\nInspection ReadSource(const Input& input)\n{\n auto kind = input.kind;\n QString value = input.value;\n if (kind == Input::Kind::Drop) {\n if (input.url_count < 0 || input.url_count > 1) return Invalid(QStringLiteral(\"Drop one payment request or PSBT at a time.\"));\n if (input.url_count == 1) value = input.url.toString();\n kind = input.url_count == 1 && input.url.isLocalFile() ? Input::Kind::File : Input::Kind::Text;\n } else if (kind == Input::Kind::File && !input.url.isEmpty()) {\n value = input.url.toString();\n }\n QByteArray bytes;\n QString identity_path;\n if (kind == Input::Kind::File) {\n const auto path = psbtwork::LocalFilePath(value);\n if (path.isEmpty() || path.size() > 4096) return Invalid(QStringLiteral(\"The import path is invalid.\"));\n if (!QFileInfo(path).isFile()) return Invalid(QStringLiteral(\"The import source must be a regular local file.\"));\n QFile file{path};\n if (!file.open(QIODevice::ReadOnly)) return Invalid(QStringLiteral(\"The import source could not be opened.\"));\n identity_path = QFileInfo(file).canonicalFilePath();\n if (identity_path.isEmpty()) return Invalid(QStringLiteral(\"The import file path could not be resolved.\"));\n bytes = file.read(MAX_FILE + 1);\n if (file.error() != QFileDevice::NoError || bytes.size() > MAX_FILE || !file.atEnd())\n return Invalid(QStringLiteral(\"The import source is too large or could not be read.\"));\n } else {\n if (value.size() > MAX_TEXT) return Invalid(QStringLiteral(\"The import source is too large.\"));\n bytes = value.toUtf8();\n }\n Inspection result;\n result.field = input.field;\n result.source_identity = QString::fromLatin1(QCryptographicHash::hash(bytes, QCryptographicHash::Sha256).toHex()) + QLatin1Char(':') +\n QString::fromLatin1(QCryptographicHash::hash(identity_path.toUtf8(), QCryptographicHash::Sha256).toHex());\n const auto text = QString::fromUtf8(bytes).trimmed();\n if (text.startsWith(QStringLiteral(\"bitcoin:\"), Qt::CaseInsensitive)) {\n const auto payment = BitcoinUri::Parse(text);\n if (!payment.success) return Invalid(payment.error);\n if (payment.address.size() > 1024 || payment.label.size() > senddraft::Limits::note ||\n payment.message.size() > senddraft::Limits::message) return Invalid(QStringLiteral(\"The payment request metadata is too large.\"));\n result.kind = Kind::Payment;\n result.payment.address = payment.address;\n result.payment.label = payment.label;\n result.payment.message = payment.message;\n if (payment.has_amount) result.payment.amount = payment.amount_sats;\n result.payment_identity = PaymentIdentity(result.payment);\n // Public URI fields never manufacture a user-authored private note.\n return result;\n }\n const auto raw = DecodeRawPSBT(std::as_bytes(std::span{bytes.constData(), static_cast<size_t>(bytes.size())}));\n auto document = raw ? std::optional<PartiallySignedTransaction>{*raw} : std::nullopt;\n if (!document) {\n const auto decoded = DecodeBase64PSBT(text.toStdString());\n if (decoded) document = *decoded;\n }\n if (!document) return Invalid(QStringLiteral(\"The source is not a supported payment request or PSBT.\"));\n const auto transaction = document->GetUnsignedTx();\n if (!transaction || transaction->vin.empty() || transaction->vout.empty() ||\n document->inputs.size() != transaction->vin.size() || document->outputs.size() != transaction->vout.size())\n return Invalid(QStringLiteral(\"The PSBT is malformed.\"));\n auto parsed = std::make_shared<psbtwork::Snapshot>();\n parsed->document = std::make_shared<const PartiallySignedTransaction>(std::move(*document));\n result.kind = Kind::Psbt;\n result.psbt = std::move(parsed);\n return result;\n}\n\nInspection AnalyzeSource(const Inspection& source, const psbtfee::Lookup& lookup)\n{\n if (source.kind != Kind::Psbt || !source.psbt || !source.psbt->document) return Invalid(QStringLiteral(\"No PSBT is available for inspection.\"));\n psbtwork::Request request;\n request.kind = psbtwork::Kind::Inspect;\n request.document = source.psbt->document;\n psbtwork::Context context; context.lookup = lookup;\n const auto analyzed = psbtwork::Execute(nullptr, std::move(request), context);\n if (!analyzed.snapshot) return Invalid(analyzed.error.isEmpty() ? QStringLiteral(\"The PSBT could not be inspected.\") : analyzed.error);\n auto result = source;\n result.psbt = analyzed.snapshot;\n return result;\n}\n\nstruct Owner::Reply {\n std::optional<Target> target;\n std::optional<ChildReply> child;\n std::exception_ptr error;\n};\nstruct Owner::Delivery {\n struct Cell {\n std::mutex mutex;\n bool ready{false};\n Reply reply;\n };\n std::shared_ptr<Cell> cell;\n std::shared_ptr<void> outcome;\n ReplyKind kind;\n std::optional<Child> child;\n uint64_t identity{0}, source{0}, target{0};\n void complete(Reply value)\n {\n std::shared_ptr<void> release;\n {\n std::lock_guard lock{cell->mutex};\n if (!cell->ready) {\n cell->reply = std::move(value);\n cell->ready = true;\n release = std::move(outcome);\n }\n }\n release.reset();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Avoid-reuse Send can leave remaining outputs at an address unavailableqml/models/coinselection.h | still_present | AssessmentApplyInputPolicy still sets m_avoid_address_reuse but does not enable m_avoid_partial_spends. The reported coupling is not shown as fixed. new_source: qml/models/coinselection.h [
{
"bounded": true,
"end_line": 152,
"evidence_id": "dc551873e57045aea375577bfde70c38",
"finding_id": "finding:3",
"kind": "new_source",
"line": 3,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/models/coinselection.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_QML_MODELS_COINSELECTION_H\n#define BITCOIN_QML_MODELS_COINSELECTION_H\n\n#include <wallet/coincontrol.h>\n\n#include <algorithm>\n#include <cstdint>\n#include <functional>\n#include <iterator>\n#include <memory>\n#include <optional>\n#include <set>\n#include <utility>\n\nnamespace coinselection {\n\n// Automatic and Manual are user intent. In particular, an empty Manual\n// selection must remain empty instead of being interpreted as a request to\n// let Core choose wallet inputs.\nenum class InputMode { Automatic, Manual };\n\ninline void ApplyInputPolicy(wallet::CCoinControl& control, const InputMode mode)\n{\n control.m_allow_other_inputs = mode == InputMode::Automatic;\n\n // Core applies this filter only when the wallet has avoid_reuse enabled.\n // Setting it on every app-generated control therefore preserves ordinary\n // wallet behavior while honoring the wallet's opt-in policy.\n control.m_avoid_address_reuse = true;\n}\n\n// Deterministic intent reducer for the temporary coin-selection editor. It\n// owns no wallet or GUI objects; the caller supplies the value-retention\n// boundary used by an opening session.\nclass Session\n{\npublic:\n using Selection = std::set<COutPoint>;\n using Snapshot = std::shared_ptr<const Selection>;\n using Retain = std::function<Snapshot(Selection)>;\n enum class Intent { Select, Unselect, Toggle, Replace, Begin, Apply, Cancel, ChooseAutomatic, ChooseManual };\n struct Transition { Snapshot selection; std::uint64_t revision{0}; InputMode mode{InputMode::Automatic}; bool failed{false}; bool changed{false}; };\n struct MarkChange { Snapshot marks; std::uint64_t revision{0}; bool failed{false}; };\n\n explicit Session(Retain retain) : m_retain{std::move(retain)}\n {\n m_empty = m_retain({});\n m_selection = m_marks = m_empty;\n }\n\n bool ready() const { return bool(m_empty); }\n Snapshot selection() const { return m_selection; }\n Snapshot marks() const { return m_marks; }\n std::uint64_t revision() const { return m_revision; }\n std::uint64_t marksRevision() const { return m_marks_revision; }\n std::uint64_t catalogVersion() const { return m_catalog_version; }\n InputMode inputMode() const { return m_mode; }\n const Selection& missing() const { return m_missing; }\n bool editing() const { return bool(m_baseline); }\n\n Transition apply(Intent intent, std::optional<COutPoint> outpoint = {}, Snapshot replacement = {})\n {\n if (!ready()) return result(true, false);\n if (intent == Intent::Begin) {\n if (!m_baseline) m_baseline = m_selection;\n return result(false, false);\n }\n if (intent == Intent::Apply) {\n m_baseline.reset();\n if (!m_catalog_known) return result(false, false);\n Selection retained;\n std::set_intersection(m_selection->begin(), m_selection->end(), m_catalog.begin(), m_catalog.end(), std::inserter(retained, retained.end()));\n return replaceSelection(std::move(retained));\n }\n if (intent == Intent::Cancel) {\n if (!m_baseline) return result(false, false);\n auto restored = m_baseline;\n m_baseline.reset();\n if (restored == m_selection) return result(false, false);\n m_selection = std::move(restored);\n updateMissing();\n ++m_revision;\n return result(false, true);\n }\n if (intent == Intent::ChooseAutomatic || intent == Intent::ChooseManual) {\n const auto mode = intent == Intent::ChooseManual ? InputMode::Manual : InputMode::Automatic;\n if (m_mode == mode && (mode == InputMode::Manual || m_selection->empty())) return result(false, false);\n if (mode == InputMode::Automatic && !m_selection->empty()) {\n auto empty = m_retain({});\n if (!empty) return result(true, false);\n m_selection = std::move(empty);\n updateMissing();\n }\n m_mode = mode;\n m_baseline.reset();\n ++m_revision;\n return result(false, true);\n }\n\n Selection next;\n if (intent == Intent::Replace) {\n if (replacement) next = *replacement;\n } else {\n next = *m_selection;\n if (outpoint) {\n if (intent == Intent::Unselect || (intent == Intent::Toggle && next.contains(*outpoint))) next.erase(*outpoint);\n else next.insert(*outpoint);\n }\n }\n if (next == *m_selection) return result(false, false);\n if (auto retained = m_retain(std::move(next))) {\n m_selection = std::move(retained);\n ++m_revision;\n return result(false, true);\n }\n return result(true, false);\n }\n\n MarkChange toggleMark(std::optional<COutPoint> outpoint = {})\n {\n if (!ready()) return {m_marks, m_marks_revision, true};\n Selection next = outpoint ? *m_marks : Selection{};\n if (outpoint) {\n if (next.contains(*outpoint)) next.erase(*outpoint);\n else next.insert(*outpoint);\n }\n if (next == *m_marks) return {m_marks, m_marks_revision, false};\n auto retained = m_retain(std::move(next));\n if (!retained) return {m_marks, m_marks_revision, true};\n m_marks = std::move(retained);\n ++m_marks_revision;\n return {m_marks, m_marks_revision, false};\n }\n\n bool reconcileCatalog(const Selection& catalog)\n {\n if (m_catalog_known && catalog == m_catalog) return false;\n m_catalog = catalog;\n m_catalog_known = true;\n ++m_catalog_version;\n updateMissing();\n return true;\n }\n\n // Bulk marks name outputs of the current catalog only. A spent output\n // must not keep a stale count or become a later Lock/Unlock target.\n bool retainMarks(const Selection& catalog)\n {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | importdescriptors private keys remain visible in console recallqml/models/rpccommandexecutor.cpp | still_present | AssessmentThe new-head HISTORY_FILTER is unchanged: it still omits importdescriptors, and the comment still says “plus addhdkey.” The reported redaction gap and comment qualification remain. new_source: qml/models/rpccommandexecutor.cpp [
{
"bounded": true,
"end_line": 150,
"evidence_id": "a8112bdeedf041e6b7ae4963b50cf827",
"finding_id": "finding:21",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/models/rpccommandexecutor.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "// Copyright (c) 2011-2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n//\n// Portions of this file are ported from src/qt/rpcconsole.cpp.\n\n#include <qml/models/rpccommandexecutor.h>\n\n#include <interfaces/node.h>\n#include <rpc/client.h>\n#include <univalue.h>\n#include <util/strencodings.h>\n\n#include <cassert>\n#include <stdexcept>\n#include <string>\n#include <utility>\n#include <vector>\n#include <optional>\n\n#include <QStringList>\n#include <QUrl>\n#include <QCoreApplication>\n\nnamespace {\n\n// Redact arguments before storing either request output or recall history.\n// Keep the pinned Qt Widgets historyFilter policy, plus addhdkey's private key.\n// The parity regression requires an explicit review when Core's policy changes.\nconst QStringList HISTORY_FILTER = QStringList()\n << \"addhdkey\"\n << \"createwallet\"\n << \"createwalletdescriptor\"\n << \"migratewallet\"\n << \"signmessagewithprivkey\"\n << \"signrawtransactionwithkey\"\n << \"walletpassphrase\"\n << \"walletpassphrasechange\"\n << \"encryptwallet\";\n\n} // namespace\n\nstruct RpcCommandExecutor::Plan {\n struct Argument {\n std::string literal;\n std::optional<size_t> result;\n std::vector<std::string> queries;\n };\n std::vector<std::vector<Argument>> calls;\n Argument result;\n std::string filtered;\n};\n\nconst std::string& RpcCommandExecutor::Prepared::filtered() const { return m_plan->filtered; }\n\nstd::optional<RpcCommandExecutor::Prepared> RpcCommandExecutor::Prepare(const std::string& strCommand)\n{\n auto plan = std::make_shared<Plan>();\n std::vector<std::vector<Plan::Argument>> stack;\n stack.emplace_back();\n\n enum CmdParseState {\n STATE_EATING_SPACES,\n STATE_EATING_SPACES_IN_ARG,\n STATE_EATING_SPACES_IN_BRACKETS,\n STATE_ARGUMENT,\n STATE_SINGLEQUOTED,\n STATE_DOUBLEQUOTED,\n STATE_ESCAPE_OUTER,\n STATE_ESCAPE_DOUBLEQUOTED,\n STATE_COMMAND_EXECUTED,\n STATE_COMMAND_EXECUTED_INNER\n } state = STATE_EATING_SPACES;\n\n std::string curarg;\n Plan::Argument last_result;\n unsigned nDepthInsideSensitive = 0;\n size_t filter_begin_pos = 0, chpos;\n std::vector<std::pair<size_t, size_t>> filter_ranges;\n\n auto add_to_current_stack = [&](const std::string& strArg) {\n if (stack.empty()) throw std::runtime_error(\"Invalid Syntax\");\n if (stack.back().empty() && (!nDepthInsideSensitive) &&\n HISTORY_FILTER.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) {\n nDepthInsideSensitive = 1;\n filter_begin_pos = chpos;\n }\n stack.back().push_back({strArg, {}, {}});\n };\n\n auto close_out_params = [&]() {\n if (nDepthInsideSensitive) {\n if (!--nDepthInsideSensitive) {\n // filter_begin_pos is set to chpos at the delimiter *after* the\n // sensitive command name, which is always > 0 (at minimum the\n // opening paren or space character follows the name).\n assert(filter_begin_pos);\n filter_ranges.emplace_back(filter_begin_pos, chpos);\n filter_begin_pos = 0;\n }\n }\n stack.pop_back();\n };\n\n std::string strCommandTerminated = strCommand;\n if (strCommandTerminated.empty() || strCommandTerminated.back() != '\\n')\n strCommandTerminated += '\\n';\n\n for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos) {\n char ch = strCommandTerminated[chpos];\n switch (state) {\n case STATE_COMMAND_EXECUTED_INNER:\n case STATE_COMMAND_EXECUTED: {\n bool breakParsing = true;\n switch (ch) {\n case '[':\n curarg.clear();\n state = STATE_COMMAND_EXECUTED_INNER;\n break;\n default:\n if (state == STATE_COMMAND_EXECUTED_INNER) {\n if (ch != ']') {\n curarg += ch;\n break;\n }\n if (!curarg.empty()) last_result.queries.push_back(curarg);\n state = STATE_COMMAND_EXECUTED;\n break;\n }\n breakParsing = false;\n\n close_out_params();\n\n if (!stack.empty()) stack.back().push_back(last_result);\n else plan->result = last_result;\n curarg.clear();\n state = STATE_EATING_SPACES;\n }\n if (breakParsing)\n break;\n [[fallthrough]];\n }\n case STATE_ARGUMENT:\n case STATE_EATING_SPACES_IN_ARG:\n case STATE_EATING_SPACES_IN_BRACKETS:\n case STATE_EATING_SPACES:\n switch (ch) {\n case '\"':\n state = STATE_DOUBLEQUOTED;\n break;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Retained secret text is released without cleansingqml/secretinput.h | still_present | AssessmentThe new-head header still declares `m_text` as a `const QString` and shows no cleansing destructor, so the retained UTF-16 buffer is not addressed by the supplied evidence. new_source: qml/secretinput.h [
{
"bounded": true,
"end_line": 50,
"evidence_id": "de6ac2273f4e4404a691ab783ef112f1",
"finding_id": "finding:20",
"kind": "new_source",
"line": 4,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/secretinput.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "#ifndef BITCOIN_QML_SECRETINPUT_H\n#define BITCOIN_QML_SECRETINPUT_H\n#include <support/allocators/secure.h>\n#include <QString>\n#include <cstddef>\n#include <exception>\n#include <functional>\n#include <memory>\n#include <utility>\n\nnamespace walletopening { class Session; }\n\nnamespace secretinput {\nenum class Error { None, Unavailable, TransportBudget, Materialization };\nclass Failure final : public std::exception {\npublic:\n explicit Failure(Error error) : m_error(error) {}\n Error error() const noexcept { return m_error; }\n const char* what() const noexcept override { return \"The secret input could not be materialized\"; }\nprivate:\n Error m_error;\n};\n// Immutable Qt-native editor handoff. All UTF8 allocation/conversion, cleansing\n// and retirement run inside the original Native action, never on GUI.\nclass Input final {\npublic:\n Input(QString text, size_t bytes);\n size_t bytes() const { return m_bytes; }\n SecureString materialize() const;\nprivate:\n const QString m_text;\n const size_t m_bytes;\n};\nusing Captured = std::shared_ptr<const Input>;\nstruct CaptureResult {\n Captured input;\n Error error{Error::None};\n size_t bytes{0};\n explicit operator bool() const { return bool(input) && error == Error::None; }\n};\n// O(1) metadata admission. result.bytes is the retained secret's accounted size.\nCaptureResult Capture(const std::function<std::shared_ptr<void>(std::function<void()>)>& hold, const QString& text);\nCaptureResult Capture(const std::shared_ptr<walletopening::Session>& opening, const QString& text);\nsize_t Bytes(const Captured& input);\nSecureString Materialize(const Captured& input);\n}\n#endif // BITCOIN_QML_SECRETINPUT_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The raw-transaction fee cap overrides a raised wallet -maxtxfeeqml/walletsend.cpp | unclear | AssessmentThe follow-up assessment was invalid: unknown follow-up evidence ID. invalid_assessment Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The helper commits claim enforcement that lands in later commitsqml/models/psbtfee.cpp | unclear | AssessmentThis finding concerns commit-message claims and attribution across the commit series, while the supplied evidence is final-tree source and does not include amended commit messages or relevant per-commit metadata. new_source: qml/models/psbtfee.cpp [
{
"bounded": true,
"end_line": 100,
"evidence_id": "cb5fd565f725495f96d2bc6c546008df",
"finding_id": "finding:18",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/models/psbtfee.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/models/psbtfee.h>\n\n#include <set>\n\nnamespace {\nbool AddAmount(CAmount& total, CAmount value)\n{\n if (!MoneyRange(value) || value > MAX_MONEY - total) return false;\n total += value;\n return true;\n}\n}\n\npsbtfee::Analysis psbtfee::Analyze(const PartiallySignedTransaction& psbt, const Outputs& verified)\n{\n Analysis result;\n const auto tx = psbt.GetUnsignedTx();\n if (!tx || tx->vin.empty() || tx->vout.empty()) return result;\n result.commitment = tx->GetHash();\n for (const auto& output : tx->vout) {\n if (!AddAmount(result.output_total, output.nValue)) return result;\n }\n result.outputs_valid = true;\n CAmount input_total{0};\n bool missing{false};\n std::set<COutPoint> seen;\n for (const auto& input : psbt.inputs) {\n const auto outpoint = input.GetOutPoint();\n if (!seen.insert(outpoint).second) return result;\n if (!input.witness_utxo.IsNull() && !MoneyRange(input.witness_utxo.nValue)) return result;\n const auto trusted = verified.find(outpoint);\n std::optional<CTxOut> prevout;\n if (input.non_witness_utxo) {\n if (input.non_witness_utxo->GetHash() != outpoint.hash || outpoint.n >= input.non_witness_utxo->vout.size()) return result;\n prevout = input.non_witness_utxo->vout[outpoint.n];\n if (trusted != verified.end() && trusted->second != *prevout) return result;\n } else if (trusted != verified.end()) {\n prevout = trusted->second;\n } else {\n missing = true;\n }\n if (prevout) {\n if (!input.witness_utxo.IsNull() && input.witness_utxo != *prevout) return result;\n if (!AddAmount(input_total, prevout->nValue)) return result;\n result.verified.emplace(outpoint, *prevout);\n }\n result.prevouts.push_back(std::move(prevout));\n }\n if (missing) {\n result.state = State::Missing;\n return result;\n }\n if (input_total < result.output_total) return result;\n result.state = State::Known;\n result.amount = input_total - result.output_total;\n return result;\n}\n\npsbtfee::Analysis psbtfee::Prepared(const CTransaction& transaction, CAmount fee)\n{\n Analysis result;\n if (!MoneyRange(fee)) return result;\n const PartiallySignedTransaction psbt{CMutableTransaction{transaction}, /*version=*/2};\n result.commitment = psbt.GetUnsignedTx()->GetHash();\n result.amount = fee;\n result.state = State::Known;\n result.wallet_prepared = true;\n return result;\n}\n\nbool psbtfee::MatchesReview(const PartiallySignedTransaction& psbt, const Analysis& proof, std::optional<CAmount> approved_fee)\n{\n if (proof.state != State::Known || !approved_fee || proof.amount != approved_fee) return false;\n const auto tx = psbt.GetUnsignedTx();\n if (!tx || proof.commitment != tx->GetHash()) return false;\n if (proof.wallet_prepared) {\n // This aggregate fee came from Core's construction of these exact\n // inputs/outputs, not from PSBT metadata. Metadata may only contradict\n // that fact; it must never establish or replace it.\n Outputs claims;\n for (const auto& input : psbt.inputs) {\n if (!input.witness_utxo.IsNull()) claims.emplace(input.GetOutPoint(), input.witness_utxo);\n }\n const auto claimed = Analyze(psbt, claims);\n return claimed.state != State::Invalid && (!claimed.amount || claimed.amount == approved_fee);\n }\n return Analyze(psbt, proof.verified).amount == approved_fee;\n}\n\nvoid psbtfee::FillMissing(PartiallySignedTransaction& psbt, const Analysis& proof)\n{\n for (auto& input : psbt.inputs) {\n const auto found = proof.verified.find(input.GetOutPoint());\n if (!input.non_witness_utxo && input.witness_utxo.IsNull() && found != proof.verified.end()) input.witness_utxo = found->second;\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | PSBT import automation bypasses the production import ownerqml/pages/wallet/SendCreate.qml | still_present | AssessmentThe shown new-head SendCreate path still routes `requestPsbtImport(path)` through `draftController.importPsbt(path)` and does not demonstrate injecting the selected file into the captured production import continuation. The requested test-path changes are also not evidenced. new_source: qml/pages/wallet/SendCreate.qml [
{
"bounded": true,
"end_line": 186,
"evidence_id": "c38a1afdd4a941818fd1986597d3e07b",
"finding_id": "finding:17",
"kind": "new_source",
"line": 37,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/pages/wallet/SendCreate.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " && wallet.coinsListModel.lockedSatoshi > 0\n readonly property string baseAvailableBalanceErrorText: qsTr(\"Amount plus fee exceeds available balance\")\n readonly property string walletBalanceErrorText: qsTr(\"The wallet does not have enough balance for this transaction.\")\n readonly property string availableBalanceErrorText: hasLockedCoins\n ? qsTr(\"Amount plus fee exceeds available balance. Some of your coins are locked.\")\n : baseAvailableBalanceErrorText\n readonly property string selectedInputsBalanceErrorText: qsTr(\"Selected inputs do not cover the amount plus fee\")\n readonly property string feeBalanceErrorText: wallet && wallet.sendAmountExhaustsBalance\n ? (selectedInputsActive ? selectedInputsBalanceErrorText : availableBalanceErrorText)\n : \"\"\n readonly property string formErrorText: wallet && wallet.fees && !wallet.fees.estimatePending && wallet.fees.errorText.length > 0\n ? wallet.fees.errorText : recipientValidationError.length > 0\n ? recipientValidationError\n : (wallet && wallet.coinsListModel && wallet.coinsListModel.selectionReconciliationRequired\n ? qsTr(\"Some selected coins are no longer available. Choose Automatic inputs or update the selection.\")\n : (feeBalanceErrorText.length > 0 ? feeBalanceErrorText : prepareTransactionErrorText))\n\n signal viewTransactionInActivity(string txid)\n\n // Prepares this page's draft for review and imports PSBT files. A result\n // answers for the draft it was started for; hiding the page or another\n // wallet drops it.\n SendDraftController {\n id: draftController\n objectName: \"sendDraftController\"\n draftInterface: root.wallet ? root.wallet.sendDraft : null\n active: root.visible\n }\n function requestPsbtImport(path) {\n if (!root.wallet || root.wallet.psbtActionBusy) return\n draftController.importPsbt(path)\n }\n readonly property bool psbtImportDone: draftController.importState !== PsbtOperation.None\n && draftController.importState !== PsbtOperation.Pending && draftController.importState !== PsbtOperation.Stale\n && draftController.importState !== PsbtOperation.Cancelled\n onPsbtImportDoneChanged: if (psbtImportDone) sendPage.handlePsbtImportResult(draftController.importResult)\n\n function confirmTransactionReview() {\n if (!sendPage.imports.pending) draftController.requestPreparation()\n }\n\n readonly property bool preparingReview: draftController.preparing\n\n function prepareTransactionForReview() {\n if (!root.wallet || !root.wallet.available || root.wallet.preparationBusy || sendPage.imports.pending) return\n draftController.prepare()\n }\n\n readonly property bool preparationReady: draftController.preparationState === PreparationOperation.Ready\n onPreparationReadyChanged: if (preparationReady) root.openTransactionReview()\n\n function openTransactionReview() {\n transactionReviewPopup.reviewWallet = root.wallet\n transactionReviewPopup.importedReview = root.wallet.currentTransactionIsImportedPsbt === true\n transactionReviewPopup.open()\n }\n\n function returnToSendForm() {\n if (root.depth > 1) {\n root.pop(null, StackView.Immediate)\n }\n }\n\n function openPaymentRequestImport() {\n root.returnToSendForm()\n root.openWhileShown(sendPage.openPaymentRequestImport)\n }\n\n function acceptDesktopImport(mailbox: DesktopIntentModel): bool {\n const imports = sendPage.imports\n if (!mailbox || !imports.canAccept) return false\n // Taking the inspection can change the selection; the import then\n // belongs to no draft and is cancelled.\n const context = imports.context\n return imports.acceptImport(mailbox.takeInspection(imports), context)\n }\n\n function openPsbtFileImport() {\n root.returnToSendForm()\n root.openWhileShown(sendPage.openPsbtFileImport)\n }\n\n // The draft owner stamps captured user intent. Validation echoes and\n // automatic Maximum observations do not create another user revision.\n readonly property string draftRevision: root.wallet ? root.wallet.recipients.revision : \"\"\n onDraftRevisionChanged: if (sendPage && reviewSweepAlert) root.draftChanged()\n\n function draftChanged() {\n sendPage.imports.draftChanged()\n }\n\n // Counts how often this page was hidden. A deferred open is dropped if\n // the page was hidden in between, even if it is shown again by then.\n property int hiddenCount: 0\n\n function openWhileShown(open) {\n const hiddenCount = root.hiddenCount\n Qt.callLater(function() {\n if (root.visible && hiddenCount === root.hiddenCount) open()\n })\n }\n\n function clearPrepareTransactionError() {\n draftController.dismissPreparationResult()\n }\n\n function resetSendForm() {\n if (sendPage.imports.pending || !draftController.resetDraft()) return\n root.clearPrepareTransactionError()\n sendPage.expandedRecipient = 0\n sendPage.imports.clearStatus()\n }\n\n function displayTransactionError(error) {\n if (hasLockedCoins && !selectedInputsActive\n && (error === baseAvailableBalanceErrorText || error === walletBalanceErrorText)) {\n return availableBalanceErrorText\n }\n return error\n }\n\n function scheduleFeeEstimates() {\n if (root.wallet) {\n root.wallet.scheduleFeeEstimates()\n }\n }\n\n function updateExpandedRecipient(index) {\n sendPage.expandedRecipient = index\n }\n\n onVisibleChanged: if (!visible) root.hiddenCount++\n onWalletChanged: {\n if (transactionReviewPopup.opened) {\n transactionReviewPopup.close()\n }\n root.pop()\n }\n\n Connections {\n target: root.wallet ? root.wallet.recipients : null\n function onListCleared() {\n root.draftChanged()\n root.clearPrepareTransactionError()\n sendPage.expandedRecipient = 0\n if (root.wallet) {\n root.wallet.scheduleFeeEstimates()\n }\n }\n function onCountChanged() {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Cancelled clipboard import objects accumulate during recipient editsqml/models/sendimportmodel.cpp | still_present | AssessmentThe new-head cancellation paths still disconnect and cancel operations without scheduling their deletion. Thus the cited QObject-retention issue remains in the shown code. new_source: qml/models/sendimportmodel.cpp [
{
"bounded": true,
"end_line": 248,
"evidence_id": "ad5dcfcf73a04140892ca13f8ae0801b",
"finding_id": "finding:16",
"kind": "new_source",
"line": 205,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/models/sendimportmodel.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "}\n\nvoid SendImportModel::cancelImport()\n{\n m_presented_result.clear();\n if (const auto operation = std::exchange(m_operation, nullptr)) {\n disconnect(operation, nullptr, this, nullptr);\n operation->cancel();\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::cancelAll()\n{\n cancelImport();\n if (const auto check = std::exchange(m_clipboard_check, nullptr)) {\n disconnect(check, nullptr, this, nullptr);\n check->cancel();\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::checkClipboard()\n{\n if (const auto check = std::exchange(m_clipboard_check, nullptr)) {\n disconnect(check, nullptr, this, nullptr);\n check->cancel();\n }\n if (m_active && m_target && m_target->available() && !m_target->importPending() && !m_clipboard_text.trimmed().isEmpty()) {\n m_offered_text = m_clipboard_text;\n m_clipboard_check = m_target->importText(m_offered_text, this);\n if (m_clipboard_check) connect(m_clipboard_check, &ImportOperation::changed, this, &SendImportModel::changed);\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::presentReview()\n{\n if (!m_operation || !m_operation->reviewOpened() || !m_target || !m_target->available()) return;\n const auto token = m_operation->resultToken();\n if (token.isEmpty() || token == m_presented_result || m_target->importedReviewToken() != token) return;\n m_presented_result = token;\n Q_EMIT reviewReady();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The Activity hold timer undoes its own final scroll clampqml/pages/wallet/ActivityListPage.qml | still_present | AssessmentThe timer still calls `restorePosition(true)` before clearing `heldContentY`, leaving the same re-entry condition described in the finding. No clamp/re-entry change is shown. new_source: qml/pages/wallet/ActivityListPage.qml [
{
"bounded": true,
"end_line": 502,
"evidence_id": "ebf664c1a85a4170bcc79f9bf5498863",
"finding_id": "finding:15",
"kind": "new_source",
"line": 353,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/pages/wallet/ActivityListPage.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " }\n // A confirmation re-groups the list: rows move out of Pending into\n // their dated groups. Qt keeps each visible row on screen as it moves,\n // so the view follows the row up the list and jumps. The list stays\n // where the user left it instead, at the top or further down. Only the\n // position is held while the move is applied; the rows still move.\n // The user always wins: a drag, a flick, the scroll bar or the wheel\n // ends the hold.\n property real heldContentY: NaN\n readonly property bool userScrolling: moving || dragging || (ScrollBar.vertical && ScrollBar.vertical.pressed)\n function holdPosition() {\n if (isNaN(heldContentY) && !userScrolling) heldContentY = contentY\n if (!isNaN(heldContentY)) holdPositionTimer.restart()\n }\n // While the list lays out the moved rows its content height is only an\n // estimate, and Qt clamps the position to it and does not come back.\n // So hold the exact position meanwhile and clamp only once settled.\n function restorePosition(settled) {\n const held = heldContentY\n if (isNaN(held)) return\n if (userScrolling) { heldContentY = NaN; return }\n const highest = Math.max(originY, originY + contentHeight - height)\n const target = settled === true ? Math.max(originY, Math.min(held, highest)) : held\n if (contentY !== target) contentY = target\n }\n onContentYChanged: restorePosition(false)\n onUserScrollingChanged: if (userScrolling) heldContentY = NaN\n Timer {\n id: holdPositionTimer\n interval: 400\n onTriggered: { listView.restorePosition(true); listView.heldContentY = NaN }\n }\n Connections {\n target: activityFilterProxy\n function onRowsAboutToBeMoved() { listView.holdPosition() }\n function onModelAboutToBeReset() { listView.holdPosition() }\n function onLayoutAboutToBeChanged() { listView.holdPosition() }\n function onRowsMoved() { listView.restorePosition(false); listView.holdPosition() }\n function onModelReset() { listView.restorePosition(false); listView.holdPosition() }\n function onLayoutChanged() { listView.restorePosition(false); listView.holdPosition() }\n function onDataChanged() { if (!isNaN(listView.heldContentY)) listView.holdPosition() }\n }\n Timer {\n id: focusScrollTimer\n interval: 0\n onTriggered: listView.ensureFocusedItemVisible()\n }\n Connections {\n target: root.Window.window\n function onActiveFocusItemChanged() { focusScrollTimer.restart() }\n }\n anchors.fill: parent\n anchors.topMargin: activityRefreshError.visible ? activityRefreshError.height + 8 : 0\n clip: true\n model: root.visible ? activityFilterProxy : null\n reuseItems: false\n boundsBehavior: Flickable.StopAtBounds\n // Nothing on this page uses the current item. Left at its default it\n // is the first row and is pushed down by every row inserted above\n // it; when a confirmation re-groups the list, the view then jumps\n // to that row instead of staying where the user left it.\n currentIndex: -1\n highlightFollowsCurrentItem: false\n ScrollBar.vertical: ScrollBar {}\n // Constant: rewriting it while the hidden page's model releases\n // its rows reads a row without its attached object and crashes.\n section.property: \"sectionLabel\"\n section.criteria: ViewSection.FullString\n section.delegate: Item {\n id: sectionHeader\n required property string section\n readonly property bool isPending: section === qsTranslate(\"ActivityFilterProxyModel\", \"Pending\")\n width: listView.width\n height: 56\n RowLayout {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.leftMargin: root.activitySideInset + Theme.space.xs\n anchors.rightMargin: root.activitySideInset + Theme.space.xs\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 12\n spacing: 12\n CoreText {\n objectName: \"activitySectionTitle\"\n Layout.fillWidth: true\n text: sectionHeader.section\n textStyle: Theme.text.subheading\n horizontalAlignment: Text.AlignLeft\n }\n BitcoinAmountDisplayLabel {\n objectName: sectionHeader.isPending ? \"activityPendingBalance\" : \"\"\n hidesAmount: true\n visible: sectionHeader.isPending && activityFilterProxy.pendingBalanceSat !== 0\n text: visible ? activityFilterProxy.pendingBalance : \"\"\n textStyle: Theme.text.amountDescription\n color: !visible ? Theme.color.neutral7 : activityFilterProxy.pendingBalanceSat > 0 ? Theme.color.txIncoming\n : activityFilterProxy.pendingBalanceSat < 0 ? Theme.color.neutral9 : Theme.color.neutral7\n horizontalAlignment: Text.AlignRight\n }\n }\n }\n delegate: Item {\n id: activityDelegate\n required property var model\n required property int index\n width: listView.width\n height: activityRow.implicitHeight + (activityPreviewNotice.visible ? activityPreviewNotice.implicitHeight + Theme.space.m : 0)\n CoreText {\n id: activityPreviewNotice\n anchors.top: activityRow.bottom\n anchors.topMargin: Theme.space.xs\n x: root.activitySideInset\n width: root.activityContentWidth\n visible: activityDelegate.model.presentationLimited === true\n text: qsTr(\"A preview is shown. Open the transaction for complete details.\")\n textStyle: Theme.text.description\n color: Theme.color.neutral7\n }\n ActivityRow {\n id: activityRow\n isCompact: activitySettings.activityDisplayDensity === \"compact\"\n x: root.activitySideInset\n width: root.activityContentWidth\n activityId: activityDelegate.model.activityId\n txid: activityDelegate.model.txid\n requestId: activityDelegate.model.requestId\n label: activityDelegate.model.label\n address: activityDelegate.model.address\n amount: activityDelegate.model.amount\n netAmountSat: activityDelegate.model.netAmountSat\n dateTimeLabel: activityDelegate.model.dateTimeLabel\n activityType: activityDelegate.model.activityType\n status: activityDelegate.model.status\n depth: activityDelegate.model.depth\n blocksToMaturity: activityDelegate.model.blocksToMaturity\n statusKnown: activityDelegate.model.statusKnown\n isInactive: activityDelegate.model.isInactive\n isPendingRequest: activityDelegate.model.isPendingRequest\n replacedByTxid: activityDelegate.model.replacedByTxid\n hasPaymentRequest: activityDelegate.model.hasPaymentRequest\n actions: activityDelegate.model.actions\n firstInSection: activityDelegate.ListView.section !== activityDelegate.ListView.previousSection\n lastInSection: activityDelegate.ListView.section !== activityDelegate.ListView.nextSection\n onContextMenuRequested: function(x, y) {\n const menu = activityRow.isPendingRequest ? activityRequestMenu : activityRowMenu\n const point = activityRow.mapToItem(menu.parent, x, y)\n if (activityRow.isPendingRequest) {\n activityRequestMenu.requestId = activityRow.requestId\n } else {\n // The proxy keeps a delayed raw copy bound to this row.",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Payment and PSBT import errors are hard-coded Englishqml/paymentimport.cpp | still_present | AssessmentThe new-head excerpt continues to construct reader and analysis errors using `QStringLiteral`, including unsupported-source and malformed-PSBT errors. The shown changes address other import behavior, not translation. new_source: qml/paymentimport.cpp [
{
"bounded": true,
"end_line": 216,
"evidence_id": "cf935add030b406588c2127171a7ef28",
"finding_id": "finding:14",
"kind": "new_source",
"line": 67,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/paymentimport.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " return Invalid(QStringLiteral(\"The import source is too large or could not be read.\"));\n } else {\n if (value.size() > MAX_TEXT) return Invalid(QStringLiteral(\"The import source is too large.\"));\n bytes = value.toUtf8();\n }\n Inspection result;\n result.field = input.field;\n result.source_identity = QString::fromLatin1(QCryptographicHash::hash(bytes, QCryptographicHash::Sha256).toHex()) + QLatin1Char(':') +\n QString::fromLatin1(QCryptographicHash::hash(identity_path.toUtf8(), QCryptographicHash::Sha256).toHex());\n const auto text = QString::fromUtf8(bytes).trimmed();\n if (text.startsWith(QStringLiteral(\"bitcoin:\"), Qt::CaseInsensitive)) {\n const auto payment = BitcoinUri::Parse(text);\n if (!payment.success) return Invalid(payment.error);\n if (payment.address.size() > 1024 || payment.label.size() > senddraft::Limits::note ||\n payment.message.size() > senddraft::Limits::message) return Invalid(QStringLiteral(\"The payment request metadata is too large.\"));\n result.kind = Kind::Payment;\n result.payment.address = payment.address;\n result.payment.label = payment.label;\n result.payment.message = payment.message;\n if (payment.has_amount) result.payment.amount = payment.amount_sats;\n result.payment_identity = PaymentIdentity(result.payment);\n // Public URI fields never manufacture a user-authored private note.\n return result;\n }\n const auto raw = DecodeRawPSBT(std::as_bytes(std::span{bytes.constData(), static_cast<size_t>(bytes.size())}));\n auto document = raw ? std::optional<PartiallySignedTransaction>{*raw} : std::nullopt;\n if (!document) {\n const auto decoded = DecodeBase64PSBT(text.toStdString());\n if (decoded) document = *decoded;\n }\n if (!document) return Invalid(QStringLiteral(\"The source is not a supported payment request or PSBT.\"));\n const auto transaction = document->GetUnsignedTx();\n if (!transaction || transaction->vin.empty() || transaction->vout.empty() ||\n document->inputs.size() != transaction->vin.size() || document->outputs.size() != transaction->vout.size())\n return Invalid(QStringLiteral(\"The PSBT is malformed.\"));\n auto parsed = std::make_shared<psbtwork::Snapshot>();\n parsed->document = std::make_shared<const PartiallySignedTransaction>(std::move(*document));\n result.kind = Kind::Psbt;\n result.psbt = std::move(parsed);\n return result;\n}\n\nInspection AnalyzeSource(const Inspection& source, const psbtfee::Lookup& lookup)\n{\n if (source.kind != Kind::Psbt || !source.psbt || !source.psbt->document) return Invalid(QStringLiteral(\"No PSBT is available for inspection.\"));\n psbtwork::Request request;\n request.kind = psbtwork::Kind::Inspect;\n request.document = source.psbt->document;\n psbtwork::Context context; context.lookup = lookup;\n const auto analyzed = psbtwork::Execute(nullptr, std::move(request), context);\n if (!analyzed.snapshot) return Invalid(analyzed.error.isEmpty() ? QStringLiteral(\"The PSBT could not be inspected.\") : analyzed.error);\n auto result = source;\n result.psbt = analyzed.snapshot;\n return result;\n}\n\nstruct Owner::Reply {\n std::optional<Target> target;\n std::optional<ChildReply> child;\n std::exception_ptr error;\n};\nstruct Owner::Delivery {\n struct Cell {\n std::mutex mutex;\n bool ready{false};\n Reply reply;\n };\n std::shared_ptr<Cell> cell;\n std::shared_ptr<void> outcome;\n ReplyKind kind;\n std::optional<Child> child;\n uint64_t identity{0}, source{0}, target{0};\n void complete(Reply value)\n {\n std::shared_ptr<void> release;\n {\n std::lock_guard lock{cell->mutex};\n if (!cell->ready) {\n cell->reply = std::move(value);\n cell->ready = true;\n release = std::move(outcome);\n }\n }\n release.reset();\n }\n};\nstruct Owner::State {\n Flow flow;\n std::shared_ptr<const Input> input;\n std::shared_ptr<const Inspection> inspection;\n std::shared_ptr<const TargetPort> target;\n std::shared_ptr<const ChildReply> result;\n std::map<uint64_t, std::shared_ptr<Delivery>> deliveries;\n uint64_t sequence{0}, target_sequence{0}, delivery_sequence{0}, query_delivery{0};\n size_t native_jobs{0};\n QString error;\n bool closing{false}, retired{false}, wake_pending{false}, use_requested{false};\n std::chrono::steady_clock::time_point retry_at{};\n};\nOwner::Owner(uint64_t identity, Services services, Notify notify, Retired retired, std::shared_ptr<State> state)\n : m_identity(identity), m_services(std::move(services)),\n m_outcomes(std::make_shared<execution::ValueCleanupQueue>(m_services.outcomes)), m_notify(std::move(notify)),\n m_retired(std::move(retired)), m_state(std::move(state)) {}\n\nstd::shared_ptr<Owner> Owner::Create(uint64_t identity, Services services, Notify notify, Retired retired)\n{\n if (!identity || !services.reads || !services.outcomes) return {};\n if (!services.read) services.read = ReadSource;\n if (!services.analyze) services.analyze = [](const Inspection& source) { return AnalyzeSource(source); };\n if (!services.now) services.now = std::chrono::steady_clock::now;\n auto owner = std::shared_ptr<Owner>{new Owner(identity, std::move(services), std::move(notify),\n std::move(retired), std::make_shared<State>())};\n auto closing = std::make_shared<std::shared_ptr<Owner>>();\n auto reservation = owner->m_outcomes->hold([closing] {\n if (*closing) (*closing)->closeOnQueue();\n });\n if (!reservation) return owner;\n owner->m_post_close = [closing, reservation = std::move(reservation)](auto self) mutable {\n *closing = std::move(self);\n reservation.reset();\n };\n return owner;\n}\n\nexecution::SubmitResult Owner::submit(std::function<void()> decision)\n{\n auto run = [self = shared_from_this(), decision = std::move(decision)] {\n decision(); self->publish();\n };\n const bool accepted = m_services.outcomes->post(std::move(run));\n return {{}, accepted ? execution::Rejection::None : execution::Rejection::Transport};\n}\n\nvoid Owner::publish()\n{\n auto& state = *m_state;\n Snapshot snapshot;\n snapshot.sequence = ++state.sequence; snapshot.owner = m_identity; snapshot.source = state.flow.source();\n snapshot.phase = state.flow.phase(); snapshot.kind = state.flow.kind(); snapshot.error_code = state.flow.error();\n snapshot.error = state.error; snapshot.target = state.flow.target(); snapshot.prompt = state.flow.prompt();\n snapshot.result = state.flow.result(); snapshot.inspection = state.inspection; snapshot.child_result = state.result;\n snapshot.pending = state.flow.pending() || state.native_jobs || !state.deliveries.empty();\n if (snapshot.phase == Phase::Closed && snapshot.pending) snapshot.phase = Phase::Closing;\n snapshot.can_apply = state.flow.canApply(); snapshot.can_review = state.flow.canReview();\n snapshot.can_export = state.flow.canExport(); snapshot.can_reconcile = state.flow.canReconcile();\n try { if (m_notify) m_notify(std::move(snapshot)); } catch (...) {}\n if (state.flow.phase() == Phase::Closed && !state.native_jobs && state.deliveries.empty() && !state.retired) {\n state.retired = true;\n state.target.reset();\n state.result.reset();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The same pasted passphrase can create a wallet but fail to unlock itqml/controls/PasswordTextField.qml | still_present | AssessmentThe new-head field still silently removes CR/LF from new-passphrase input through `dropLineEndings()`. It does not reject the input visibly or preserve the pasted value for correction. new_source: qml/controls/PasswordTextField.qml [
{
"bounded": true,
"end_line": 58,
"evidence_id": "1322e2e1f6ac413b826d620108037c15",
"finding_id": "finding:13",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/controls/PasswordTextField.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\n\nLabeledTextField {\n id: root\n\n property bool passwordVisible: false\n property string visibilityToggleObjectName: root.objectName.length > 0\n ? root.objectName + \"VisibilityToggle\"\n : \"\"\n\n // For a new passphrase only. A line ending cannot be typed into this\n // field, so one that arrives by paste is dropped instead of becoming a\n // character the user cannot see or type again. Fields that unlock an\n // existing wallet leave this off: a wallet encrypted with a pasted line\n // ending must still open with exactly that text.\n property bool dropsLineEndings: false\n\n function dropLineEndings() {\n const text = root.field.text\n if (!root.dropsLineEndings || !/[\\r\\n]/.test(text)) return\n const caret = text.slice(0, root.field.cursorPosition).replace(/[\\r\\n]/g, \"\").length\n root.field.text = text.replace(/[\\r\\n]/g, \"\")\n root.field.cursorPosition = caret\n }\n\n Connections {\n target: root.field\n function onTextChanged() { root.dropLineEndings() }\n }\n onDropsLineEndingsChanged: dropLineEndings()\n\n echoMode: passwordVisible ? TextInput.Normal : TextInput.Password\n // Qt never exposes a name for a password field, so the label also goes\n // into the description, which VoiceOver still reads.\n accessibleDescription: [label, errorText.length > 0 ? errorText : supportingText]\n .filter(function(part) { return part.length > 0 }).join(\". \")\n inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText\n\n trailingItem: IconButton {\n id: visibilityToggle\n objectName: root.visibilityToggleObjectName\n size: 30\n iconSize: 22\n iconSource: root.passwordVisible ? \"qrc:/icons/hidden\" : \"qrc:/icons/visible\"\n iconColor: Theme.color.neutral7\n activeColor: Theme.color.neutral9\n enabled: root.enabled\n // Clicking keeps focus in the field; Tab still reaches the toggle.\n focusPolicy: Qt.TabFocus\n accessibleName: root.passwordVisible ? qsTr(\"Hide password\") : qsTr(\"Show password\")\n background: null\n onClicked: root.passwordVisible = !root.passwordVisible\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Sign-only enables broadcast readiness without a policy assessmentqml/models/walletsendhandle.cpp | still_present | AssessmentThe shown sign-only success path still enables broadcast based on node presence and `!result->partial`, without a policy assessment. The change shown only selects a wallet-specific policy for the operation; it does not assess readiness before enabling broadcast. new_source: qml/models/walletsendhandle.cpp [
{
"bounded": true,
"end_line": 577,
"evidence_id": "46fa50046964498caac5a2f20ff84bd3",
"finding_id": "finding:12",
"kind": "new_source",
"line": 483,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/models/walletsendhandle.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " m_coins_list_model->setManualInputSelection(false);\n m_coins_list_model->update();\n if (!self) return;\n Q_EMIT sentDraftCleared();\n}\n\nvoid WalletModel::finishSendWork(const std::shared_ptr<walletsend::SendTask>& work, const QPointer<TransactionReviewModel>& review,\n bool sign_only, const QPointer<WalletSendHandle> &operation)\n{\n if (!observationsAllowed() || m_closed || !work) return;\n const auto result = work->result();\n if (!result) return;\n const QPointer<WalletModel> self{this};\n if (work == m_send_operation) setSendRunning(false);\n if (!self) return;\n const auto [outcome, message] = DescribeSendResult(*result, sign_only);\n const auto tell = [&](bool review_current) {\n if (operation) operation->workFinished(*result, review_current);\n };\n const bool review_current = available() && review && review == m_current_transaction;\n if (sign_only && result->document && !result->quarantined_document && review_current) {\n // A sign-only result may contain new valid partial signatures even\n // when the wallet reported a terminal signing error. Preserve that\n // captured document, while allowing broadcast only after a clean,\n // verified complete result.\n invalidateImportReview();\n review->setPsbt(result->document);\n review->setAssessedPsbt(result->document);\n if (result->error == walletsend::Error::None && !result->relock_failed) {\n if (result->signed_transaction) { review->setWtx(result->signed_transaction); if (!self) return; }\n review->setCanBroadcast(m_node && !result->partial);\n setTransactionStatus(message);\n Q_EMIT currentTransactionChanged();\n if (!self) return;\n tell(true);\n return;\n }\n }\n if (result->committed && result->notes_requested) {\n m_sent_labels_work = work;\n m_sent_labels_operation = result->notes;\n m_sent_labels_txid = QString::fromStdString(result->committed->GetHash().GetHex());\n m_sent_labels_pending = bool(result->notes);\n m_sent_labels_error = result->notes ? QString{}\n : result->record != walletsend::Record::Recorded\n ? tr(\"The wallet transaction record could not be confirmed, so its outgoing notes were not saved.\")\n : result->notes_rejection == execution::Rejection::Transport\n ? tr(\"The transaction was committed, but its outgoing note results could not be confirmed.\")\n : tr(\"The transaction was saved to the wallet, but its outgoing notes could not be saved.\");\n publishSentRecipientLabels();\n if (!self) return;\n }\n m_opening->refreshMetadata();\n if (!self) return;\n // A consumed effect belongs to its original review. A successor gets no\n // old success, password prompt, mutation or transaction error.\n if (!available() || !review || review != m_current_transaction) {\n tell(false);\n return;\n }\n if (result->committed) {\n review->setCanSend(false); review->setCanBroadcast(false);\n review->setWtx(result->committed);\n if (!self || !review || review != m_current_transaction) return;\n review->setPsbt({}); m_psbt_document_lease.reset(); review->setRequiresRecheck(false);\n review->setSource(CurrentTransactionSource::None);\n review->setReviewMessage({}); clearTransactionStatus();\n if (!self || !review || review != m_current_transaction) return;\n clearSelectedCoins();\n if (!self) return;\n // The sent payment leaves the form, even when its page is hidden or\n // gone. A draft changed since the review (an import) is newer and stays.\n if (!sign_only && m_send_recipients->revision() == m_send_draft_revision) clearSentDraft();\n if (!self) return;\n } else {\n if (result->quarantined_document) {\n review->setCanSend(false);\n review->setCanBroadcast(false);\n }\n if (outcome == SendOperation::State::Uncertain) review->setCanSend(false);\n setTransactionStatus(message, outcome == SendOperation::State::NeedsUnlock);\n if (!self) return;\n if (sign_only && (result->document || result->quarantined_document)) {\n Q_EMIT currentTransactionChanged();\n if (!self) return;\n Q_EMIT signerApprovalChanged();\n if (!self) return;\n }\n }\n if (result->committed || outcome == SendOperation::State::Uncertain) {\n Q_EMIT currentTransactionChanged();\n if (!self) return;\n }\n tell(true);\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A refused Receive type stays hidden after descriptor importqml/walletopening.cpp | still_present | AssessmentThe new-head excerpt retains the same negative-cache insertion and lookup behavior; it shows no clearing or re-probing of unavailable receive types on capability changes. The excerpt does not include the capability-change callback, so whether it was separately changed is not established by this evidence. new_source: qml/walletopening.cpp [
{
"bounded": true,
"end_line": 659,
"evidence_id": "81c1152b4f0d43c2bef8228d60c20bc0",
"finding_id": "finding:11",
"kind": "new_source",
"line": 510,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/walletopening.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " if (transactions) m_pending.transaction_revision = m_transaction_revision;\n m_retry_after = m_clock() + std::chrono::seconds{std::min(30U, 1U << m_refresh_failures)};\n m_refresh_failures = std::min(5U, m_refresh_failures + 1);\n }\n Update update; update.failed = true; publish(std::move(update));\n}\n\nOutputType Session::preferredReceiveType(interfaces::Wallet& wallet) const\n{\n const auto saved = m_preferences.read ? m_preferences.read(wallet.getWalletName()) : std::string{};\n const auto parsed = ParseOutputType(saved);\n // A saved choice wins, then an explicit -addresstype, then Taproot, the\n // app's own default (#932, #1137). Core's implicit default is not used.\n const OutputType preferred = parsed ? *parsed\n : gArgs.IsArgSet(\"-addresstype\") ? wallet.getDefaultAddressType()\n : wallet.taprootEnabled() ? OutputType::BECH32M : wallet.getDefaultAddressType();\n std::lock_guard lock{m_receive_types_mutex};\n if (!m_unavailable_receive_types.contains(preferred)) return preferred;\n // #1088: fall back in the order Receive lists types. Without a Core\n // capability query, a type is only known unavailable once it has failed.\n for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n if (type == OutputType::BECH32M && !wallet.taprootEnabled()) continue;\n if (!m_unavailable_receive_types.contains(type)) return type;\n }\n return preferred;\n}\n\nvoid Session::markReceiveTypeUnavailable(OutputType type)\n{\n std::lock_guard lock{m_receive_types_mutex};\n m_unavailable_receive_types.insert(type);\n}\n\nstd::vector<std::string> Session::unavailableReceiveTypes() const\n{\n std::lock_guard lock{m_receive_types_mutex};\n std::vector<std::string> ids;\n ids.reserve(m_unavailable_receive_types.size());\n for (const OutputType type : m_unavailable_receive_types) ids.push_back(FormatOutputType(type));\n return ids;\n}\n\nexecution::SubmitResult Session::setReceivePreference(std::string type, std::shared_ptr<const Action> original, std::function<void(bool)> done)\n{\n if (type != \"bech32m\" && type != \"bech32\" && type != \"p2sh-segwit\" && type != \"legacy\") return {{}, execution::Rejection::Invalid};\n if (original && original->identity() != identity()) return {{}, execution::Rejection::Invalid};\n const auto revision = ++m_preference_revision;\n const auto self = shared_from_this();\n const auto work = [self, type](interfaces::Wallet& wallet) {\n const bool supported = type != \"bech32m\" || wallet.taprootEnabled();\n const bool persisted = supported && self->m_preferences.write && self->m_preferences.write(wallet.getWalletName(), type);\n auto metadata = ReadMetadata(wallet, self->m_preferences, self->unavailableReceiveTypes());\n const bool saved = persisted && metadata.receive_preference == type;\n return std::pair{std::move(metadata), saved};\n };\n const auto complete = [self, revision, done](std::pair<Metadata, bool> result) {\n const bool saved = result.second;\n Update update; update.metadata = std::move(result.first); update.preference_saved = result.second; update.preference_revision = revision;\n update.phase = self->m_state.phase(); update.question = self->m_state.question();\n self->publish(std::move(update));\n try { if (done) done(saved); } catch (...) { }\n };\n const auto failed = [self, revision, done](std::exception_ptr) {\n Update update; update.preference_saved = false; update.preference_revision = revision;\n update.phase = self->m_state.phase(); update.question = self->m_state.question();\n self->publish(std::move(update));\n try { if (done) done(false); } catch (...) { }\n };\n const auto submitted = original ? perform(original, work, complete, failed)\n : read(work, complete, failed, execution::WorkClass::Action);\n if (!submitted) {\n Update update; update.preference_saved = false; update.preference_revision = revision;\n publish(std::move(update));\n }\n return submitted;\n}\n\nvoid Session::refreshed(Metadata metadata, Update events)\n{\n Transactions consumer;\n { std::lock_guard lock{m_mutex}; m_refresh_pending = false; m_refresh_failures = 0; m_retry_after = {}; consumer = m_transactions_consumer; }\n if (!available()) return;\n if (consumer && (!events.transactions.empty() || events.rescan)) consumer(events.transaction_revision, events.transactions, events.rescan);\n events.metadata = std::move(metadata);\n events.phase = m_state.phase();\n events.question = m_state.question();\n publish(std::move(events));\n scheduleRefresh();\n}\n\nvoid Session::publishState()\n{\n Update update;\n update.phase = m_state.phase();\n update.question = m_state.question();\n publish(std::move(update));\n}\n\nvoid Session::publish(Update update)\n{\n bool notify;\n {\n std::lock_guard lock{m_mutex};\n if (m_latest) {\n update.transaction_revision = std::max(update.transaction_revision, m_latest->transaction_revision);\n if (!update.metadata) update.metadata = std::move(m_latest->metadata);\n if (!update.preference_saved) {\n update.preference_saved = m_latest->preference_saved;\n update.preference_revision = m_latest->preference_revision;\n }\n for (const auto& [id, change] : m_latest->transactions) {\n if (update.transactions.size() < 256) update.transactions.try_emplace(id, change);\n else update.rescan = true;\n }\n update.addresses |= m_latest->addresses;\n update.status |= m_latest->status;\n update.rescan |= m_latest->rescan;\n update.unloaded |= m_latest->unloaded;\n update.failed |= m_latest->failed;\n }\n if (m_closed->load()) {\n update.phase = m_drained.load() ? Phase::Closed : Phase::Closing;\n update.question.reset();\n }\n m_latest = std::move(update);\n notify = !std::exchange(m_notice_pending, true);\n }\n if (notify) m_notify();\n}\n\nstd::optional<Update> Session::take()\n{\n std::lock_guard lock{m_mutex};\n m_notice_pending = false;\n return std::exchange(m_latest, {});\n}\n\nvoid Session::acknowledgeTransactions()\n{\n std::lock_guard lock{m_mutex};\n if (!m_refresh_pending && m_pending.transactions.empty() && !m_pending.rescan &&\n (!m_latest || (m_latest->transactions.empty() && !m_latest->rescan))) m_transactions_pending = false;\n}\nSession::Preferences ChainPreferences(interfaces::Chain& chain)\n{\n return {\n [&chain](const std::string& name) {\n const auto values = chain.getRwSetting(\"qml_receive_address_types\");\n const auto& value = values[name];\n return value.isStr() ? value.get_str() : std::string{};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The additive cluster check can veto an accepted replacementqml/psbtpolicy.cpp | addressed | AssessmentThe policy now allows exact `testmempoolaccept` admission to supersede the additive chain-limit check, while still blocking when admission is not Allowed. This directly removes the reported veto for an accepted replacement. path_diff: qml/psbtpolicy.cpp; new_source: qml/psbtpolicy.cpp [
{
"evidence_id": "f61dbb127e304d55b089355229ac591d",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/psbtpolicy.cpp",
"source_generation": 24,
"source_job_id": 3164,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex dac47edbc0..3cd08b0509 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -25,15 +25,16 @@\n namespace {\n QString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n \n-void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n+void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts, bool enforce_raw_fee_cap)\n {\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- // The same fee-rate cap that submission passes to broadcastTransaction.\n- parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n+ // Raw PSBT broadcasts pass MAX_FEE_RATE to broadcastTransaction; wallet\n+ // sends and fee bumps already checked the wallet's own -maxtxfee limit.\n+ parameters.push_back(enforce_raw_fee_cap ? ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()) : UniValue{0});\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -99,12 +100,12 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n }\n } // namespace\n \n-psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n+psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain, bool enforce_raw_fee_cap)\n {\n- return [node, chain](CTransactionRef transaction, CAmount fee) {\n+ return [node, chain, enforce_raw_fee_cap](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n- facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n+ facts.within_fee_cap = !enforce_raw_fee_cap || !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -142,7 +143,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n- ReadAdmission(*node, *transaction, facts);\n+ ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n@@ -162,7 +163,10 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (facts.immature_inputs) return {State::Blocked, Tr(\"An input spends an immature coinbase output. Refresh the review after more blocks.\")};\n if (!facts.final) return {State::Blocked, Tr(\"The transaction lock time is not final at the observed chain tip.\")};\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n- if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n+ // checkChainLimits does not account for conflicting transactions a\n+ // replacement would evict; when testmempoolaccept already allowed this\n+ // exact transaction, do not override it with the non-RBF chain check.\n+ if (!facts.chain_limits && facts.admission != Admission::Allowed) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 187,
"evidence_id": "cfe4034a7e954d4280b32e88f438ef58",
"finding_id": "finding:10",
"kind": "new_source",
"line": 135,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"path": "qml/psbtpolicy.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 24,
"source_job_id": 3164,
"text": " }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);\n }\n return facts;\n };\n}\n\npsbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n{\n if (facts.observed) {\n if (facts.missing_inputs) return {State::Blocked, Tr(\"An input is missing or already spent at the observed chain tip. Refresh the review before submitting.\")};\n if (facts.immature_inputs) return {State::Blocked, Tr(\"An input spends an immature coinbase output. Refresh the review after more blocks.\")};\n if (!facts.final) return {State::Blocked, Tr(\"The transaction lock time is not final at the observed chain tip.\")};\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n // checkChainLimits does not account for conflicting transactions a\n // replacement would evict; when testmempoolaccept already allowed this\n // exact transaction, do not override it with the non-RBF chain check.\n if (!facts.chain_limits && facts.admission != Admission::Allowed) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n }\n if (facts.admission == Admission::Allowed) {\n if (!facts.replaces.isEmpty()) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n }\n if (facts.replaces_unknown) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n return {State::Unknown, Tr(\"Fully signed. Current node policy will be checked when you submit.\")};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Failed signer approval can switch Save transaction back to PSBT v2qml/models/walletmodel.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · f28230183aa9..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1144 | Wallet backups do not carry pending import recovery stateqml/walletqmlcontroller.cpp | addressed | AssessmentThe wallet model rejects backups while history recovery is nonempty, and the settings-page caller also displays a warning and stops before starting a backup. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "5024f33692994d25a06422bc10a97d07",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 3119,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 81317bf10e..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -145,7 +145,7 @@ QString PendingImportKey(const std::string& wallet_path)\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n@@ -155,6 +155,7 @@ void SetPendingImport(const std::string& wallet_path, std::optional<PendingImpor\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n@@ -205,13 +206,10 @@ ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& walle\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n- ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n- if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n- wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n- stopped.checkpoint = last_time;\n- }\n- return stopped;\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -736,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -769,10 +768,19 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -924,16 +932,24 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n- SetPendingImport(path, PendingImport{start, /*installed=*/false});\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- // The rescan starts once every descriptor is saved.\n- bool installed{false};\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n- if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -943,7 +959,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n@@ -967,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 60c9d57773fb..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Cancellation after the final worker check is ignoredqml/walletqmlcontroller.cpp | addressed | AssessmentThe wallet-creation GUI completion now checks the shared import control; if cancellation won after the worker's last check, it schedules disposal of the created wallet instead of publishing it. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "4bd59e1ad42a4cb8915a9d081df6718e",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 3119,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 81317bf10e..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -145,7 +145,7 @@ QString PendingImportKey(const std::string& wallet_path)\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n@@ -155,6 +155,7 @@ void SetPendingImport(const std::string& wallet_path, std::optional<PendingImpor\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n@@ -205,13 +206,10 @@ ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& walle\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n- ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n- if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n- wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n- stopped.checkpoint = last_time;\n- }\n- return stopped;\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -736,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -769,10 +768,19 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -924,16 +932,24 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n- SetPendingImport(path, PendingImport{start, /*installed=*/false});\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- // The rescan starts once every descriptor is saved.\n- bool installed{false};\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n- if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -943,7 +959,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n@@ -967,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 60c9d57773fb..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Long import rescans block switching to other walletsqml/walletqmlcontroller.cpp | still_present | AssessmentThe import still calls importDescriptors synchronously inside the wallet-creation command. The supplied change adds cancellation handling and recovery tracking but does not separate the scan from creation or make other wallets usable during it. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "2479a262a6c34323855f377858c6c903",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 3119,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 81317bf10e..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -145,7 +145,7 @@ QString PendingImportKey(const std::string& wallet_path)\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n@@ -155,6 +155,7 @@ void SetPendingImport(const std::string& wallet_path, std::optional<PendingImpor\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n@@ -205,13 +206,10 @@ ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& walle\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n- ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n- if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n- wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n- stopped.checkpoint = last_time;\n- }\n- return stopped;\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -736,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -769,10 +768,19 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -924,16 +932,24 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n- SetPendingImport(path, PendingImport{start, /*installed=*/false});\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- // The rescan starts once every descriptor is saved.\n- bool installed{false};\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n- if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -943,7 +959,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n@@ -967,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 60c9d57773fb..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Import proceeds without confirming recovery-marker persistenceqml/walletqmlcontroller.cpp | addressed | AssessmentSetPendingImport now reports QSettings persistence status, and setup returns a recoverable error before importing descriptors if the initial pending marker cannot be saved. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "bbd04bf6509b4b9a85eecf074514f624",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 3119,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 81317bf10e..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -145,7 +145,7 @@ QString PendingImportKey(const std::string& wallet_path)\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n@@ -155,6 +155,7 @@ void SetPendingImport(const std::string& wallet_path, std::optional<PendingImpor\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n@@ -205,13 +206,10 @@ ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& walle\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n- ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n- if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n- wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n- stopped.checkpoint = last_time;\n- }\n- return stopped;\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -736,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -769,10 +768,19 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -924,16 +932,24 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n- SetPendingImport(path, PendingImport{start, /*installed=*/false});\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- // The rescan starts once every descriptor is saved.\n- bool installed{false};\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n- if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -943,7 +959,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n@@ -967,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 60c9d57773fb..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Rescan progress incorrectly certifies complete descriptor installationqml/walletqmlcontroller.cpp | addressed | AssessmentThe marker is promoted to installed only after DescriptorsSaved verifies each requested descriptor and each path of a multipath descriptor; progress events alone no longer certify installation. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "1336b34e69a946628cb99ed7ab470461",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 3119,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 81317bf10e..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -145,7 +145,7 @@ QString PendingImportKey(const std::string& wallet_path)\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n@@ -155,6 +155,7 @@ void SetPendingImport(const std::string& wallet_path, std::optional<PendingImpor\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n@@ -205,13 +206,10 @@ ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& walle\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n- ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n- if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n- wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n- stopped.checkpoint = last_time;\n- }\n- return stopped;\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -736,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -769,10 +768,19 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -924,16 +932,24 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n- SetPendingImport(path, PendingImport{start, /*installed=*/false});\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- // The rescan starts once every descriptor is saved.\n- bool installed{false};\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n- if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -943,7 +959,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n@@ -967,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 60c9d57773fb..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | High-start descriptor ranges trigger enormous uncancellable importsqml/viewonlyimport.cpp | addressed | AssessmentJSON descriptor ranges ending at or above 1,000,000 are rejected before import with an explanatory error, bounding the derivation work that previously could run into billions of indexes. path_diff: qml/viewonlyimport.cpp [
{
"evidence_id": "b1fd97d298c84e3fbf43870999b6f239",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"path": "qml/viewonlyimport.cpp",
"source_generation": 5,
"source_job_id": 3119,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex 145f14baa5..12e54f0f5b 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -31,6 +31,9 @@\n \n using wallet::ImportDescriptorRequest;\n \n+// As many keys as the wallet allows in one range.\n+constexpr int64_t MAX_RANGE_END{1'000'000};\n+\n namespace {\n \n struct DescriptorCheck {\n@@ -201,6 +204,12 @@ ViewOnlyImport ParseJson(const std::string& text)\n if (const auto bounds{CheckDescriptorRangeBounds(request.range->first, request.range->second)}; !bounds) {\n return Failed(Kind::DescriptorJson, QStringLiteral(\"%1: %2\").arg(position, QString::fromStdString(bounds.error())));\n }\n+ // The wallet derives every key from index 0 to the end, while it blocks and can't be cancelled.\n+ if (request.range->second >= MAX_RANGE_END) {\n+ //: %2 is the highest index that can be imported.\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range that ends after %2, which would take too long to set up.\")\n+ .arg(position).arg(MAX_RANGE_END - 1));\n+ }\n }\n const UniValue& next_index{entry.find_value(\"next_index\")};\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n@@ -574,3 +583,18 @@ int64_t ResolveImportTimes(std::vector<ImportDescriptorRequest>& requests, int64\n }\n return oldest;\n }\n+\n+bool DescriptorsSaved(const wallet::CWallet& wallet, const std::vector<ImportDescriptorRequest>& requests)\n+{\n+ LOCK(wallet.cs_wallet);\n+ for (const ImportDescriptorRequest& request : requests) {\n+ FlatSigningProvider keys;\n+ std::string error;\n+ auto parsed{Parse(request.descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return false;\n+ for (auto& descriptor : parsed) {\n+ if (!wallet.GetDescriptorScriptPubKeyMan(wallet::WalletDescriptor{std::move(descriptor), 0, 0, 0, 0})) return false;\n+ }\n+ }\n+ return true;\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 60c9d57773fb..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Import exceptions leave a dangling abort callbackqml/walletqmlcontroller.cpp | addressed | AssessmentA scope guard is installed immediately after successful attachment, so every exit, including an exception from descriptor import, detaches the abort callback before the wallet interface is destroyed. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "addc589f92174465920b9ee745d59504",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 3119,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 81317bf10e..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -145,7 +145,7 @@ QString PendingImportKey(const std::string& wallet_path)\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n@@ -155,6 +155,7 @@ void SetPendingImport(const std::string& wallet_path, std::optional<PendingImpor\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n@@ -205,13 +206,10 @@ ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& walle\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n- ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n- if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n- wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n- stopped.checkpoint = last_time;\n- }\n- return stopped;\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -736,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -769,10 +768,19 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -924,16 +932,24 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n- SetPendingImport(path, PendingImport{start, /*installed=*/false});\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- // The rescan starts once every descriptor is saved.\n- bool installed{false};\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n- if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -943,7 +959,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n@@ -967,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 60c9d57773fb..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | next_index without range bypasses pre-import bounds checkingqml/viewonlyimport.cpp | addressed | AssessmentJSON validation now rejects any next_index without an explicit range and checks the index against the supplied range before wallet creation. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "e2e7c9be513b4982bc4322a4cb385696",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/viewonlyimport.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex 4dbb3041d2..145f14baa5 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -220,9 +220,12 @@ ViewOnlyImport ParseJson(const std::string& text)\n if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n }\n+ // Without a range, the wallet's keypool size bounds it, which isn't known here.\n+ if (request.next_index && !request.range) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index but no range.\").arg(position));\n+ }\n if (check.ranged && request.next_index) {\n- const int64_t first{request.range ? request.range->first : 0};\n- if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ if (*request.next_index < request.range->first || *request.next_index > request.range->second) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n@@ -321,6 +324,8 @@ const std::array KNOWN_KEY_VERSIONS{\n // [fingerprint/path]key, the key origin form wallets export.\n const QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\n const QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n+// BIP45 and BIP48 are multisig cosigner paths.\n+const QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n \n struct ExtendedKey {\n bool recognized{false};\n@@ -394,6 +399,9 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n {\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n+ if (MULTISIG_PURPOSE.match(path).hasMatch()) {\n+ return Failed(Kind::ExtendedKey, QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\"));\n+ }\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n@@ -476,8 +484,10 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n active_slots[{type, request.internal.value_or(false)}] = i;\n }\n }\n- std::vector<bool> active(parsed.requests.size(), false);\n- for (const auto& [slot, index] : active_slots) active[index] = true;\n+ const auto branch_active = [&](size_t i, bool change) {\n+ const auto slot{active_slots.find({parsed.sources[i].type, change})};\n+ return slot != active_slots.end() && slot->second == i;\n+ };\n QString warning{parsed.warning};\n if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n bool watches_change{false};\n@@ -489,7 +499,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n }\n \n- // Receive and change of one key share a row.\n+ // Receive and change of one key share a row, unless only one of them stays active.\n QVariantList rows;\n QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n@@ -501,34 +511,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- auto row_it{rows.begin()};\n- for (; row_it != rows.end(); ++row_it) {\n- const QVariantMap map{row_it->toMap()};\n- if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n- map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n- break;\n+ const std::vector<bool> branches{source.multipath ? std::vector<bool>{false, true} : std::vector<bool>{request.internal.value_or(false)}};\n+ for (const bool change : branches) {\n+ const bool active{branch_active(i, change)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == active && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n }\n+ if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n+ rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n+ {QStringLiteral(\"key\"), source.key},\n+ {QStringLiteral(\"receive\"), false},\n+ {QStringLiteral(\"change\"), false},\n+ {QStringLiteral(\"active\"), active},\n+ {QStringLiteral(\"ranged\"), source.ranged},\n+ {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n+ row_it = std::prev(rows.end());\n+ }\n+ QVariantMap row{row_it->toMap()};\n+ row.insert(change ? QStringLiteral(\"change\") : QStringLiteral(\"receive\"), true);\n+ if (time) {\n+ const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n+ row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n+ }\n+ *row_it = row;\n }\n- if (row_it == rows.end()) {\n- row_keys.append(source.key_id);\n- rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n- {QStringLiteral(\"key\"), source.key},\n- {QStringLiteral(\"receive\"), false},\n- {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), bool(active[i])},\n- {QStringLiteral(\"ranged\"), source.ranged},\n- {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n- row_it = std::prev(rows.end());\n- }\n- QVariantMap row{row_it->toMap()};\n- const bool change{request.internal.value_or(false)};\n- if (source.multipath || !change) row.insert(QStringLiteral(\"receive\"), true);\n- if (source.multipath || change) row.insert(QStringLiteral(\"change\"), true);\n- if (time) {\n- const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n- row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n- }\n- *row_it = row;\n }\n QStringList descriptors;\n for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n@@ -552,3 +564,13 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n return result;\n }\n+\n+int64_t ResolveImportTimes(std::vector<ImportDescriptorRequest>& requests, int64_t now)\n+{\n+ int64_t oldest{now};\n+ for (ImportDescriptorRequest& request : requests) {\n+ request.timestamp = request.timestamp.value_or(now);\n+ oldest = std::min(oldest, *request.timestamp);\n+ }\n+ return oldest;\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 344,
"evidence_id": "aacf4876345c42d689e9e07d1100589b",
"finding_id": "finding:9",
"kind": "new_source",
"line": 195,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/viewonlyimport.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " if (const UniValue& active{entry.find_value(\"active\")}; !active.isNull()) request.active = active.get_bool();\n if (const UniValue& internal{entry.find_value(\"internal\")}; !internal.isNull()) request.internal = internal.get_bool();\n if (const UniValue& label{entry.find_value(\"label\")}; !label.isNull()) request.label = label.get_str();\n if (const UniValue& range{entry.find_value(\"range\")}; !range.isNull()) {\n request.range = ReadRange(range);\n if (!request.range) return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has an invalid range.\").arg(position));\n if (const auto bounds{CheckDescriptorRangeBounds(request.range->first, request.range->second)}; !bounds) {\n return Failed(Kind::DescriptorJson, QStringLiteral(\"%1: %2\").arg(position, QString::fromStdString(bounds.error())));\n }\n }\n const UniValue& next_index{entry.find_value(\"next_index\")};\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n\n // The same checks the wallet makes, before the wallet file is created.\n const bool multipath{check.count > 1};\n if (request.active && !check.ranged) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n }\n if (request.range && !check.ranged) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n }\n if (request.internal && multipath) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n }\n if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n }\n // Without a range, the wallet's keypool size bounds it, which isn't known here.\n if (request.next_index && !request.range) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index but no range.\").arg(position));\n }\n if (check.ranged && request.next_index) {\n if (*request.next_index < request.range->first || *request.next_index > request.range->second) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n for (size_t p = 0; p < check.paths.size(); ++p) {\n const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n if (!added && it->second != settings) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n }\n }\n\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n } catch (const std::exception&) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a field of the wrong type.\").arg(position));\n }\n }\n if (std::ranges::none_of(result.requests, &ImportDescriptorRequest::active)) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"None of these descriptors is active, so the wallet could not give out addresses.\"));\n }\n return result;\n}\n\nViewOnlyImport ParseLines(const QStringList& lines)\n{\n using Kind = ViewOnlyImport::Kind;\n ViewOnlyImport result;\n result.kind = Kind::Descriptors;\n const qsizetype filled{std::ranges::count_if(lines, [](const QString& line) { return !line.trimmed().isEmpty(); })};\n for (qsizetype i = 0; i < lines.size(); ++i) {\n const QString line{lines[i].trimmed()};\n if (line.isEmpty()) continue;\n if (filled == 1 && !line.contains(QLatin1Char('('))) {\n return Failed(Kind::Descriptors, QObject::tr(\"Enter descriptors, or an extended public key (xpub).\"));\n }\n const DescriptorCheck check{CheckDescriptor(line.toStdString())};\n if (!check.error.isEmpty()) {\n //: %1 is a line number, %2 explains what is wrong with that line.\n ViewOnlyImport failed{Failed(Kind::Descriptors, filled == 1 ? check.error : QObject::tr(\"Line %1: %2\").arg(i + 1).arg(check.error))};\n failed.error_line = int(i);\n return failed;\n }\n ImportDescriptorRequest request;\n request.descriptor = check.descriptor;\n request.active = check.ranged;\n // A multipath descriptor sets receive and change itself.\n if (check.ranged && check.count == 1) request.internal = check.change_chain;\n result.undated.push_back(result.requests.size());\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n }\n if (std::ranges::none_of(result.requests, &ImportDescriptorRequest::active)) {\n return Failed(Kind::Descriptors, QObject::tr(\"Add a ranged descriptor, one ending in /*, so the wallet can give out addresses.\"));\n }\n return result;\n}\n\nusing KeyVersion = std::array<unsigned char, 4>;\n\nstruct KnownKeyVersion {\n KeyVersion version;\n //! Testnet, signet and regtest share these.\n bool test;\n bool is_private;\n bool multisig;\n std::optional<OutputType> type;\n};\n\n// BIP32 and SLIP-132 versions. The prefix of a ypub or zpub names its script type.\nconst std::array KNOWN_KEY_VERSIONS{\n KnownKeyVersion{{0x04, 0x88, 0xb2, 0x1e}, false, false, false, std::nullopt}, // xpub\n KnownKeyVersion{{0x04, 0x9d, 0x7c, 0xb2}, false, false, false, OutputType::P2SH_SEGWIT}, // ypub\n KnownKeyVersion{{0x04, 0xb2, 0x47, 0x46}, false, false, false, OutputType::BECH32}, // zpub\n KnownKeyVersion{{0x02, 0x95, 0xb4, 0x3f}, false, false, true, std::nullopt}, // Ypub\n KnownKeyVersion{{0x02, 0xaa, 0x7e, 0xd3}, false, false, true, std::nullopt}, // Zpub\n KnownKeyVersion{{0x04, 0x35, 0x87, 0xcf}, true, false, false, std::nullopt}, // tpub\n KnownKeyVersion{{0x04, 0x4a, 0x52, 0x62}, true, false, false, OutputType::P2SH_SEGWIT}, // upub\n KnownKeyVersion{{0x04, 0x5f, 0x1c, 0xf6}, true, false, false, OutputType::BECH32}, // vpub\n KnownKeyVersion{{0x02, 0x42, 0x89, 0xef}, true, false, true, std::nullopt}, // Upub\n KnownKeyVersion{{0x02, 0x57, 0x54, 0x83}, true, false, true, std::nullopt}, // Vpub\n KnownKeyVersion{{0x04, 0x88, 0xad, 0xe4}, false, true, false, std::nullopt}, // xprv\n KnownKeyVersion{{0x04, 0x9d, 0x78, 0x78}, false, true, false, std::nullopt}, // yprv\n KnownKeyVersion{{0x04, 0xb2, 0x43, 0x0c}, false, true, false, std::nullopt}, // zprv\n KnownKeyVersion{{0x02, 0x95, 0xb0, 0x05}, false, true, true, std::nullopt}, // Yprv\n KnownKeyVersion{{0x02, 0xaa, 0x7a, 0x99}, false, true, true, std::nullopt}, // Zprv\n KnownKeyVersion{{0x04, 0x35, 0x83, 0x94}, true, true, false, std::nullopt}, // tprv\n KnownKeyVersion{{0x04, 0x4a, 0x4e, 0x28}, true, true, false, std::nullopt}, // uprv\n KnownKeyVersion{{0x04, 0x5f, 0x18, 0xbc}, true, true, false, std::nullopt}, // vprv\n KnownKeyVersion{{0x02, 0x42, 0x85, 0xb5}, true, true, true, std::nullopt}, // Uprv\n KnownKeyVersion{{0x02, 0x57, 0x50, 0x48}, true, true, true, std::nullopt}, // Vprv\n};\n\n// [fingerprint/path]key, the key origin form wallets export.\nconst QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\nconst QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n// BIP45 and BIP48 are multisig cosigner paths.\nconst QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n\nstruct ExtendedKey {\n bool recognized{false};\n QString error;\n //! The key with this network's xpub or tpub version.\n std::string key;\n std::optional<OutputType> type;\n};\n\nExtendedKey ReadExtendedKey(const std::string& text)\n{\n std::vector<unsigned char> data;\n if (!DecodeBase58Check(text, data, BIP32_EXTKEY_WITH_VERSION_SIZE) || data.size() != BIP32_EXTKEY_WITH_VERSION_SIZE) return {};\n const auto known{std::ranges::find_if(KNOWN_KEY_VERSIONS, [&](const KnownKeyVersion& known) {\n return std::equal(known.version.begin(), known.version.end(), data.begin());\n })};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | BIP48 cosigner origins are treated as single-key importsqml/viewonlyimport.cpp | addressed | AssessmentThe new multisig-purpose matcher recognizes BIP45 and BIP48 origins, and parsing rejects these keys with the multisig-only rejection message before offering an address-type choice. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "49ae8b480a464f9bb1f6378f5cae03a6",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/viewonlyimport.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex 4dbb3041d2..145f14baa5 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -220,9 +220,12 @@ ViewOnlyImport ParseJson(const std::string& text)\n if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n }\n+ // Without a range, the wallet's keypool size bounds it, which isn't known here.\n+ if (request.next_index && !request.range) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index but no range.\").arg(position));\n+ }\n if (check.ranged && request.next_index) {\n- const int64_t first{request.range ? request.range->first : 0};\n- if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ if (*request.next_index < request.range->first || *request.next_index > request.range->second) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n@@ -321,6 +324,8 @@ const std::array KNOWN_KEY_VERSIONS{\n // [fingerprint/path]key, the key origin form wallets export.\n const QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\n const QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n+// BIP45 and BIP48 are multisig cosigner paths.\n+const QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n \n struct ExtendedKey {\n bool recognized{false};\n@@ -394,6 +399,9 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n {\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n+ if (MULTISIG_PURPOSE.match(path).hasMatch()) {\n+ return Failed(Kind::ExtendedKey, QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\"));\n+ }\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n@@ -476,8 +484,10 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n active_slots[{type, request.internal.value_or(false)}] = i;\n }\n }\n- std::vector<bool> active(parsed.requests.size(), false);\n- for (const auto& [slot, index] : active_slots) active[index] = true;\n+ const auto branch_active = [&](size_t i, bool change) {\n+ const auto slot{active_slots.find({parsed.sources[i].type, change})};\n+ return slot != active_slots.end() && slot->second == i;\n+ };\n QString warning{parsed.warning};\n if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n bool watches_change{false};\n@@ -489,7 +499,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n }\n \n- // Receive and change of one key share a row.\n+ // Receive and change of one key share a row, unless only one of them stays active.\n QVariantList rows;\n QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n@@ -501,34 +511,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- auto row_it{rows.begin()};\n- for (; row_it != rows.end(); ++row_it) {\n- const QVariantMap map{row_it->toMap()};\n- if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n- map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n- break;\n+ const std::vector<bool> branches{source.multipath ? std::vector<bool>{false, true} : std::vector<bool>{request.internal.value_or(false)}};\n+ for (const bool change : branches) {\n+ const bool active{branch_active(i, change)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == active && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n }\n+ if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n+ rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n+ {QStringLiteral(\"key\"), source.key},\n+ {QStringLiteral(\"receive\"), false},\n+ {QStringLiteral(\"change\"), false},\n+ {QStringLiteral(\"active\"), active},\n+ {QStringLiteral(\"ranged\"), source.ranged},\n+ {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n+ row_it = std::prev(rows.end());\n+ }\n+ QVariantMap row{row_it->toMap()};\n+ row.insert(change ? QStringLiteral(\"change\") : QStringLiteral(\"receive\"), true);\n+ if (time) {\n+ const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n+ row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n+ }\n+ *row_it = row;\n }\n- if (row_it == rows.end()) {\n- row_keys.append(source.key_id);\n- rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n- {QStringLiteral(\"key\"), source.key},\n- {QStringLiteral(\"receive\"), false},\n- {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), bool(active[i])},\n- {QStringLiteral(\"ranged\"), source.ranged},\n- {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n- row_it = std::prev(rows.end());\n- }\n- QVariantMap row{row_it->toMap()};\n- const bool change{request.internal.value_or(false)};\n- if (source.multipath || !change) row.insert(QStringLiteral(\"receive\"), true);\n- if (source.multipath || change) row.insert(QStringLiteral(\"change\"), true);\n- if (time) {\n- const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n- row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n- }\n- *row_it = row;\n }\n QStringList descriptors;\n for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n@@ -552,3 +564,13 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n return result;\n }\n+\n+int64_t ResolveImportTimes(std::vector<ImportDescriptorRequest>& requests, int64_t now)\n+{\n+ int64_t oldest{now};\n+ for (ImportDescriptorRequest& request : requests) {\n+ request.timestamp = request.timestamp.value_or(now);\n+ oldest = std::min(oldest, *request.timestamp);\n+ }\n+ return oldest;\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 442,
"evidence_id": "8606513bfc124045aade5321655cc57f",
"finding_id": "finding:8",
"kind": "new_source",
"line": 293,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/viewonlyimport.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " //! Testnet, signet and regtest share these.\n bool test;\n bool is_private;\n bool multisig;\n std::optional<OutputType> type;\n};\n\n// BIP32 and SLIP-132 versions. The prefix of a ypub or zpub names its script type.\nconst std::array KNOWN_KEY_VERSIONS{\n KnownKeyVersion{{0x04, 0x88, 0xb2, 0x1e}, false, false, false, std::nullopt}, // xpub\n KnownKeyVersion{{0x04, 0x9d, 0x7c, 0xb2}, false, false, false, OutputType::P2SH_SEGWIT}, // ypub\n KnownKeyVersion{{0x04, 0xb2, 0x47, 0x46}, false, false, false, OutputType::BECH32}, // zpub\n KnownKeyVersion{{0x02, 0x95, 0xb4, 0x3f}, false, false, true, std::nullopt}, // Ypub\n KnownKeyVersion{{0x02, 0xaa, 0x7e, 0xd3}, false, false, true, std::nullopt}, // Zpub\n KnownKeyVersion{{0x04, 0x35, 0x87, 0xcf}, true, false, false, std::nullopt}, // tpub\n KnownKeyVersion{{0x04, 0x4a, 0x52, 0x62}, true, false, false, OutputType::P2SH_SEGWIT}, // upub\n KnownKeyVersion{{0x04, 0x5f, 0x1c, 0xf6}, true, false, false, OutputType::BECH32}, // vpub\n KnownKeyVersion{{0x02, 0x42, 0x89, 0xef}, true, false, true, std::nullopt}, // Upub\n KnownKeyVersion{{0x02, 0x57, 0x54, 0x83}, true, false, true, std::nullopt}, // Vpub\n KnownKeyVersion{{0x04, 0x88, 0xad, 0xe4}, false, true, false, std::nullopt}, // xprv\n KnownKeyVersion{{0x04, 0x9d, 0x78, 0x78}, false, true, false, std::nullopt}, // yprv\n KnownKeyVersion{{0x04, 0xb2, 0x43, 0x0c}, false, true, false, std::nullopt}, // zprv\n KnownKeyVersion{{0x02, 0x95, 0xb0, 0x05}, false, true, true, std::nullopt}, // Yprv\n KnownKeyVersion{{0x02, 0xaa, 0x7a, 0x99}, false, true, true, std::nullopt}, // Zprv\n KnownKeyVersion{{0x04, 0x35, 0x83, 0x94}, true, true, false, std::nullopt}, // tprv\n KnownKeyVersion{{0x04, 0x4a, 0x4e, 0x28}, true, true, false, std::nullopt}, // uprv\n KnownKeyVersion{{0x04, 0x5f, 0x18, 0xbc}, true, true, false, std::nullopt}, // vprv\n KnownKeyVersion{{0x02, 0x42, 0x85, 0xb5}, true, true, true, std::nullopt}, // Uprv\n KnownKeyVersion{{0x02, 0x57, 0x50, 0x48}, true, true, true, std::nullopt}, // Vprv\n};\n\n// [fingerprint/path]key, the key origin form wallets export.\nconst QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\nconst QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n// BIP45 and BIP48 are multisig cosigner paths.\nconst QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n\nstruct ExtendedKey {\n bool recognized{false};\n QString error;\n //! The key with this network's xpub or tpub version.\n std::string key;\n std::optional<OutputType> type;\n};\n\nExtendedKey ReadExtendedKey(const std::string& text)\n{\n std::vector<unsigned char> data;\n if (!DecodeBase58Check(text, data, BIP32_EXTKEY_WITH_VERSION_SIZE) || data.size() != BIP32_EXTKEY_WITH_VERSION_SIZE) return {};\n const auto known{std::ranges::find_if(KNOWN_KEY_VERSIONS, [&](const KnownKeyVersion& known) {\n return std::equal(known.version.begin(), known.version.end(), data.begin());\n })};\n if (known == KNOWN_KEY_VERSIONS.end()) return {};\n\n ExtendedKey result;\n result.recognized = true;\n if (known->is_private) {\n result.error = QObject::tr(\"This is a private key. Enter the extended public key instead.\");\n return result;\n }\n if (known->multisig) {\n result.error = QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\");\n return result;\n }\n const std::vector<unsigned char>& prefix{Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY)};\n const KeyVersion& mainnet{KNOWN_KEY_VERSIONS.front().version};\n if (known->test == std::equal(mainnet.begin(), mainnet.end(), prefix.begin(), prefix.end())) {\n result.error = QObject::tr(\"This key is for a different network.\");\n return result;\n }\n std::copy(prefix.begin(), prefix.end(), data.begin());\n result.key = EncodeBase58Check(data);\n if (!DecodeExtPubKey(result.key).pubkey.IsValid()) {\n result.error = QObject::tr(\"This extended public key is not valid.\");\n return result;\n }\n result.type = known->type;\n return result;\n}\n\nstd::optional<OutputType> PurposeType(const QString& path)\n{\n const QRegularExpressionMatch match{ORIGIN_PURPOSE.match(path)};\n if (!match.hasMatch()) return std::nullopt;\n switch (match.captured(1).toInt()) {\n case 44: return OutputType::LEGACY;\n case 49: return OutputType::P2SH_SEGWIT;\n case 84: return OutputType::BECH32;\n case 86: return OutputType::BECH32M;\n }\n return std::nullopt;\n}\n\nQString WrapKey(OutputType type, const QString& key)\n{\n switch (type) {\n case OutputType::LEGACY: return QStringLiteral(\"pkh(%1)\").arg(key);\n case OutputType::P2SH_SEGWIT: return QStringLiteral(\"sh(wpkh(%1))\").arg(key);\n case OutputType::BECH32: return QStringLiteral(\"wpkh(%1)\").arg(key);\n case OutputType::BECH32M: return QStringLiteral(\"tr(%1)\").arg(key);\n case OutputType::UNKNOWN: break;\n }\n return {};\n}\n\nViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, const QString& path, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n if (MULTISIG_PURPOSE.match(path).hasMatch()) {\n return Failed(Kind::ExtendedKey, QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\"));\n }\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n if (!type || *type == OutputType::UNKNOWN) return Failed(Kind::ExtendedKey, QObject::tr(\"Choose a valid address type.\"));\n }\n ViewOnlyImport result;\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n result.key_id = origin + QString::fromStdString(key.key);\n if (key.type && path_type && *key.type != *path_type) {\n //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n }\n return result;\n}\n\n} // namespace\n\nViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_type)\n{\n const QString trimmed{text.trimmed()};\n if (trimmed.isEmpty()) return {};\n\n const QRegularExpressionMatch origin{KEY_ORIGIN.match(trimmed)};\n const QString key_text{origin.hasMatch() ? origin.captured(3) : trimmed};\n if (const ExtendedKey key{ReadExtendedKey(key_text.toStdString())}; key.recognized) {\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n if (origin.hasMatch()) {\n return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Partially replaced multipath descriptors appear fully activeqml/viewonlyimport.cpp | addressed | AssessmentActivity is computed per receive/change branch, and multipath rows are split by branch activity, so a replaced receive branch can be shown inactive while change remains active. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "4a46a1b9932c481caa92ad9423662f39",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/viewonlyimport.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex 4dbb3041d2..145f14baa5 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -220,9 +220,12 @@ ViewOnlyImport ParseJson(const std::string& text)\n if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n }\n+ // Without a range, the wallet's keypool size bounds it, which isn't known here.\n+ if (request.next_index && !request.range) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index but no range.\").arg(position));\n+ }\n if (check.ranged && request.next_index) {\n- const int64_t first{request.range ? request.range->first : 0};\n- if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ if (*request.next_index < request.range->first || *request.next_index > request.range->second) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n@@ -321,6 +324,8 @@ const std::array KNOWN_KEY_VERSIONS{\n // [fingerprint/path]key, the key origin form wallets export.\n const QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\n const QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n+// BIP45 and BIP48 are multisig cosigner paths.\n+const QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n \n struct ExtendedKey {\n bool recognized{false};\n@@ -394,6 +399,9 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n {\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n+ if (MULTISIG_PURPOSE.match(path).hasMatch()) {\n+ return Failed(Kind::ExtendedKey, QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\"));\n+ }\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n@@ -476,8 +484,10 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n active_slots[{type, request.internal.value_or(false)}] = i;\n }\n }\n- std::vector<bool> active(parsed.requests.size(), false);\n- for (const auto& [slot, index] : active_slots) active[index] = true;\n+ const auto branch_active = [&](size_t i, bool change) {\n+ const auto slot{active_slots.find({parsed.sources[i].type, change})};\n+ return slot != active_slots.end() && slot->second == i;\n+ };\n QString warning{parsed.warning};\n if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n bool watches_change{false};\n@@ -489,7 +499,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n }\n \n- // Receive and change of one key share a row.\n+ // Receive and change of one key share a row, unless only one of them stays active.\n QVariantList rows;\n QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n@@ -501,34 +511,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- auto row_it{rows.begin()};\n- for (; row_it != rows.end(); ++row_it) {\n- const QVariantMap map{row_it->toMap()};\n- if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n- map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n- break;\n+ const std::vector<bool> branches{source.multipath ? std::vector<bool>{false, true} : std::vector<bool>{request.internal.value_or(false)}};\n+ for (const bool change : branches) {\n+ const bool active{branch_active(i, change)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == active && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n }\n+ if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n+ rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n+ {QStringLiteral(\"key\"), source.key},\n+ {QStringLiteral(\"receive\"), false},\n+ {QStringLiteral(\"change\"), false},\n+ {QStringLiteral(\"active\"), active},\n+ {QStringLiteral(\"ranged\"), source.ranged},\n+ {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n+ row_it = std::prev(rows.end());\n+ }\n+ QVariantMap row{row_it->toMap()};\n+ row.insert(change ? QStringLiteral(\"change\") : QStringLiteral(\"receive\"), true);\n+ if (time) {\n+ const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n+ row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n+ }\n+ *row_it = row;\n }\n- if (row_it == rows.end()) {\n- row_keys.append(source.key_id);\n- rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n- {QStringLiteral(\"key\"), source.key},\n- {QStringLiteral(\"receive\"), false},\n- {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), bool(active[i])},\n- {QStringLiteral(\"ranged\"), source.ranged},\n- {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n- row_it = std::prev(rows.end());\n- }\n- QVariantMap row{row_it->toMap()};\n- const bool change{request.internal.value_or(false)};\n- if (source.multipath || !change) row.insert(QStringLiteral(\"receive\"), true);\n- if (source.multipath || change) row.insert(QStringLiteral(\"change\"), true);\n- if (time) {\n- const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n- row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n- }\n- *row_it = row;\n }\n QStringList descriptors;\n for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n@@ -552,3 +564,13 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n return result;\n }\n+\n+int64_t ResolveImportTimes(std::vector<ImportDescriptorRequest>& requests, int64_t now)\n+{\n+ int64_t oldest{now};\n+ for (ImportDescriptorRequest& request : requests) {\n+ request.timestamp = request.timestamp.value_or(now);\n+ oldest = std::min(oldest, *request.timestamp);\n+ }\n+ return oldest;\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 576,
"evidence_id": "09acc135362c4bd5b4f792ab132d642c",
"finding_id": "finding:7",
"kind": "new_source",
"line": 450,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/viewonlyimport.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": "{\n using Kind = ViewOnlyImport::Kind;\n const ViewOnlyImport parsed{ParseViewOnlyImport(text, address_type)};\n QVariantMap result;\n if (parsed.kind == Kind::Empty) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"empty\"));\n return result;\n }\n const QString kind{parsed.kind == Kind::ExtendedKey ? QStringLiteral(\"extendedKey\")\n : parsed.kind == Kind::Descriptors ? QStringLiteral(\"descriptors\")\n : QStringLiteral(\"descriptorJson\")};\n result.insert(QStringLiteral(\"kind\"), kind);\n if (!parsed.error.isEmpty()) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"invalid\"));\n result.insert(QStringLiteral(\"error\"), parsed.error);\n result.insert(QStringLiteral(\"errorLine\"), parsed.error_line);\n return result;\n }\n\n QStringList address_types;\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n // An address type has one active receive and one active change descriptor.\n // The wallet activates requests in order, so a later one replaces an earlier one.\n std::map<std::pair<OutputType, bool>, size_t> active_slots;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n if (!request.active) continue;\n const OutputType type{parsed.sources[i].type};\n if (parsed.sources[i].multipath) {\n active_slots[{type, false}] = i;\n active_slots[{type, true}] = i;\n } else {\n active_slots[{type, request.internal.value_or(false)}] = i;\n }\n }\n const auto branch_active = [&](size_t i, bool change) {\n const auto slot{active_slots.find({parsed.sources[i].type, change})};\n return slot != active_slots.end() && slot->second == i;\n };\n QString warning{parsed.warning};\n if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n bool watches_change{false};\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n }\n warning = watches_change\n ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n }\n\n // Receive and change of one key share a row, unless only one of them stays active.\n QVariantList rows;\n QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n std::optional<int64_t> time;\n // An unset timestamp here was \"now\".\n if (std::ranges::find(parsed.undated, i) == parsed.undated.end()) time = request.timestamp.value_or(now);\n if (time) created = std::min(created.value_or(*time), *time);\n\n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n const std::vector<bool> branches{source.multipath ? std::vector<bool>{false, true} : std::vector<bool>{request.internal.value_or(false)}};\n for (const bool change : branches) {\n const bool active{branch_active(i, change)};\n auto row_it{rows.begin()};\n for (; row_it != rows.end(); ++row_it) {\n const QVariantMap map{row_it->toMap()};\n if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n map.value(QStringLiteral(\"active\")) == active && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n break;\n }\n }\n if (row_it == rows.end()) {\n row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n {QStringLiteral(\"active\"), active},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n }\n QVariantMap row{row_it->toMap()};\n row.insert(change ? QStringLiteral(\"change\") : QStringLiteral(\"receive\"), true);\n if (time) {\n const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n }\n *row_it = row;\n }\n }\n QStringList descriptors;\n for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n // A key waiting for its address type has no date either.\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n for (const OutputType type : {OutputType::BECH32, OutputType::BECH32M, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n options.append(QVariantMap{{QStringLiteral(\"id\"), QString::fromStdString(FormatOutputType(type))},\n {QStringLiteral(\"label\"), QmlUtil::OutputTypeLabel(type)}});\n }\n result.insert(QStringLiteral(\"addressTypeOptions\"), options);\n }\n return result;\n}\n\nint64_t ResolveImportTimes(std::vector<ImportDescriptorRequest>& requests, int64_t now)\n{\n int64_t oldest{now};\n for (ImportDescriptorRequest& request : requests) {\n request.timestamp = request.timestamp.value_or(now);\n oldest = std::min(oldest, *request.timestamp);\n }\n return oldest;\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Same-named wallets share a recovery marker across directoriesqml/walletqmlcontroller.cpp | addressed | AssessmentThe pending marker is now keyed by the canonical wallet path rather than the wallet name, separating same-named wallets in different directories. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "e38d939183c947c99f6fc7e3b286dff5",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..81317bf10e 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,94 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+QString PendingImportKey(const std::string& wallet_path)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n+}\n+\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n+{\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n {\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n+ }\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ ImportRescanResult stopped{Status::Stopped};\n+ int64_t last_time{0};\n+ if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n+ stopped.checkpoint = last_time;\n }\n- control.detach();\n- return done;\n+ return stopped;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +262,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +573,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +593,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -676,9 +760,11 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -825,9 +911,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +920,20 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts once every descriptor is saved.\n+ bool installed{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -856,12 +945,16 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 247,
"evidence_id": "d63990fddde742e9bb51abe31024c3df",
"finding_id": "finding:6",
"kind": "new_source",
"line": 98,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " if (!chain.havePruned()) return false;\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n }\n const std::optional<int> prune_height{chain.getPruneHeight()};\n return prune_height && height <= *prune_height;\n}\n\n// remove() only unloads the wallet. Its files are deleted too, so the name can be used again.\nvoid DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<interfaces::Wallet> wallet)\n{\n const std::string name{wallet->getWalletName()};\n wallet::WalletContext* context{loader.context()};\n std::shared_ptr<wallet::CWallet> shared{context ? wallet::GetWallet(*context, name) : nullptr};\n wallet->remove();\n wallet.reset();\n if (!shared) return;\n std::vector<fs::path> paths{shared->GetDatabase().Files()};\n if (!name.empty() && !paths.empty()) paths.push_back(paths.front().parent_path());\n // The database closes once the last reference is gone.\n wallet::WaitForDeleteWallet(std::move(shared));\n std::error_code error;\n // A directory is only removed when empty.\n for (const fs::path& path : paths) fs::remove(path, error);\n}\n\n// A view-only import saves its descriptors before it rescans. The wallet's\n// best block is already the tip then, so after a crash it would load without\n// the older transactions. This records where the rescan starts until it ends,\n// and whether every descriptor was saved.\nstruct PendingImport {\n int64_t start{0};\n bool installed{false};\n};\n\n// The marker belongs to the wallet file, not to its name.\nstd::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n{\n const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n std::error_code error;\n const fs::path canonical{fs::weakly_canonical(path, error)};\n return fs::PathToString(error ? path : canonical);\n}\n\nQString PendingImportKey(const std::string& wallet_path)\n{\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n}\n\nvoid SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n{\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n settings.remove(key);\n if (pending) {\n settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n}\n\nstd::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n{\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n if (!start.isValid()) return std::nullopt;\n return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n}\n\n// What the wallet takes as now for an import: the median time of the tip.\nint64_t ChainNow(interfaces::WalletLoader& loader)\n{\n wallet::WalletContext* context{loader.context()};\n int64_t time{0};\n if (context && context->chain) {\n interfaces::Chain& chain{*context->chain};\n if (const std::optional<int> height{chain.getHeight()};\n height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n return time;\n }\n }\n return QDateTime::currentSecsSinceEpoch();\n}\n\nImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n const std::function<void(int)>& progress)\n{\n using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n // Another rescan of this wallet is running.\n if (!reserver.reserve()) return {Status::Failed};\n if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n // The abort refers to this frame, and Scan can throw.\n const auto detach{qScopeGuard([&control] { control.detach(); })};\n const auto progress_handler{interfaces::MakeSignalHandler(\n wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n interfaces::FoundBlock().hash(start_block).height(start_height))) {\n return {Status::Done};\n }\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n stopped.checkpoint = last_time;\n }\n return stopped;\n}\n\nQString ImportErrorText(const wallet::ImportError& error)\n{\n const bilingual_str& message{error.wallet_error.message};\n return QString::fromStdString(message.translated.empty() ? message.original : message.translated);\n}\n} // namespace\n\nbool RescanControl::attach(std::function<void()> abort)\n{\n const std::lock_guard lock{m_mutex};\n if (m_cancelled) return false;\n m_abort = std::move(abort);\n return true;\n}\n\nvoid RescanControl::detach()\n{\n const std::lock_guard lock{m_mutex};\n m_abort = nullptr;\n}\n\nvoid RescanControl::cancel()\n{\n const std::lock_guard lock{m_mutex};\n m_cancelled = true;\n if (m_abort) m_abort();\n}\n\nbool RescanControl::cancelled() const\n{\n const std::lock_guard lock{m_mutex};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Recovery uses wall-clock time for "now" importsqml/walletqmlcontroller.cpp | addressed | AssessmentRecovery start times are resolved against the chain's tip median time before the marker is written. ResolveImportTimes assigns that value to unset request timestamps and returns the oldest resolved timestamp. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "09eb40c8a26b42de86c58bc07694a24b",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..81317bf10e 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,94 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+QString PendingImportKey(const std::string& wallet_path)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n+}\n+\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n+{\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n {\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n+ }\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ ImportRescanResult stopped{Status::Stopped};\n+ int64_t last_time{0};\n+ if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n+ stopped.checkpoint = last_time;\n }\n- control.detach();\n- return done;\n+ return stopped;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +262,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +573,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +593,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -676,9 +760,11 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -825,9 +911,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +920,20 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts once every descriptor is saved.\n+ bool installed{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -856,12 +945,16 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 948,
"evidence_id": "a77af839b906440c80ae0897a1fba331",
"finding_id": "finding:5",
"kind": "new_source",
"line": 799,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletCreateError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletCreateError(name_error);\n return;\n }\n\n SecureString secure_passphrase{QmlUtil::SecureStringFromQString(passphrase)};\n createWalletAsync(name.trimmed(),\n std::move(secure_passphrase),\n wallet::WALLET_FLAG_DESCRIPTORS,\n WalletLoadAction::Create,\n /*report_create_error=*/true);\n}\n\nbool WalletQmlController::createExternalSignerWallet(const QString& name)\n{\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return false;\n }\n\n const QString wallet_name = name.trimmed();\n const QString name_error = walletNameAvailabilityError(wallet_name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return false;\n }\n\n refreshExternalSignerStatus();\n if (!m_external_signer_path_configured) {\n setWalletLoadError(tr(\"Set an external signer path in Wallet settings first.\"));\n return false;\n }\n if (!m_external_signer_error.isEmpty()) {\n setWalletLoadError(m_external_signer_error);\n return false;\n }\n if (m_external_signer_count == 0) {\n setWalletLoadError(tr(\"Connect an external signer and try again.\"));\n return false;\n }\n if (m_external_signer_count > 1) {\n setWalletLoadError(tr(\"More than one external signer was found. Connect only one device and try again.\"));\n return false;\n }\n\n constexpr uint64_t flags = wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_EXTERNAL_SIGNER;\n createWalletAsync(wallet_name,\n SecureString{},\n flags,\n WalletLoadAction::Load,\n /*report_create_error=*/false);\n return true;\n}\n\nvoid WalletQmlController::createWatchOnlyWallet(const QString& name, const QString& import_text, qint64 birth_time,\n const QString& address_type)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n ViewOnlyImport input{ParseViewOnlyImport(import_text, address_type)};\n if (input.kind == ViewOnlyImport::Kind::Empty) {\n setWalletLoadError(tr(\"Enter descriptors, or an extended public key (xpub).\"));\n return;\n }\n if (!input.error.isEmpty()) {\n setWalletLoadError(input.error);\n return;\n }\n if (input.requests.empty()) {\n setWalletLoadError(tr(\"Choose the address type of this key.\"));\n return;\n }\n if (!input.undated.empty()) {\n if (birth_time < 0) {\n setWalletLoadError(tr(\"Choose when this wallet was created.\"));\n return;\n }\n for (const size_t index : input.undated) input.requests[index].timestamp = birth_time;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return;\n }\n\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n std::optional<int64_t> oldest_dated;\n for (size_t i = 0; i < input.requests.size(); ++i) {\n const std::optional<int64_t>& time{input.requests[i].timestamp};\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n [node = &m_node, requests, control, guard = QPointer{this},\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n // The rescan starts once every descriptor is saved.\n bool installed{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n }, Qt::QueuedConnection);\n })};\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Recovery has no visible pending or failed stateqml/walletqmlcontroller.cpp | addressed | AssessmentRecovery is represented on the wallet model with running/failed states; scan progress is forwarded, and a retry method is provided for failed recovery. The new completion handling also exposes failure instead of silently leaving the wallet without status. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "5cdf0a9625d348eeb2e43d5abb4cd850",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,92 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n+{\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n+}\n+\n+QString PendingImportKey(const std::string& wallet_path)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n {\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n+}\n+\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n+{\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n }\n- control.detach();\n- return done;\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ int64_t last_time{0};\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +260,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +571,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +591,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -652,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -676,17 +759,28 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -825,9 +919,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +928,28 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -854,14 +959,17 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n@@ -874,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Editing during an import hides the cancellation controlqml/pages/wallet/CreateWalletForm.qml | addressed | AssessmentThe wallet-name and descriptor inputs, as well as the address-type and birth-date sections, are disabled while creation is running, preventing edits from clearing load status or changing the displayed import during the worker operation. path_diff: qml/pages/wallet/CreateWalletForm.qml; new_source: qml/pages/wallet/CreateWalletForm.qml [
{
"evidence_id": "b833d9d8930544d993600ed5bc4c91e2",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/pages/wallet/CreateWalletForm.qml",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/pages/wallet/CreateWalletForm.qml b/qml/pages/wallet/CreateWalletForm.qml\nindex a2b36f3b3f..5fb58b3929 100644\n--- a/qml/pages/wallet/CreateWalletForm.qml\n+++ b/qml/pages/wallet/CreateWalletForm.qml\n@@ -160,6 +160,8 @@ OnboardingView {\n LabeledTextField {\n id: nameEntry\n objectName: \"createWalletNameEntry\"\n+ // Editing clears the load status, which would hide Cancel import.\n+ enabled: !root.creating\n Layout.fillWidth: true\n label: qsTr(\"Wallet name\")\n fieldObjectName: \"createWalletNameInput\"\n@@ -251,6 +253,7 @@ OnboardingView {\n id: xpubEntry\n objectName: \"createWalletXpubEntry\"\n visible: root.watchOnly\n+ enabled: !root.creating\n Layout.fillWidth: true\n label: qsTr(\"Descriptors or extended public key\")\n inputObjectName: \"watchOnlyXpubInput\"\n@@ -394,6 +397,7 @@ OnboardingView {\n FormSection {\n objectName: \"watchOnlyAddressType\"\n visible: root.watchOnly && root.needsAddressType\n+ enabled: !root.creating\n Layout.fillWidth: true\n Layout.topMargin: 8\n showBackground: false\n@@ -428,6 +432,7 @@ OnboardingView {\n FormSection {\n objectName: \"watchOnlyBirthDate\"\n visible: root.watchOnly && root.needsBirthDate\n+ enabled: !root.creating\n Layout.fillWidth: true\n Layout.topMargin: 8\n showBackground: false\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 230,
"evidence_id": "c839b915d5c043419936aea502b8c781",
"finding_id": "finding:3",
"kind": "new_source",
"line": 81,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/pages/wallet/CreateWalletForm.qml",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " function submit() {\n if (!canCreate) return\n const availabilityError = walletController.walletNameAvailabilityError(loadedChildView.walletName)\n if (availabilityError.length > 0) {\n nameError = availabilityError\n return\n }\n createRequested(loadedChildView.walletName.trim(), watchOnly ? loadedChildView.importText.trim() : \"\",\n watchOnly || !loadedChildView.encryptWallet ? \"\" : loadedChildView.passwordText,\n watchOnly ? birthTime() : -1,\n watchOnly && needsAddressType ? loadedChildView.addressTypeChoice : \"\")\n }\n\n function clearSecrets() {\n if (loadedChildView) loadedChildView.clearSecrets()\n }\n\n title: \"\"\n heading: watchOnly ? qsTr(\"Watch-only wallet\") : qsTr(\"Single-key wallet\")\n subheading: watchOnly\n ? qsTr(\"See balances and activity without keeping spending keys in this app. An external signer is needed to spend.\")\n : qsTr(\"You can control it in this application.\\nWallet data will be stored locally in your hard drive.\")\n maximumContentWidth: 800\n showBackButton: !creating && navigationStack\n ? (navigationStack.canGoBack !== undefined\n ? navigationStack.canGoBack : navigationStack.depth > 1) : false\n showCloseButton: modalView && !creating\n primaryButtonText: creating ? (watchOnly ? qsTr(\"Importing…\") : qsTr(\"Creating…\")) : qsTr(\"Create wallet\")\n primaryButtonObjectName: \"createWalletFormCreateButton\"\n primaryButtonEnabled: canCreate\n readonly property bool importRunning: watchOnly && creating && walletController.walletLoadInProgress\n secondaryButtonText: importRunning ? qsTr(\"Cancel import\") : \"\"\n secondaryButtonObjectName: \"createWalletFormCancelImportButton\"\n onSecondaryClicked: walletController.cancelViewOnlyImport()\n onCloseClicked: root.cancel()\n onPrimaryClicked: {\n if (!root.canCreate) return\n if (root.watchOnly || root.loadedChildView.encryptWallet) root.submit()\n else root.loadedChildView.openUnencryptedWarning()\n }\n\n // Choices made for one key or set of descriptors do not carry over to another.\n onImportIdChanged: {\n if (importId.length === 0) return\n if (previousImportId.length > 0 && importId !== previousImportId && loadedChildView) {\n loadedChildView.addressTypeChoice = \"\"\n loadedChildView.birthChoice = \"\"\n }\n previousImportId = importId\n }\n\n Component.onCompleted: {\n walletController.clearWalletCreateStatus()\n walletController.clearWalletLoadStatus()\n }\n Component.onDestruction: clearSecrets()\n\n childView: ColumnLayout {\n id: fields\n property alias walletName: nameEntry.text\n property alias importText: xpubEntry.text\n property string addressTypeChoice: \"\"\n property string birthChoice: \"\"\n property alias encryptWallet: encryptCheck.checked\n property alias passwordText: passwordEntry.text\n property alias confirmText: confirmEntry.text\n readonly property bool passwordLossAcknowledged: acknowledgement.checked\n readonly property bool unencryptedWalletAcknowledged: unencryptedAcknowledgement.checked\n\n function clearSecrets() {\n passwordEntry.text = \"\"\n confirmEntry.text = \"\"\n }\n function openUnencryptedWarning() {\n unencryptedWarning.open()\n }\n\n spacing: 16\n\n LabeledTextField {\n id: nameEntry\n objectName: \"createWalletNameEntry\"\n // Editing clears the load status, which would hide Cancel import.\n enabled: !root.creating\n Layout.fillWidth: true\n label: qsTr(\"Wallet name\")\n fieldObjectName: \"createWalletNameInput\"\n placeholderText: qsTr(\"e.g. My bitcoin wallet\")\n supportingText: qsTr(\"You cannot change this later.\")\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n fieldBackgroundColor: Theme.color.surface2\n onTextEdited: {\n root.nameError = \"\"\n walletController.clearWalletCreateStatus()\n walletController.clearWalletLoadStatus()\n }\n }\n\n // Consent in a form is a checkbox; nothing applies until Create.\n FormSection {\n objectName: \"createWalletSecuritySection\"\n visible: !root.watchOnly\n Layout.fillWidth: true\n Layout.topMargin: 8\n showBackground: false\n title: qsTr(\"Security\")\n rowSpacing: 16\n\n CheckBox {\n id: encryptCheck\n objectName: \"createWalletEncryptCheckBox\"\n Layout.fillWidth: true\n text: qsTr(\"Encrypt this wallet with a strong password.\")\n description: qsTr(\"Recommended\")\n checked: true\n onCheckedChanged: {\n if (!checked) acknowledgement.checked = false\n if (checked) unencryptedAcknowledgement.checked = false\n }\n }\n\n PasswordTextField {\n id: passwordEntry\n objectName: \"createWalletPasswordEntry\"\n visible: encryptCheck.checked\n Layout.fillWidth: true\n label: qsTr(\"Password\")\n fieldObjectName: \"createWalletPasswordInput\"\n placeholderText: qsTr(\"Enter password…\")\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n fieldBackgroundColor: Theme.color.surface2\n onTextEdited: walletController.clearWalletCreateStatus()\n }\n PasswordTextField {\n id: confirmEntry\n objectName: \"createWalletConfirmPasswordEntry\"\n visible: encryptCheck.checked\n Layout.fillWidth: true\n label: qsTr(\"Confirm password\")\n fieldObjectName: \"createWalletPasswordRepeatInput\"\n placeholderText: qsTr(\"Enter password again…\")\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n fieldBackgroundColor: Theme.color.surface2\n errorText: text.length > 0 && passwordEntry.text !== text",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Quitting during the import discards a recoverable walletqml/walletqmlcontroller.cpp | addressed | AssessmentWhen shutdown interrupts the initial rescan after installation, the setup handler preserves the wallet and writes an installed pending marker, allowing recovery on the next start rather than discarding the wallet and marker. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "cb9e56c3b8a549a1a84b806925ae3f1e",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..81317bf10e 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,94 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+QString PendingImportKey(const std::string& wallet_path)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n+}\n+\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n+{\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n {\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n+ }\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ ImportRescanResult stopped{Status::Stopped};\n+ int64_t last_time{0};\n+ if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n+ stopped.checkpoint = last_time;\n }\n- control.detach();\n- return done;\n+ return stopped;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +262,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +573,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +593,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -676,9 +760,11 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -825,9 +911,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +920,20 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts once every descriptor is saved.\n+ bool installed{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -856,12 +945,16 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 979,
"evidence_id": "58b3a4aa42fe4296a85316ba753304cc",
"finding_id": "finding:2",
"kind": "new_source",
"line": 830,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return false;\n }\n\n refreshExternalSignerStatus();\n if (!m_external_signer_path_configured) {\n setWalletLoadError(tr(\"Set an external signer path in Wallet settings first.\"));\n return false;\n }\n if (!m_external_signer_error.isEmpty()) {\n setWalletLoadError(m_external_signer_error);\n return false;\n }\n if (m_external_signer_count == 0) {\n setWalletLoadError(tr(\"Connect an external signer and try again.\"));\n return false;\n }\n if (m_external_signer_count > 1) {\n setWalletLoadError(tr(\"More than one external signer was found. Connect only one device and try again.\"));\n return false;\n }\n\n constexpr uint64_t flags = wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_EXTERNAL_SIGNER;\n createWalletAsync(wallet_name,\n SecureString{},\n flags,\n WalletLoadAction::Load,\n /*report_create_error=*/false);\n return true;\n}\n\nvoid WalletQmlController::createWatchOnlyWallet(const QString& name, const QString& import_text, qint64 birth_time,\n const QString& address_type)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n ViewOnlyImport input{ParseViewOnlyImport(import_text, address_type)};\n if (input.kind == ViewOnlyImport::Kind::Empty) {\n setWalletLoadError(tr(\"Enter descriptors, or an extended public key (xpub).\"));\n return;\n }\n if (!input.error.isEmpty()) {\n setWalletLoadError(input.error);\n return;\n }\n if (input.requests.empty()) {\n setWalletLoadError(tr(\"Choose the address type of this key.\"));\n return;\n }\n if (!input.undated.empty()) {\n if (birth_time < 0) {\n setWalletLoadError(tr(\"Choose when this wallet was created.\"));\n return;\n }\n for (const size_t index : input.undated) input.requests[index].timestamp = birth_time;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return;\n }\n\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n std::optional<int64_t> oldest_dated;\n for (size_t i = 0; i < input.requests.size(); ++i) {\n const std::optional<int64_t>& time{input.requests[i].timestamp};\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n [node = &m_node, requests, control, guard = QPointer{this},\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n // The rescan starts once every descriptor is saved.\n bool installed{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n }, Qt::QueuedConnection);\n })};\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n // Shutdown stops the rescan early without an error. The next start finishes it.\n if (node->shutdownRequested()) {\n SetPendingImport(path, PendingImport{start, /*installed=*/true});\n keep_wallet = true;\n return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n }\n SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n wallet::WalletContext* context{node->walletLoader().context()};\n if (!context || !context->chain) return QString{};\n if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n }\n if (ScanBlocksPruned(*context->chain, chosen_date)) {\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n });\n}\n\nvoid WalletQmlController::importWallet(const QString& path)\n{\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n startWalletImport(path);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Parser and row-grouping corrections are separated from their introductionsqml/viewonlyimport.cpp | unclear | AssessmentThe requested changes concern combining fixes with their introducing commits. The source diff shows corrected final parser and row-grouping behavior, but does not establish whether the commits were rearranged as requested. path_diff: qml/viewonlyimport.cpp [
{
"evidence_id": "b11d18479003455ebabefa81411a27b7",
"finding_id": "finding:13",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/viewonlyimport.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex 4dbb3041d2..12e54f0f5b 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -31,6 +31,9 @@\n \n using wallet::ImportDescriptorRequest;\n \n+// As many keys as the wallet allows in one range.\n+constexpr int64_t MAX_RANGE_END{1'000'000};\n+\n namespace {\n \n struct DescriptorCheck {\n@@ -201,6 +204,12 @@ ViewOnlyImport ParseJson(const std::string& text)\n if (const auto bounds{CheckDescriptorRangeBounds(request.range->first, request.range->second)}; !bounds) {\n return Failed(Kind::DescriptorJson, QStringLiteral(\"%1: %2\").arg(position, QString::fromStdString(bounds.error())));\n }\n+ // The wallet derives every key from index 0 to the end, while it blocks and can't be cancelled.\n+ if (request.range->second >= MAX_RANGE_END) {\n+ //: %2 is the highest index that can be imported.\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range that ends after %2, which would take too long to set up.\")\n+ .arg(position).arg(MAX_RANGE_END - 1));\n+ }\n }\n const UniValue& next_index{entry.find_value(\"next_index\")};\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n@@ -220,9 +229,12 @@ ViewOnlyImport ParseJson(const std::string& text)\n if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n }\n+ // Without a range, the wallet's keypool size bounds it, which isn't known here.\n+ if (request.next_index && !request.range) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index but no range.\").arg(position));\n+ }\n if (check.ranged && request.next_index) {\n- const int64_t first{request.range ? request.range->first : 0};\n- if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ if (*request.next_index < request.range->first || *request.next_index > request.range->second) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n@@ -321,6 +333,8 @@ const std::array KNOWN_KEY_VERSIONS{\n // [fingerprint/path]key, the key origin form wallets export.\n const QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\n const QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n+// BIP45 and BIP48 are multisig cosigner paths.\n+const QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n \n struct ExtendedKey {\n bool recognized{false};\n@@ -394,6 +408,9 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n {\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n+ if (MULTISIG_PURPOSE.match(path).hasMatch()) {\n+ return Failed(Kind::ExtendedKey, QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\"));\n+ }\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n@@ -476,8 +493,10 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n active_slots[{type, request.internal.value_or(false)}] = i;\n }\n }\n- std::vector<bool> active(parsed.requests.size(), false);\n- for (const auto& [slot, index] : active_slots) active[index] = true;\n+ const auto branch_active = [&](size_t i, bool change) {\n+ const auto slot{active_slots.find({parsed.sources[i].type, change})};\n+ return slot != active_slots.end() && slot->second == i;\n+ };\n QString warning{parsed.warning};\n if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n bool watches_change{false};\n@@ -489,7 +508,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n }\n \n- // Receive and change of one key share a row.\n+ // Receive and change of one key share a row, unless only one of them stays active.\n QVariantList rows;\n QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n@@ -501,34 +520,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- auto row_it{rows.begin()};\n- for (; row_it != rows.end(); ++row_it) {\n- const QVariantMap map{row_it->toMap()};\n- if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n- map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n- break;\n+ const std::vector<bool> branches{source.multipath ? std::vector<bool>{false, true} : std::vector<bool>{request.internal.value_or(false)}};\n+ for (const bool change : branches) {\n+ const bool active{branch_active(i, change)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == active && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n }\n+ if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n+ rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n+ {QStringLiteral(\"key\"), source.key},\n+ {QStringLiteral(\"receive\"), false},\n+ {QStringLiteral(\"change\"), false},\n+ {QStringLiteral(\"active\"), active},\n+ {QStringLiteral(\"ranged\"), source.ranged},\n+ {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n+ row_it = std::prev(rows.end());\n+ }\n+ QVariantMap row{row_it->toMap()};\n+ row.insert(change ? QStringLiteral(\"change\") : QStringLiteral(\"receive\"), true);\n+ if (time) {\n+ const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n+ row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n+ }\n+ *row_it = row;\n }\n- if (row_it == rows.end()) {\n- row_keys.append(source.key_id);\n- rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n- {QStringLiteral(\"key\"), source.key},\n- {QStringLiteral(\"receive\"), false},\n- {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), bool(active[i])},\n- {QStringLiteral(\"ranged\"), source.ranged},\n- {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n- row_it = std::prev(rows.end());\n- }\n- QVariantMap row{row_it->toMap()};\n- const bool change{request.internal.value_or(false)};\n- if (source.multipath || !change) row.insert(QStringLiteral(\"receive\"), true);\n- if (source.multipath || change) row.insert(QStringLiteral(\"change\"), true);\n- if (time) {\n- const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n- row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n- }\n- *row_it = row;\n }\n QStringList descriptors;\n for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n@@ -552,3 +573,28 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n return result;\n }\n+\n+int64_t ResolveImportTimes(std::vector<ImportDescriptorRequest>& requests, int64_t now)\n+{\n+ int64_t oldest{now};\n+ for (ImportDescriptorRequest& request : requests) {\n+ request.timestamp = request.timestamp.value_or(now);\n+ oldest = std::min(oldest, *request.timestamp);\n+ }\n+ return oldest;\n+}\n+\n+bool DescriptorsSaved(const wallet::CWallet& wallet, const std::vector<ImportDescriptorRequest>& requests)\n+{\n+ LOCK(wallet.cs_wallet);\n+ for (const ImportDescriptorRequest& request : requests) {\n+ FlatSigningProvider keys;\n+ std::string error;\n+ auto parsed{Parse(request.descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return false;\n+ for (auto& descriptor : parsed) {\n+ if (!wallet.GetDescriptorScriptPubKeyMan(wallet::WalletDescriptor{std::move(descriptor), 0, 0, 0, 0})) return false;\n+ }\n+ }\n+ return true;\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Pruning preflight is immediately revised by the next commitqml/walletqmlcontroller.cpp | unclear | AssessmentThe finding is about folding adjacent commits together. The supplied evidence establishes revised final-tree behavior but does not establish commit sequencing. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "cd35cab5cd9f4aaa86b6c91a55a90e6a",
"finding_id": "finding:12",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..08c013c361 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,92 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n+{\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n+}\n+\n+QString PendingImportKey(const std::string& wallet_path)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+bool SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n+ return settings.status() == QSettings::NoError;\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n {\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n+}\n+\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n+{\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n }\n- control.detach();\n- return done;\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ int64_t last_time{0};\n+ const bool checkpoint{result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))};\n+ return {Status::Stopped, checkpoint ? std::optional<int64_t>{last_time} : std::nullopt};\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +260,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +571,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +591,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -652,7 +734,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n WalletLoadAction load_action,\n bool report_create_error,\n WalletSetupFn setup_wallet,\n- WalletCheckFn check_before_create)\n+ WalletCheckFn check_before_create,\n+ std::shared_ptr<RescanControl> import_control)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -676,17 +759,28 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n return out;\n- }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n+ }, [this, wallet_name, load_action, report_create_error, import_control](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n+ // A cancel can arrive after the worker last checked for one.\n+ if (out.wallet && import_control && import_control->cancelled()) {\n+ setWalletLoadError(tr(\"The import was cancelled, and its wallet was deleted.\"));\n+ m_wallet_command_executor->submit(this, [node = &m_node, wallet = std::move(out.wallet), wallet_name]() mutable {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }, [] {});\n+ return;\n+ }\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n@@ -825,9 +919,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +928,28 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ // The abort refers to this wallet, which is gone once this returns or throws.\n+ const auto detach{qScopeGuard([&control] { control->detach(); })};\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ // Without the marker, a crash during the rescan would leave the wallet missing history unnoticed.\n+ if (!SetPendingImport(path, PendingImport{start, /*installed=*/false})) {\n+ return WalletQmlController::tr(\"The app couldn't save its settings, which it needs to finish the import if it closes during it. Check that its settings can be written, then try again.\");\n+ }\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts after every request is handled, even when some failed.\n+ bool checked{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(checked, true)) {\n+ const wallet::CWallet* raw_wallet{wallet.wallet()};\n+ if (raw_wallet && DescriptorsSaved(*raw_wallet, requests)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ }\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -854,14 +959,17 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n- control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n@@ -874,7 +982,7 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n }\n return QString{};\n- });\n+ }, control);\n }\n \n void WalletQmlController::importWallet(const QString& path)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Each interrupted recovery repeats the scan from its original startqml/walletqmlcontroller.cpp | addressed | AssessmentOn a stopped recovery scan, the code records a checkpoint from the last scanned block when no earlier block read failed; the next recovery uses the updated start. If the checkpoint is not safely later than the prior start, the marker remains unchanged. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "8a9e4c54ac834b4d844e9c0124d4a4d5",
"finding_id": "finding:11",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..81317bf10e 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,94 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+QString PendingImportKey(const std::string& wallet_path)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n+}\n+\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n+{\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n {\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n+ }\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ ImportRescanResult stopped{Status::Stopped};\n+ int64_t last_time{0};\n+ if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n+ stopped.checkpoint = last_time;\n }\n- control.detach();\n- return done;\n+ return stopped;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +262,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +573,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +593,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -676,9 +760,11 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -825,9 +911,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +920,20 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts once every descriptor is saved.\n+ bool installed{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -856,12 +945,16 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 280,
"evidence_id": "63ef6ff73fdf46478eed24f5bf088ed4",
"finding_id": "finding:11",
"kind": "new_source",
"line": 131,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " bool installed{false};\n};\n\n// The marker belongs to the wallet file, not to its name.\nstd::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n{\n const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n std::error_code error;\n const fs::path canonical{fs::weakly_canonical(path, error)};\n return fs::PathToString(error ? path : canonical);\n}\n\nQString PendingImportKey(const std::string& wallet_path)\n{\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n}\n\nvoid SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n{\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n settings.remove(key);\n if (pending) {\n settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n}\n\nstd::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n{\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n if (!start.isValid()) return std::nullopt;\n return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n}\n\n// What the wallet takes as now for an import: the median time of the tip.\nint64_t ChainNow(interfaces::WalletLoader& loader)\n{\n wallet::WalletContext* context{loader.context()};\n int64_t time{0};\n if (context && context->chain) {\n interfaces::Chain& chain{*context->chain};\n if (const std::optional<int> height{chain.getHeight()};\n height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n return time;\n }\n }\n return QDateTime::currentSecsSinceEpoch();\n}\n\nImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n const std::function<void(int)>& progress)\n{\n using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n // Another rescan of this wallet is running.\n if (!reserver.reserve()) return {Status::Failed};\n if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n // The abort refers to this frame, and Scan can throw.\n const auto detach{qScopeGuard([&control] { control.detach(); })};\n const auto progress_handler{interfaces::MakeSignalHandler(\n wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n interfaces::FoundBlock().hash(start_block).height(start_height))) {\n return {Status::Done};\n }\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n stopped.checkpoint = last_time;\n }\n return stopped;\n}\n\nQString ImportErrorText(const wallet::ImportError& error)\n{\n const bilingual_str& message{error.wallet_error.message};\n return QString::fromStdString(message.translated.empty() ? message.original : message.translated);\n}\n} // namespace\n\nbool RescanControl::attach(std::function<void()> abort)\n{\n const std::lock_guard lock{m_mutex};\n if (m_cancelled) return false;\n m_abort = std::move(abort);\n return true;\n}\n\nvoid RescanControl::detach()\n{\n const std::lock_guard lock{m_mutex};\n m_abort = nullptr;\n}\n\nvoid RescanControl::cancel()\n{\n const std::lock_guard lock{m_mutex};\n m_cancelled = true;\n if (m_abort) m_abort();\n}\n\nbool RescanControl::cancelled() const\n{\n const std::lock_guard lock{m_mutex};\n return m_cancelled;\n}\n\nWalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n , m_empty_wallet(new WalletQmlModel(&node, this))\n , m_selected_wallet(m_empty_wallet)\n , m_wallet_command_executor(std::make_shared<BackendExecutor>())\n , m_load_notifications(std::make_shared<WalletLoadNotifications>())\n , m_notification_bridge(new QObject, [](QObject* bridge) {\n if (QThread::currentThread() == bridge->thread()) delete bridge;\n else bridge->deleteLater();\n })\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n const std::function<void(int)>& progress) {\n return ResumeImport(node, wallet_name, time, control, progress);\n })\n{\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n connect(m_wallet_command_executor.get(), &BackendExecutor::drained, this, [this] {\n m_controller_drained = true;\n checkShutdownFinished();\n });\n\n}\n\nWalletQmlController::~WalletQmlController()\n{",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Recovery cannot distinguish partial installation from a pending scanqml/walletqmlcontroller.cpp | addressed | AssessmentThe pending marker now records whether descriptor installation completed. Recovery detects an uninstalled marker and reports an incomplete import instead of rescanning and clearing it as though installation had completed. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "26691d54ef574b61948b7acafc2009a6",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..81317bf10e 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,94 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+QString PendingImportKey(const std::string& wallet_path)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n+}\n+\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n+{\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n {\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n+ }\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ ImportRescanResult stopped{Status::Stopped};\n+ int64_t last_time{0};\n+ if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n+ stopped.checkpoint = last_time;\n }\n- control.detach();\n- return done;\n+ return stopped;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +262,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +573,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +593,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -676,9 +760,11 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -825,9 +911,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +920,20 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts once every descriptor is saved.\n+ bool installed{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -856,12 +945,16 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 963,
"evidence_id": "34b5720791f547dfb20eece793234227",
"finding_id": "finding:10",
"kind": "new_source",
"line": 814,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": " wallet::WALLET_FLAG_DESCRIPTORS,\n WalletLoadAction::Create,\n /*report_create_error=*/true);\n}\n\nbool WalletQmlController::createExternalSignerWallet(const QString& name)\n{\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return false;\n }\n\n const QString wallet_name = name.trimmed();\n const QString name_error = walletNameAvailabilityError(wallet_name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return false;\n }\n\n refreshExternalSignerStatus();\n if (!m_external_signer_path_configured) {\n setWalletLoadError(tr(\"Set an external signer path in Wallet settings first.\"));\n return false;\n }\n if (!m_external_signer_error.isEmpty()) {\n setWalletLoadError(m_external_signer_error);\n return false;\n }\n if (m_external_signer_count == 0) {\n setWalletLoadError(tr(\"Connect an external signer and try again.\"));\n return false;\n }\n if (m_external_signer_count > 1) {\n setWalletLoadError(tr(\"More than one external signer was found. Connect only one device and try again.\"));\n return false;\n }\n\n constexpr uint64_t flags = wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_EXTERNAL_SIGNER;\n createWalletAsync(wallet_name,\n SecureString{},\n flags,\n WalletLoadAction::Load,\n /*report_create_error=*/false);\n return true;\n}\n\nvoid WalletQmlController::createWatchOnlyWallet(const QString& name, const QString& import_text, qint64 birth_time,\n const QString& address_type)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n ViewOnlyImport input{ParseViewOnlyImport(import_text, address_type)};\n if (input.kind == ViewOnlyImport::Kind::Empty) {\n setWalletLoadError(tr(\"Enter descriptors, or an extended public key (xpub).\"));\n return;\n }\n if (!input.error.isEmpty()) {\n setWalletLoadError(input.error);\n return;\n }\n if (input.requests.empty()) {\n setWalletLoadError(tr(\"Choose the address type of this key.\"));\n return;\n }\n if (!input.undated.empty()) {\n if (birth_time < 0) {\n setWalletLoadError(tr(\"Choose when this wallet was created.\"));\n return;\n }\n for (const size_t index : input.undated) input.requests[index].timestamp = birth_time;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return;\n }\n\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n std::optional<int64_t> oldest_dated;\n for (size_t i = 0; i < input.requests.size(); ++i) {\n const std::optional<int64_t>& time{input.requests[i].timestamp};\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n [node = &m_node, requests, control, guard = QPointer{this},\n bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n // Resolved here, so the marker starts where the wallet's rescan does.\n const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n // The rescan starts once every descriptor is saved.\n bool installed{false};\n const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n }, Qt::QueuedConnection);\n })};\n // Imports the descriptors, then rescans from the oldest timestamp.\n results = wallet.importDescriptors(requests);\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n // Shutdown stops the rescan early without an error. The next start finishes it.\n if (node->shutdownRequested()) {\n SetPendingImport(path, PendingImport{start, /*installed=*/true});\n keep_wallet = true;\n return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n }\n SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n wallet::WalletContext* context{node->walletLoader().context()};\n if (!context || !context->chain) return QString{};\n if (ScanBlocksPruned(*context->chain, oldest_dated)) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | A recovery-scan exception leaves a dangling abort callbackqml/walletqmlcontroller.cpp | addressed | AssessmentA scope guard now detaches the abort callback immediately after successful attachment, including on exceptions. The recovery executor also has an exception completion handler that removes the control while leaving the pending marker intact. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "79492e8593f242b9a0a98981f79825e4",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 3,
"source_job_id": 3100,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 452a87cf64..81317bf10e 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -13,6 +13,7 @@\n #include <common/args.h>\n #include <common/settings.h>\n #include <interfaces/chain.h>\n+#include <interfaces/handler.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n@@ -45,6 +46,7 @@\n #include <QMetaObject>\n #include <QPointer>\n #include <QRegularExpression>\n+#include <QScopeGuard>\n #include <QSettings>\n #include <QStringList>\n #include <QTimer>\n@@ -122,48 +124,94 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n \n // A view-only import saves its descriptors before it rescans. The wallet's\n // best block is already the tip then, so after a crash it would load without\n-// the older transactions. This records where the rescan starts until it ends.\n-QString PendingImportKey(const std::string& wallet_name)\n+// the older transactions. This records where the rescan starts until it ends,\n+// and whether every descriptor was saved.\n+struct PendingImport {\n+ int64_t start{0};\n+ bool installed{false};\n+};\n+\n+// The marker belongs to the wallet file, not to its name.\n+std::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n {\n- return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+ const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n+ std::error_code error;\n+ const fs::path canonical{fs::weakly_canonical(path, error)};\n+ return fs::PathToString(error ? path : canonical);\n }\n \n-void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+QString PendingImportKey(const std::string& wallet_path)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n {\n QSettings settings;\n- if (time) {\n- settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n- } else {\n- settings.remove(PendingImportKey(wallet_name));\n+ const QString key{PendingImportKey(wallet_path)};\n+ settings.remove(key);\n+ if (pending) {\n+ settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n+ settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n }\n \n-std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+std::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n {\n- const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n- return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+ QSettings settings;\n+ const QString key{PendingImportKey(wallet_path)};\n+ const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n+ if (!start.isValid()) return std::nullopt;\n+ return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n+}\n+\n+// What the wallet takes as now for an import: the median time of the tip.\n+int64_t ChainNow(interfaces::WalletLoader& loader)\n+{\n+ wallet::WalletContext* context{loader.context()};\n+ int64_t time{0};\n+ if (context && context->chain) {\n+ interfaces::Chain& chain{*context->chain};\n+ if (const std::optional<int> height{chain.getHeight()};\n+ height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n+ return time;\n+ }\n+ }\n+ return QDateTime::currentSecsSinceEpoch();\n }\n \n-bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+ImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress)\n {\n+ using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n- if (!wallet) return false;\n+ if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n- if (!reserver.reserve()) return false;\n- if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ // Another rescan of this wallet is running.\n+ if (!reserver.reserve()) return {Status::Failed};\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n+ // The abort refers to this frame, and Scan can throw.\n+ const auto detach{qScopeGuard([&control] { control.detach(); })};\n+ const auto progress_handler{interfaces::MakeSignalHandler(\n+ wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n- bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n- interfaces::FoundBlock().hash(start_block).height(start_height))};\n- if (!done) {\n- // Progress is saved, so a later load continues from where this stopped too.\n- done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n- wallet::ScanResult::SUCCESS;\n+ if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))) {\n+ return {Status::Done};\n+ }\n+ const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n+ if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n+ if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n+ ImportRescanResult stopped{Status::Stopped};\n+ int64_t last_time{0};\n+ if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n+ wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n+ stopped.checkpoint = last_time;\n }\n- control.detach();\n- return done;\n+ return stopped;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -214,8 +262,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n- , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n- return ResumeImport(node, wallet_name, time, control);\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n+ const std::function<void(int)>& progress) {\n+ return ResumeImport(node, wallet_name, time, control, progress);\n })\n {\n m_empty_wallet->setNode(&m_node);\n@@ -524,8 +573,15 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n {\n const QString name{wallet_model->name()};\n- const std::optional<int64_t> time{PendingImport(name.toStdString())};\n- if (!time) return;\n+ if (m_import_rescans.contains(name)) return;\n+ const std::string path{WalletPath(m_node.walletLoader(), name.toStdString())};\n+ const std::optional<PendingImport> pending{ReadPendingImport(path)};\n+ if (!pending) return;\n+ // Rescanning can't add the descriptors that were never saved.\n+ if (!pending->installed) {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"incomplete\"));\n+ return;\n+ }\n if (!m_import_rescan_executor) {\n m_import_rescan_executor = std::make_unique<BackendExecutor>();\n m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n@@ -537,15 +593,43 @@ void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n }\n auto control{std::make_shared<RescanControl>()};\n m_import_rescans[name] = control;\n- m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n- // Stays pending when the rescan stops early, so the next load tries again.\n- if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n- }, [this, name, control] {\n+ wallet_model->setHistoryRecovery(QStringLiteral(\"running\"));\n+ const QPointer<WalletQmlModel> model{wallet_model};\n+ auto progress = [bridge = m_notification_bridge, model](int percent) {\n+ QMetaObject::invokeMethod(bridge.get(), [model, percent] {\n+ if (model) model->setHistoryRecovery(QStringLiteral(\"running\"), percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ };\n+ const auto finished = [this, name, control, model](bool failed) {\n const auto it{m_import_rescans.find(name)};\n if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ if (model) model->setHistoryRecovery(failed ? QStringLiteral(\"failed\") : QString{});\n+ };\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), path, start = pending->start,\n+ control, progress = std::move(progress)] {\n+ using Status = ImportRescanResult::Status;\n+ const ImportRescanResult result{resume(name, start, *control, progress)};\n+ if (result.status == Status::Done) {\n+ SetPendingImport(path, std::nullopt);\n+ } else if (result.status == Status::Stopped && result.checkpoint && *result.checkpoint > start) {\n+ // The next rescan starts a window before the last block read.\n+ SetPendingImport(path, PendingImport{*result.checkpoint, /*installed=*/true});\n+ }\n+ // The marker stays otherwise, so the next load tries again.\n+ return result.status;\n+ }, [finished](ImportRescanResult::Status status) {\n+ finished(status != ImportRescanResult::Status::Done);\n+ }, [finished](std::exception_ptr) {\n+ finished(/*failed=*/true);\n });\n }\n \n+void WalletQmlController::retryHistoryRecovery(WalletQmlModel* wallet)\n+{\n+ if (!wallet || m_shutting_down || wallet->historyRecovery() != QStringLiteral(\"failed\")) return;\n+ resumeInterruptedImport(wallet);\n+}\n+\n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n {\n if (!wallet_model || wallet_model == m_empty_wallet) {\n@@ -676,9 +760,11 @@ void WalletQmlController::createWalletAsync(const QString& name,\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n- } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n- SetPendingImport(wallet_name.toStdString(), std::nullopt);\n+ } else if (bool keep_wallet{false}; setup_wallet && !(out.error = setup_wallet(**wallet, keep_wallet)).isEmpty()) {\n+ if (!keep_wallet) {\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(WalletPath(node->walletLoader(), wallet_name.toStdString()), std::nullopt);\n+ }\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -825,9 +911,6 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n }\n const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n- // An unset timestamp means now.\n- int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n- for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n auto control{std::make_shared<RescanControl>()};\n m_import_control = control;\n@@ -837,14 +920,20 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n- bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ [node = &m_node, requests, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet, bool& keep_wallet) mutable {\n const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n- SetPendingImport(wallet.getWalletName(), rescan_from);\n+ const std::string path{WalletPath(node->walletLoader(), wallet.getWalletName())};\n+ // Resolved here, so the marker starts where the wallet's rescan does.\n+ const int64_t start{ResolveImportTimes(requests, ChainNow(node->walletLoader()))};\n+ SetPendingImport(path, PendingImport{start, /*installed=*/false});\n std::vector<wallet::ImportResult> results;\n {\n- const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // The rescan starts once every descriptor is saved.\n+ bool installed{false};\n+ const auto progress{wallet.handleShowProgress([&, control, guard, bridge](const std::string&, int percent) {\n+ if (!std::exchange(installed, true)) SetPendingImport(path, PendingImport{start, /*installed=*/true});\n // Starting a rescan clears an earlier abort.\n if (control->cancelled()) wallet.abortRescan();\n QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n@@ -856,12 +945,16 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n }\n control->detach();\n if (control->cancelled()) return cancelled;\n- // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n- if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n- SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ // Shutdown stops the rescan early without an error. The next start finishes it.\n+ if (node->shutdownRequested()) {\n+ SetPendingImport(path, PendingImport{start, /*installed=*/true});\n+ keep_wallet = true;\n+ return WalletQmlController::tr(\"The import will finish the next time the app starts.\");\n+ }\n+ SetPendingImport(path, std::nullopt);\n return QString{};\n }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 274,
"evidence_id": "5591d4253d864b41810327f26952e96d",
"finding_id": "finding:1",
"kind": "new_source",
"line": 125,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"path": "qml/walletqmlcontroller.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 3,
"source_job_id": 3100,
"text": "// A view-only import saves its descriptors before it rescans. The wallet's\n// best block is already the tip then, so after a crash it would load without\n// the older transactions. This records where the rescan starts until it ends,\n// and whether every descriptor was saved.\nstruct PendingImport {\n int64_t start{0};\n bool installed{false};\n};\n\n// The marker belongs to the wallet file, not to its name.\nstd::string WalletPath(interfaces::WalletLoader& loader, const std::string& wallet_name)\n{\n const fs::path path{fs::PathFromString(loader.getWalletDir()) / fs::PathFromString(wallet_name)};\n std::error_code error;\n const fs::path canonical{fs::weakly_canonical(path, error)};\n return fs::PathToString(error ? path : canonical);\n}\n\nQString PendingImportKey(const std::string& wallet_path)\n{\n return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_path).toHex()));\n}\n\nvoid SetPendingImport(const std::string& wallet_path, std::optional<PendingImport> pending)\n{\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n settings.remove(key);\n if (pending) {\n settings.setValue(key + QStringLiteral(\"/start\"), qlonglong(pending->start));\n settings.setValue(key + QStringLiteral(\"/installed\"), pending->installed);\n }\n settings.sync();\n}\n\nstd::optional<PendingImport> ReadPendingImport(const std::string& wallet_path)\n{\n QSettings settings;\n const QString key{PendingImportKey(wallet_path)};\n const QVariant start{settings.value(key + QStringLiteral(\"/start\"))};\n if (!start.isValid()) return std::nullopt;\n return PendingImport{start.toLongLong(), settings.value(key + QStringLiteral(\"/installed\")).toBool()};\n}\n\n// What the wallet takes as now for an import: the median time of the tip.\nint64_t ChainNow(interfaces::WalletLoader& loader)\n{\n wallet::WalletContext* context{loader.context()};\n int64_t time{0};\n if (context && context->chain) {\n interfaces::Chain& chain{*context->chain};\n if (const std::optional<int> height{chain.getHeight()};\n height && chain.findBlock(chain.getBlockHash(*height), interfaces::FoundBlock().mtpTime(time))) {\n return time;\n }\n }\n return QDateTime::currentSecsSinceEpoch();\n}\n\nImportRescanResult ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control,\n const std::function<void(int)>& progress)\n{\n using Status = ImportRescanResult::Status;\n wallet::WalletContext* context{node.walletLoader().context()};\n const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n if (!wallet) return {Status::Stopped};\n wallet::WalletRescanReserver reserver{*wallet};\n // Another rescan of this wallet is running.\n if (!reserver.reserve()) return {Status::Failed};\n if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return {Status::Stopped};\n // The abort refers to this frame, and Scan can throw.\n const auto detach{qScopeGuard([&control] { control.detach(); })};\n const auto progress_handler{interfaces::MakeSignalHandler(\n wallet->ShowProgress.connect([&progress](const std::string&, int percent) { progress(percent); }))};\n int start_height{0};\n uint256 start_block;\n if (!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n interfaces::FoundBlock().hash(start_block).height(start_height))) {\n return {Status::Done};\n }\n const wallet::ScanResult result{wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true)};\n if (result.status == wallet::ScanResult::SUCCESS) return {Status::Done};\n if (result.status == wallet::ScanResult::FAILURE) return {Status::Failed};\n ImportRescanResult stopped{Status::Stopped};\n int64_t last_time{0};\n if (result.last_failed_block.IsNull() && !result.last_scanned_block.IsNull() &&\n wallet->chain().findBlock(result.last_scanned_block, interfaces::FoundBlock().time(last_time))) {\n stopped.checkpoint = last_time;\n }\n return stopped;\n}\n\nQString ImportErrorText(const wallet::ImportError& error)\n{\n const bilingual_str& message{error.wallet_error.message};\n return QString::fromStdString(message.translated.empty() ? message.original : message.translated);\n}\n} // namespace\n\nbool RescanControl::attach(std::function<void()> abort)\n{\n const std::lock_guard lock{m_mutex};\n if (m_cancelled) return false;\n m_abort = std::move(abort);\n return true;\n}\n\nvoid RescanControl::detach()\n{\n const std::lock_guard lock{m_mutex};\n m_abort = nullptr;\n}\n\nvoid RescanControl::cancel()\n{\n const std::lock_guard lock{m_mutex};\n m_cancelled = true;\n if (m_abort) m_abort();\n}\n\nbool RescanControl::cancelled() const\n{\n const std::lock_guard lock{m_mutex};\n return m_cancelled;\n}\n\nWalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n , m_empty_wallet(new WalletQmlModel(&node, this))\n , m_selected_wallet(m_empty_wallet)\n , m_wallet_command_executor(std::make_shared<BackendExecutor>())\n , m_load_notifications(std::make_shared<WalletLoadNotifications>())\n , m_notification_bridge(new QObject, [](QObject* bridge) {\n if (QThread::currentThread() == bridge->thread()) delete bridge;\n else bridge->deleteLater();\n })\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control,\n const std::function<void(int)>& progress) {\n return ResumeImport(node, wallet_name, time, control, progress);\n })\n{\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n connect(m_wallet_command_executor.get(), &BackendExecutor::drained, this, [this] {\n m_controller_drained = true;\n checkShutdownFinished();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c6ff067c1dff..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1148 | The -reverselayout help gives the wrong direction for RTL languagesqml/guiargs.cpp | addressed | AssessmentThe -reverselayout help now says it reverses the selected language’s layout direction, directly describing the flag’s behavior rather than implying that it enables RTL layout. path_diff: qml/guiargs.cpp [
{
"evidence_id": "fe14537f79b1462781c57877e90373bd",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "d72c4d9aa262fc999ac2956c032a19ad3ea7683c",
"old_head": "bbaf12d52e9392115986241ac3c1b7a2ae38f7f8",
"path": "qml/guiargs.cpp",
"source_generation": 1,
"source_job_id": 3099,
"text": "diff --git a/qml/guiargs.cpp b/qml/guiargs.cpp\nindex 5791a23ca4..37eab9359a 100644\n--- a/qml/guiargs.cpp\n+++ b/qml/guiargs.cpp\n@@ -11,7 +11,7 @@ void SetupQmlGuiArgs(ArgsManager& argsman)\n argsman.AddArg(\"-choosedatadir\", \"Choose data directory on startup (default: 0)\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n argsman.AddArg(\"-lang=<lang>\", \"Set language, for example \\\"de_DE\\\" (default: system locale)\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n argsman.AddArg(\"-min\", \"Start minimized\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n- argsman.AddArg(\"-reverselayout\", \"Mirror the layout as for a right-to-left language (default: 0)\", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI);\n+ argsman.AddArg(\"-reverselayout\", \"Reverse the layout direction of the selected language (default: 0)\", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI);\n argsman.AddArg(\"-resetguisettings\", \"Reset all settings changed in the GUI\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n argsman.AddHiddenArgs({\"-qml_onboarded\", \"-qml_receive_address_types\"});\n #ifdef ENABLE_TEST_AUTOMATION\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bbaf12d52e93..d72c4d9aa262 2026-11-25T19:31:11Z · gpt-6-luna |
| gui#1148 | The Arabic layout test does not verify catalog loadingtest/functional/qml_test_settings_display.py | addressed | AssessmentAfter selecting Arabic, the test now asserts that displayLanguageRow.title equals the Arabic catalog translation, in addition to checking layout mirroring. This verifies that the application-specific translation loaded. path_diff: test/functional/qml_test_settings_display.py [
{
"evidence_id": "0060190195974fd9ae37a9efaed5ca8b",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "d72c4d9aa262fc999ac2956c032a19ad3ea7683c",
"old_head": "bbaf12d52e9392115986241ac3c1b7a2ae38f7f8",
"path": "test/functional/qml_test_settings_display.py",
"source_generation": 1,
"source_job_id": 3099,
"text": "diff --git a/test/functional/qml_test_settings_display.py b/test/functional/qml_test_settings_display.py\nindex 0c0792ea0d..d62675ad66 100644\n--- a/test/functional/qml_test_settings_display.py\n+++ b/test/functional/qml_test_settings_display.py\n@@ -109,7 +109,9 @@ def test_language_direction(gui):\n assert gui.get_property(\"displayLanguageRow\", \"mirrored\") is False\n select_language(gui, \"arabic\", \"language_ar\")\n gui.wait_for_property(\"displayLanguageRow\", \"mirrored\", True, timeout_ms=3000)\n- print(\" Arabic mirrors the layout PASSED\")\n+ language_title = gui.get_property(\"displayLanguageRow\", \"title\")\n+ assert language_title == \"اللغة\", language_title\n+ print(\" Arabic mirrors and translates the layout PASSED\")\n \n select_language(gui, \"español\", \"language_es\")\n gui.wait_for_property(\"displayLanguageRow\", \"mirrored\", False, timeout_ms=3000)\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bbaf12d52e93..d72c4d9aa262 2026-11-25T19:31:11Z · gpt-6-luna |
| gui#1148 | Untranslated date patterns discard regional order and clock conventionsqml/pages/wallet/TransactionDetail.qml | addressed | AssessmentThe affected date displays now use LocaleFormat.shortDateTimePattern, which is derived from the selected QLocale’s ShortFormat, instead of fixed month-first, 12-hour patterns. This preserves locale-specific date order and clock conventions while using the locale-aware formatting path. path_diff: qml/pages/wallet/TransactionDetail.qml [
{
"evidence_id": "2a08128cea4043148bd5bba6d885b19a",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "d72c4d9aa262fc999ac2956c032a19ad3ea7683c",
"old_head": "bbaf12d52e9392115986241ac3c1b7a2ae38f7f8",
"path": "qml/pages/wallet/TransactionDetail.qml",
"source_generation": 1,
"source_job_id": 3099,
"text": "diff --git a/qml/pages/wallet/TransactionDetail.qml b/qml/pages/wallet/TransactionDetail.qml\nindex ba6cc3761c..37347ee38f 100644\n--- a/qml/pages/wallet/TransactionDetail.qml\n+++ b/qml/pages/wallet/TransactionDetail.qml\n@@ -125,10 +125,8 @@ Page {\n amount: root.amount\n hidesAmount: true\n amountColor: root.inactive ? Theme.color.neutral7 : root.incoming ? Theme.color.txIncoming : Theme.color.neutral9\n- //: Qt date and time format pattern for when a transaction happened\n- readonly property string datePattern: qsTr(\"MMM d, yyyy h:mm AP\")\n subtitle: root.actionLabel + (root.transactionData.timestamp\n- ? \" · \" + LocaleFormat.formatDate(new Date(root.transactionData.timestamp * 1000), datePattern) : \"\")\n+ ? \" · \" + LocaleFormat.formatDate(new Date(root.transactionData.timestamp * 1000), LocaleFormat.shortDateTimePattern) : \"\")\n iconComponent: ActivityIcon {\n objectName: \"transactionDetailIcon\"\n iconSize: 48\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bbaf12d52e93..d72c4d9aa262 2026-11-25T19:31:11Z · gpt-6-luna |
| gui#1148 | Retained Activity date labels keep the previous languageqml/models/activityfilterproxymodel.cpp | addressed | AssessmentThe new localeChanged connection emits dataChanged for existing rows with SectionLabelRole and DateTimeLabelRole, addressing stale retained Activity labels. A regression test populates the model, switches languages, checks the notification roles, and verifies the translated label. path_diff: qml/models/activityfilterproxymodel.cpp [
{
"evidence_id": "090b1bee468546f38a80bcccff7a1fd8",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "d72c4d9aa262fc999ac2956c032a19ad3ea7683c",
"old_head": "bbaf12d52e9392115986241ac3c1b7a2ae38f7f8",
"path": "qml/models/activityfilterproxymodel.cpp",
"source_generation": 1,
"source_job_id": 3099,
"text": "diff --git a/qml/models/activityfilterproxymodel.cpp b/qml/models/activityfilterproxymodel.cpp\nindex 66d5cd81e4..b67dab0453 100644\n--- a/qml/models/activityfilterproxymodel.cpp\n+++ b/qml/models/activityfilterproxymodel.cpp\n@@ -77,6 +77,9 @@ ActivityFilterProxyModel::ActivityFilterProxyModel(QObject* parent)\n || roles.contains(TransactionActivityModel::NetAmountSatRole) || roles.contains(TransactionActivityModel::IsPendingRequestRole)) invalidatePendingBalance();\n });\n connect(this, &ActivityFilterProxyModel::displayUnitChanged, this, &ActivityFilterProxyModel::pendingBalanceChanged);\n+ connect(&LocaleFormat::instance(), &LocaleFormat::localeChanged, this, [this] {\n+ if (rowCount()) Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0), {SectionLabelRole, DateTimeLabelRole});\n+ });\n }\n \n QHash<int, QByteArray> ActivityFilterProxyModel::roleNames() const\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bbaf12d52e93..d72c4d9aa262 2026-11-25T19:31:11Z · gpt-6-luna |
| gui#1148 | Coin rows and saved payment requests no longer show the yearqml/components/CoinsList.qml | addressed | AssessmentCoin rows and saved payment-request cards now format their dates with LocaleFormat.shortDateTimePattern rather than the yearless fixed pattern. This restores the locale’s short date-time format, which includes the year in the relevant regional pattern; the diff shows both affected displays changed. path_diff: qml/components/CoinsList.qml [
{
"evidence_id": "675ba7589cfb4df59e6a754152c08126",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "d72c4d9aa262fc999ac2956c032a19ad3ea7683c",
"old_head": "bbaf12d52e9392115986241ac3c1b7a2ae38f7f8",
"path": "qml/components/CoinsList.qml",
"source_generation": 1,
"source_job_id": 3099,
"text": "diff --git a/qml/components/CoinsList.qml b/qml/components/CoinsList.qml\nindex 45c949ce2e..e7694a09e6 100644\n--- a/qml/components/CoinsList.qml\n+++ b/qml/components/CoinsList.qml\n@@ -285,8 +285,7 @@ ColumnLayout {\n CoreText { visible: !root.coins || root.coins.groupBy !== \"address\"; Layout.fillWidth: true; text: coinRow.address; horizontalAlignment: Text.AlignLeft; textStyle: Theme.text.monoCaption; color: Theme.color.neutral7; wrap: false; elide: Text.ElideMiddle }\n CoreText {\n Layout.fillWidth: true\n- //: Qt date format pattern for when a coin was received\n- text: LocaleFormat.formatDate(coinRow.date, qsTr(\"MMM d, h:mm AP\"))\n+ text: LocaleFormat.formatDate(coinRow.date, LocaleFormat.shortDateTimePattern)\n horizontalAlignment: Text.AlignLeft\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bbaf12d52e93..d72c4d9aa262 2026-11-25T19:31:11Z · gpt-6-luna |
| gui#1057 | Early commits refine a modal that the series deletesqml/components/WatchOnlyExportModal.qml | unclear | AssessmentThere is no captured evidence about the commit sequence or its reorganization in the new head, so whether the early commits still refine the deleted modal cannot be determined. Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Tr() hides destination errors from lupdateqml/walletfiledestination.cpp | addressed | AssessmentThe Tr() wrapper was removed and each reported destination error now passes its literal directly to QCoreApplication::translate(), including the missing-folder message with its translator comment retained. path_diff: qml/walletfiledestination.cpp; new_source: qml/walletfiledestination.cpp [
{
"evidence_id": "4188a8b6a74d42b5ac693ee6bd2e599e",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/walletfiledestination.cpp",
"source_generation": 6,
"source_job_id": 3097,
"text": "diff --git a/qml/walletfiledestination.cpp b/qml/walletfiledestination.cpp\nindex 434ba4bf90..d7f72ac332 100644\n--- a/qml/walletfiledestination.cpp\n+++ b/qml/walletfiledestination.cpp\n@@ -13,11 +13,6 @@\n \n namespace {\n \n-QString Tr(const char* text)\n-{\n- return QCoreApplication::translate(\"WalletFileDestination\", text);\n-}\n-\n QString CleanPath(const QString& path)\n {\n const QFileInfo info{path};\n@@ -110,7 +105,7 @@ QVariantMap DescribeWalletFileDestination(const QString& path,\n const QDateTime& now)\n {\n const QString trimmed{path.trimmed()};\n- if (trimmed.isEmpty()) return Blocked(Tr(\"Choose where to save the file.\"));\n+ if (trimmed.isEmpty()) return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"Choose where to save the file.\"));\n \n const QUrl url{trimmed};\n QString local{QFileInfo{url.isLocalFile() ? url.toLocalFile() : trimmed}.absoluteFilePath()};\n@@ -126,14 +121,14 @@ QVariantMap DescribeWalletFileDestination(const QString& path,\n const QString folder{QDir::toNativeSeparators(info.absolutePath())};\n if (!QFileInfo{info.absolutePath()}.isDir()) {\n //: %1 is a folder path.\n- return Blocked(Tr(\"The folder %1 does not exist.\").arg(folder));\n+ return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"The folder %1 does not exist.\").arg(folder));\n }\n- if (info.isDir()) return Blocked(Tr(\"A folder with this name already exists.\"));\n+ if (info.isDir()) return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"A folder with this name already exists.\"));\n \n const QString resolved{CleanPath(info.absolutePath()) + '/' + info.fileName()};\n for (const QString& protected_path : protected_paths) {\n if (!protected_path.isEmpty() && IsSameOrInside(resolved, CleanPath(protected_path))) {\n- return Blocked(Tr(\"Wallet files can't be saved in the wallets folder. Choose another location.\"));\n+ return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"Wallet files can't be saved in the wallets folder. Choose another location.\"));\n }\n }\n \n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 150,
"evidence_id": "a634ddeceedf444ab572913c66b4c073",
"finding_id": "finding:8",
"kind": "new_source",
"line": 1,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/walletfiledestination.cpp",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 6,
"source_job_id": 3097,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/walletfiledestination.h>\n\n#include <QCoreApplication>\n#include <QDir>\n#include <QFile>\n#include <QFileInfo>\n#include <QRegularExpression>\n#include <QUrl>\n\nnamespace {\n\nQString CleanPath(const QString& path)\n{\n const QFileInfo info{path};\n const QString canonical{info.canonicalFilePath()};\n return canonical.isEmpty() ? QDir::cleanPath(info.absoluteFilePath()) : canonical;\n}\n\nbool IsSameOrInside(const QString& path, const QString& root)\n{\n#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)\n constexpr Qt::CaseSensitivity sensitivity{Qt::CaseInsensitive};\n#else\n constexpr Qt::CaseSensitivity sensitivity{Qt::CaseSensitive};\n#endif\n if (root.isEmpty()) return false;\n if (path.compare(root, sensitivity) == 0) return true;\n const QString prefix{root.endsWith('/') ? root : root + '/'};\n return path.startsWith(prefix, sensitivity);\n}\n\nQVariantMap Blocked(const QString& error)\n{\n return {{QStringLiteral(\"status\"), QStringLiteral(\"blocked\")}, {QStringLiteral(\"error\"), error}};\n}\n\n} // namespace\n\nbool IsWalletDatabaseFile(const QString& path)\n{\n QFile file{path};\n if (!file.open(QIODevice::ReadOnly)) return false;\n const QByteArray header{file.read(72)};\n\n if (header.startsWith(QByteArray(\"SQLite format 3\\0\", 16))) {\n // Core stores the network magic as the application id.\n return header.size() >= 72 && header.mid(68, 4) != QByteArray(4, '\\0');\n }\n\n // Berkeley DB btree magic, in either byte order, as Core's IsBDBFile.\n if (file.size() < 4096 || header.size() < 16) return false;\n const QByteArray magic{header.mid(12, 4)};\n return magic == QByteArray(\"\\x00\\x05\\x31\\x62\", 4) || magic == QByteArray(\"\\x62\\x31\\x05\\x00\", 4);\n}\n\nQString DefaultWalletFileName(const QString& wallet_name, bool watch_only, const QDate& date)\n{\n static const QRegularExpression separators{QStringLiteral(\"[\\\\\\\\/]\")};\n static const QRegularExpression reserved{QStringLiteral(\"[:*?\\\"<>|]\")};\n const QStringList parts{wallet_name.split(separators, Qt::SkipEmptyParts)};\n QString name{parts.isEmpty() ? QString{} : parts.last().trimmed()};\n name.replace(reserved, QStringLiteral(\"_\"));\n if (name.isEmpty()) name = QStringLiteral(\"wallet\");\n\n const QString stamp{date.toString(QStringLiteral(\"yyyy-MM-dd\"))};\n return watch_only\n ? QStringLiteral(\"%1-watchonly-%2.dat\").arg(name, stamp)\n : QStringLiteral(\"%1-%2.bak\").arg(name, stamp);\n}\n\nQString KeepBothPath(const QString& path, bool watch_only, const QDateTime& now)\n{\n // A stamp left by an earlier save is replaced, not appended to.\n static const QRegularExpression old_stamp{QStringLiteral(\"-\\\\d{4}-\\\\d{2}-\\\\d{2}(-\\\\d{4})?(-\\\\d+)?$\")};\n static const QRegularExpression watch_only_label{QStringLiteral(\"-watchonly$\"), QRegularExpression::CaseInsensitiveOption};\n const QFileInfo info{path};\n QString base{info.completeBaseName()};\n base.remove(old_stamp);\n // The existing file can be the other type, so its label and suffix are not kept.\n base.remove(watch_only_label);\n if (base.isEmpty()) base = QStringLiteral(\"wallet\");\n if (watch_only) base += QStringLiteral(\"-watchonly\");\n const QString stem{base + '-' + now.toString(QStringLiteral(\"yyyy-MM-dd-HHmm\"))};\n const bool known_suffix{info.suffix().compare(QStringLiteral(\"bak\"), Qt::CaseInsensitive) == 0 ||\n info.suffix().compare(QStringLiteral(\"dat\"), Qt::CaseInsensitive) == 0};\n const QString suffix{known_suffix ? (watch_only ? QStringLiteral(\".dat\") : QStringLiteral(\".bak\"))\n : info.suffix().isEmpty() ? QString{} : '.' + info.suffix()};\n const QDir dir{info.absoluteDir()};\n\n for (int count{1};; ++count) {\n const QString name{count == 1 ? stem + suffix : QStringLiteral(\"%1-%2%3\").arg(stem).arg(count).arg(suffix)};\n const QString candidate{dir.filePath(name)};\n if (!QFileInfo::exists(candidate)) return candidate;\n }\n}\n\nQVariantMap DescribeWalletFileDestination(const QString& path,\n bool watch_only,\n const QString& wallet_name,\n const QStringList& protected_paths,\n const QDateTime& now)\n{\n const QString trimmed{path.trimmed()};\n if (trimmed.isEmpty()) return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"Choose where to save the file.\"));\n\n const QUrl url{trimmed};\n QString local{QFileInfo{url.isLocalFile() ? url.toLocalFile() : trimmed}.absoluteFilePath()};\n if (QFileInfo{local}.isDir()) {\n local = QDir{local}.filePath(DefaultWalletFileName(wallet_name, watch_only, now.date()));\n } else {\n static const QRegularExpression known_suffix{QStringLiteral(\"\\\\.(bak|dat)$\"),\n QRegularExpression::CaseInsensitiveOption};\n if (!known_suffix.match(local).hasMatch()) local += watch_only ? QStringLiteral(\".dat\") : QStringLiteral(\".bak\");\n }\n\n const QFileInfo info{local};\n const QString folder{QDir::toNativeSeparators(info.absolutePath())};\n if (!QFileInfo{info.absolutePath()}.isDir()) {\n //: %1 is a folder path.\n return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"The folder %1 does not exist.\").arg(folder));\n }\n if (info.isDir()) return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"A folder with this name already exists.\"));\n\n const QString resolved{CleanPath(info.absolutePath()) + '/' + info.fileName()};\n for (const QString& protected_path : protected_paths) {\n if (!protected_path.isEmpty() && IsSameOrInside(resolved, CleanPath(protected_path))) {\n return Blocked(QCoreApplication::translate(\"WalletFileDestination\", \"Wallet files can't be saved in the wallets folder. Choose another location.\"));\n }\n }\n\n QVariantMap result{\n {QStringLiteral(\"path\"), QDir::toNativeSeparators(local)},\n {QStringLiteral(\"folder\"), folder},\n {QStringLiteral(\"fileName\"), info.fileName()},\n {QStringLiteral(\"error\"), QString{}},\n };\n if (!info.exists()) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"available\"));\n return result;\n }\n const QFileInfo keep_both{KeepBothPath(local, watch_only, now)};\n result.insert(QStringLiteral(\"status\"), IsWalletDatabaseFile(local) ? QStringLiteral(\"walletFile\") : QStringLiteral(\"otherFile\"));\n result.insert(QStringLiteral(\"keepBothPath\"), QDir::toNativeSeparators(keep_both.absoluteFilePath()));\n result.insert(QStringLiteral(\"keepBothFileName\"), keep_both.fileName());\n return result;\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Descriptor footer overstates receive/change coverageqml/pages/wallet/WalletDescriptors.qml | addressed | AssessmentThe list footer now claims receive-and-change coverage only when every listed descriptor's coversChange flag is true; otherwise it omits that claim, retaining only the fingerprint where applicable. path_diff: qml/pages/wallet/WalletDescriptors.qml; new_source: qml/pages/wallet/WalletDescriptors.qml [
{
"evidence_id": "1ed6ca7e06564433afdbfad313a1a189",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/pages/wallet/WalletDescriptors.qml",
"source_generation": 6,
"source_job_id": 3097,
"text": "diff --git a/qml/pages/wallet/WalletDescriptors.qml b/qml/pages/wallet/WalletDescriptors.qml\nindex 48838e3059..40491b8b0c 100644\n--- a/qml/pages/wallet/WalletDescriptors.qml\n+++ b/qml/pages/wallet/WalletDescriptors.qml\n@@ -19,9 +19,8 @@ SettingsPage {\n property var exports: []\n // Descriptors that no longer give out addresses but may still hold funds.\n property var inactiveExports: []\n- // Descriptors that importdescriptors can't take without private keys.\n- property int omittedCount: 0\n readonly property var completeExports: exports.concat(inactiveExports)\n+ readonly property bool coversChange: completeExports.length > 0 && completeExports.every(item => item.coversChange)\n readonly property string sharedFingerprint: {\n const fingerprints = new Set(completeExports.map(item => item.fingerprint))\n return fingerprints.size === 1 ? completeExports[0].fingerprint : \"\"\n@@ -37,7 +36,6 @@ SettingsPage {\n function refresh() {\n exports = wallet ? wallet.descriptorExports() : []\n inactiveExports = wallet ? wallet.inactiveDescriptorExports() : []\n- omittedCount = wallet ? wallet.descriptorImportOmittedCount() : 0\n }\n \n function shortKey(key) {\n@@ -50,13 +48,6 @@ SettingsPage {\n return scripts.join(\"(\") + \"(\" + shortKey(item.xpub) + \")\".repeat(scripts.length)\n }\n \n- function copyAll() {\n- const json = wallet ? wallet.descriptorImportJson() : \"\"\n- if (json === \"\") return\n- clipboard.setText(json)\n- copyAllTimer.restart()\n- }\n-\n Component.onCompleted: refresh()\n onWalletChanged: refresh()\n \n@@ -65,28 +56,26 @@ SettingsPage {\n function onDescriptorExportsChanged() { root.refresh() }\n }\n \n- Timer {\n- id: copyAllTimer\n- interval: 1000\n- }\n-\n- CoreText {\n+ DescriptorPrivacyNote {\n objectName: \"descriptorsListNote\"\n Layout.fillWidth: true\n- text: qsTr(\"Anyone with these descriptors can see all of this wallet's addresses and transactions, but cannot spend from it.\")\n- textStyle: Theme.text.description\n- color: Theme.color.neutral7\n- horizontalAlignment: Text.AlignLeft\n }\n \n FormSection {\n objectName: \"descriptorsTypeList\"\n Layout.fillWidth: true\n title: qsTr(\"Address types\")\n- footerText: root.sharedFingerprint !== \"\"\n- //: %1 is the wallet's BIP32 master key fingerprint.\n- ? qsTr(\"Fingerprint %1. Each descriptor covers receive and change addresses.\").arg(root.sharedFingerprint)\n- : qsTr(\"Each descriptor covers receive and change addresses.\")\n+ // Imported descriptors can cover receive addresses only.\n+ footerText: {\n+ if (root.sharedFingerprint === \"\") {\n+ return root.coversChange ? qsTr(\"Each descriptor covers receive and change addresses.\") : \"\"\n+ }\n+ return root.coversChange\n+ //: %1 is the wallet's BIP32 master key fingerprint.\n+ ? qsTr(\"Fingerprint %1. Each descriptor covers receive and change addresses.\").arg(root.sharedFingerprint)\n+ //: %1 is the wallet's BIP32 master key fingerprint.\n+ : qsTr(\"Fingerprint %1.\").arg(root.sharedFingerprint)\n+ }\n \n Repeater {\n model: root.completeExports\n@@ -116,30 +105,10 @@ SettingsPage {\n }\n }\n \n- NeutralButton {\n- objectName: \"descriptorsCopyAll\"\n- buttonSize: NeutralButton.Large\n- visible: root.completeExports.length > 0\n- enabled: !(root.wallet && root.wallet.watchOnlyWalletExportPending)\n- Layout.fillWidth: true\n- //: Copies every descriptor as JSON for Bitcoin Core's importdescriptors command.\n- text: copyAllTimer.running ? qsTr(\"Copied\") : qsTr(\"Copy all for Bitcoin Core\")\n- onClicked: root.copyAll()\n- }\n-\n- CoreText {\n- objectName: \"descriptorsCopyAllNote\"\n+ DescriptorCopyAll {\n visible: root.completeExports.length > 0\n Layout.fillWidth: true\n- //: \"importdescriptors\" is a Bitcoin Core command and is not translated.\n- text: qsTr(\"Copies every descriptor, with when it was created, as JSON for importdescriptors. Import it into a Bitcoin Core wallet without private keys.\")\n- + (root.omittedCount === 0 ? \"\"\n- : \" \" + (root.omittedCount === 1\n- ? qsTr(\"1 older descriptor needs private keys to find its addresses, so it is left out. To keep it, save a watch-only copy from Back up or export wallet.\")\n- //: %1 is a number of descriptors.\n- : qsTr(\"%1 older descriptors need private keys to find their addresses, so they are left out. To keep them, save a watch-only copy from Back up or export wallet.\").arg(root.omittedCount)))\n- textStyle: Theme.text.caption\n- color: Theme.color.neutral7\n- horizontalAlignment: Text.AlignLeft\n+ wallet: root.wallet\n+ clipboard: root.clipboard\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 114,
"evidence_id": "45187f8f302b4608b9008c3aa37011fe",
"finding_id": "finding:7",
"kind": "new_source",
"line": 59,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/pages/wallet/WalletDescriptors.qml",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 6,
"source_job_id": 3097,
"text": " DescriptorPrivacyNote {\n objectName: \"descriptorsListNote\"\n Layout.fillWidth: true\n }\n\n FormSection {\n objectName: \"descriptorsTypeList\"\n Layout.fillWidth: true\n title: qsTr(\"Address types\")\n // Imported descriptors can cover receive addresses only.\n footerText: {\n if (root.sharedFingerprint === \"\") {\n return root.coversChange ? qsTr(\"Each descriptor covers receive and change addresses.\") : \"\"\n }\n return root.coversChange\n //: %1 is the wallet's BIP32 master key fingerprint.\n ? qsTr(\"Fingerprint %1. Each descriptor covers receive and change addresses.\").arg(root.sharedFingerprint)\n //: %1 is the wallet's BIP32 master key fingerprint.\n : qsTr(\"Fingerprint %1.\").arg(root.sharedFingerprint)\n }\n\n Repeater {\n model: root.completeExports\n\n ListRow {\n required property var modelData\n required property int index\n readonly property bool inactive: index >= root.exports.length\n readonly property string rowId: inactive ? \"inactive\" + (index - root.exports.length) : modelData.id\n objectName: \"descriptorsType_\" + rowId\n Layout.fillWidth: true\n title: modelData.label\n description: inactive\n //: Shown under an address type in the descriptors list for keys that no longer give out new addresses, such as keys from before a password was set. %1 is a shortened descriptor.\n ? qsTr(\"Previous key %1\").arg(root.shortDescriptor(modelData))\n : root.shortDescriptor(modelData)\n showDivider: index < root.completeExports.length - 1\n showsDisclosureIndicator: !inactive\n onClicked: if (!inactive) root.descriptorRequested(modelData.id)\n trailingItem: CopyButton {\n objectName: \"descriptorsTypeCopy_\" + rowId\n displayMode: CopyButton.IconOnly\n Accessible.name: qsTr(\"Copy %1 descriptor\").arg(modelData.label)\n onCopyRequested: root.clipboard.setText(modelData.descriptor)\n }\n }\n }\n }\n\n DescriptorCopyAll {\n visible: root.completeExports.length > 0\n Layout.fillWidth: true\n wallet: root.wallet\n clipboard: root.clipboard\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | The PR description still promises descriptor and key file savingqml/pages/wallet/WalletDescriptorDetail.qml | unclear | AssessmentThe supplied new-head evidence shows clipboard copying and the watch-only database export, but does not show whether the PR description or screenshots were updated or whether saving the selected payload to a text file remains intended. path_diff: qml/pages/wallet/WalletDescriptorDetail.qml; new_source: qml/pages/wallet/WalletDescriptorDetail.qml [
{
"evidence_id": "2438df1b4b2842a29ed464be80b9561d",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/pages/wallet/WalletDescriptorDetail.qml",
"source_generation": 6,
"source_job_id": 3097,
"text": "diff --git a/qml/pages/wallet/WalletDescriptorDetail.qml b/qml/pages/wallet/WalletDescriptorDetail.qml\nindex 37be305349..4f3cbf4e9c 100644\n--- a/qml/pages/wallet/WalletDescriptorDetail.qml\n+++ b/qml/pages/wallet/WalletDescriptorDetail.qml\n@@ -21,6 +21,8 @@ SettingsPage {\n property bool extendedKeyFormat: false\n // Previous keys of this type are separate descriptors.\n property bool hasPreviousKeys: false\n+ // Opened without the Descriptors list, so it also offers what the list does.\n+ property bool standalone: false\n readonly property bool extendedKeyAvailable: !!exportItem && exportItem.extendedKey !== \"\"\n readonly property string payload: !exportItem ? \"\"\n : extendedKeyFormat ? exportItem.extendedKey : exportItem.descriptor\n@@ -61,6 +63,12 @@ SettingsPage {\n interval: 1000\n }\n \n+ DescriptorPrivacyNote {\n+ objectName: \"descriptorsPrivacyNote\"\n+ visible: root.standalone\n+ Layout.fillWidth: true\n+ }\n+\n SegmentedPicker {\n objectName: \"descriptorsFormatPicker\"\n Layout.fillWidth: true\n@@ -71,13 +79,18 @@ SettingsPage {\n }\n \n // A bare key has no script type, so an importer can guess another one.\n+ // SegWit keys carry theirs in the ypub or zpub prefix.\n ToastBanner {\n- objectName: \"descriptorsTaprootWarning\"\n+ readonly property string addressType: root.exportItem ? root.exportItem.id : \"\"\n+ objectName: \"descriptorsScriptTypeWarning\"\n Layout.fillWidth: true\n- shown: root.extendedKeyFormat && !!root.exportItem && root.exportItem.id === \"bech32m\"\n+ shown: root.extendedKeyFormat && (addressType === \"bech32m\" || addressType === \"legacy\")\n tone: ToastBanner.Warning\n- textObjectName: \"descriptorsTaprootWarningText\"\n- text: qsTr(\"This key doesn't record that it is for Taproot. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Use the descriptor unless the other wallet asks for a Taproot key.\")\n+ textObjectName: \"descriptorsScriptTypeWarningText\"\n+ text: addressType === \"legacy\"\n+ //: \"Bitcoin Core App\" is this app's name.\n+ ? qsTr(\"This key doesn't record that it is for Legacy addresses. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Bitcoin Core App, like many wallets, imports a bare key as SegWit. Use the descriptor unless the other wallet asks for a Legacy key.\")\n+ : qsTr(\"This key doesn't record that it is for Taproot. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Use the descriptor unless the other wallet asks for a Taproot key.\")\n }\n \n Rectangle {\n@@ -181,4 +194,11 @@ SettingsPage {\n : qsTr(\"Copy descriptor\")\n onClicked: root.copy()\n }\n+\n+ DescriptorCopyAll {\n+ visible: root.standalone && !!root.exportItem\n+ Layout.fillWidth: true\n+ wallet: root.wallet\n+ clipboard: root.clipboard\n+ }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 204,
"evidence_id": "08b63e2c0d4e4b43b8ef5064abafd7ae",
"finding_id": "finding:6",
"kind": "new_source",
"line": 152,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/pages/wallet/WalletDescriptorDetail.qml",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 6,
"source_job_id": 3097,
"text": " valueTextStyle: Theme.text.monoDescription\n showDivider: !root.extendedKeyFormat\n }\n\n ValueRow {\n objectName: \"descriptorsChains\"\n visible: !root.extendedKeyFormat && !!root.exportItem\n Layout.fillWidth: true\n //: Derivation branches the descriptor covers: receiving addresses and change addresses.\n title: qsTr(\"Chains\")\n value: !root.exportItem ? \"\"\n : root.exportItem.changeChain === \"\" ? qsTr(\"Receive %1\").arg(root.exportItem.receiveChain)\n : qsTr(\"Receive %1, change %2\").arg(root.exportItem.receiveChain).arg(root.exportItem.changeChain)\n showDivider: false\n }\n }\n\n CoreText {\n objectName: \"descriptorsNote\"\n Layout.fillWidth: true\n text: {\n if (!root.exportItem) return \"\"\n //: \"Back up or export wallet\" is the wallet settings action that saves a watch-only copy of the whole wallet.\n let note = qsTr(\"Only includes funds on %1 addresses. For a copy of the whole wallet, use Back up or export wallet.\").arg(root.exportItem.label)\n if (root.hasPreviousKeys) {\n //: %1 is an address type. \"Copy all for Bitcoin Core\" is a button on the Descriptors page.\n note += \" \" + qsTr(\"Funds on previous %1 keys are not included. To include them, use Copy all for Bitcoin Core on Descriptors, or save a watch-only copy.\").arg(root.exportItem.label)\n }\n return note\n }\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignLeft\n }\n\n NeutralButton {\n objectName: \"descriptorsCopyButton\"\n buttonSize: NeutralButton.Large\n Layout.fillWidth: true\n enabled: root.payload !== \"\"\n text: copiedTimer.running ? qsTr(\"Copied\")\n : root.extendedKeyFormat ? qsTr(\"Copy extended key\")\n : qsTr(\"Copy descriptor\")\n onClicked: root.copy()\n }\n\n DescriptorCopyAll {\n visible: root.standalone && !!root.exportItem\n Layout.fillWidth: true\n wallet: root.wallet\n clipboard: root.clipboard\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Single-type shortcut hides Core JSON export and the privacy noteqml/pages/wallet/WalletSettingsStack.qml | unclear | AssessmentThe follow-up assessment was invalid: follow-up evidence belongs to another finding or comparison. invalid_assessment Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Legacy extended-key export lacks a script-type warningqml/pages/wallet/WalletDescriptorDetail.qml | addressed | AssessmentThe extended-key warning now appears for Legacy as well as Taproot; its Legacy-specific text explains that this app imports a bare key as SegWit and recommends using the descriptor unless a Legacy key is specifically requested. path_diff: qml/pages/wallet/WalletDescriptorDetail.qml; new_source: qml/pages/wallet/WalletDescriptorDetail.qml [
{
"evidence_id": "9dff3930f3be4d1b83b9ba08094f2976",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/pages/wallet/WalletDescriptorDetail.qml",
"source_generation": 6,
"source_job_id": 3097,
"text": "diff --git a/qml/pages/wallet/WalletDescriptorDetail.qml b/qml/pages/wallet/WalletDescriptorDetail.qml\nindex 37be305349..4f3cbf4e9c 100644\n--- a/qml/pages/wallet/WalletDescriptorDetail.qml\n+++ b/qml/pages/wallet/WalletDescriptorDetail.qml\n@@ -21,6 +21,8 @@ SettingsPage {\n property bool extendedKeyFormat: false\n // Previous keys of this type are separate descriptors.\n property bool hasPreviousKeys: false\n+ // Opened without the Descriptors list, so it also offers what the list does.\n+ property bool standalone: false\n readonly property bool extendedKeyAvailable: !!exportItem && exportItem.extendedKey !== \"\"\n readonly property string payload: !exportItem ? \"\"\n : extendedKeyFormat ? exportItem.extendedKey : exportItem.descriptor\n@@ -61,6 +63,12 @@ SettingsPage {\n interval: 1000\n }\n \n+ DescriptorPrivacyNote {\n+ objectName: \"descriptorsPrivacyNote\"\n+ visible: root.standalone\n+ Layout.fillWidth: true\n+ }\n+\n SegmentedPicker {\n objectName: \"descriptorsFormatPicker\"\n Layout.fillWidth: true\n@@ -71,13 +79,18 @@ SettingsPage {\n }\n \n // A bare key has no script type, so an importer can guess another one.\n+ // SegWit keys carry theirs in the ypub or zpub prefix.\n ToastBanner {\n- objectName: \"descriptorsTaprootWarning\"\n+ readonly property string addressType: root.exportItem ? root.exportItem.id : \"\"\n+ objectName: \"descriptorsScriptTypeWarning\"\n Layout.fillWidth: true\n- shown: root.extendedKeyFormat && !!root.exportItem && root.exportItem.id === \"bech32m\"\n+ shown: root.extendedKeyFormat && (addressType === \"bech32m\" || addressType === \"legacy\")\n tone: ToastBanner.Warning\n- textObjectName: \"descriptorsTaprootWarningText\"\n- text: qsTr(\"This key doesn't record that it is for Taproot. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Use the descriptor unless the other wallet asks for a Taproot key.\")\n+ textObjectName: \"descriptorsScriptTypeWarningText\"\n+ text: addressType === \"legacy\"\n+ //: \"Bitcoin Core App\" is this app's name.\n+ ? qsTr(\"This key doesn't record that it is for Legacy addresses. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Bitcoin Core App, like many wallets, imports a bare key as SegWit. Use the descriptor unless the other wallet asks for a Legacy key.\")\n+ : qsTr(\"This key doesn't record that it is for Taproot. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Use the descriptor unless the other wallet asks for a Taproot key.\")\n }\n \n Rectangle {\n@@ -181,4 +194,11 @@ SettingsPage {\n : qsTr(\"Copy descriptor\")\n onClicked: root.copy()\n }\n+\n+ DescriptorCopyAll {\n+ visible: root.standalone && !!root.exportItem\n+ Layout.fillWidth: true\n+ wallet: root.wallet\n+ clipboard: root.clipboard\n+ }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 196,
"evidence_id": "1c9892fca98a4e00864e8b844c8a179d",
"finding_id": "finding:3",
"kind": "new_source",
"line": 47,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/pages/wallet/WalletDescriptorDetail.qml",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 6,
"source_job_id": 3097,
"text": " if (payload === \"\") return\n clipboard.setText(payload)\n copiedTimer.restart()\n }\n\n Component.onCompleted: refresh()\n onWalletChanged: refresh()\n onAddressTypeChanged: refresh()\n\n Connections {\n target: root.wallet && root.wallet.descriptorExportsChanged ? root.wallet : null\n function onDescriptorExportsChanged() { root.refresh() }\n }\n\n Timer {\n id: copiedTimer\n interval: 1000\n }\n\n DescriptorPrivacyNote {\n objectName: \"descriptorsPrivacyNote\"\n visible: root.standalone\n Layout.fillWidth: true\n }\n\n SegmentedPicker {\n objectName: \"descriptorsFormatPicker\"\n Layout.fillWidth: true\n //: Export formats: an output descriptor, or a bare xpub/ypub/zpub key for wallets that only accept those.\n model: [qsTr(\"Descriptor\"), {text: qsTr(\"Extended key\"), enabled: root.extendedKeyAvailable}]\n currentIndex: root.extendedKeyFormat ? 1 : 0\n onSelected: index => root.setExtendedKeyFormat(index === 1)\n }\n\n // A bare key has no script type, so an importer can guess another one.\n // SegWit keys carry theirs in the ypub or zpub prefix.\n ToastBanner {\n readonly property string addressType: root.exportItem ? root.exportItem.id : \"\"\n objectName: \"descriptorsScriptTypeWarning\"\n Layout.fillWidth: true\n shown: root.extendedKeyFormat && (addressType === \"bech32m\" || addressType === \"legacy\")\n tone: ToastBanner.Warning\n textObjectName: \"descriptorsScriptTypeWarningText\"\n text: addressType === \"legacy\"\n //: \"Bitcoin Core App\" is this app's name.\n ? qsTr(\"This key doesn't record that it is for Legacy addresses. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Bitcoin Core App, like many wallets, imports a bare key as SegWit. Use the descriptor unless the other wallet asks for a Legacy key.\")\n : qsTr(\"This key doesn't record that it is for Taproot. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Use the descriptor unless the other wallet asks for a Taproot key.\")\n }\n\n Rectangle {\n readonly property real side: Math.min(parent.width, 240)\n Layout.preferredWidth: side\n Layout.preferredHeight: side\n Layout.alignment: Qt.AlignHCenter\n radius: Theme.radius.cardInset\n color: Theme.color.qrBackground\n\n QRImage {\n objectName: \"descriptorsQRImage\"\n anchors.fill: parent\n anchors.margins: Theme.space.l\n code: root.payload\n backgroundColor: Theme.color.qrBackground\n foregroundColor: Theme.color.qrForeground\n }\n }\n\n AddressLabel {\n objectName: \"descriptorsKeyText\"\n visible: root.extendedKeyFormat\n Layout.fillWidth: true\n address: visible && root.exportItem ? root.exportItem.extendedKey : \"\"\n textStyle: Theme.text.monoDescription\n clipboard: root.clipboard\n surfaceLevel: 0\n }\n\n DescriptorText {\n objectName: \"descriptorsDetail\"\n visible: !root.extendedKeyFormat && !!root.exportItem\n Layout.fillWidth: true\n parts: visible ? root.exportItem.descriptorParts : ({})\n descriptor: visible ? root.exportItem.descriptor : \"\"\n clipboard: root.clipboard\n }\n\n FormSection {\n Layout.fillWidth: true\n\n ValueRow {\n objectName: \"descriptorsFingerprint\"\n visible: !!root.exportItem && root.exportItem.fingerprint !== \"\"\n Layout.fillWidth: true\n //: BIP32 fingerprint of the wallet's master key.\n title: qsTr(\"Master fingerprint\")\n value: root.exportItem ? root.exportItem.fingerprint : \"\"\n valueTextStyle: Theme.text.monoDescription\n }\n\n ValueRow {\n objectName: \"descriptorsDerivationPath\"\n visible: !!root.exportItem && root.exportItem.derivationPath !== \"\"\n Layout.fillWidth: true\n title: qsTr(\"Derivation path\")\n value: root.exportItem ? root.exportItem.derivationPath : \"\"\n valueTextStyle: Theme.text.monoDescription\n showDivider: !root.extendedKeyFormat\n }\n\n ValueRow {\n objectName: \"descriptorsChains\"\n visible: !root.extendedKeyFormat && !!root.exportItem\n Layout.fillWidth: true\n //: Derivation branches the descriptor covers: receiving addresses and change addresses.\n title: qsTr(\"Chains\")\n value: !root.exportItem ? \"\"\n : root.exportItem.changeChain === \"\" ? qsTr(\"Receive %1\").arg(root.exportItem.receiveChain)\n : qsTr(\"Receive %1, change %2\").arg(root.exportItem.receiveChain).arg(root.exportItem.changeChain)\n showDivider: false\n }\n }\n\n CoreText {\n objectName: \"descriptorsNote\"\n Layout.fillWidth: true\n text: {\n if (!root.exportItem) return \"\"\n //: \"Back up or export wallet\" is the wallet settings action that saves a watch-only copy of the whole wallet.\n let note = qsTr(\"Only includes funds on %1 addresses. For a copy of the whole wallet, use Back up or export wallet.\").arg(root.exportItem.label)\n if (root.hasPreviousKeys) {\n //: %1 is an address type. \"Copy all for Bitcoin Core\" is a button on the Descriptors page.\n note += \" \" + qsTr(\"Funds on previous %1 keys are not included. To include them, use Copy all for Bitcoin Core on Descriptors, or save a watch-only copy.\").arg(root.exportItem.label)\n }\n return note\n }\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignLeft\n }\n\n NeutralButton {\n objectName: \"descriptorsCopyButton\"\n buttonSize: NeutralButton.Large\n Layout.fillWidth: true\n enabled: root.payload !== \"\"\n text: copiedTimer.running ? qsTr(\"Copied\")\n : root.extendedKeyFormat ? qsTr(\"Copy extended key\")\n : qsTr(\"Copy descriptor\")\n onClicked: root.copy()\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Exhausted descriptor ranges produce rejected import JSONqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new JSON export sets the inclusive range end to at least next_index, and adds an exhausted-range round-trip test that imports the generated descriptors and verifies next_index is preserved. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "38bb0bd884b1469ca1c46a62f4a01b7a",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 6,
"source_job_id": 3097,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 371d57b2f6..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1341,7 +1341,34 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n \n bool WalletQmlModel::canShowDescriptors() const\n {\n- return !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n QVariantList WalletQmlModel::descriptorExports() const\n@@ -1376,6 +1403,7 @@ QVariantList WalletQmlModel::descriptorExports() const\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n@@ -1421,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1445,19 +1474,27 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n \n namespace {\n \n-// Hardened derivation after the key, as in a migrated wallet's old HD chain,\n-// needs the private key, so importdescriptors rejects the public form.\n-bool ExpandsFromPublicKeys(const std::string& descriptor)\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n {\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n- if (parsed.empty()) return false;\n- return std::ranges::all_of(parsed, [&](const auto& desc) {\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n- });\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n }\n \n std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n@@ -1468,10 +1505,15 @@ std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet&\n if (!exported) return {};\n std::vector<wallet::WalletDescInfo> importable;\n for (wallet::WalletDescInfo& info : *exported) {\n- if (ExpandsFromPublicKeys(info.descriptor)) {\n+ switch (ClassifyPublicImport(info.descriptor)) {\n+ case PublicImport::Importable:\n importable.push_back(std::move(info));\n- } else {\n+ break;\n+ case PublicImport::NeedsPrivateKeys:\n ++omitted;\n+ break;\n+ case PublicImport::NoScripts:\n+ break;\n }\n }\n std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n@@ -1510,7 +1552,8 @@ QString WalletQmlModel::descriptorImportJson() const\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n- range.push_back(info.range->second - 1);\n+ // A used-up range ends before next_index, which importdescriptors rejects.\n+ range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1632,
"evidence_id": "f5ad7f26493949bc8134b963517427bb",
"finding_id": "finding:2",
"kind": "new_source",
"line": 1483,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 6,
"source_job_id": 3097,
"text": " const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n // unused(), as addhdkey adds, has no addresses, and a wallet without\n // private keys rejects it.\n if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n return PublicImport::NoScripts;\n }\n // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n // needs the private key, so importdescriptors rejects the public form.\n const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n })};\n return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n}\n\nstd::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n{\n omitted = 0;\n LOCK(wallet.cs_wallet);\n auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n if (!exported) return {};\n std::vector<wallet::WalletDescInfo> importable;\n for (wallet::WalletDescInfo& info : *exported) {\n switch (ClassifyPublicImport(info.descriptor)) {\n case PublicImport::Importable:\n importable.push_back(std::move(info));\n break;\n case PublicImport::NeedsPrivateKeys:\n ++omitted;\n break;\n case PublicImport::NoScripts:\n break;\n }\n }\n std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n return importable;\n}\n\n} // namespace\n\nint WalletQmlModel::descriptorImportOmittedCount() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return 0;\n size_t omitted{0};\n ImportableDescriptors(*raw_wallet, omitted);\n return int(omitted);\n}\n\n// Every descriptor in the same form as listdescriptors, ready for importdescriptors.\nQString WalletQmlModel::descriptorImportJson() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n size_t omitted{0};\n const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n if (exported.empty()) return {};\n\n UniValue descriptors{UniValue::VARR};\n for (const wallet::WalletDescInfo& info : exported) {\n UniValue item{UniValue::VOBJ};\n item.pushKV(\"desc\", info.descriptor);\n // The import rescans from here, so \"now\" would miss older transactions.\n item.pushKV(\"timestamp\", info.creation_time);\n item.pushKV(\"active\", info.active);\n if (info.internal) item.pushKV(\"internal\", *info.internal);\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n // A used-up range ends before next_index, which importdescriptors rejects.\n range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n descriptors.push_back(std::move(item));\n }\n return QString::fromStdString(descriptors.write(2));\n}\n\nbool WalletQmlModel::canExportWatchOnlyWallet() const\n{\n // Like Bitcoin Core's GUI: a wallet without private keys is already watch-only.\n return m_wallet && !m_wallet->privateKeysDisabled();\n}\n\nbool WalletQmlModel::exportWatchOnlyWallet(const QString& path, bool replace)\n{\n const QString local_path{PsbtQmlModel::LocalFilePath(path)};\n if (m_watch_only_wallet_export_pending || !available() || !canExportWatchOnlyWallet() || local_path.trimmed().isEmpty()) {\n return false;\n }\n\n m_watch_only_wallet_export_pending = true;\n Q_EMIT watchOnlyWalletExportPendingChanged();\n const auto finish = [this, local_path](const QString& error) {\n m_watch_only_wallet_export_pending = false;\n Q_EMIT watchOnlyWalletExportPendingChanged();\n if (error.isEmpty()) {\n Q_EMIT watchOnlyWalletExported(local_path);\n } else {\n Q_EMIT watchOnlyWalletExportFailed(error);\n }\n };\n // The export copies every transaction while holding the wallet lock.\n m_backend_executor->submit(this, [wallet = m_wallet, destination = QmlDataDir::QStringToPath(local_path), replace] {\n return WriteWalletFile(destination, replace, [&](const fs::path& file) {\n const auto result = wallet->exportWatchOnlyWallet(file);\n return result ? QString{} : LocalizedString(util::ErrorString(result));\n });\n }, finish, [finish](std::exception_ptr) {\n finish(tr(\"The watch-only wallet could not be exported.\"));\n });\n return true;\n}\n\nvoid WalletQmlModel::removeWallet()\n{\n if (!m_wallet) {\n return;\n }\n m_wallet->remove();\n}\n\nbool WalletQmlModel::setCurrentPaymentRequestAddress(QString address)\n{\n if (!m_wallet || !m_current_payment_request || address.isEmpty()) {\n return false;\n }\n\n const CTxDestination destination{DecodeDestination(address.toStdString())};\n if (!IsValidDestination(destination)) {\n return false;\n }\n\n // A request already saved for this address is loaded for editing, not\n // duplicated: reopening the action on such an address means changing\n // the saved request, and silently minting a second request for the\n // same address multiplies rows that all describe one ask.\n if (m_receive_requests) {\n const QVariantList existing = m_receive_requests->matchingEntriesForAddress(address);\n if (!existing.isEmpty()) {\n const QString request_id = existing.first().toMap().value(QStringLiteral(\"requestId\")).toString();\n if (!loadPaymentRequest(request_id)) {\n return false;\n }\n m_current_payment_request->setIsEditing(true);\n return true;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Watch-only import JSON includes rejected unused() entriesqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new classifier checks HasScripts() and categorizes descriptors without scripts as NoScripts, which the importable-descriptor collector skips without incrementing the private-key omission count. A round-trip test includes an unused descriptor alongside ordinary descriptors and verifies the resulting JSON imports into a watch-only wallet. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "ea88d25ed556483e8eb8b9ff7834562b",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 6,
"source_job_id": 3097,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 371d57b2f6..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1341,7 +1341,34 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n \n bool WalletQmlModel::canShowDescriptors() const\n {\n- return !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n QVariantList WalletQmlModel::descriptorExports() const\n@@ -1376,6 +1403,7 @@ QVariantList WalletQmlModel::descriptorExports() const\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n@@ -1421,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1445,19 +1474,27 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n \n namespace {\n \n-// Hardened derivation after the key, as in a migrated wallet's old HD chain,\n-// needs the private key, so importdescriptors rejects the public form.\n-bool ExpandsFromPublicKeys(const std::string& descriptor)\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n {\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n- if (parsed.empty()) return false;\n- return std::ranges::all_of(parsed, [&](const auto& desc) {\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n- });\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n }\n \n std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n@@ -1468,10 +1505,15 @@ std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet&\n if (!exported) return {};\n std::vector<wallet::WalletDescInfo> importable;\n for (wallet::WalletDescInfo& info : *exported) {\n- if (ExpandsFromPublicKeys(info.descriptor)) {\n+ switch (ClassifyPublicImport(info.descriptor)) {\n+ case PublicImport::Importable:\n importable.push_back(std::move(info));\n- } else {\n+ break;\n+ case PublicImport::NeedsPrivateKeys:\n ++omitted;\n+ break;\n+ case PublicImport::NoScripts:\n+ break;\n }\n }\n std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n@@ -1510,7 +1552,8 @@ QString WalletQmlModel::descriptorImportJson() const\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n- range.push_back(info.range->second - 1);\n+ // A used-up range ends before next_index, which importdescriptors rejects.\n+ range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1590,
"evidence_id": "5f4d84b37bcc4879bfdff89b7c2548a2",
"finding_id": "finding:1",
"kind": "new_source",
"line": 1441,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 6,
"source_job_id": 3097,
"text": " return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n\n QVariantList exports;\n const auto append = [&](const Inactive& receive, const std::optional<SingleKeyDescriptor>& change) {\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(receive.type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n };\n for (auto it = found.begin(); it != found.end();) {\n const auto end = std::find_if(it, found.end(), [&](const Inactive& item) {\n return item.type != it->type || item.descriptor.origin != it->descriptor.origin ||\n item.descriptor.xpub != it->descriptor.xpub;\n });\n // next_index only moves once an address is handed out or seen in a transaction.\n if (std::any_of(it, end, [](const Inactive& item) { return item.used; })) {\n if (end - it == 2) {\n append(*it, std::next(it)->descriptor);\n } else {\n std::for_each(it, end, [&](const Inactive& item) { append(item, std::nullopt); });\n }\n }\n it = end;\n }\n return exports;\n}\n\nnamespace {\n\nenum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n\nPublicImport ClassifyPublicImport(const std::string& descriptor)\n{\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n // unused(), as addhdkey adds, has no addresses, and a wallet without\n // private keys rejects it.\n if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n return PublicImport::NoScripts;\n }\n // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n // needs the private key, so importdescriptors rejects the public form.\n const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n })};\n return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n}\n\nstd::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n{\n omitted = 0;\n LOCK(wallet.cs_wallet);\n auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n if (!exported) return {};\n std::vector<wallet::WalletDescInfo> importable;\n for (wallet::WalletDescInfo& info : *exported) {\n switch (ClassifyPublicImport(info.descriptor)) {\n case PublicImport::Importable:\n importable.push_back(std::move(info));\n break;\n case PublicImport::NeedsPrivateKeys:\n ++omitted;\n break;\n case PublicImport::NoScripts:\n break;\n }\n }\n std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n return importable;\n}\n\n} // namespace\n\nint WalletQmlModel::descriptorImportOmittedCount() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return 0;\n size_t omitted{0};\n ImportableDescriptors(*raw_wallet, omitted);\n return int(omitted);\n}\n\n// Every descriptor in the same form as listdescriptors, ready for importdescriptors.\nQString WalletQmlModel::descriptorImportJson() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n size_t omitted{0};\n const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n if (exported.empty()) return {};\n\n UniValue descriptors{UniValue::VARR};\n for (const wallet::WalletDescInfo& info : exported) {\n UniValue item{UniValue::VOBJ};\n item.pushKV(\"desc\", info.descriptor);\n // The import rescans from here, so \"now\" would miss older transactions.\n item.pushKV(\"timestamp\", info.creation_time);\n item.pushKV(\"active\", info.active);\n if (info.internal) item.pushKV(\"internal\", *info.internal);\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n // A used-up range ends before next_index, which importdescriptors rejects.\n range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n descriptors.push_back(std::move(item));\n }\n return QString::fromStdString(descriptors.write(2));\n}\n\nbool WalletQmlModel::canExportWatchOnlyWallet() const\n{\n // Like Bitcoin Core's GUI: a wallet without private keys is already watch-only.\n return m_wallet && !m_wallet->privateKeysDisabled();\n}\n\nbool WalletQmlModel::exportWatchOnlyWallet(const QString& path, bool replace)\n{\n const QString local_path{PsbtQmlModel::LocalFilePath(path)};\n if (m_watch_only_wallet_export_pending || !available() || !canExportWatchOnlyWallet() || local_path.trimmed().isEmpty()) {\n return false;\n }\n\n m_watch_only_wallet_export_pending = true;\n Q_EMIT watchOnlyWalletExportPendingChanged();\n const auto finish = [this, local_path](const QString& error) {\n m_watch_only_wallet_export_pending = false;\n Q_EMIT watchOnlyWalletExportPendingChanged();\n if (error.isEmpty()) {\n Q_EMIT watchOnlyWalletExported(local_path);\n } else {\n Q_EMIT watchOnlyWalletExportFailed(error);\n }\n };\n // The export copies every transaction while holding the wallet lock.\n m_backend_executor->submit(this, [wallet = m_wallet, destination = QmlDataDir::QStringToPath(local_path), replace] {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 598abdbeb3a5..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1142 | Recipient edits retain discarded clipboard-check objectsqml/models/sendimportmodel.cpp | still_present | AssessmentThe new-head code still disconnects and cancels the prior clipboard-check operation but does not schedule it for deletion, so discarded operation objects can remain parented to the model. new_source: qml/models/sendimportmodel.cpp [
{
"bounded": true,
"end_line": 248,
"evidence_id": "1ed440d4611544778e03370b61ad7b0a",
"finding_id": "finding:9",
"kind": "new_source",
"line": 205,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/models/sendimportmodel.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 17,
"source_job_id": 3096,
"text": "}\n\nvoid SendImportModel::cancelImport()\n{\n m_presented_result.clear();\n if (const auto operation = std::exchange(m_operation, nullptr)) {\n disconnect(operation, nullptr, this, nullptr);\n operation->cancel();\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::cancelAll()\n{\n cancelImport();\n if (const auto check = std::exchange(m_clipboard_check, nullptr)) {\n disconnect(check, nullptr, this, nullptr);\n check->cancel();\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::checkClipboard()\n{\n if (const auto check = std::exchange(m_clipboard_check, nullptr)) {\n disconnect(check, nullptr, this, nullptr);\n check->cancel();\n }\n if (m_active && m_target && m_target->available() && !m_target->importPending() && !m_clipboard_text.trimmed().isEmpty()) {\n m_offered_text = m_clipboard_text;\n m_clipboard_check = m_target->importText(m_offered_text, this);\n if (m_clipboard_check) connect(m_clipboard_check, &ImportOperation::changed, this, &SendImportModel::changed);\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::presentReview()\n{\n if (!m_operation || !m_operation->reviewOpened() || !m_target || !m_target->available()) return;\n const auto token = m_operation->resultToken();\n if (token.isEmpty() || token == m_presented_result || m_target->importedReviewToken() != token) return;\n m_presented_result = token;\n Q_EMIT reviewReady();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A definite fee-bump refusal is reported as uncertainqml/walletbump.cpp | still_present | AssessmentThe new-head commit path still maps a false commitBumpTransaction return to Error::Commit. No supplied change establishes that the UI now treats that definite refusal as Failed or NeedsRevalidation rather than Uncertain. new_source: qml/walletbump.cpp [
{
"bounded": true,
"end_line": 228,
"evidence_id": "63a9a7fc476b43528c45005a0ed5417d",
"finding_id": "finding:8",
"kind": "new_source",
"line": 169,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/walletbump.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 17,
"source_job_id": 3096,
"text": " if (!passphrase) { result.error = Error::NeedsUnlock; return finishAfterRelock(); }\n relock_required = true;\n if (!wallet.unlock(*passphrase)) { relock_required = false; result.error = Error::IncorrectPassphrase; return finishAfterRelock(); }\n }\n CMutableTransaction signed_tx{review.transaction};\n // An external signer helper failure throws before any commit. It is a\n // definite signing failure, not an uncertain replacement outcome.\n bool signed_replacement{false};\n try { signed_replacement = wallet.signBumpTransaction(signed_tx); } catch (...) {}\n if (!signed_replacement) { result.error = Error::Sign; return finishAfterRelock(); }\n if (!MatchesUnsignedTransaction(review.transaction, signed_tx)) { result.error = Error::Changed; return finishAfterRelock(); }\n if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n }\n if (const auto scope_error = CheckApprovedScope(wallet, review); scope_error != Error::None) {\n result.error = scope_error; return finishAfterRelock();\n }\n // No further key operation is needed. Restore authorization before\n // commit, and never publish a successful spend with failed restoration.\n restoreWalletLock(); passphrase.reset();\n if (result.relock_failed) return result;\n if (services.admission) {\n const auto exact = MakeTransactionRef(signed_tx);\n const auto decision = psbtpolicy::Evaluate(services.admission(exact, review.new_fee));\n if (decision.state == psbtpolicy::State::Blocked) {\n result.error = Error::Policy;\n result.message = decision.explanation;\n return result;\n }\n }\n std::vector<bilingual_str> errors;\n Txid txid;\n const CTransaction exact{signed_tx};\n result.candidate_txid = exact.GetHash();\n result.candidate_wtxid = exact.GetWitnessHash();\n result.commit_attempted = true;\n if (!wallet.commitBumpTransaction(review.original, std::move(signed_tx), errors, txid)) {\n result.error = Error::Commit; result.message = Message(errors); return result;\n }\n result.txid = txid;\n result.committed = true;\n Observe(wallet, result);\n } catch (const secretinput::Failure&) {\n result.error = Error::Invalid; result.message = QObject::tr(\"The wallet password could not be prepared. No fee bump was submitted.\");\n } catch (...) { result.error = Error::Uncertain; }\n return finishAfterRelock();\n}\nCommit ObserveOutcome(interfaces::Wallet& wallet, const Commit& original)\n{\n auto result = original;\n result.record = Record::Unknown;\n result.submission = Submission::Unknown;\n if (!original.commit_attempted || original.candidate_txid == Txid{}) return result;\n result.txid = original.candidate_txid;\n Observe(wallet, result, true);\n // Observing a record cannot manufacture the original call's missing\n // persistence/replacement-metadata receipt. Keep its uncertainty explicit.\n return result;\n}\n} // namespace walletbump",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The cluster check can override successful replacement admissionqml/psbtpolicy.cpp | addressed | AssessmentEvaluate now allows successful exact testmempoolaccept admission to supersede a failing addition-only chain-limit check. The supplied test covers that case and confirms unknown admission remains blocked. path_diff: qml/psbtpolicy.cpp [
{
"evidence_id": "2a473c2e6ab044c09a8a64b833c63db4",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/psbtpolicy.cpp",
"source_generation": 17,
"source_job_id": 3096,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex dac47edbc0..3cd08b0509 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -25,15 +25,16 @@\n namespace {\n QString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n \n-void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n+void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts, bool enforce_raw_fee_cap)\n {\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- // The same fee-rate cap that submission passes to broadcastTransaction.\n- parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n+ // Raw PSBT broadcasts pass MAX_FEE_RATE to broadcastTransaction; wallet\n+ // sends and fee bumps already checked the wallet's own -maxtxfee limit.\n+ parameters.push_back(enforce_raw_fee_cap ? ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()) : UniValue{0});\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -99,12 +100,12 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n }\n } // namespace\n \n-psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n+psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain, bool enforce_raw_fee_cap)\n {\n- return [node, chain](CTransactionRef transaction, CAmount fee) {\n+ return [node, chain, enforce_raw_fee_cap](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n- facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n+ facts.within_fee_cap = !enforce_raw_fee_cap || !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -142,7 +143,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n- ReadAdmission(*node, *transaction, facts);\n+ ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n@@ -162,7 +163,10 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (facts.immature_inputs) return {State::Blocked, Tr(\"An input spends an immature coinbase output. Refresh the review after more blocks.\")};\n if (!facts.final) return {State::Blocked, Tr(\"The transaction lock time is not final at the observed chain tip.\")};\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n- if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n+ // checkChainLimits does not account for conflicting transactions a\n+ // replacement would evict; when testmempoolaccept already allowed this\n+ // exact transaction, do not override it with the non-RBF chain check.\n+ if (!facts.chain_limits && facts.admission != Admission::Allowed) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The request editor no longer offers bare-address copyingqml/components/ReceiveEditorFields.qml | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Close leaves the inline Receive editor unable to saveqml/components/ReceiveRequestEditorCard.qml | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A refused receive type stays hidden after its capability changesqml/walletopening.cpp | still_present | AssessmentThe new-head code still inserts refused address types into the unavailable set, and preferredReceiveType continues to consult that set without invalidation in the supplied excerpt. new_source: qml/walletopening.cpp [
{
"bounded": true,
"end_line": 658,
"evidence_id": "cc8d880028c74f21801cb7f2b2cfd7b8",
"finding_id": "finding:3",
"kind": "new_source",
"line": 509,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/walletopening.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 17,
"source_job_id": 3096,
"text": " m_pending.rescan |= transactions;\n if (transactions) m_pending.transaction_revision = m_transaction_revision;\n m_retry_after = m_clock() + std::chrono::seconds{std::min(30U, 1U << m_refresh_failures)};\n m_refresh_failures = std::min(5U, m_refresh_failures + 1);\n }\n Update update; update.failed = true; publish(std::move(update));\n}\n\nOutputType Session::preferredReceiveType(interfaces::Wallet& wallet) const\n{\n const auto saved = m_preferences.read ? m_preferences.read(wallet.getWalletName()) : std::string{};\n const auto parsed = ParseOutputType(saved);\n // A saved choice wins, then an explicit -addresstype, then Taproot, the\n // app's own default (#932, #1137). Core's implicit default is not used.\n const OutputType preferred = parsed ? *parsed\n : gArgs.IsArgSet(\"-addresstype\") ? wallet.getDefaultAddressType()\n : wallet.taprootEnabled() ? OutputType::BECH32M : wallet.getDefaultAddressType();\n std::lock_guard lock{m_receive_types_mutex};\n if (!m_unavailable_receive_types.contains(preferred)) return preferred;\n // #1088: fall back in the order Receive lists types. Without a Core\n // capability query, a type is only known unavailable once it has failed.\n for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n if (type == OutputType::BECH32M && !wallet.taprootEnabled()) continue;\n if (!m_unavailable_receive_types.contains(type)) return type;\n }\n return preferred;\n}\n\nvoid Session::markReceiveTypeUnavailable(OutputType type)\n{\n std::lock_guard lock{m_receive_types_mutex};\n m_unavailable_receive_types.insert(type);\n}\n\nstd::vector<std::string> Session::unavailableReceiveTypes() const\n{\n std::lock_guard lock{m_receive_types_mutex};\n std::vector<std::string> ids;\n ids.reserve(m_unavailable_receive_types.size());\n for (const OutputType type : m_unavailable_receive_types) ids.push_back(FormatOutputType(type));\n return ids;\n}\n\nexecution::SubmitResult Session::setReceivePreference(std::string type, std::shared_ptr<const Action> original, std::function<void(bool)> done)\n{\n if (type != \"bech32m\" && type != \"bech32\" && type != \"p2sh-segwit\" && type != \"legacy\") return {{}, execution::Rejection::Invalid};\n if (original && original->identity() != identity()) return {{}, execution::Rejection::Invalid};\n const auto revision = ++m_preference_revision;\n const auto self = shared_from_this();\n const auto work = [self, type](interfaces::Wallet& wallet) {\n const bool supported = type != \"bech32m\" || wallet.taprootEnabled();\n const bool persisted = supported && self->m_preferences.write && self->m_preferences.write(wallet.getWalletName(), type);\n auto metadata = ReadMetadata(wallet, self->m_preferences, self->unavailableReceiveTypes());\n const bool saved = persisted && metadata.receive_preference == type;\n return std::pair{std::move(metadata), saved};\n };\n const auto complete = [self, revision, done](std::pair<Metadata, bool> result) {\n const bool saved = result.second;\n Update update; update.metadata = std::move(result.first); update.preference_saved = result.second; update.preference_revision = revision;\n update.phase = self->m_state.phase(); update.question = self->m_state.question();\n self->publish(std::move(update));\n try { if (done) done(saved); } catch (...) { }\n };\n const auto failed = [self, revision, done](std::exception_ptr) {\n Update update; update.preference_saved = false; update.preference_revision = revision;\n update.phase = self->m_state.phase(); update.question = self->m_state.question();\n self->publish(std::move(update));\n try { if (done) done(false); } catch (...) { }\n };\n const auto submitted = original ? perform(original, work, complete, failed)\n : read(work, complete, failed, execution::WorkClass::Action);\n if (!submitted) {\n Update update; update.preference_saved = false; update.preference_revision = revision;\n publish(std::move(update));\n }\n return submitted;\n}\n\nvoid Session::refreshed(Metadata metadata, Update events)\n{\n Transactions consumer;\n { std::lock_guard lock{m_mutex}; m_refresh_pending = false; m_refresh_failures = 0; m_retry_after = {}; consumer = m_transactions_consumer; }\n if (!available()) return;\n if (consumer && (!events.transactions.empty() || events.rescan)) consumer(events.transaction_revision, events.transactions, events.rescan);\n events.metadata = std::move(metadata);\n events.phase = m_state.phase();\n events.question = m_state.question();\n publish(std::move(events));\n scheduleRefresh();\n}\n\nvoid Session::publishState()\n{\n Update update;\n update.phase = m_state.phase();\n update.question = m_state.question();\n publish(std::move(update));\n}\n\nvoid Session::publish(Update update)\n{\n bool notify;\n {\n std::lock_guard lock{m_mutex};\n if (m_latest) {\n update.transaction_revision = std::max(update.transaction_revision, m_latest->transaction_revision);\n if (!update.metadata) update.metadata = std::move(m_latest->metadata);\n if (!update.preference_saved) {\n update.preference_saved = m_latest->preference_saved;\n update.preference_revision = m_latest->preference_revision;\n }\n for (const auto& [id, change] : m_latest->transactions) {\n if (update.transactions.size() < 256) update.transactions.try_emplace(id, change);\n else update.rescan = true;\n }\n update.addresses |= m_latest->addresses;\n update.status |= m_latest->status;\n update.rescan |= m_latest->rescan;\n update.unloaded |= m_latest->unloaded;\n update.failed |= m_latest->failed;\n }\n if (m_closed->load()) {\n update.phase = m_drained.load() ? Phase::Closed : Phase::Closing;\n update.question.reset();\n }\n m_latest = std::move(update);\n notify = !std::exchange(m_notice_pending, true);\n }\n if (notify) m_notify();\n}\n\nstd::optional<Update> Session::take()\n{\n std::lock_guard lock{m_mutex};\n m_notice_pending = false;\n return std::exchange(m_latest, {});\n}\n\nvoid Session::acknowledgeTransactions()\n{\n std::lock_guard lock{m_mutex};\n if (!m_refresh_pending && m_pending.transactions.empty() && !m_pending.rescan &&\n (!m_latest || (m_latest->transactions.empty() && !m_latest->rescan))) m_transactions_pending = false;\n}\nSession::Preferences ChainPreferences(interfaces::Chain& chain)\n{\n return {\n [&chain](const std::string& name) {\n const auto values = chain.getRwSetting(\"qml_receive_address_types\");\n const auto& value = values[name];",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | PSBT file import no longer matches the export size limitqml/paymentimport.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The new import-source diagnostics bypass translationqml/paymentimport.cpp | still_present | AssessmentThe new-head import diagnostics remain constructed with QStringLiteral, including the malformed-PSBT message; no translation change is shown. new_source: qml/paymentimport.cpp [
{
"bounded": true,
"end_line": 220,
"evidence_id": "87e0556f01224fd9805d2305e8efd681",
"finding_id": "finding:17",
"kind": "new_source",
"line": 71,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/paymentimport.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 17,
"source_job_id": 3096,
"text": " }\n Inspection result;\n result.field = input.field;\n result.source_identity = QString::fromLatin1(QCryptographicHash::hash(bytes, QCryptographicHash::Sha256).toHex()) + QLatin1Char(':') +\n QString::fromLatin1(QCryptographicHash::hash(identity_path.toUtf8(), QCryptographicHash::Sha256).toHex());\n const auto text = QString::fromUtf8(bytes).trimmed();\n if (text.startsWith(QStringLiteral(\"bitcoin:\"), Qt::CaseInsensitive)) {\n const auto payment = BitcoinUri::Parse(text);\n if (!payment.success) return Invalid(payment.error);\n if (payment.address.size() > 1024 || payment.label.size() > senddraft::Limits::note ||\n payment.message.size() > senddraft::Limits::message) return Invalid(QStringLiteral(\"The payment request metadata is too large.\"));\n result.kind = Kind::Payment;\n result.payment.address = payment.address;\n result.payment.label = payment.label;\n result.payment.message = payment.message;\n if (payment.has_amount) result.payment.amount = payment.amount_sats;\n result.payment_identity = PaymentIdentity(result.payment);\n // Public URI fields never manufacture a user-authored private note.\n return result;\n }\n const auto raw = DecodeRawPSBT(std::as_bytes(std::span{bytes.constData(), static_cast<size_t>(bytes.size())}));\n auto document = raw ? std::optional<PartiallySignedTransaction>{*raw} : std::nullopt;\n if (!document) {\n const auto decoded = DecodeBase64PSBT(text.toStdString());\n if (decoded) document = *decoded;\n }\n if (!document) return Invalid(QStringLiteral(\"The source is not a supported payment request or PSBT.\"));\n const auto transaction = document->GetUnsignedTx();\n if (!transaction || transaction->vin.empty() || transaction->vout.empty() ||\n document->inputs.size() != transaction->vin.size() || document->outputs.size() != transaction->vout.size())\n return Invalid(QStringLiteral(\"The PSBT is malformed.\"));\n auto parsed = std::make_shared<psbtwork::Snapshot>();\n parsed->document = std::make_shared<const PartiallySignedTransaction>(std::move(*document));\n result.kind = Kind::Psbt;\n result.psbt = std::move(parsed);\n return result;\n}\n\nInspection AnalyzeSource(const Inspection& source, const psbtfee::Lookup& lookup)\n{\n if (source.kind != Kind::Psbt || !source.psbt || !source.psbt->document) return Invalid(QStringLiteral(\"No PSBT is available for inspection.\"));\n psbtwork::Request request;\n request.kind = psbtwork::Kind::Inspect;\n request.document = source.psbt->document;\n psbtwork::Context context; context.lookup = lookup;\n const auto analyzed = psbtwork::Execute(nullptr, std::move(request), context);\n if (!analyzed.snapshot) return Invalid(analyzed.error.isEmpty() ? QStringLiteral(\"The PSBT could not be inspected.\") : analyzed.error);\n auto result = source;\n result.psbt = analyzed.snapshot;\n return result;\n}\n\nstruct Owner::Reply {\n std::optional<Target> target;\n std::optional<ChildReply> child;\n std::exception_ptr error;\n};\nstruct Owner::Delivery {\n struct Cell {\n std::mutex mutex;\n bool ready{false};\n Reply reply;\n };\n std::shared_ptr<Cell> cell;\n std::shared_ptr<void> outcome;\n ReplyKind kind;\n std::optional<Child> child;\n uint64_t identity{0}, source{0}, target{0};\n void complete(Reply value)\n {\n std::shared_ptr<void> release;\n {\n std::lock_guard lock{cell->mutex};\n if (!cell->ready) {\n cell->reply = std::move(value);\n cell->ready = true;\n release = std::move(outcome);\n }\n }\n release.reset();\n }\n};\nstruct Owner::State {\n Flow flow;\n std::shared_ptr<const Input> input;\n std::shared_ptr<const Inspection> inspection;\n std::shared_ptr<const TargetPort> target;\n std::shared_ptr<const ChildReply> result;\n std::map<uint64_t, std::shared_ptr<Delivery>> deliveries;\n uint64_t sequence{0}, target_sequence{0}, delivery_sequence{0}, query_delivery{0};\n size_t native_jobs{0};\n QString error;\n bool closing{false}, retired{false}, wake_pending{false}, use_requested{false};\n std::chrono::steady_clock::time_point retry_at{};\n};\nOwner::Owner(uint64_t identity, Services services, Notify notify, Retired retired, std::shared_ptr<State> state)\n : m_identity(identity), m_services(std::move(services)),\n m_outcomes(std::make_shared<execution::ValueCleanupQueue>(m_services.outcomes)), m_notify(std::move(notify)),\n m_retired(std::move(retired)), m_state(std::move(state)) {}\n\nstd::shared_ptr<Owner> Owner::Create(uint64_t identity, Services services, Notify notify, Retired retired)\n{\n if (!identity || !services.reads || !services.outcomes) return {};\n if (!services.read) services.read = ReadSource;\n if (!services.analyze) services.analyze = [](const Inspection& source) { return AnalyzeSource(source); };\n if (!services.now) services.now = std::chrono::steady_clock::now;\n auto owner = std::shared_ptr<Owner>{new Owner(identity, std::move(services), std::move(notify),\n std::move(retired), std::make_shared<State>())};\n auto closing = std::make_shared<std::shared_ptr<Owner>>();\n auto reservation = owner->m_outcomes->hold([closing] {\n if (*closing) (*closing)->closeOnQueue();\n });\n if (!reservation) return owner;\n owner->m_post_close = [closing, reservation = std::move(reservation)](auto self) mutable {\n *closing = std::move(self);\n reservation.reset();\n };\n return owner;\n}\n\nexecution::SubmitResult Owner::submit(std::function<void()> decision)\n{\n auto run = [self = shared_from_this(), decision = std::move(decision)] {\n decision(); self->publish();\n };\n const bool accepted = m_services.outcomes->post(std::move(run));\n return {{}, accepted ? execution::Rejection::None : execution::Rejection::Transport};\n}\n\nvoid Owner::publish()\n{\n auto& state = *m_state;\n Snapshot snapshot;\n snapshot.sequence = ++state.sequence; snapshot.owner = m_identity; snapshot.source = state.flow.source();\n snapshot.phase = state.flow.phase(); snapshot.kind = state.flow.kind(); snapshot.error_code = state.flow.error();\n snapshot.error = state.error; snapshot.target = state.flow.target(); snapshot.prompt = state.flow.prompt();\n snapshot.result = state.flow.result(); snapshot.inspection = state.inspection; snapshot.child_result = state.result;\n snapshot.pending = state.flow.pending() || state.native_jobs || !state.deliveries.empty();\n if (snapshot.phase == Phase::Closed && snapshot.pending) snapshot.phase = Phase::Closing;\n snapshot.can_apply = state.flow.canApply(); snapshot.can_review = state.flow.canReview();\n snapshot.can_export = state.flow.canExport(); snapshot.can_reconcile = state.flow.canReconcile();\n try { if (m_notify) m_notify(std::move(snapshot)); } catch (...) {}\n if (state.flow.phase() == Phase::Closed && !state.native_jobs && state.deliveries.empty() && !state.retired) {\n state.retired = true;\n state.target.reset();\n state.result.reset();\n state.input.reset();\n state.inspection.reset();\n if (m_retired) m_retired(m_identity);\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The captured passphrase buffer is released without cleansingqml/secretinput.h | still_present | AssessmentThe new-head Input still stores the retained text as const QString and declares no cleansing-on-release behavior. new_source: qml/secretinput.h [
{
"bounded": true,
"end_line": 50,
"evidence_id": "0357f1a333e74ac090c3ffe493e1807b",
"finding_id": "finding:16",
"kind": "new_source",
"line": 4,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/secretinput.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 17,
"source_job_id": 3096,
"text": "#ifndef BITCOIN_QML_SECRETINPUT_H\n#define BITCOIN_QML_SECRETINPUT_H\n#include <support/allocators/secure.h>\n#include <QString>\n#include <cstddef>\n#include <exception>\n#include <functional>\n#include <memory>\n#include <utility>\n\nnamespace walletopening { class Session; }\n\nnamespace secretinput {\nenum class Error { None, Unavailable, TransportBudget, Materialization };\nclass Failure final : public std::exception {\npublic:\n explicit Failure(Error error) : m_error(error) {}\n Error error() const noexcept { return m_error; }\n const char* what() const noexcept override { return \"The secret input could not be materialized\"; }\nprivate:\n Error m_error;\n};\n// Immutable Qt-native editor handoff. All UTF8 allocation/conversion, cleansing\n// and retirement run inside the original Native action, never on GUI.\nclass Input final {\npublic:\n Input(QString text, size_t bytes);\n size_t bytes() const { return m_bytes; }\n SecureString materialize() const;\nprivate:\n const QString m_text;\n const size_t m_bytes;\n};\nusing Captured = std::shared_ptr<const Input>;\nstruct CaptureResult {\n Captured input;\n Error error{Error::None};\n size_t bytes{0};\n explicit operator bool() const { return bool(input) && error == Error::None; }\n};\n// O(1) metadata admission. result.bytes is the retained secret's accounted size.\nCaptureResult Capture(const std::function<std::shared_ptr<void>(std::function<void()>)>& hold, const QString& text);\nCaptureResult Capture(const std::shared_ptr<walletopening::Session>& opening, const QString& text);\nsize_t Bytes(const Captured& input);\nSecureString Materialize(const Captured& input);\n}\n#endif // BITCOIN_QML_SECRETINPUT_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Console redaction still retains importdescriptors private keysqml/models/rpccommandexecutor.cpp | still_present | AssessmentThe new-head HISTORY_FILTER still omits importdescriptors, and its comment still claims the app adds addhdkey protection. The reported redaction and comment issues remain. new_source: qml/models/rpccommandexecutor.cpp [
{
"bounded": true,
"end_line": 150,
"evidence_id": "9c8785d9aa57494abc862342407d2385",
"finding_id": "finding:15",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/models/rpccommandexecutor.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 17,
"source_job_id": 3096,
"text": "// Copyright (c) 2011-2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n//\n// Portions of this file are ported from src/qt/rpcconsole.cpp.\n\n#include <qml/models/rpccommandexecutor.h>\n\n#include <interfaces/node.h>\n#include <rpc/client.h>\n#include <univalue.h>\n#include <util/strencodings.h>\n\n#include <cassert>\n#include <stdexcept>\n#include <string>\n#include <utility>\n#include <vector>\n#include <optional>\n\n#include <QStringList>\n#include <QUrl>\n#include <QCoreApplication>\n\nnamespace {\n\n// Redact arguments before storing either request output or recall history.\n// Keep the pinned Qt Widgets historyFilter policy, plus addhdkey's private key.\n// The parity regression requires an explicit review when Core's policy changes.\nconst QStringList HISTORY_FILTER = QStringList()\n << \"addhdkey\"\n << \"createwallet\"\n << \"createwalletdescriptor\"\n << \"migratewallet\"\n << \"signmessagewithprivkey\"\n << \"signrawtransactionwithkey\"\n << \"walletpassphrase\"\n << \"walletpassphrasechange\"\n << \"encryptwallet\";\n\n} // namespace\n\nstruct RpcCommandExecutor::Plan {\n struct Argument {\n std::string literal;\n std::optional<size_t> result;\n std::vector<std::string> queries;\n };\n std::vector<std::vector<Argument>> calls;\n Argument result;\n std::string filtered;\n};\n\nconst std::string& RpcCommandExecutor::Prepared::filtered() const { return m_plan->filtered; }\n\nstd::optional<RpcCommandExecutor::Prepared> RpcCommandExecutor::Prepare(const std::string& strCommand)\n{\n auto plan = std::make_shared<Plan>();\n std::vector<std::vector<Plan::Argument>> stack;\n stack.emplace_back();\n\n enum CmdParseState {\n STATE_EATING_SPACES,\n STATE_EATING_SPACES_IN_ARG,\n STATE_EATING_SPACES_IN_BRACKETS,\n STATE_ARGUMENT,\n STATE_SINGLEQUOTED,\n STATE_DOUBLEQUOTED,\n STATE_ESCAPE_OUTER,\n STATE_ESCAPE_DOUBLEQUOTED,\n STATE_COMMAND_EXECUTED,\n STATE_COMMAND_EXECUTED_INNER\n } state = STATE_EATING_SPACES;\n\n std::string curarg;\n Plan::Argument last_result;\n unsigned nDepthInsideSensitive = 0;\n size_t filter_begin_pos = 0, chpos;\n std::vector<std::pair<size_t, size_t>> filter_ranges;\n\n auto add_to_current_stack = [&](const std::string& strArg) {\n if (stack.empty()) throw std::runtime_error(\"Invalid Syntax\");\n if (stack.back().empty() && (!nDepthInsideSensitive) &&\n HISTORY_FILTER.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) {\n nDepthInsideSensitive = 1;\n filter_begin_pos = chpos;\n }\n stack.back().push_back({strArg, {}, {}});\n };\n\n auto close_out_params = [&]() {\n if (nDepthInsideSensitive) {\n if (!--nDepthInsideSensitive) {\n // filter_begin_pos is set to chpos at the delimiter *after* the\n // sensitive command name, which is always > 0 (at minimum the\n // opening paren or space character follows the name).\n assert(filter_begin_pos);\n filter_ranges.emplace_back(filter_begin_pos, chpos);\n filter_begin_pos = 0;\n }\n }\n stack.pop_back();\n };\n\n std::string strCommandTerminated = strCommand;\n if (strCommandTerminated.empty() || strCommandTerminated.back() != '\\n')\n strCommandTerminated += '\\n';\n\n for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos) {\n char ch = strCommandTerminated[chpos];\n switch (state) {\n case STATE_COMMAND_EXECUTED_INNER:\n case STATE_COMMAND_EXECUTED: {\n bool breakParsing = true;\n switch (ch) {\n case '[':\n curarg.clear();\n state = STATE_COMMAND_EXECUTED_INNER;\n break;\n default:\n if (state == STATE_COMMAND_EXECUTED_INNER) {\n if (ch != ']') {\n curarg += ch;\n break;\n }\n if (!curarg.empty()) last_result.queries.push_back(curarg);\n state = STATE_COMMAND_EXECUTED;\n break;\n }\n breakParsing = false;\n\n close_out_params();\n\n if (!stack.empty()) stack.back().push_back(last_result);\n else plan->result = last_result;\n curarg.clear();\n state = STATE_EATING_SPACES;\n }\n if (breakParsing)\n break;\n [[fallthrough]];\n }\n case STATE_ARGUMENT:\n case STATE_EATING_SPACES_IN_ARG:\n case STATE_EATING_SPACES_IN_BRACKETS:\n case STATE_EATING_SPACES:\n switch (ch) {\n case '\"':\n state = STATE_DOUBLEQUOTED;\n break;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The new threads drop the documented macOS stack safeguardqml/executor.cpp | still_present | AssessmentThe new Worker still starts its thread with plain std::thread construction and shows no macOS stack-size safeguard. The supplied diff adds no equivalent sizing. new_source: qml/executor.cpp [
{
"bounded": true,
"end_line": 150,
"evidence_id": "c6155905f37c4963bcbc2658dcf4f1bc",
"finding_id": "finding:10",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"path": "qml/executor.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 17,
"source_job_id": 3096,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/executor.h>\n\n#include <qml/execution.h>\n\n#include <algorithm>\n#include <atomic>\n#include <cassert>\n#include <condition_variable>\n#include <deque>\n#include <mutex>\n#include <thread>\n#include <utility>\n#include <vector>\n\nnamespace execution {\nnamespace {\nusing Callback = std::function<void()>;\n\nclass Worker\n{\npublic:\n Worker() : m_thread([this] { run(); }) {}\n ~Worker()\n {\n close();\n join();\n }\n\n bool post(Callback callback)\n {\n {\n std::lock_guard lock{m_mutex};\n if (m_closed) return false;\n m_tasks.push_back(std::move(callback));\n }\n m_ready.notify_one();\n return true;\n }\n\n void close()\n {\n {\n std::lock_guard lock{m_mutex};\n m_closed = true;\n }\n m_ready.notify_one();\n }\n\n void join()\n {\n if (m_thread.joinable()) m_thread.join();\n }\n\nprivate:\n void run()\n {\n for (;;) {\n Callback callback;\n {\n std::unique_lock lock{m_mutex};\n m_ready.wait(lock, [this] { return m_closed || !m_tasks.empty(); });\n if (m_tasks.empty()) return;\n callback.swap(m_tasks.front());\n m_tasks.pop_front();\n }\n callback();\n }\n }\n\n std::mutex m_mutex;\n std::condition_variable m_ready;\n std::deque<Callback> m_tasks;\n bool m_closed{false};\n std::thread m_thread;\n};\n\nstruct Workers {\n Worker core, priority, rpc, io, signer, cleanup;\n\n bool post(Lane lane, UtilityWorker utility, Callback callback)\n {\n switch (lane) {\n case Lane::Core: return core.post(std::move(callback));\n case Lane::Priority: return priority.post(std::move(callback));\n case Lane::Rpc: return rpc.post(std::move(callback));\n case Lane::Utility:\n switch (utility) {\n case UtilityWorker::IO: return io.post(std::move(callback));\n case UtilityWorker::Signer: return signer.post(std::move(callback));\n case UtilityWorker::Cleanup: return cleanup.post(std::move(callback));\n }\n return false;\n case Lane::Domain:\n case Lane::Control:\n case Lane::Cleanup: return false;\n }\n return false;\n }\n\n void stopAndJoin()\n {\n for (auto* worker : {&core, &priority, &rpc, &io, &signer, &cleanup}) worker->close();\n for (auto* worker : {&core, &priority, &rpc, &io, &signer, &cleanup}) worker->join();\n }\n};\n} // namespace\n\nstruct SerialQueue::State : std::enable_shared_from_this<SerialQueue::State> {\n State(Executor::Dispatch dispatch, Lane lane, UtilityWorker utility)\n : dispatch(std::move(dispatch)), lane(lane), utility(utility) {}\n\n void run()\n {\n {\n std::lock_guard lock{mutex};\n admission = nullptr;\n }\n changed.notify_all();\n\n for (;;) {\n Callback task;\n std::vector<Callback> ready;\n {\n std::lock_guard lock{mutex};\n if (tasks.empty()) {\n active = false;\n ready = takeListeners();\n } else {\n task.swap(tasks.front());\n tasks.pop_front();\n }\n }\n if (!task) {\n changed.notify_all();\n notify(std::move(ready));\n return;\n }\n // Destroy captures before the next idle check, outside the mutex.\n task();\n task = {};\n {\n std::lock_guard lock{mutex};\n if (tasks.empty()) continue;\n }\n // An inline dispatcher resumes this loop without growing the stack.\n static thread_local State* posting{};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Wallet sends and Speed Up ignore raised fee limitsqml/walletsend.cpp | unclear | AssessmentThe follow-up assessment was invalid: follow-up evidence belongs to another finding or comparison. invalid_assessment Source report · 02bca021a086..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1146 | Small Receive commands perform an unnecessary full pre-scanqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe new-head execute() still unconditionally calls read(node) before dispatching the command, so the reported full pre-scan remains for the small Receive commands. new_source: qml/models/walletstatesnapshot.cpp [
{
"bounded": true,
"end_line": 441,
"evidence_id": "704a42182e514b099d7f9ff2fab56645",
"finding_id": "finding:9",
"kind": "new_source",
"line": 298,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": " } catch (...) {\n // Persistence may already have succeeded. Keep its result and ID\n // so retrying the refresh cannot create another request.\n result.refresh_error = Tr(\"Wallet information could not be refreshed. It will be retried.\");\n }\n return std::move(result);\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n if (command.passphrase) {\n const auto unlocked = TryUnlockWithPassphrase(*m_wallet, *command.passphrase);\n command.passphrase.reset();\n if (unlocked == WalletUnlockResult::IncorrectPassphrase) {\n result.error = Tr(\"The wallet password you entered was incorrect.\");\n return finish();\n }\n relock = unlocked == WalletUnlockResult::UnlockedNowRelockRequired;\n }\n WalletRelockGuard guard{*m_wallet, [] {}, relock};\n // Release cs_wallet before settings I/O and before relocking, which takes the relock mutex first.\n std::unique_ptr<UniqueLock<RecursiveMutex>> wallet_lock;\n if (command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) {\n if (auto* wallet = m_wallet->wallet()) {\n wallet_lock = std::make_unique<UniqueLock<RecursiveMutex>>(wallet->cs_wallet, \"wallet->cs_wallet\", __FILE__, __LINE__);\n }\n }\n auto state = read(node);\n auto complete = [&] {\n wallet_lock.reset();\n guard.relock();\n if (unlock_session) unlock_session.unlock();\n return finish();\n };\n QSettings settings;\n const auto address_key = settingsKey();\n const auto type_text = command.address_type.isEmpty() ? state.receive_address_type : command.address_type;\n const auto type = ParseOutputType(type_text.toStdString());\n auto new_address = [&](const std::string& label) -> QString {\n if (!type || !SupportsType(state, *type)) {\n result.error = Tr(\"The selected address type is unavailable.\");\n return {};\n }\n const auto destination = m_wallet->getNewDestination(*type, label);\n if (!destination || !IsValidDestination(*destination)) {\n const auto security = ReadSecurityState(*m_wallet);\n result.needs_unlock = security.encrypted && security.locked;\n result.error = result.needs_unlock ? Tr(\"Enter your wallet password to create an address.\") : Tr(\"A receiving address could not be generated. Please try again.\");\n return {};\n }\n return Address(*destination);\n };\n const auto saved_address = [&](const QString& address) {\n return std::any_of(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& entry) {\n return entry.recipient.address == address.toStdString();\n });\n };\n if (command.kind == ReceiveCommand::Kind::EnsureAddress) {\n auto address = command.address.isEmpty() ? settings.value(address_key).toString() : command.address;\n const auto destination = DecodeDestination(address.toStdString());\n wallet::AddressPurpose purpose{};\n const auto old_type = AddressType(destination);\n if (command.next || !IsValidDestination(destination) || !m_wallet->getAddress(destination, nullptr, &purpose) || purpose != wallet::AddressPurpose::RECEIVE || m_observed_addresses.contains(address) || saved_address(address) || (!command.address_type.isEmpty() && (!old_type || !type || *old_type != *type))) {\n address = new_address({});\n }\n if (address.isEmpty()) return complete();\n wallet_lock.reset();\n settings.setValue(address_key, address);\n settings.sync();\n if (settings.status() != QSettings::NoError || !setAddressType(node, type_text)) result.error = Tr(\"The receiving address preference could not be saved.\");\n else { result.receiving_address = address; result.success = true; }\n } else if (command.kind == ReceiveCommand::Kind::Save) {\n auto entry = command.entry;\n if (!MoneyRange(entry.recipient.amount)) { result.error = Tr(\"The request amount is invalid.\"); return complete(); }\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == entry.id; });\n if (entry.id != 0) {\n if (existing == state.receive_requests.end() || existing->recipient.address != entry.recipient.address) { result.error = Tr(\"The payment request is no longer available.\"); return complete(); }\n entry.payment_received = existing->payment_received;\n entry.date = existing->date;\n if (entry.payment_received && (entry.recipient.amount != existing->recipient.amount || entry.recipient.label != existing->recipient.label || entry.recipient.message != existing->recipient.message)) { result.error = Tr(\"A paid payment request cannot be changed.\"); return complete(); }\n } else {\n if (command.reserve_receiving_address && (entry.recipient.address.empty() || m_observed_addresses.contains(QString::fromStdString(entry.recipient.address)))) { result.error = Tr(\"This address has received a payment. Create a new receiving address.\"); return complete(); }\n if (command.reserve_receiving_address && saved_address(QString::fromStdString(entry.recipient.address))) { result.error = Tr(\"This address already belongs to a saved request. Create a new receiving address.\"); return complete(); }\n int64_t maximum{0};\n for (const auto& item : state.receive_requests) maximum = std::max(maximum, item.id);\n if (maximum >= std::numeric_limits<unsigned int>::max()) { result.error = Tr(\"No more payment requests can be saved.\"); return complete(); }\n entry.id = maximum + 1;\n entry.date = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch());\n if (entry.recipient.address.empty()) entry.recipient.address = new_address(entry.recipient.noteSelf).toStdString();\n if (entry.recipient.address.empty()) return complete();\n if (command.note_is_prefill) {\n std::string label;\n if (m_wallet->getAddress(DecodeDestination(entry.recipient.address), &label, nullptr)) entry.recipient.noteSelf = label;\n }\n }\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(entry.recipient.address), util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) { result.error = Tr(\"The payment request could not be saved.\"); return complete(); }\n result.saved_entry = entry;\n result.success = true;\n const auto address = QString::fromStdString(entry.recipient.address);\n std::string old_label_text;\n m_wallet->getAddress(DecodeDestination(entry.recipient.address), &old_label_text, nullptr);\n const auto old_label = QString::fromStdString(old_label_text);\n const auto note = QString::fromStdString(entry.recipient.noteSelf);\n const bool note_changed = existing == state.receive_requests.end() || existing->recipient.noteSelf != entry.recipient.noteSelf;\n if (note_changed && old_label != note && (!note.isEmpty() || (existing != state.receive_requests.end() && old_label.toStdString() == existing->recipient.noteSelf))) {\n if (!m_wallet->setAddressBook(DecodeDestination(entry.recipient.address), entry.recipient.noteSelf, wallet::AddressPurpose::RECEIVE)) result.error = Tr(\"The request was saved, but its address label could not be saved.\");\n }\n wallet_lock.reset();\n if (command.reserve_receiving_address) {\n settings.remove(address_key);\n settings.sync();\n // Harmless once the request is saved, so log it instead of failing.\n if (settings.status() != QSettings::NoError) qWarning() << \"Could not clear the receiving address preference for\" << address_key;\n }\n } else if (command.kind == ReceiveCommand::Kind::Remove) {\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == command.entry.id; });\n result.success = existing != state.receive_requests.end() && m_wallet->setAddressReceiveRequest(DecodeDestination(existing->recipient.address), util::ToString(existing->id), {});\n if (!result.success) result.error = Tr(\"The payment request could not be removed.\");\n } else if (command.kind == ReceiveCommand::Kind::Label) {\n const auto destination = DecodeDestination(command.address.toStdString());\n wallet::AddressPurpose purpose{};\n result.success = IsValidDestination(destination) && m_wallet->getAddress(destination, nullptr, &purpose) && m_wallet->setAddressBook(destination, command.label.toStdString(), purpose);\n if (result.success) {\n for (auto entry : state.receive_requests) {\n if (entry.recipient.address != command.address.toStdString() || entry.recipient.noteSelf == command.label.toStdString()) continue;\n entry.recipient.noteSelf = command.label.toStdString();\n if (!m_wallet->setAddressReceiveRequest(destination, util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) result.error = Tr(\"The address label was saved, but a payment request note could not be saved.\");\n }\n } else result.error = Tr(\"The address label could not be saved.\");\n } else if (command.kind == ReceiveCommand::Kind::AddressType) {\n result.success = type && SupportsType(state, *type) && setAddressType(node, type_text);\n if (!result.success) result.error = Tr(\"The receiving address preference could not be saved.\");\n } else if (command.kind == ReceiveCommand::Kind::RememberAddress) {\n if (command.address.isEmpty()) settings.remove(address_key);\n else settings.setValue(address_key, command.address);\n settings.sync();\n result.success = settings.status() == QSettings::NoError;\n if (!result.success) result.error = Tr(\"The receiving address preference could not be saved.\");\n }\n return complete();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Successful snapshot balance reads are immediately repeatedqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe new-head read() still assigns state.balance from m_wallet->getBalance() after tryGetBalances(), rather than using balances.balance when the try succeeds. new_source: qml/models/walletstatesnapshot.cpp [
{
"bounded": true,
"end_line": 260,
"evidence_id": "fcd2c152b8c747eaa7cd21b00d4bbc6c",
"finding_id": "finding:8",
"kind": "new_source",
"line": 111,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": "{\n CoinLockResult result;\n for (const auto& output : outputs) {\n // RPC changes do not notify the GUI. Apply the requested state even if\n // the last published snapshot already matches it.\n const bool success = locked ? m_wallet->lockCoin(output, true) : m_wallet->unlockCoin(output);\n result.success = success && result.success;\n }\n // A failed database write can still change the in-memory lock state.\n result.snapshot = read(node);\n return result;\n}\n\nQString WalletStateBackend::settingsKey() const\n{\n return QStringLiteral(\"receiveAddressTypes/%1/address\").arg(QString::fromStdString(m_wallet->getWalletName()));\n}\n\nWalletStateSnapshot WalletStateBackend::read(interfaces::Node* node)\n{\n // Capture the wallet's processed tip before reading. If it advances during\n // the scan, the next poll will reconcile again. Failed reads remain dirty.\n m_last_processed_block.reset();\n const uint64_t notification_count = m_notification_count ? m_notification_count->load() : 0;\n interfaces::WalletBalances balances;\n uint256 processed_block;\n const bool have_processed_block = m_wallet->tryGetBalances(balances, processed_block);\n WalletStateSnapshot state;\n state.notification_count = notification_count;\n state.name = QString::fromStdString(m_wallet->getWalletName());\n state.balance = m_wallet->getBalance();\n state.available_balance = m_wallet->getAvailableBalance(wallet::CCoinControl{});\n state.key_scheme = ReadWalletKeyScheme(*m_wallet);\n const auto security = ReadSecurityState(*m_wallet);\n state.encrypted = security.encrypted;\n state.locked = security.locked;\n state.private_keys_disabled = m_wallet->privateKeysDisabled();\n state.external_signer = m_wallet->hasExternalSigner();\n state.can_get_addresses = m_wallet->canGetAddresses();\n state.taproot_enabled = m_wallet->taprootEnabled();\n state.default_address_type = m_wallet->getDefaultAddressType();\n state.dust_relay_fee = node ? node->getDustRelayFee() : CFeeRate{DUST_RELAY_TX_FEE};\n state.receive_address_type = state.taproot_enabled ? QStringLiteral(\"bech32m\") : QStringLiteral(\"bech32\");\n if (node) {\n const auto preferences = node->getPersistentSetting(\"qml_receive_address_types\");\n const auto& saved = preferences[state.name.toStdString()];\n if (saved.isStr()) {\n const auto type = ParseOutputType(saved.get_str());\n if (type && SupportsType(state, *type)) state.receive_address_type = QString::fromStdString(saved.get_str());\n }\n }\n state.addresses = m_wallet->getAddresses();\n std::set<QString> receive_addresses;\n for (const auto& address : state.addresses) {\n const auto text = Address(address.dest);\n state.labels[text] = QString::fromStdString(address.name);\n if (address.is_mine && address.purpose == wallet::AddressPurpose::RECEIVE) receive_addresses.insert(text);\n }\n state.coins = m_wallet->listCoins();\n std::vector<COutPoint> locked;\n m_wallet->listLockedCoins(locked);\n state.locked_coins.insert(locked.begin(), locked.end());\n m_locked_coins = state.locked_coins;\n state.receive_requests = ReceiveRequestHistoryModel::DeserializeEntries(m_wallet->getAddressReceiveRequests());\n std::set<QString> request_addresses;\n for (const auto& request : state.receive_requests) {\n const auto address = QString::fromStdString(request.recipient.address);\n request_addresses.insert(address);\n if (request.payment_received) m_observed_addresses.insert(address);\n }\n std::set<Txid> unconfirmed_payment_txids;\n std::set<COutPoint> change_outputs;\n for (const auto& tx : m_wallet->getWalletTxs()) {\n if (!tx.tx) continue;\n std::map<QString, CAmount> received;\n for (size_t i = 0; i < tx.tx->vout.size(); ++i) {\n if (i < tx.txout_is_change.size() && tx.txout_is_change[i]) change_outputs.emplace(tx.tx->GetHash(), i);\n if (i >= tx.txout_is_mine.size() || !tx.txout_is_mine[i]) continue;\n CTxDestination destination;\n const auto& output = tx.tx->vout[i];\n if (!ExtractDestination(output.scriptPubKey, destination)) continue;\n const auto address = Address(destination);\n if (receive_addresses.contains(address) && (i >= tx.txout_is_change.size() || !tx.txout_is_change[i])) state.used_addresses.insert(address);\n if (output.nValue <= 0) continue;\n m_observed_addresses.insert(address);\n if (request_addresses.contains(address)) received[address] += output.nValue;\n }\n if (received.empty()) continue;\n interfaces::WalletTxStatus status{};\n std::vector<std::string> messages;\n std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int blocks{0};\n m_wallet->getWalletTxDetails(tx.tx->GetHash(), status, messages, payment_requests, in_mempool, blocks);\n const bool replaced = tx.replaced_by_txid.has_value();\n if (status.depth_in_main_chain < 0 || status.is_abandoned || (status.depth_in_main_chain == 0 && (!in_mempool || replaced))) continue;\n if (status.depth_in_main_chain == 0) unconfirmed_payment_txids.insert(tx.tx->GetHash());\n for (const auto& [address, amount] : received) state.received_amounts[address] += amount;\n }\n for (const auto& [ancestor, coins] : state.coins) {\n for (const auto& [outpoint, output] : coins) {\n CTxDestination destination;\n if (!ExtractDestination(output.txout.scriptPubKey, destination)) continue;\n const auto address = Address(destination);\n state.address_balances[address] += output.txout.nValue;\n if (output.txout.nValue > 0 && change_outputs.contains(outpoint)) state.change_addresses.insert(address);\n }\n }\n state.observed_addresses = m_observed_addresses;\n for (auto& request : state.receive_requests) {\n if (request.payment_received || !m_observed_addresses.contains(QString::fromStdString(request.recipient.address))) continue;\n request.payment_received = true;\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(request.recipient.address), util::ToString(request.id), ReceiveRequestHistoryModel::SerializeEntry(request))) {\n state.persistence_error = Tr(\"The received-payment status could not be saved. The address will not be reused.\");\n }\n }\n if (have_processed_block) m_last_processed_block = processed_block;\n state.unconfirmed_payments = !unconfirmed_payment_txids.empty();\n m_unconfirmed_payment_txids = std::move(unconfirmed_payment_txids);\n return state;\n}\n\nstd::optional<WalletStateSnapshot> WalletStateBackend::poll(interfaces::Node* node)\n{\n // A node-tip notification can precede wallet processing, and maturity does\n // not emit a transaction notification. Retry busy wallets on the next poll.\n uint256 processed_block;\n if (auto* wallet = m_wallet->wallet()) {\n // tryGetBalances() would also sum every wallet output; only the block hash is needed here.\n TRY_LOCK(wallet->cs_wallet, locked_wallet);\n if (!locked_wallet) return std::nullopt;\n processed_block = wallet->GetLastBlockHash();\n } else {\n interfaces::WalletBalances balances;\n if (!m_wallet->tryGetBalances(balances, processed_block)) return std::nullopt;\n }\n if (m_last_processed_block != processed_block) return read(node);\n\n // lockunspent does not notify the wallet either.\n std::vector<COutPoint> locked;\n m_wallet->listLockedCoins(locked);\n if (std::set<COutPoint>(locked.begin(), locked.end()) != m_locked_coins) return read(node);\n\n // Mempool eviction need not notify the receiving wallet. Check only the\n // outstanding payments; an unchanged payment must not rebuild every wallet\n // model (and destroy an address label editor) on each timer tick.\n for (const auto& txid : m_unconfirmed_payment_txids) {\n interfaces::WalletTxStatus status{};\n std::vector<std::string> messages;\n std::vector<std::string> payment_requests;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | A successful deletion remains cached when its follow-up read failsqml/models/walletqmlmodel.cpp | still_present | AssessmentIn the new-head completion path, a missing snapshot still restores saved entries but has no successful-Remove handling to remove the deleted request from the cached model. new_source: qml/models/walletqmlmodel.cpp [
{
"bounded": true,
"end_line": 921,
"evidence_id": "59ae529d4d02476d891b1ee3c0fc1d6a",
"finding_id": "finding:7",
"kind": "new_source",
"line": 772,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": " m_backend_executor->submitTask(this,\n [backend, node, command = std::move(command)]() mutable { return backend->execute(node, std::move(command)); },\n [this, held, revision, operation, reserve](BackendExecutor::Outcome<ReceiveCommandResult> outcome) {\n auto* received = std::get_if<0>(&outcome);\n if (!received) {\n m_receive_operation_pending = false;\n m_receive_operation_error = tr(\"The wallet operation failed. Please try again.\");\n if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, false);\n requestWalletStateRefresh();\n return;\n }\n auto& result = *received;\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n std::optional<QmlRecentRequestEntry> saved_entry;\n if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n // The final read can already include a payment that arrived after the write.\n if (saved_entry) {\n if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n if (result.success && result.saved_entry) m_receive_requests->prependOrReplace(*result.saved_entry);\n m_wallet_state_error = result.refresh_error;\n Q_EMIT walletStateChanged();\n requestWalletStateRefresh();\n }\n if (current_request) {\n held->setNeedsUnlock(result.needs_unlock);\n held->setUnlockError(result.error);\n if (result.success && !result.receiving_address.isEmpty()) {\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n if (saved_entry) {\n if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n if (result.success && reserve && result.saved_entry &&\n m_receiving_address->address().toStdString() == result.saved_entry->recipient.address) {\n m_receiving_address->clear();\n }\n if (held && !current_request) {\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }\n if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, result.success);\n if (walletStateRefreshNeeded()) scheduleWalletStateRefresh();\n });\n return true;\n}\n\nvoid WalletQmlModel::beginShutdown(bool remove_wallet)\n{\n if (m_stopping) return;\n m_stopping = true;\n const bool was_available{available()};\n m_unload_requested->store(true);\n if (was_available) Q_EMIT availableChanged();\n m_wallet_poll_timer.stop();\n m_state_refresh_retry_timer.stop();\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n // Move subscriptions into the last backend job. Callback delivery targets\n // the separately retained bridge, never a raw pointer to this model.\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),\n std::move(m_handler_transaction_changed), std::move(m_handler_can_get_addresses_changed), std::move(m_handler_unload));\n if (m_bump_transaction_model) m_bump_transaction_model->detachWallet();\n if (m_imported_psbt_model) m_imported_psbt_model->detachWallet();\n auto wallet = std::move(m_wallet);\n auto backend = std::move(m_wallet_state_backend);\n m_sign_verify_message_model->setWallet({});\n m_sign_verify_message_model->setSecurityStateChangedFn({});\n m_backend_executor->submit(this, [wallet = std::move(wallet), backend = std::move(backend), handlers = std::move(handlers), remove_wallet]() mutable {\n std::apply([](auto&... handler) { ((handler ? handler->disconnect() : void()), ...); }, handlers);\n if (wallet && remove_wallet) wallet->remove();\n }, [] {});\n m_backend_executor->shutdown();\n}\n\nTransactionActivityModel* WalletQmlModel::transactionActivityModel()\n{\n // Instantiate when the activity screen first asks for it.\n if (!m_transaction_activity_model) m_transaction_activity_model = new TransactionActivityModel(this);\n return m_transaction_activity_model;\n}\n\nvoid WalletQmlModel::setNode(interfaces::Node* node)\n{\n m_node = node;\n if (m_imported_psbt_model) {\n m_imported_psbt_model->setNode(node);\n }\n}\n\nvoid WalletQmlModel::initializeFeeEstimator()\n{\n m_fee_estimation_timer = new QTimer(this);\n m_fee_estimation_timer->setSingleShot(true);\n m_fee_estimation_timer->setInterval(FEE_ESTIMATE_DEBOUNCE_MS);\n connect(m_fee_estimation_timer, &QTimer::timeout, this, &WalletQmlModel::requestFeeEstimatesNow);\n}\n\nQString WalletQmlModel::balance() const\n{\n return QmlBitcoinUnits::formatForDisplay(QmlBitcoinUnits::fromDisplayUnit(m_display_unit), m_wallet_state.balance);\n}\n\nqint64 WalletQmlModel::balanceSatoshi() const\n{\n return m_wallet_state.balance;\n}\n\nQString WalletQmlModel::estimatedFee() const\n{\n if (m_custom_fee_enabled) {\n return customFeeRateValid() && m_custom_fee_estimate.has_value()\n ? FormatFeeEstimate(m_custom_fee_estimate->fee)\n : QString{};\n }\n return estimatedFeeForTarget(feeTargetBlocks());\n}\n\nstd::optional<SendFeePreview> WalletQmlModel::selectedFeePreview() const\n{\n if (m_custom_fee_enabled) return customFeeRateValid() ? m_custom_fee_estimate : std::nullopt;\n const auto it = m_fee_estimates.constFind(feeTargetBlocks());\n return it == m_fee_estimates.constEnd() ? std::nullopt : std::make_optional(it.value());\n}\n\nstd::optional<CAmount> WalletQmlModel::selectedFeeEstimate() const\n{\n const auto preview = selectedFeePreview();\n return preview ? std::make_optional(preview->fee) : std::nullopt;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | A busy unlock session leaves Speed up in Failedqml/models/bumptransactionmodel.cpp | still_present | AssessmentThe new-head confirmFeeBumpInternal() still calls setError() when the unlock session is busy; no change is shown to retain NeedsConfirmation for retry. new_source: qml/models/bumptransactionmodel.cpp [
{
"bounded": true,
"end_line": 256,
"evidence_id": "065028a27fbd400ea7bc2ce5a25fd8a6",
"finding_id": "finding:6",
"kind": "new_source",
"line": 130,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/bumptransactionmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": "}\n\nbool BumpTransactionModel::confirmFeeBump()\n{\n return confirmFeeBumpInternal(std::nullopt);\n}\n\nbool BumpTransactionModel::confirmFeeBumpWithPassphrase(const QString& passphrase)\n{\n return confirmFeeBumpInternal(std::optional<SecureString>{QmlUtil::SecureStringFromQString(passphrase)});\n}\n\nbool BumpTransactionModel::confirmFeeBumpInternal(std::optional<SecureString> passphrase)\n{\n if (!m_wallet || m_state != NeedsConfirmation) {\n if (passphrase.has_value()) {\n QmlUtil::ClearSecureString(*passphrase);\n passphrase.reset();\n }\n return false;\n }\n\n std::unique_lock<std::mutex> unlock_session;\n const bool crypted{m_wallet->isCrypted()};\n if (crypted) unlock_session = m_unlock_session->tryAcquire();\n if (crypted && !unlock_session) {\n if (passphrase.has_value()) {\n QmlUtil::ClearSecureString(*passphrase);\n passphrase.reset();\n }\n setError(tr(\"The wallet is busy with another operation. Try again in a moment.\"));\n return false;\n }\n if (!m_wallet->privateKeysDisabled() && m_wallet->isCrypted() && m_wallet->isLocked() && !passphrase.has_value()) {\n setUnlockRequired(tr(\"Enter your wallet password to update this transaction.\"));\n return false;\n }\n\n bool relock{false};\n if (!unlockForCommit(passphrase, relock)) {\n return false;\n }\n WalletRelockGuard relock_guard{*m_wallet, [this] {\n if (m_security_state_changed_fn) {\n m_security_state_changed_fn();\n }\n }, relock};\n\n setNeedsUnlock(false);\n setState(Committing);\n\n if (!m_wallet->transactionCanBeBumped(m_original_txid)) {\n relock_guard.relock();\n setError(tr(\"Transaction can no longer be bumped.\"));\n return false;\n }\n\n if (!m_wallet->signBumpTransaction(m_bump_mtx)) {\n relock_guard.relock();\n setError(tr(\"Failed to sign transaction.\"));\n return false;\n }\n\n std::vector<bilingual_str> errors;\n Txid bumped_txid;\n if (!m_wallet->commitBumpTransaction(m_original_txid, std::move(m_bump_mtx), errors, bumped_txid)) {\n relock_guard.relock();\n setError(errors.empty() ? tr(\"Failed to commit transaction.\") : QString::fromStdString(errors[0].translated));\n return false;\n }\n\n m_new_txid = QString::fromStdString(bumped_txid.GetHex());\n relock_guard.relock();\n setState(Succeeded);\n Q_EMIT resultChanged();\n return true;\n}\n\nbool BumpTransactionModel::unlockForCommit(std::optional<SecureString>& passphrase, bool& relock)\n{\n relock = false;\n if (!m_wallet) {\n if (passphrase.has_value()) {\n QmlUtil::ClearSecureString(*passphrase);\n passphrase.reset();\n }\n return false;\n }\n if (!passphrase.has_value()) {\n return true;\n }\n\n const auto result{TryUnlockWithPassphrase(*m_wallet, *passphrase)};\n passphrase.reset();\n switch (result) {\n case WalletUnlockResult::IncorrectPassphrase:\n setUnlockRequired(tr(\"The wallet password you entered was incorrect.\"));\n return false;\n case WalletUnlockResult::AlreadyUnlocked:\n return true;\n case WalletUnlockResult::UnlockedNowRelockRequired:\n relock = true;\n if (m_security_state_changed_fn) {\n m_security_state_changed_fn();\n }\n return true;\n }\n return false;\n}\n\nvoid BumpTransactionModel::reset()\n{\n m_state = Idle;\n m_action_type = SpeedUp;\n m_old_fee = 0;\n m_new_fee = 0;\n m_bump_mtx = CMutableTransaction{};\n m_original_txid = Txid{};\n m_new_txid.clear();\n m_error.clear();\n m_needs_unlock = false;\n\n Q_EMIT stateChanged();\n Q_EMIT actionTypeChanged();\n Q_EMIT resultChanged();\n Q_EMIT needsUnlockChanged();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Automatic Receive preparation can overwrite the type used by an unlock retryqml/pages/wallet/ReceivePage.qml | still_present | AssessmentThe new-head ensureReceivingAddress() still assigns pendingNextAddress and pendingAddressType before checking receiveOperationPending, leaving automatic calls able to overwrite the explicit intent. new_source: qml/pages/wallet/ReceivePage.qml [
{
"bounded": true,
"end_line": 155,
"evidence_id": "ecfb1c5fa2c645d1b7216bbccbe1f9ae",
"finding_id": "finding:5",
"kind": "new_source",
"line": 6,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/pages/wallet/ReceivePage.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": "import QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\nimport org.bitcoincore.qt 1.0\nimport \"../../controls\"\nimport \"../../components\"\n\nPage {\n id: root\n objectName: \"requestPaymentPage\"\n property var wallet: null\n property var request: wallet ? wallet.currentPaymentRequest : null\n property var clipboard: Clipboard\n property var presentedRequest: null\n property bool pendingNextAddress: false\n property string pendingAddressType: \"\"\n property bool addressPreparationDeferred: false\n property string addressErrorText: \"\"\n readonly property real pageSidePadding: SizeClass.isCompact(width) ? Theme.space.pageCompact : Theme.space.pageRegular\n readonly property real headerContentWidth: Math.max(0, Math.min(660, width - pageSidePadding * 2))\n readonly property alias requestModal: requestModal\n readonly property alias draftCard: card\n signal addressHistoryRequested()\n signal paymentRequestCreated()\n background: Rectangle { color: Theme.color.background }\n padding: 0\n\n function ensureReceivingAddress(next, type) {\n if (!wallet) return\n pendingNextAddress = !!next\n pendingAddressType = type || \"\"\n if (wallet.receiveOperationPending) {\n addressPreparationDeferred = true\n return\n }\n addressPreparationDeferred = false\n root.addressErrorText = \"\"\n if (!wallet.ensureReceivingAddress(pendingNextAddress, pendingAddressType)) {\n //: Error shown in Receive when preparing an address for a payment request fails.\n root.addressErrorText = wallet.receiveOperationError || qsTr(\"A receiving address could not be generated. Please try again.\")\n }\n }\n\n function prepareReceivingAddress() {\n const type = root.request && !root.request.id && root.wallet && root.wallet.receivingAddress.address === \"\"\n ? root.request.addressType.toLowerCase() : \"\"\n root.ensureReceivingAddress(false, type)\n }\n\n // The Addresses page may bring an existing request into Receive.\n // Saved requests always use the same modal, including this entry point.\n onVisibleChanged: {\n if (visible) Qt.callLater(function() {\n if (root.visible) root.prepareReceivingAddress()\n if (root.visible && root.request && root.request.id && !requestModal.visible) {\n root.presentedRequest = root.request\n requestModal.openRequest(root.request.id)\n }\n })\n }\n Component.onCompleted: Qt.callLater(function() {\n if (root.visible) root.prepareReceivingAddress()\n })\n\n Item {\n objectName: \"requestHistoryCount\"\n visible: false\n property int count: root.wallet ? root.wallet.receiveRequests.count : 0\n }\n\n ScrollView {\n id: scroll\n anchors.fill: parent\n clip: true\n contentWidth: availableWidth\n contentHeight: content.implicitHeight + 48\n ScrollBar.horizontal.policy: ScrollBar.AlwaysOff\n ColumnLayout {\n id: content\n width: scroll.availableWidth\n spacing: 24\n RowLayout {\n objectName: \"receivePageHeader\"\n Layout.fillWidth: true\n Layout.preferredWidth: root.headerContentWidth\n Layout.maximumWidth: root.headerContentWidth\n Layout.alignment: Qt.AlignHCenter\n Layout.topMargin: 28\n CoreText {\n Layout.fillWidth: true\n text: qsTr(\"Receive bitcoin\")\n textStyle: Theme.text.headline\n horizontalAlignment: Text.AlignLeft\n }\n OverflowMenuButton {\n id: receiveAddressSettingsButton\n objectName: \"receiveAddressSettingsButton\"\n iconSource: \"qrc:/icons/address-settings.svg\"\n iconSize: 28\n Accessible.name: qsTr(\"Address settings\")\n checked: receiveAddressTypeMenu.opened\n onClicked: receiveAddressTypeMenu.opened ? receiveAddressTypeMenu.close() : receiveAddressTypeMenu.open()\n ContextMenu {\n id: receiveAddressTypeMenu\n objectName: \"receiveAddressTypeMenu\"\n x: receiveAddressSettingsButton.width - width\n y: receiveAddressSettingsButton.height + 8\n minMenuWidth: 320\n modal: true\n dim: false\n ContextMenuPicker {\n objectName: \"receiveAddressTypePicker\"\n title: qsTr(\"Address type\")\n textRole: \"label\"\n valueRole: \"id\"\n subtitleRole: \"description\"\n objectNameRole: \"objectName\"\n subtitleObjectNameRole: \"subtitleObjectName\"\n model: root.wallet ? root.wallet.receiveAddressTypes.map(function(type) {\n return {\n id: type.id,\n label: type.label,\n description: type.description,\n objectName: \"receiveAddressType_\" + type.id,\n subtitleObjectName: \"receiveAddressTypeDescription_\" + type.id\n }\n }) : []\n currentValue: root.wallet && root.wallet.receivingAddress\n ? root.wallet.receivingAddress.addressType.toLowerCase() : \"\"\n enabled: walletController.initialized && (!root.wallet || !root.wallet.receiveOperationPending)\n onActivated: function(value) {\n receiveAddressTypeMenu.close()\n root.ensureReceivingAddress(false, value)\n }\n }\n }\n }\n OverflowMenuButton {\n id: receiveMoreButton\n objectName: \"receiveMoreButton\"\n Layout.leftMargin: 6\n checked: receiveMoreMenu.opened\n onClicked: receiveMoreMenu.opened ? receiveMoreMenu.close() : receiveMoreMenu.open()\n ContextMenu {\n id: receiveMoreMenu\n objectName: \"receiveMoreMenu\"\n x: receiveMoreButton.width - width\n y: receiveMoreButton.height + 8\n modal: true\n dim: false\n ContextMenuButton {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | A delayed signing password prompt can open over Verifyqml/pages/wallet/SignVerifyMessage.qml | still_present | AssessmentThe new-head SegmentedPicker excerpt still has no enabled condition tied to signingPending, while only the StackLayout is disabled during the operation. new_source: qml/pages/wallet/SignVerifyMessage.qml [
{
"bounded": true,
"end_line": 203,
"evidence_id": "58ba076e19bd4423b4b66fcb735499af",
"finding_id": "finding:4",
"kind": "new_source",
"line": 54,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/pages/wallet/SignVerifyMessage.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": " root.verifyResultText = \"\"\n root.verifyResultSuccess = false\n }\n\n function addressErrorText(address) {\n if (address.length === 0\n || (root.signVerifyModel && root.signVerifyModel.isLegacyP2PKHAddress(address))) {\n return \"\"\n }\n return qsTr(\"Not a valid P2PKH address.\")\n }\n\n function submitSign(passphrase) {\n if (!root.signVerifyModel) return\n if (arguments.length === 0)\n root.signVerifyModel.signMessage(signAddressModel.address, signMessageText.text)\n else\n root.signVerifyModel.signMessageWithPassphrase(signAddressModel.address, signMessageText.text, passphrase)\n }\n\n function submitVerify() {\n if (root.signVerifyModel)\n root.signVerifyModel.verifyMessage(verifyAddressModel.address, verifyMessageText.text, verifySignature.text)\n }\n\n Connections {\n target: root.signVerifyModel\n function onSigningFinished(success) {\n signPassphrasePopup.busy = false\n if (success) signPassphrasePopup.close()\n else if (root.signVerifyModel.signingNeedsUnlock && root.visible) {\n signPassphrasePopup.errorText = \"\"\n signPassphrasePopup.open()\n } else if (signPassphrasePopup.visible) signPassphrasePopup.errorText = root.signVerifyModel.signingError\n }\n function onVerificationFinished() {\n const verified = root.signVerifyModel.verificationValid\n root.verifyResultSuccess = verified\n root.verifyResultText = verified ? qsTr(\"Message verified successfully.\") : qsTr(\"Message verification failed.\")\n }\n }\n\n Component.onDestruction: { if (root.signVerifyModel) root.signVerifyModel.clear() }\n\n Component.onCompleted: {\n if (root.signVerifyModel) root.signVerifyModel.clear()\n }\n\n SegmentedPicker {\n objectName: \"signVerifyMessageModePicker\"\n Accessible.name: qsTr(\"Sign or verify message\")\n Layout.fillWidth: true\n Layout.maximumWidth: 400\n Layout.alignment: Qt.AlignHCenter\n model: [\n {\n text: qsTr(\"Sign message\"),\n objectName: \"signMessageTab\"\n },\n {\n text: qsTr(\"Verify message\"),\n objectName: \"verifyMessageTab\"\n }\n ]\n currentIndex: root.selectedMode\n onSelected: (index) => root.selectedMode = index\n }\n\n StackLayout {\n Layout.fillWidth: true\n enabled: !root.signVerifyModel || (!root.signVerifyModel.signingPending && !root.signVerifyModel.verificationPending)\n currentIndex: root.selectedMode\n\n FormSection {\n id: signSection\n objectName: \"signMessageFormSection\"\n Layout.fillWidth: true\n\n ColumnLayout {\n Layout.fillWidth: true\n Layout.margins: signSection.contentInset\n spacing: 20\n\n PageHeading {\n objectName: \"signMessageHeading\"\n Layout.fillWidth: true\n description: qsTr(\"You can sign messages or agreements with your legacy P2PKH addresses to prove you can receive bitcoin sent to them. Be careful not to sign anything vague or random, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully detailed statements you agree to.\")\n }\n\n LabeledBitcoinAddressField {\n id: signAddress\n objectName: \"signMessageAddressEntry\"\n Layout.fillWidth: true\n label: qsTr(\"Bitcoin address\")\n fieldObjectName: \"signMessageAddressField\"\n placeholderText: qsTr(\"Enter a legacy P2PKH address\")\n address: signAddressModel\n fieldTextStyle: Theme.text.monoDescription\n errorText: root.addressErrorText(signAddressModel.address)\n readOnly: root.signingComplete\n showCopyButton: root.signingComplete\n copyButtonObjectName: \"signMessageCopyAddressButton\"\n onCopyRequested: Clipboard.setText(signAddressModel.address)\n }\n\n LabeledTextView {\n id: signMessageText\n objectName: \"signMessageMessageEntry\"\n Layout.fillWidth: true\n label: qsTr(\"Message\")\n fieldObjectName: \"signMessageMessageField\"\n placeholderText: qsTr(\"Enter the message you want to sign\")\n fieldBackgroundColor: Theme.color.surface2\n readOnly: root.signingComplete\n showCopyButton: root.signingComplete\n copyButtonObjectName: \"signMessageCopyMessageButton\"\n onCopyRequested: Clipboard.setText(text)\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: 12\n\n PrimaryButton {\n objectName: \"signMessageButton\"\n Layout.fillWidth: true\n text: qsTr(\"Sign message\")\n enabled: !!root.signVerifyModel\n && root.signVerifyModel.isLegacyP2PKHAddress(signAddressModel.address)\n onClicked: root.submitSign()\n }\n\n NeutralButton {\n objectName: \"signMessageClearButton\"\n buttonSize: NeutralButton.Large\n Layout.preferredWidth: 140\n text: qsTr(\"Clear all\")\n onClicked: root.clearSignForm()\n }\n }\n\n CoreText {\n objectName: \"signMessageErrorText\"\n visible: !!root.signVerifyModel\n && root.signVerifyModel.signingError.length > 0\n && !root.signVerifyModel.signingNeedsUnlock\n Layout.fillWidth: true\n text: root.signVerifyModel ? root.signVerifyModel.signingError : \"\"\n color: Theme.color.dangerText\n textStyle: Theme.text.caption",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | The lock checkpoint can hide a stale available balanceqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe new-head read() excerpt still obtains and records the locked-coin checkpoint after the balance calls, so the reported read-order race remains possible. new_source: qml/models/walletstatesnapshot.cpp [
{
"bounded": true,
"end_line": 292,
"evidence_id": "d288e4d0559f478f87baf0cbe1fbb741",
"finding_id": "finding:3",
"kind": "new_source",
"line": 143,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": " state.key_scheme = ReadWalletKeyScheme(*m_wallet);\n const auto security = ReadSecurityState(*m_wallet);\n state.encrypted = security.encrypted;\n state.locked = security.locked;\n state.private_keys_disabled = m_wallet->privateKeysDisabled();\n state.external_signer = m_wallet->hasExternalSigner();\n state.can_get_addresses = m_wallet->canGetAddresses();\n state.taproot_enabled = m_wallet->taprootEnabled();\n state.default_address_type = m_wallet->getDefaultAddressType();\n state.dust_relay_fee = node ? node->getDustRelayFee() : CFeeRate{DUST_RELAY_TX_FEE};\n state.receive_address_type = state.taproot_enabled ? QStringLiteral(\"bech32m\") : QStringLiteral(\"bech32\");\n if (node) {\n const auto preferences = node->getPersistentSetting(\"qml_receive_address_types\");\n const auto& saved = preferences[state.name.toStdString()];\n if (saved.isStr()) {\n const auto type = ParseOutputType(saved.get_str());\n if (type && SupportsType(state, *type)) state.receive_address_type = QString::fromStdString(saved.get_str());\n }\n }\n state.addresses = m_wallet->getAddresses();\n std::set<QString> receive_addresses;\n for (const auto& address : state.addresses) {\n const auto text = Address(address.dest);\n state.labels[text] = QString::fromStdString(address.name);\n if (address.is_mine && address.purpose == wallet::AddressPurpose::RECEIVE) receive_addresses.insert(text);\n }\n state.coins = m_wallet->listCoins();\n std::vector<COutPoint> locked;\n m_wallet->listLockedCoins(locked);\n state.locked_coins.insert(locked.begin(), locked.end());\n m_locked_coins = state.locked_coins;\n state.receive_requests = ReceiveRequestHistoryModel::DeserializeEntries(m_wallet->getAddressReceiveRequests());\n std::set<QString> request_addresses;\n for (const auto& request : state.receive_requests) {\n const auto address = QString::fromStdString(request.recipient.address);\n request_addresses.insert(address);\n if (request.payment_received) m_observed_addresses.insert(address);\n }\n std::set<Txid> unconfirmed_payment_txids;\n std::set<COutPoint> change_outputs;\n for (const auto& tx : m_wallet->getWalletTxs()) {\n if (!tx.tx) continue;\n std::map<QString, CAmount> received;\n for (size_t i = 0; i < tx.tx->vout.size(); ++i) {\n if (i < tx.txout_is_change.size() && tx.txout_is_change[i]) change_outputs.emplace(tx.tx->GetHash(), i);\n if (i >= tx.txout_is_mine.size() || !tx.txout_is_mine[i]) continue;\n CTxDestination destination;\n const auto& output = tx.tx->vout[i];\n if (!ExtractDestination(output.scriptPubKey, destination)) continue;\n const auto address = Address(destination);\n if (receive_addresses.contains(address) && (i >= tx.txout_is_change.size() || !tx.txout_is_change[i])) state.used_addresses.insert(address);\n if (output.nValue <= 0) continue;\n m_observed_addresses.insert(address);\n if (request_addresses.contains(address)) received[address] += output.nValue;\n }\n if (received.empty()) continue;\n interfaces::WalletTxStatus status{};\n std::vector<std::string> messages;\n std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int blocks{0};\n m_wallet->getWalletTxDetails(tx.tx->GetHash(), status, messages, payment_requests, in_mempool, blocks);\n const bool replaced = tx.replaced_by_txid.has_value();\n if (status.depth_in_main_chain < 0 || status.is_abandoned || (status.depth_in_main_chain == 0 && (!in_mempool || replaced))) continue;\n if (status.depth_in_main_chain == 0) unconfirmed_payment_txids.insert(tx.tx->GetHash());\n for (const auto& [address, amount] : received) state.received_amounts[address] += amount;\n }\n for (const auto& [ancestor, coins] : state.coins) {\n for (const auto& [outpoint, output] : coins) {\n CTxDestination destination;\n if (!ExtractDestination(output.txout.scriptPubKey, destination)) continue;\n const auto address = Address(destination);\n state.address_balances[address] += output.txout.nValue;\n if (output.txout.nValue > 0 && change_outputs.contains(outpoint)) state.change_addresses.insert(address);\n }\n }\n state.observed_addresses = m_observed_addresses;\n for (auto& request : state.receive_requests) {\n if (request.payment_received || !m_observed_addresses.contains(QString::fromStdString(request.recipient.address))) continue;\n request.payment_received = true;\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(request.recipient.address), util::ToString(request.id), ReceiveRequestHistoryModel::SerializeEntry(request))) {\n state.persistence_error = Tr(\"The received-payment status could not be saved. The address will not be reused.\");\n }\n }\n if (have_processed_block) m_last_processed_block = processed_block;\n state.unconfirmed_payments = !unconfirmed_payment_txids.empty();\n m_unconfirmed_payment_txids = std::move(unconfirmed_payment_txids);\n return state;\n}\n\nstd::optional<WalletStateSnapshot> WalletStateBackend::poll(interfaces::Node* node)\n{\n // A node-tip notification can precede wallet processing, and maturity does\n // not emit a transaction notification. Retry busy wallets on the next poll.\n uint256 processed_block;\n if (auto* wallet = m_wallet->wallet()) {\n // tryGetBalances() would also sum every wallet output; only the block hash is needed here.\n TRY_LOCK(wallet->cs_wallet, locked_wallet);\n if (!locked_wallet) return std::nullopt;\n processed_block = wallet->GetLastBlockHash();\n } else {\n interfaces::WalletBalances balances;\n if (!m_wallet->tryGetBalances(balances, processed_block)) return std::nullopt;\n }\n if (m_last_processed_block != processed_block) return read(node);\n\n // lockunspent does not notify the wallet either.\n std::vector<COutPoint> locked;\n m_wallet->listLockedCoins(locked);\n if (std::set<COutPoint>(locked.begin(), locked.end()) != m_locked_coins) return read(node);\n\n // Mempool eviction need not notify the receiving wallet. Check only the\n // outstanding payments; an unchanged payment must not rebuild every wallet\n // model (and destroy an address label editor) on each timer tick.\n for (const auto& txid : m_unconfirmed_payment_txids) {\n interfaces::WalletTxStatus status{};\n std::vector<std::string> messages;\n std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int blocks{0};\n const auto tx = m_wallet->getWalletTxDetails(txid, status, messages, payment_requests, in_mempool, blocks);\n if (status.depth_in_main_chain != 0 || status.is_abandoned || !in_mempool || tx.replaced_by_txid.has_value()) {\n return read(node);\n }\n }\n return std::nullopt;\n}\n\nbool WalletStateBackend::setAddressType(interfaces::Node* node, const QString& type)\n{\n if (!node) return true;\n const auto updated_preferences = [&] {\n auto preferences = node->getPersistentSetting(\"qml_receive_address_types\");\n if (!preferences.isObject()) preferences = common::SettingsValue{UniValue::VOBJ};\n preferences.pushKV(m_wallet->getWalletName(), type.toStdString());\n return preferences;\n };\n if (auto* context = node->context(); context && context->args) {\n return QmlCoreSettings::PersistSettings(*context->args, {QStringLiteral(\"qml_receive_address_types\")}, [&] {\n // Read and merge inside the shared writer lock: other wallet\n // queues may update their own entry in the same settings object.\n QmlCoreSettings::SetRwSetting(*context->args, QStringLiteral(\"qml_receive_address_types\"), updated_preferences());\n return true;\n });\n }\n node->updateRwSetting(\"qml_receive_address_types\", updated_preferences());\n return true;\n}\n\nReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, ReceiveCommand command)",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | A pending coin lock leaves the coin available to Send preparationqml/models/walletqmlmodel.cpp | still_present | AssessmentThe new-head setCoinsLocked() excerpt still only unselects locked outputs in the asynchronous completion handler; it shows no pending-lock check in Review or transaction preparation. new_source: qml/models/walletqmlmodel.cpp [
{
"bounded": true,
"end_line": 2634,
"evidence_id": "3f0c4f6337df4409aeabb4df469116bf",
"finding_id": "finding:2",
"kind": "new_source",
"line": 2485,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": " return false;\n }\n return m_wallet->transactionCanBeBumped(Txid::FromUint256(txid));\n}\n\ninterfaces::Wallet::CoinsList WalletQmlModel::listCoins() const\n{\n if (!m_wallet) {\n return {};\n }\n return m_wallet_state.coins;\n}\n\nbool WalletQmlModel::setCoinsLocked(std::vector<COutPoint> outputs, bool locked)\n{\n if (m_stopping || !m_wallet_state_backend || m_coin_lock_pending || outputs.empty()) return false;\n m_coin_lock_pending = true;\n m_coin_lock_error.clear();\n Q_EMIT coinLockStateChanged();\n const auto backend = m_wallet_state_backend;\n const auto node = m_node;\n // Use the snapshot reader's serial executor so earlier refreshes cannot\n // arrive after this command's result and restore an obsolete lock state.\n m_backend_executor->submitTask(this,\n [backend, node, outputs, locked] { return backend->setCoinsLocked(node, outputs, locked); },\n [this, outputs, locked](BackendExecutor::Outcome<CoinLockResult> outcome) {\n if (!m_stopping) {\n if (auto* result = std::get_if<0>(&outcome)) {\n if (locked) {\n for (const auto& output : outputs) {\n if (result->snapshot.locked_coins.contains(output)) unselectCoin(output);\n }\n }\n m_coin_lock_error = result->success ? QString{} : tr(\"Some coins could not be updated. Try again.\");\n applyWalletState(std::move(result->snapshot));\n scheduleFeeEstimates();\n } else {\n m_coin_lock_error = tr(\"Coins could not be updated or reloaded. Try again.\");\n requestWalletStateRefresh();\n }\n }\n m_coin_lock_pending = false;\n Q_EMIT coinLockStateChanged();\n if (walletStateRefreshNeeded()) scheduleWalletStateRefresh();\n });\n return true;\n}\n\nbool WalletQmlModel::isLockedCoin(const COutPoint& output)\n{\n if (!m_wallet) {\n return false;\n }\n return m_wallet_state.locked_coins.contains(output);\n}\n\nvoid WalletQmlModel::listLockedCoins(std::vector<COutPoint>& outputs)\n{\n if (!m_wallet) {\n return;\n }\n m_wallet->listLockedCoins(outputs);\n}\n\nvoid WalletQmlModel::selectCoin(const COutPoint& output)\n{\n const bool was_selected{m_coin_control.IsSelected(output)};\n m_coin_control.Select(output);\n if (!was_selected) {\n refreshSelectedAvailableBalance(true);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::unselectCoin(const COutPoint& output)\n{\n const bool was_selected{m_coin_control.IsSelected(output)};\n m_coin_control.UnSelect(output);\n if (was_selected) {\n refreshSelectedAvailableBalance(true);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n scheduleFeeEstimates();\n}\n\nbool WalletQmlModel::isSelectedCoin(const COutPoint& output)\n{\n return m_coin_control.IsSelected(output);\n}\n\nstd::vector<COutPoint> WalletQmlModel::listSelectedCoins() const\n{\n return m_coin_control.ListSelected();\n}\n\nvoid WalletQmlModel::clearSelectedCoins()\n{\n setMaximumRecipient(nullptr);\n if (m_coin_control.HasSelected()) setSelectedCoins({});\n}\n\nvoid WalletQmlModel::setSelectedCoins(const std::vector<COutPoint>& outputs)\n{\n // Restoring a cancelled coin-picker edit preserves the maximum recipient.\n m_coin_control.UnSelectAll();\n for (const auto& output : outputs) m_coin_control.Select(output);\n if (m_coins_list_model) m_coins_list_model->refreshSelection();\n refreshSelectedAvailableBalance(true);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::followPrefilledNote()\n{\n if (m_prefilled_note_address.isEmpty()) return;\n // A pending Receive command checks the request's revision; follow the label once it finishes.\n if (m_receive_operation_pending) {\n m_prefilled_note_follow_pending = true;\n return;\n }\n auto* request = m_current_payment_request;\n if (!request->id().isEmpty() || request->address() != m_prefilled_note_address || request->noteSelf() != m_prefilled_note) {\n m_prefilled_note_address.clear();\n return;\n }\n // An untouched prefill follows the label, so saving it cannot restore an older one.\n m_prefilled_note = getAddressLabel(m_prefilled_note_address);\n request->setNoteSelf(m_prefilled_note);\n}\n\nCAmount WalletQmlModel::sendAvailableBalance() const\n{\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);\n}\n\nvoid WalletQmlModel::refreshSelectedAvailableBalance(bool selection_changed)\n{\n if (m_selected_balance_task) m_backend_executor->cancel(*m_selected_balance_task);\n m_selected_balance_task.reset();\n if (selection_changed) m_selected_available_balance.reset();\n const quint64 request = ++m_selected_balance_request;\n if (!m_wallet || m_stopping || !m_coin_control.HasSelected()) return;\n wallet::CCoinControl control{m_coin_control};\n ApplySelectedInputsPolicy(control);\n m_selected_balance_task = m_backend_executor->submitTask(this,\n [wallet = m_wallet, control] { return wallet->getAvailableBalance(control); },\n [this, request](BackendExecutor::Outcome<CAmount> outcome) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Failed batch coin-lock operations lose the marked selectionqml/components/CoinsList.qml | still_present | AssessmentThe new-head lockMarked() still clears markedIds immediately when setCoinsLocked() returns true, without retaining the submitted IDs for a later failed completion. new_source: qml/components/CoinsList.qml [
{
"bounded": true,
"end_line": 183,
"evidence_id": "d262a015b6214c21b9366107e983ca7b",
"finding_id": "finding:14",
"kind": "new_source",
"line": 34,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/components/CoinsList.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": " readonly property int activeFilterCount: !coins ? 0 : (coins.filter !== \"all\" ? 1 : 0) + (coins.minAmount >= 0 || coins.maxAmount >= 0 ? 1 : 0)\n spacing: Theme.space.l\n onWalletChanged: { markedIds = []; walletSelectionActive = false; pendingLockedCoinId = \"\"; errorText = \"\" }\n\n BitcoinAmount { id: targetAmount; unit: optionsModel.displayUnit; satoshi: root.target }\n BitcoinAmount { id: selectedAmountText; unit: optionsModel.displayUnit; satoshi: root.selectedAmount }\n BitcoinAmount { id: remainingAmountText; unit: optionsModel.displayUnit; satoshi: root.remainingAmount }\n BitcoinAmount { id: changeAmountText; unit: optionsModel.displayUnit; satoshi: root.changeAmount }\n BitcoinAmount { id: totalAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi : 0 }\n BitcoinAmount { id: spendableAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi - root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lockedAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lowerAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.lowerValue }\n BitcoinAmount { id: upperAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.upperValue }\n\n function toggleRow(row, coinId, locked, marked) {\n if (selectionMode && locked && !marked) {\n pendingLockedCoinId = coinId\n lockedCoinAlert.open()\n } else if (selectionMode) coins.toggleCoinSelection(row)\n else if (walletSelectionActive) {\n const ids = markedIds.slice()\n const i = ids.indexOf(coinId)\n if (i < 0) ids.push(coinId); else ids.splice(i, 1)\n markedIds = ids\n }\n }\n function lockMarked(locked) {\n if (!coins || lockOperationPending) return\n if (coins.setCoinsLocked(markedIds, locked)) {\n errorText = \"\"\n markedIds = []\n } else {\n errorText = qsTr(\"Some coins could not be updated. Try again.\")\n }\n }\n function setCoinLocked(coinId, locked) {\n if (!coins || lockOperationPending) return\n errorText = coins.setCoinsLocked([coinId], locked) ? \"\" : qsTr(\"This coin could not be updated. Try again.\")\n }\n function openMenu(menu, button) {\n menu.openBelow(button, Theme.space.s)\n }\n function clearFilters() {\n if (!coins) return\n coins.filter = \"all\"\n coins.minAmount = -1\n coins.maxAmount = -1\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: 10\n SearchBar {\n objectName: \"coinBrowserSearch\"\n fieldObjectName: \"coinBrowserSearchField\"\n Layout.fillWidth: true\n placeholderText: SizeClass.isCompact(root.width) ? qsTr(\"Search coins\") : qsTr(\"Search notes, addresses or transaction IDs\")\n accessibleName: qsTr(\"Search coins\")\n text: root.coins ? root.coins.searchText : \"\"\n onTextChanged: if (root.coins) root.coins.searchText = text\n }\n IconButton {\n id: sortButton\n objectName: \"coinBrowserSortButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/arrow-up-down.svg\"\n accessibleName: qsTr(\"Sort coins\")\n onClicked: root.openMenu(sortMenu, sortButton)\n }\n IconButton {\n id: groupButton\n objectName: \"coinBrowserGroupButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/group-by.svg\"\n accessibleName: qsTr(\"Group coins\")\n onClicked: root.openMenu(groupMenu, groupButton)\n }\n IconButton {\n id: selectionButton\n objectName: \"walletCoinsSelectionButton\"\n visible: !root.selectionMode\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/checklist.svg\"\n accessibleName: qsTr(\"Select coins\")\n checked: root.walletSelectionActive\n Accessible.checkable: true\n Accessible.checked: root.walletSelectionActive\n onClicked: {\n root.walletSelectionActive = !root.walletSelectionActive\n if (!root.walletSelectionActive) root.markedIds = []\n }\n }\n }\n\n Flow {\n Layout.fillWidth: true\n Layout.preferredHeight: childrenRect.height\n spacing: 10\n FilterButton {\n id: activeFiltersButton\n objectName: \"coinBrowserActiveFiltersButton\"\n visible: root.activeFilterCount > 0\n active: true\n count: root.activeFilterCount\n size: coinTypeButton.height\n iconSize: Theme.size.icon.l\n text: count === 1 ? qsTr(\"1 active filter\") : qsTr(\"%1 active filters\").arg(count)\n onClicked: root.openMenu(clearFiltersMenu, activeFiltersButton)\n }\n DropdownButton {\n id: coinTypeButton\n objectName: \"coinBrowserFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: !root.coins || root.coins.filter === \"all\" ? qsTr(\"Coin type\") : root.coins.filter === \"locked\" ? qsTr(\"Locked\") : qsTr(\"Spendable\")\n active: root.coins && root.coins.filter !== \"all\"\n opened: filterMenu.opened\n onClicked: root.openMenu(filterMenu, coinTypeButton)\n }\n DropdownButton {\n id: amountFilterButton\n objectName: \"coinBrowserAmountFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: qsTr(\"Amount\")\n active: root.coins && (root.coins.minAmount >= 0 || root.coins.maxAmount >= 0)\n opened: amountPopup.opened\n onClicked: root.openMenu(amountPopup, amountFilterButton)\n }\n }\n\n ListView {\n id: list\n objectName: \"coinSelectionListView\"\n Layout.fillWidth: true; Layout.fillHeight: true; Layout.minimumHeight: 120\n clip: true; model: root.coins; reuseItems: true\n boundsBehavior: Flickable.StopAtBounds\n ScrollBar.vertical: ScrollBar {}\n section.property: \"groupTitle\"\n section.criteria: ViewSection.FullString\n section.delegate: Item {\n required property string section\n width: list.width; height: 44\n CoreText {\n anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom; anchors.bottomMargin: 8\n anchors.leftMargin: Theme.space.xs; anchors.rightMargin: Theme.space.xs",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Every applied snapshot clears Send fees and disables Reviewqml/models/walletqmlmodel.cpp | still_present | AssessmentThe new-head excerpt still unconditionally calls scheduleFeeEstimates() from applyWalletState(), with no change to preserve the existing preview or Review availability during background re-estimation. new_source: qml/models/walletqmlmodel.cpp [
{
"bounded": true,
"end_line": 853,
"evidence_id": "a0d60f5344e44523a981b908a9569450",
"finding_id": "finding:11",
"kind": "new_source",
"line": 704,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": " const bool balance_changed = !m_wallet_state_ready || state.balance != m_wallet_state.balance || state.available_balance != m_wallet_state.available_balance;\n const bool was_encrypted = m_is_encrypted;\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n m_receive_requests->setEntries(std::vector<QmlRecentRequestEntry>{m_wallet_state.receive_requests});\n for (auto* request : {m_receiving_address, m_current_payment_request, m_detail_payment_request}) {\n if (!request) continue;\n if (m_wallet_state.observed_addresses.contains(request->address())) request->setPaymentReceived(true);\n if (const auto entry = m_receive_requests->entryById(request->id()); entry && !request->isEditing()) {\n applySavedRequest(request, *entry);\n }\n }\n updateReceivedPaymentRequestAmounts();\n m_receive_reconciliation_applying = false;\n if (name_changed) { Q_EMIT nameChanged(); Q_EMIT displayNameChanged(); }\n if (was_encrypted != m_is_encrypted || was_locked != m_is_locked) Q_EMIT securityStateChanged();\n Q_EMIT walletStateChanged();\n if (labels_changed) {\n followPrefilledNote();\n Q_EMIT addressListChanged();\n }\n if (balance_changed) Q_EMIT balanceChanged();\n refreshSelectedAvailableBalance(false);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n // New funds and lock changes affect previews without editing the draft.\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::applySavedRequest(PaymentRequest* request, const QmlRecentRequestEntry& entry)\n{\n if (!request) return;\n request->setDestination(DecodeDestination(entry.recipient.address));\n request->setId(static_cast<unsigned int>(entry.id));\n request->setCreated(entry.date);\n request->amount()->setSatoshi(entry.recipient.amount);\n request->setLabel(QString::fromStdString(entry.recipient.label));\n request->setMessage(QString::fromStdString(entry.recipient.message));\n request->setNoteSelf(QString::fromStdString(entry.recipient.noteSelf));\n request->setPaymentReceived(entry.payment_received);\n request->setReceivedAmountSatoshi(receivedPaymentRequestAmount(request->address()));\n request->setIsEditing(false);\n request->setNeedsUnlock(false);\n request->setUnlockError({});\n}\n\nbool WalletQmlModel::canSubmitReceiveCommand() const\n{\n return available() && !m_stopping && m_wallet_state_backend && !m_receive_operation_pending;\n}\n\nbool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operation, PaymentRequest* request)\n{\n if (!canSubmitReceiveCommand()) return false;\n m_receive_operation_pending = true;\n m_receive_operation_error.clear();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n const auto backend = m_wallet_state_backend;\n const auto node = m_node;\n const QPointer<PaymentRequest> held{request};\n const auto revision = request ? request->revision() : 0;\n const bool reserve = command.reserve_receiving_address;\n m_backend_executor->submitTask(this,\n [backend, node, command = std::move(command)]() mutable { return backend->execute(node, std::move(command)); },\n [this, held, revision, operation, reserve](BackendExecutor::Outcome<ReceiveCommandResult> outcome) {\n auto* received = std::get_if<0>(&outcome);\n if (!received) {\n m_receive_operation_pending = false;\n m_receive_operation_error = tr(\"The wallet operation failed. Please try again.\");\n if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, false);\n requestWalletStateRefresh();\n return;\n }\n auto& result = *received;\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n std::optional<QmlRecentRequestEntry> saved_entry;\n if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n // The final read can already include a payment that arrived after the write.\n if (saved_entry) {\n if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n if (result.success && result.saved_entry) m_receive_requests->prependOrReplace(*result.saved_entry);\n m_wallet_state_error = result.refresh_error;\n Q_EMIT walletStateChanged();\n requestWalletStateRefresh();\n }\n if (current_request) {\n held->setNeedsUnlock(result.needs_unlock);\n held->setUnlockError(result.error);\n if (result.success && !result.receiving_address.isEmpty()) {\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n if (saved_entry) {\n if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n if (result.success && reserve && result.saved_entry &&\n m_receiving_address->address().toStdString() == result.saved_entry->recipient.address) {\n m_receiving_address->clear();\n }\n if (held && !current_request) {\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }\n if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, result.success);\n if (walletStateRefreshNeeded()) scheduleWalletStateRefresh();\n });\n return true;\n}\n\nvoid WalletQmlModel::beginShutdown(bool remove_wallet)\n{\n if (m_stopping) return;\n m_stopping = true;\n const bool was_available{available()};\n m_unload_requested->store(true);\n if (was_available) Q_EMIT availableChanged();\n m_wallet_poll_timer.stop();\n m_state_refresh_retry_timer.stop();\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n // Move subscriptions into the last backend job. Callback delivery targets\n // the separately retained bridge, never a raw pointer to this model.\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Signing reads the encryption state without cs_walletqml/models/signverifymessagemodel.cpp | still_present | AssessmentThe new-head signing worker still reads encryption and lock state using wallet->isCrypted() and wallet->isLocked(), including before acquiring the unlock session. The supplied code does not show the requested locked security-state helper or associated coverage. new_source: qml/models/signverifymessagemodel.cpp [
{
"bounded": true,
"end_line": 173,
"evidence_id": "a443324a9683452d87e8f131b5616c36",
"finding_id": "finding:1",
"kind": "new_source",
"line": 46,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "5ef27a71c31bca9848e43258f531d2eec253ddc4",
"path": "qml/models/signverifymessagemodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 6,
"source_job_id": 3047,
"text": "bool SignVerifyMessageModel::isLegacyP2PKHAddress(const QString& address) const\n{\n return LegacyP2PKHFromAddress(address).has_value();\n}\n\nbool SignVerifyMessageModel::signMessage(const QString& address, const QString& message)\n{\n return signMessageInternal(address, message, std::nullopt);\n}\n\nbool SignVerifyMessageModel::signMessageWithPassphrase(const QString& address, const QString& message, const QString& passphrase)\n{\n return signMessageInternal(address, message, QmlUtil::SecureStringFromQString(passphrase));\n}\n\nbool SignVerifyMessageModel::signMessageInternal(const QString& address, const QString& message, std::optional<SecureString> passphrase)\n{\n if (m_signing_pending) return false;\n clearSigningStatus();\n setSignature({});\n if (!m_wallet) { setSigningStatus(tr(\"No wallet is selected.\")); return false; }\n const auto pkhash = LegacyP2PKHFromAddress(address);\n if (!pkhash) { setSigningStatus(tr(\"Enter a legacy P2PKH bitcoin address.\")); return false; }\n struct Result { QString signature; QString error; bool needs_unlock{false}; };\n m_signing_pending = true;\n const auto generation = ++m_signing_generation;\n Q_EMIT signingPendingChanged();\n const auto wallet = m_wallet;\n m_executor->submitTask(this, [wallet, session = m_unlock_session, pkhash = *pkhash, message = message.toStdString(), passphrase = std::move(passphrase)]() mutable {\n std::unique_lock<std::mutex> unlock_session;\n if (passphrase || wallet->isCrypted()) unlock_session = session->acquire();\n Result result;\n bool relock{false};\n if (wallet->isCrypted() && wallet->isLocked()) {\n if (!passphrase) {\n result.needs_unlock = true;\n result.error = tr(\"Enter your wallet password to sign this message.\");\n return result;\n }\n const auto unlocked = TryUnlockWithPassphrase(*wallet, *passphrase);\n passphrase.reset();\n if (unlocked == WalletUnlockResult::IncorrectPassphrase) { result.error = tr(\"The wallet password you entered was incorrect.\"); return result; }\n relock = unlocked == WalletUnlockResult::UnlockedNowRelockRequired;\n }\n if (passphrase) { QmlUtil::ClearSecureString(*passphrase); passphrase.reset(); }\n WalletRelockGuard guard{*wallet, [] {}, relock};\n std::string signature;\n const auto status = wallet->signMessage(message, pkhash, signature);\n if (status == SigningResult::OK) result.signature = QString::fromStdString(signature);\n else result.error = QString::fromStdString(SigningResultString(status));\n return result;\n }, [this, generation](BackendExecutor::Outcome<Result> outcome) {\n m_signing_pending = false;\n Q_EMIT signingPendingChanged();\n notifySecurityStateChanged();\n if (generation != m_signing_generation) return;\n if (const auto* result = std::get_if<0>(&outcome)) {\n setSigningStatus(result->error, result->needs_unlock);\n setSignature(result->signature);\n Q_EMIT signingFinished(result->error.isEmpty());\n } else {\n setSigningStatus(tr(\"The message could not be signed. Please try again.\"));\n Q_EMIT signingFinished(false);\n }\n });\n return true;\n}\n\nbool SignVerifyMessageModel::verifyMessage(const QString& address, const QString& message, const QString& signature)\n{\n if (m_verification_pending) return false;\n const auto generation = ++m_verification_generation;\n m_verification_pending = true;\n m_verification_valid = false;\n Q_EMIT verificationPendingChanged();\n m_executor->submitTask(this, [address = address.trimmed().toStdString(), message = message.toStdString(), signature = signature.trimmed().toStdString()] {\n return MessageVerify(address, signature, message) == MessageVerificationResult::OK;\n }, [this, generation](BackendExecutor::Outcome<bool> outcome) {\n m_verification_pending = false;\n Q_EMIT verificationPendingChanged();\n if (generation != m_verification_generation) return;\n const auto* valid = std::get_if<0>(&outcome);\n m_verification_valid = valid && *valid;\n Q_EMIT verificationFinished();\n });\n return true;\n}\n\nvoid SignVerifyMessageModel::clear()\n{\n ++m_signing_generation;\n ++m_verification_generation;\n m_verification_valid = false;\n clearSigningStatus();\n setSignature(QString());\n}\n\nvoid SignVerifyMessageModel::clearSigningStatus()\n{\n setSigningStatus(QString());\n}\n\nvoid SignVerifyMessageModel::setSigningStatus(const QString& error, bool needs_unlock)\n{\n if (m_signing_error != error) {\n m_signing_error = error;\n Q_EMIT signingErrorChanged();\n }\n if (m_signing_needs_unlock != needs_unlock) {\n m_signing_needs_unlock = needs_unlock;\n Q_EMIT signingNeedsUnlockChanged();\n }\n}\n\nvoid SignVerifyMessageModel::setSignature(const QString& signature)\n{\n if (m_signature != signature) {\n m_signature = signature;\n Q_EMIT signatureChanged();\n }\n}\n\nvoid SignVerifyMessageModel::notifySecurityStateChanged()\n{\n if (m_security_state_changed) {\n m_security_state_changed();\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5ef27a71c31b..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Batch-lock failures discard the marked coinsqml/components/CoinsList.qml | still_present | AssessmentlockMarked() still clears markedIds immediately upon asynchronous submission acceptance, while later failures are reported separately. The new-head excerpt shows no change to retain marks until successful completion. new_source: qml/components/CoinsList.qml [
{
"bounded": true,
"end_line": 183,
"evidence_id": "aa2980ce6770474280727ef83d58dc82",
"finding_id": "finding:9",
"kind": "new_source",
"line": 34,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"path": "qml/components/CoinsList.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 5,
"source_job_id": 3046,
"text": " readonly property int activeFilterCount: !coins ? 0 : (coins.filter !== \"all\" ? 1 : 0) + (coins.minAmount >= 0 || coins.maxAmount >= 0 ? 1 : 0)\n spacing: Theme.space.l\n onWalletChanged: { markedIds = []; walletSelectionActive = false; pendingLockedCoinId = \"\"; errorText = \"\" }\n\n BitcoinAmount { id: targetAmount; unit: optionsModel.displayUnit; satoshi: root.target }\n BitcoinAmount { id: selectedAmountText; unit: optionsModel.displayUnit; satoshi: root.selectedAmount }\n BitcoinAmount { id: remainingAmountText; unit: optionsModel.displayUnit; satoshi: root.remainingAmount }\n BitcoinAmount { id: changeAmountText; unit: optionsModel.displayUnit; satoshi: root.changeAmount }\n BitcoinAmount { id: totalAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi : 0 }\n BitcoinAmount { id: spendableAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi - root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lockedAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lowerAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.lowerValue }\n BitcoinAmount { id: upperAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.upperValue }\n\n function toggleRow(row, coinId, locked, marked) {\n if (selectionMode && locked && !marked) {\n pendingLockedCoinId = coinId\n lockedCoinAlert.open()\n } else if (selectionMode) coins.toggleCoinSelection(row)\n else if (walletSelectionActive) {\n const ids = markedIds.slice()\n const i = ids.indexOf(coinId)\n if (i < 0) ids.push(coinId); else ids.splice(i, 1)\n markedIds = ids\n }\n }\n function lockMarked(locked) {\n if (!coins || lockOperationPending) return\n if (coins.setCoinsLocked(markedIds, locked)) {\n errorText = \"\"\n markedIds = []\n } else {\n errorText = qsTr(\"Some coins could not be updated. Try again.\")\n }\n }\n function setCoinLocked(coinId, locked) {\n if (!coins || lockOperationPending) return\n errorText = coins.setCoinsLocked([coinId], locked) ? \"\" : qsTr(\"This coin could not be updated. Try again.\")\n }\n function openMenu(menu, button) {\n menu.openBelow(button, Theme.space.s)\n }\n function clearFilters() {\n if (!coins) return\n coins.filter = \"all\"\n coins.minAmount = -1\n coins.maxAmount = -1\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: 10\n SearchBar {\n objectName: \"coinBrowserSearch\"\n fieldObjectName: \"coinBrowserSearchField\"\n Layout.fillWidth: true\n placeholderText: SizeClass.isCompact(root.width) ? qsTr(\"Search coins\") : qsTr(\"Search notes, addresses or transaction IDs\")\n accessibleName: qsTr(\"Search coins\")\n text: root.coins ? root.coins.searchText : \"\"\n onTextChanged: if (root.coins) root.coins.searchText = text\n }\n IconButton {\n id: sortButton\n objectName: \"coinBrowserSortButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/arrow-up-down.svg\"\n accessibleName: qsTr(\"Sort coins\")\n onClicked: root.openMenu(sortMenu, sortButton)\n }\n IconButton {\n id: groupButton\n objectName: \"coinBrowserGroupButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/group-by.svg\"\n accessibleName: qsTr(\"Group coins\")\n onClicked: root.openMenu(groupMenu, groupButton)\n }\n IconButton {\n id: selectionButton\n objectName: \"walletCoinsSelectionButton\"\n visible: !root.selectionMode\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/checklist.svg\"\n accessibleName: qsTr(\"Select coins\")\n checked: root.walletSelectionActive\n Accessible.checkable: true\n Accessible.checked: root.walletSelectionActive\n onClicked: {\n root.walletSelectionActive = !root.walletSelectionActive\n if (!root.walletSelectionActive) root.markedIds = []\n }\n }\n }\n\n Flow {\n Layout.fillWidth: true\n Layout.preferredHeight: childrenRect.height\n spacing: 10\n FilterButton {\n id: activeFiltersButton\n objectName: \"coinBrowserActiveFiltersButton\"\n visible: root.activeFilterCount > 0\n active: true\n count: root.activeFilterCount\n size: coinTypeButton.height\n iconSize: Theme.size.icon.l\n text: count === 1 ? qsTr(\"1 active filter\") : qsTr(\"%1 active filters\").arg(count)\n onClicked: root.openMenu(clearFiltersMenu, activeFiltersButton)\n }\n DropdownButton {\n id: coinTypeButton\n objectName: \"coinBrowserFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: !root.coins || root.coins.filter === \"all\" ? qsTr(\"Coin type\") : root.coins.filter === \"locked\" ? qsTr(\"Locked\") : qsTr(\"Spendable\")\n active: root.coins && root.coins.filter !== \"all\"\n opened: filterMenu.opened\n onClicked: root.openMenu(filterMenu, coinTypeButton)\n }\n DropdownButton {\n id: amountFilterButton\n objectName: \"coinBrowserAmountFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: qsTr(\"Amount\")\n active: root.coins && (root.coins.minAmount >= 0 || root.coins.maxAmount >= 0)\n opened: amountPopup.opened\n onClicked: root.openMenu(amountPopup, amountFilterButton)\n }\n }\n\n ListView {\n id: list\n objectName: \"coinSelectionListView\"\n Layout.fillWidth: true; Layout.fillHeight: true; Layout.minimumHeight: 120\n clip: true; model: root.coins; reuseItems: true\n boundsBehavior: Flickable.StopAtBounds\n ScrollBar.vertical: ScrollBar {}\n section.property: \"groupTitle\"\n section.criteria: ViewSection.FullString\n section.delegate: Item {\n required property string section\n width: list.width; height: 44\n CoreText {\n anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom; anchors.bottomMargin: 8\n anchors.leftMargin: Theme.space.xs; anchors.rightMargin: Theme.space.xs",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efd7e4986698..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | The settings test wallet exposes a different completion contracttest/qml/qml_tests_main.cpp | still_present | AssessmentThe new-head fixture methods still return startSettingsOperation() acceptance and backupWallet() still defers completion through QTimer. The excerpt does not establish synchronous configurable outcomes matching production. new_source: test/qml/qml_tests_main.cpp [
{
"bounded": true,
"end_line": 1825,
"evidence_id": "eea89a8d4e464f8d8947d2a05cd7d6a6",
"finding_id": "finding:7",
"kind": "new_source",
"line": 1676,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"path": "test/qml/qml_tests_main.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 5,
"source_job_id": 3046,
"text": " Q_EMIT request->idChanged();\n Q_EMIT request->addressChanged();\n Q_EMIT request->isEditingChanged();\n finishReceiveOperation(QStringLiteral(\"save\"));\n return true;\n }\n Q_INVOKABLE bool updatePaymentRequest(const QString& id, qint64 amount, const QString& label, const QString& message, const QString& note)\n {\n auto* request = &m_detail_payment_request;\n if (request->m_id != id) return false;\n if (request->m_payment_received && (amount != request->m_amount.satoshi() || label != request->m_label || message != request->m_message)) return false;\n request->m_amount.setSatoshi(amount);\n request->setProperty(\"label\", label);\n request->setProperty(\"message\", message);\n request->setProperty(\"noteSelf\", note);\n finishReceiveOperation(QStringLiteral(\"update\"));\n return true;\n }\n Q_INVOKABLE bool commitPaymentRequestWithPassphrase(const QString&)\n {\n return commitPaymentRequest();\n }\n Q_INVOKABLE void clearSettingsError()\n {\n if (m_settings_error.isEmpty()) return;\n m_settings_error.clear();\n Q_EMIT settingsErrorChanged();\n }\n Q_INVOKABLE bool encryptWallet(const QString&)\n {\n return startSettingsOperation(QStringLiteral(\"encrypt\"));\n }\n Q_INVOKABLE bool changeWalletPassphrase(const QString&, const QString&)\n {\n return startSettingsOperation(QStringLiteral(\"passphrase\"));\n }\n Q_INVOKABLE void completeSettingsOperation(bool success)\n {\n if (!m_settings_busy) return;\n const QString operation = std::exchange(m_pending_settings_operation, QString{});\n m_settings_busy = false;\n if (success && operation == QStringLiteral(\"encrypt\")) {\n m_is_encrypted = true;\n m_is_locked = true;\n Q_EMIT securityStateChanged();\n }\n if (!success) {\n m_settings_error = QStringLiteral(\"The wallet operation failed.\");\n Q_EMIT settingsErrorChanged();\n }\n Q_EMIT settingsBusyChanged();\n Q_EMIT settingsOperationFinished(operation, success);\n }\n bool startSettingsOperation(const QString& operation)\n {\n if (m_settings_busy) return false;\n clearSettingsError();\n m_settings_busy = true;\n m_pending_settings_operation = operation;\n Q_EMIT settingsBusyChanged();\n if (m_settings_auto_complete) QTimer::singleShot(0, this, [this] { completeSettingsOperation(true); });\n return true;\n }\n Q_INVOKABLE bool backupWallet(const QString& path)\n {\n if (m_settings_busy) return false;\n m_settings_busy = true;\n Q_EMIT settingsBusyChanged();\n QTimer::singleShot(0, this, [this, path] {\n m_last_backup_path = path;\n ++m_backup_wallet_calls;\n clearSettingsError();\n m_settings_busy = false;\n Q_EMIT backupWalletCallsChanged();\n Q_EMIT settingsBusyChanged();\n Q_EMIT settingsOperationFinished(QStringLiteral(\"backup\"), true);\n });\n return true;\n }\n Q_INVOKABLE void resetWalletSettingsTestState()\n {\n m_last_backup_path.clear();\n m_backup_wallet_calls = 0;\n m_key_scheme = QStringLiteral(\"Descriptor\");\n m_private_keys_status = QStringLiteral(\"Enabled\");\n m_external_signer_status = QStringLiteral(\"Not used\");\n m_can_manage_passphrase = true;\n clearSettingsError();\n Q_EMIT backupWalletCallsChanged();\n Q_EMIT walletInfoChanged();\n }\n Q_INVOKABLE void setExternalSignerWalletSettingsTestState()\n {\n m_key_scheme = QStringLiteral(\"Watch-only\");\n m_private_keys_status = QStringLiteral(\"Disabled\");\n m_external_signer_status = QStringLiteral(\"Enabled\");\n m_can_manage_passphrase = false;\n Q_EMIT walletInfoChanged();\n }\n Q_INVOKABLE void usePaymentRequestAsTemplate(const QString& request_id)\n {\n m_receiving_address.clear();\n m_last_template_request_id = request_id;\n Q_EMIT lastTemplateRequestIdChanged();\n auto* request = qobject_cast<MockPaymentRequest*>(m_current_payment_request);\n if (!request) return;\n request->m_id.clear();\n request->m_label = m_saved_payment_request_label;\n request->m_message = m_saved_payment_request_message;\n request->m_note_self = m_saved_payment_request_note_self;\n request->m_address.clear();\n request->m_address_type = m_saved_payment_request_address_type;\n request->m_is_editing = true;\n request->m_amount.m_display = m_saved_payment_request_amount_display;\n Q_EMIT request->idChanged();\n Q_EMIT request->labelChanged();\n Q_EMIT request->messageChanged();\n Q_EMIT request->noteSelfChanged();\n Q_EMIT request->addressChanged();\n Q_EMIT request->addressTypeChanged();\n Q_EMIT request->isEditingChanged();\n Q_EMIT request->m_amount.displayChanged();\n finishReceiveOperation(QStringLiteral(\"rememberAddress\"));\n }\n Q_INVOKABLE void releaseReceiveOperation()\n {\n if (!m_held_receive_operation) return;\n const auto [operation, success] = *std::exchange(m_held_receive_operation, std::nullopt);\n completeReceiveOperation(operation, success);\n }\n Q_INVOKABLE bool removeReceiveRequest(const QString& request_id)\n {\n if (m_remove_receive_request_result) {\n m_last_removed_request_id = request_id;\n Q_EMIT lastRemovedRequestIdChanged();\n }\n finishReceiveOperation(QStringLiteral(\"remove\"), m_remove_receive_request_result);\n return true;\n }\n\nQ_SIGNALS:\n void availableChanged();\n void nameChanged();\n void balanceChanged();\n void targetBlocksChanged();\n void customFeeEnabledChanged();\n void customFeeRateChanged();\n void customFeeRateValidChanged();\n void feeEstimatePendingChanged();\n void feeEstimateRevisionChanged();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efd7e4986698..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Light Receive commands perform an unnecessary full wallet scanqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe new head still unconditionally calls read(node) before command dispatch. Label, Remove, AddressType, and RememberAddress therefore retain the full pre-read even though the finding calls for targeted validation reads. new_source: qml/models/walletstatesnapshot.cpp [
{
"bounded": true,
"end_line": 441,
"evidence_id": "31a5076cff9e4f03ab6be570bf1daf42",
"finding_id": "finding:6",
"kind": "new_source",
"line": 298,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 5,
"source_job_id": 3046,
"text": " } catch (...) {\n // Persistence may already have succeeded. Keep its result and ID\n // so retrying the refresh cannot create another request.\n result.refresh_error = Tr(\"Wallet information could not be refreshed. It will be retried.\");\n }\n return std::move(result);\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n if (command.passphrase) {\n const auto unlocked = TryUnlockWithPassphrase(*m_wallet, *command.passphrase);\n command.passphrase.reset();\n if (unlocked == WalletUnlockResult::IncorrectPassphrase) {\n result.error = Tr(\"The wallet password you entered was incorrect.\");\n return finish();\n }\n relock = unlocked == WalletUnlockResult::UnlockedNowRelockRequired;\n }\n WalletRelockGuard guard{*m_wallet, [] {}, relock};\n // Release cs_wallet before settings I/O and before relocking, which takes the relock mutex first.\n std::unique_ptr<UniqueLock<RecursiveMutex>> wallet_lock;\n if (command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) {\n if (auto* wallet = m_wallet->wallet()) {\n wallet_lock = std::make_unique<UniqueLock<RecursiveMutex>>(wallet->cs_wallet, \"wallet->cs_wallet\", __FILE__, __LINE__);\n }\n }\n auto state = read(node);\n auto complete = [&] {\n wallet_lock.reset();\n guard.relock();\n if (unlock_session) unlock_session.unlock();\n return finish();\n };\n QSettings settings;\n const auto address_key = settingsKey();\n const auto type_text = command.address_type.isEmpty() ? state.receive_address_type : command.address_type;\n const auto type = ParseOutputType(type_text.toStdString());\n auto new_address = [&](const std::string& label) -> QString {\n if (!type || !SupportsType(state, *type)) {\n result.error = Tr(\"The selected address type is unavailable.\");\n return {};\n }\n const auto destination = m_wallet->getNewDestination(*type, label);\n if (!destination || !IsValidDestination(*destination)) {\n const auto security = ReadSecurityState(*m_wallet);\n result.needs_unlock = security.encrypted && security.locked;\n result.error = result.needs_unlock ? Tr(\"Enter your wallet password to create an address.\") : Tr(\"A receiving address could not be generated. Please try again.\");\n return {};\n }\n return Address(*destination);\n };\n const auto saved_address = [&](const QString& address) {\n return std::any_of(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& entry) {\n return entry.recipient.address == address.toStdString();\n });\n };\n if (command.kind == ReceiveCommand::Kind::EnsureAddress) {\n auto address = command.address.isEmpty() ? settings.value(address_key).toString() : command.address;\n const auto destination = DecodeDestination(address.toStdString());\n wallet::AddressPurpose purpose{};\n const auto old_type = AddressType(destination);\n if (command.next || !IsValidDestination(destination) || !m_wallet->getAddress(destination, nullptr, &purpose) || purpose != wallet::AddressPurpose::RECEIVE || m_observed_addresses.contains(address) || saved_address(address) || (!command.address_type.isEmpty() && (!old_type || !type || *old_type != *type))) {\n address = new_address({});\n }\n if (address.isEmpty()) return complete();\n wallet_lock.reset();\n settings.setValue(address_key, address);\n settings.sync();\n if (settings.status() != QSettings::NoError || !setAddressType(node, type_text)) result.error = Tr(\"The receiving address preference could not be saved.\");\n else { result.receiving_address = address; result.success = true; }\n } else if (command.kind == ReceiveCommand::Kind::Save) {\n auto entry = command.entry;\n if (!MoneyRange(entry.recipient.amount)) { result.error = Tr(\"The request amount is invalid.\"); return complete(); }\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == entry.id; });\n if (entry.id != 0) {\n if (existing == state.receive_requests.end() || existing->recipient.address != entry.recipient.address) { result.error = Tr(\"The payment request is no longer available.\"); return complete(); }\n entry.payment_received = existing->payment_received;\n entry.date = existing->date;\n if (entry.payment_received && (entry.recipient.amount != existing->recipient.amount || entry.recipient.label != existing->recipient.label || entry.recipient.message != existing->recipient.message)) { result.error = Tr(\"A paid payment request cannot be changed.\"); return complete(); }\n } else {\n if (command.reserve_receiving_address && (entry.recipient.address.empty() || m_observed_addresses.contains(QString::fromStdString(entry.recipient.address)))) { result.error = Tr(\"This address has received a payment. Create a new receiving address.\"); return complete(); }\n if (command.reserve_receiving_address && saved_address(QString::fromStdString(entry.recipient.address))) { result.error = Tr(\"This address already belongs to a saved request. Create a new receiving address.\"); return complete(); }\n int64_t maximum{0};\n for (const auto& item : state.receive_requests) maximum = std::max(maximum, item.id);\n if (maximum >= std::numeric_limits<unsigned int>::max()) { result.error = Tr(\"No more payment requests can be saved.\"); return complete(); }\n entry.id = maximum + 1;\n entry.date = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch());\n if (entry.recipient.address.empty()) entry.recipient.address = new_address(entry.recipient.noteSelf).toStdString();\n if (entry.recipient.address.empty()) return complete();\n if (command.note_is_prefill) {\n std::string label;\n if (m_wallet->getAddress(DecodeDestination(entry.recipient.address), &label, nullptr)) entry.recipient.noteSelf = label;\n }\n }\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(entry.recipient.address), util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) { result.error = Tr(\"The payment request could not be saved.\"); return complete(); }\n result.saved_entry = entry;\n result.success = true;\n const auto address = QString::fromStdString(entry.recipient.address);\n std::string old_label_text;\n m_wallet->getAddress(DecodeDestination(entry.recipient.address), &old_label_text, nullptr);\n const auto old_label = QString::fromStdString(old_label_text);\n const auto note = QString::fromStdString(entry.recipient.noteSelf);\n const bool note_changed = existing == state.receive_requests.end() || existing->recipient.noteSelf != entry.recipient.noteSelf;\n if (note_changed && old_label != note && (!note.isEmpty() || (existing != state.receive_requests.end() && old_label.toStdString() == existing->recipient.noteSelf))) {\n if (!m_wallet->setAddressBook(DecodeDestination(entry.recipient.address), entry.recipient.noteSelf, wallet::AddressPurpose::RECEIVE)) result.error = Tr(\"The request was saved, but its address label could not be saved.\");\n }\n wallet_lock.reset();\n if (command.reserve_receiving_address) {\n settings.remove(address_key);\n settings.sync();\n // Harmless once the request is saved, so log it instead of failing.\n if (settings.status() != QSettings::NoError) qWarning() << \"Could not clear the receiving address preference for\" << address_key;\n }\n } else if (command.kind == ReceiveCommand::Kind::Remove) {\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == command.entry.id; });\n result.success = existing != state.receive_requests.end() && m_wallet->setAddressReceiveRequest(DecodeDestination(existing->recipient.address), util::ToString(existing->id), {});\n if (!result.success) result.error = Tr(\"The payment request could not be removed.\");\n } else if (command.kind == ReceiveCommand::Kind::Label) {\n const auto destination = DecodeDestination(command.address.toStdString());\n wallet::AddressPurpose purpose{};\n result.success = IsValidDestination(destination) && m_wallet->getAddress(destination, nullptr, &purpose) && m_wallet->setAddressBook(destination, command.label.toStdString(), purpose);\n if (result.success) {\n for (auto entry : state.receive_requests) {\n if (entry.recipient.address != command.address.toStdString() || entry.recipient.noteSelf == command.label.toStdString()) continue;\n entry.recipient.noteSelf = command.label.toStdString();\n if (!m_wallet->setAddressReceiveRequest(destination, util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) result.error = Tr(\"The address label was saved, but a payment request note could not be saved.\");\n }\n } else result.error = Tr(\"The address label could not be saved.\");\n } else if (command.kind == ReceiveCommand::Kind::AddressType) {\n result.success = type && SupportsType(state, *type) && setAddressType(node, type_text);\n if (!result.success) result.error = Tr(\"The receiving address preference could not be saved.\");\n } else if (command.kind == ReceiveCommand::Kind::RememberAddress) {\n if (command.address.isEmpty()) settings.remove(address_key);\n else settings.setValue(address_key, command.address);\n settings.sync();\n result.success = settings.status() == QSettings::NoError;\n if (!result.success) result.error = Tr(\"The receiving address preference could not be saved.\");\n }\n return complete();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efd7e4986698..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | A busy unlock session leaves fee-bump review stuck in Failedqml/models/bumptransactionmodel.cpp | still_present | AssessmentOn unlock-session contention, confirmFeeBumpInternal() still calls setError() and returns. The excerpt does not show retaining NeedsConfirmation or another retryable state. new_source: qml/models/bumptransactionmodel.cpp [
{
"bounded": true,
"end_line": 256,
"evidence_id": "fdaaac6817d04497ab93de5fb7859b77",
"finding_id": "finding:5",
"kind": "new_source",
"line": 130,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"path": "qml/models/bumptransactionmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 5,
"source_job_id": 3046,
"text": "}\n\nbool BumpTransactionModel::confirmFeeBump()\n{\n return confirmFeeBumpInternal(std::nullopt);\n}\n\nbool BumpTransactionModel::confirmFeeBumpWithPassphrase(const QString& passphrase)\n{\n return confirmFeeBumpInternal(std::optional<SecureString>{QmlUtil::SecureStringFromQString(passphrase)});\n}\n\nbool BumpTransactionModel::confirmFeeBumpInternal(std::optional<SecureString> passphrase)\n{\n if (!m_wallet || m_state != NeedsConfirmation) {\n if (passphrase.has_value()) {\n QmlUtil::ClearSecureString(*passphrase);\n passphrase.reset();\n }\n return false;\n }\n\n std::unique_lock<std::mutex> unlock_session;\n const bool crypted{m_wallet->isCrypted()};\n if (crypted) unlock_session = m_unlock_session->tryAcquire();\n if (crypted && !unlock_session) {\n if (passphrase.has_value()) {\n QmlUtil::ClearSecureString(*passphrase);\n passphrase.reset();\n }\n setError(tr(\"The wallet is busy with another operation. Try again in a moment.\"));\n return false;\n }\n if (!m_wallet->privateKeysDisabled() && m_wallet->isCrypted() && m_wallet->isLocked() && !passphrase.has_value()) {\n setUnlockRequired(tr(\"Enter your wallet password to update this transaction.\"));\n return false;\n }\n\n bool relock{false};\n if (!unlockForCommit(passphrase, relock)) {\n return false;\n }\n WalletRelockGuard relock_guard{*m_wallet, [this] {\n if (m_security_state_changed_fn) {\n m_security_state_changed_fn();\n }\n }, relock};\n\n setNeedsUnlock(false);\n setState(Committing);\n\n if (!m_wallet->transactionCanBeBumped(m_original_txid)) {\n relock_guard.relock();\n setError(tr(\"Transaction can no longer be bumped.\"));\n return false;\n }\n\n if (!m_wallet->signBumpTransaction(m_bump_mtx)) {\n relock_guard.relock();\n setError(tr(\"Failed to sign transaction.\"));\n return false;\n }\n\n std::vector<bilingual_str> errors;\n Txid bumped_txid;\n if (!m_wallet->commitBumpTransaction(m_original_txid, std::move(m_bump_mtx), errors, bumped_txid)) {\n relock_guard.relock();\n setError(errors.empty() ? tr(\"Failed to commit transaction.\") : QString::fromStdString(errors[0].translated));\n return false;\n }\n\n m_new_txid = QString::fromStdString(bumped_txid.GetHex());\n relock_guard.relock();\n setState(Succeeded);\n Q_EMIT resultChanged();\n return true;\n}\n\nbool BumpTransactionModel::unlockForCommit(std::optional<SecureString>& passphrase, bool& relock)\n{\n relock = false;\n if (!m_wallet) {\n if (passphrase.has_value()) {\n QmlUtil::ClearSecureString(*passphrase);\n passphrase.reset();\n }\n return false;\n }\n if (!passphrase.has_value()) {\n return true;\n }\n\n const auto result{TryUnlockWithPassphrase(*m_wallet, *passphrase)};\n passphrase.reset();\n switch (result) {\n case WalletUnlockResult::IncorrectPassphrase:\n setUnlockRequired(tr(\"The wallet password you entered was incorrect.\"));\n return false;\n case WalletUnlockResult::AlreadyUnlocked:\n return true;\n case WalletUnlockResult::UnlockedNowRelockRequired:\n relock = true;\n if (m_security_state_changed_fn) {\n m_security_state_changed_fn();\n }\n return true;\n }\n return false;\n}\n\nvoid BumpTransactionModel::reset()\n{\n m_state = Idle;\n m_action_type = SpeedUp;\n m_old_fee = 0;\n m_new_fee = 0;\n m_bump_mtx = CMutableTransaction{};\n m_original_txid = Txid{};\n m_new_txid.clear();\n m_error.clear();\n m_needs_unlock = false;\n\n Q_EMIT stateChanged();\n Q_EMIT actionTypeChanged();\n Q_EMIT resultChanged();\n Q_EMIT needsUnlockChanged();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efd7e4986698..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Unrelated wallet snapshots invalidate Send fee previewsqml/models/walletqmlmodel.cpp | still_present | AssessmentapplyWalletState() still unconditionally calls scheduleFeeEstimates(). The supplied new-head excerpt shows no preservation of the existing preview or allowance for Review while refreshing an unchanged draft. new_source: qml/models/walletqmlmodel.cpp [
{
"bounded": true,
"end_line": 853,
"evidence_id": "0424412f58ec4819b578a418d8d050a1",
"finding_id": "finding:3",
"kind": "new_source",
"line": 704,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 5,
"source_job_id": 3046,
"text": " const bool balance_changed = !m_wallet_state_ready || state.balance != m_wallet_state.balance || state.available_balance != m_wallet_state.available_balance;\n const bool was_encrypted = m_is_encrypted;\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n m_receive_requests->setEntries(std::vector<QmlRecentRequestEntry>{m_wallet_state.receive_requests});\n for (auto* request : {m_receiving_address, m_current_payment_request, m_detail_payment_request}) {\n if (!request) continue;\n if (m_wallet_state.observed_addresses.contains(request->address())) request->setPaymentReceived(true);\n if (const auto entry = m_receive_requests->entryById(request->id()); entry && !request->isEditing()) {\n applySavedRequest(request, *entry);\n }\n }\n updateReceivedPaymentRequestAmounts();\n m_receive_reconciliation_applying = false;\n if (name_changed) { Q_EMIT nameChanged(); Q_EMIT displayNameChanged(); }\n if (was_encrypted != m_is_encrypted || was_locked != m_is_locked) Q_EMIT securityStateChanged();\n Q_EMIT walletStateChanged();\n if (labels_changed) {\n followPrefilledNote();\n Q_EMIT addressListChanged();\n }\n if (balance_changed) Q_EMIT balanceChanged();\n refreshSelectedAvailableBalance(false);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n // New funds and lock changes affect previews without editing the draft.\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::applySavedRequest(PaymentRequest* request, const QmlRecentRequestEntry& entry)\n{\n if (!request) return;\n request->setDestination(DecodeDestination(entry.recipient.address));\n request->setId(static_cast<unsigned int>(entry.id));\n request->setCreated(entry.date);\n request->amount()->setSatoshi(entry.recipient.amount);\n request->setLabel(QString::fromStdString(entry.recipient.label));\n request->setMessage(QString::fromStdString(entry.recipient.message));\n request->setNoteSelf(QString::fromStdString(entry.recipient.noteSelf));\n request->setPaymentReceived(entry.payment_received);\n request->setReceivedAmountSatoshi(receivedPaymentRequestAmount(request->address()));\n request->setIsEditing(false);\n request->setNeedsUnlock(false);\n request->setUnlockError({});\n}\n\nbool WalletQmlModel::canSubmitReceiveCommand() const\n{\n return available() && !m_stopping && m_wallet_state_backend && !m_receive_operation_pending;\n}\n\nbool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operation, PaymentRequest* request)\n{\n if (!canSubmitReceiveCommand()) return false;\n m_receive_operation_pending = true;\n m_receive_operation_error.clear();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n const auto backend = m_wallet_state_backend;\n const auto node = m_node;\n const QPointer<PaymentRequest> held{request};\n const auto revision = request ? request->revision() : 0;\n const bool reserve = command.reserve_receiving_address;\n m_backend_executor->submitTask(this,\n [backend, node, command = std::move(command)]() mutable { return backend->execute(node, std::move(command)); },\n [this, held, revision, operation, reserve](BackendExecutor::Outcome<ReceiveCommandResult> outcome) {\n auto* received = std::get_if<0>(&outcome);\n if (!received) {\n m_receive_operation_pending = false;\n m_receive_operation_error = tr(\"The wallet operation failed. Please try again.\");\n if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, false);\n requestWalletStateRefresh();\n return;\n }\n auto& result = *received;\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n std::optional<QmlRecentRequestEntry> saved_entry;\n if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n // The final read can already include a payment that arrived after the write.\n if (saved_entry) {\n if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n if (result.success && result.saved_entry) m_receive_requests->prependOrReplace(*result.saved_entry);\n m_wallet_state_error = result.refresh_error;\n Q_EMIT walletStateChanged();\n requestWalletStateRefresh();\n }\n if (current_request) {\n held->setNeedsUnlock(result.needs_unlock);\n held->setUnlockError(result.error);\n if (result.success && !result.receiving_address.isEmpty()) {\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n if (saved_entry) {\n if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n if (result.success && reserve && result.saved_entry &&\n m_receiving_address->address().toStdString() == result.saved_entry->recipient.address) {\n m_receiving_address->clear();\n }\n if (held && !current_request) {\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }\n if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, result.success);\n if (walletStateRefreshNeeded()) scheduleWalletStateRefresh();\n });\n return true;\n}\n\nvoid WalletQmlModel::beginShutdown(bool remove_wallet)\n{\n if (m_stopping) return;\n m_stopping = true;\n const bool was_available{available()};\n m_unload_requested->store(true);\n if (was_available) Q_EMIT availableChanged();\n m_wallet_poll_timer.stop();\n m_state_refresh_retry_timer.stop();\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n // Move subscriptions into the last backend job. Callback delivery targets\n // the separately retained bridge, never a raw pointer to this model.\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efd7e4986698..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Message signing races first-time wallet encryptionqml/models/signverifymessagemodel.cpp | still_present | AssessmentThe new-head signing task still calls wallet->isCrypted() before acquiring the unlock session and wallet->isCrypted()/isLocked() again afterward. It does not use the cs_wallet-protected ReadSecurityState helper described in the finding. new_source: qml/models/signverifymessagemodel.cpp [
{
"bounded": true,
"end_line": 173,
"evidence_id": "a8545ab546d9482ab1663129f589a103",
"finding_id": "finding:2",
"kind": "new_source",
"line": 46,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"path": "qml/models/signverifymessagemodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 5,
"source_job_id": 3046,
"text": "bool SignVerifyMessageModel::isLegacyP2PKHAddress(const QString& address) const\n{\n return LegacyP2PKHFromAddress(address).has_value();\n}\n\nbool SignVerifyMessageModel::signMessage(const QString& address, const QString& message)\n{\n return signMessageInternal(address, message, std::nullopt);\n}\n\nbool SignVerifyMessageModel::signMessageWithPassphrase(const QString& address, const QString& message, const QString& passphrase)\n{\n return signMessageInternal(address, message, QmlUtil::SecureStringFromQString(passphrase));\n}\n\nbool SignVerifyMessageModel::signMessageInternal(const QString& address, const QString& message, std::optional<SecureString> passphrase)\n{\n if (m_signing_pending) return false;\n clearSigningStatus();\n setSignature({});\n if (!m_wallet) { setSigningStatus(tr(\"No wallet is selected.\")); return false; }\n const auto pkhash = LegacyP2PKHFromAddress(address);\n if (!pkhash) { setSigningStatus(tr(\"Enter a legacy P2PKH bitcoin address.\")); return false; }\n struct Result { QString signature; QString error; bool needs_unlock{false}; };\n m_signing_pending = true;\n const auto generation = ++m_signing_generation;\n Q_EMIT signingPendingChanged();\n const auto wallet = m_wallet;\n m_executor->submitTask(this, [wallet, session = m_unlock_session, pkhash = *pkhash, message = message.toStdString(), passphrase = std::move(passphrase)]() mutable {\n std::unique_lock<std::mutex> unlock_session;\n if (passphrase || wallet->isCrypted()) unlock_session = session->acquire();\n Result result;\n bool relock{false};\n if (wallet->isCrypted() && wallet->isLocked()) {\n if (!passphrase) {\n result.needs_unlock = true;\n result.error = tr(\"Enter your wallet password to sign this message.\");\n return result;\n }\n const auto unlocked = TryUnlockWithPassphrase(*wallet, *passphrase);\n passphrase.reset();\n if (unlocked == WalletUnlockResult::IncorrectPassphrase) { result.error = tr(\"The wallet password you entered was incorrect.\"); return result; }\n relock = unlocked == WalletUnlockResult::UnlockedNowRelockRequired;\n }\n if (passphrase) { QmlUtil::ClearSecureString(*passphrase); passphrase.reset(); }\n WalletRelockGuard guard{*wallet, [] {}, relock};\n std::string signature;\n const auto status = wallet->signMessage(message, pkhash, signature);\n if (status == SigningResult::OK) result.signature = QString::fromStdString(signature);\n else result.error = QString::fromStdString(SigningResultString(status));\n return result;\n }, [this, generation](BackendExecutor::Outcome<Result> outcome) {\n m_signing_pending = false;\n Q_EMIT signingPendingChanged();\n notifySecurityStateChanged();\n if (generation != m_signing_generation) return;\n if (const auto* result = std::get_if<0>(&outcome)) {\n setSigningStatus(result->error, result->needs_unlock);\n setSignature(result->signature);\n Q_EMIT signingFinished(result->error.isEmpty());\n } else {\n setSigningStatus(tr(\"The message could not be signed. Please try again.\"));\n Q_EMIT signingFinished(false);\n }\n });\n return true;\n}\n\nbool SignVerifyMessageModel::verifyMessage(const QString& address, const QString& message, const QString& signature)\n{\n if (m_verification_pending) return false;\n const auto generation = ++m_verification_generation;\n m_verification_pending = true;\n m_verification_valid = false;\n Q_EMIT verificationPendingChanged();\n m_executor->submitTask(this, [address = address.trimmed().toStdString(), message = message.toStdString(), signature = signature.trimmed().toStdString()] {\n return MessageVerify(address, signature, message) == MessageVerificationResult::OK;\n }, [this, generation](BackendExecutor::Outcome<bool> outcome) {\n m_verification_pending = false;\n Q_EMIT verificationPendingChanged();\n if (generation != m_verification_generation) return;\n const auto* valid = std::get_if<0>(&outcome);\n m_verification_valid = valid && *valid;\n Q_EMIT verificationFinished();\n });\n return true;\n}\n\nvoid SignVerifyMessageModel::clear()\n{\n ++m_signing_generation;\n ++m_verification_generation;\n m_verification_valid = false;\n clearSigningStatus();\n setSignature(QString());\n}\n\nvoid SignVerifyMessageModel::clearSigningStatus()\n{\n setSigningStatus(QString());\n}\n\nvoid SignVerifyMessageModel::setSigningStatus(const QString& error, bool needs_unlock)\n{\n if (m_signing_error != error) {\n m_signing_error = error;\n Q_EMIT signingErrorChanged();\n }\n if (m_signing_needs_unlock != needs_unlock) {\n m_signing_needs_unlock = needs_unlock;\n Q_EMIT signingNeedsUnlockChanged();\n }\n}\n\nvoid SignVerifyMessageModel::setSignature(const QString& signature)\n{\n if (m_signature != signature) {\n m_signature = signature;\n Q_EMIT signatureChanged();\n }\n}\n\nvoid SignVerifyMessageModel::notifySecurityStateChanged()\n{\n if (m_security_state_changed) {\n m_security_state_changed();\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efd7e4986698..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Send can still spend a coin while its lock is pendingqml/models/walletqmlmodel.cpp | still_present | AssessmentThe new-head setCoinsLocked completion still unselects selected outputs only after the asynchronous result arrives. The supplied excerpt does not show a pending-lock guard in transaction preparation or the Review control, so the reported window remains unresolved. new_source: qml/models/walletqmlmodel.cpp [
{
"bounded": true,
"end_line": 2620,
"evidence_id": "c5435a8cfb394174b9fce023d541b4d1",
"finding_id": "finding:1",
"kind": "new_source",
"line": 2471,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 5,
"source_job_id": 3046,
"text": " m_current_transaction_can_send = false;\n m_current_transaction_can_broadcast = false;\n m_current_transaction_review_message.clear();\n clearTransactionStatus();\n m_send_recipients->clear();\n\n if (had_transaction_state) {\n Q_EMIT currentTransactionChanged();\n }\n}\n\nbool WalletQmlModel::canBumpTransaction(const uint256& txid) const\n{\n if (!m_wallet) {\n return false;\n }\n return m_wallet->transactionCanBeBumped(Txid::FromUint256(txid));\n}\n\ninterfaces::Wallet::CoinsList WalletQmlModel::listCoins() const\n{\n if (!m_wallet) {\n return {};\n }\n return m_wallet_state.coins;\n}\n\nbool WalletQmlModel::setCoinsLocked(std::vector<COutPoint> outputs, bool locked)\n{\n if (m_stopping || !m_wallet_state_backend || m_coin_lock_pending || outputs.empty()) return false;\n m_coin_lock_pending = true;\n m_coin_lock_error.clear();\n Q_EMIT coinLockStateChanged();\n const auto backend = m_wallet_state_backend;\n const auto node = m_node;\n // Use the snapshot reader's serial executor so earlier refreshes cannot\n // arrive after this command's result and restore an obsolete lock state.\n m_backend_executor->submitTask(this,\n [backend, node, outputs, locked] { return backend->setCoinsLocked(node, outputs, locked); },\n [this, outputs, locked](BackendExecutor::Outcome<CoinLockResult> outcome) {\n if (!m_stopping) {\n if (auto* result = std::get_if<0>(&outcome)) {\n if (locked) {\n for (const auto& output : outputs) {\n if (result->snapshot.locked_coins.contains(output)) unselectCoin(output);\n }\n }\n m_coin_lock_error = result->success ? QString{} : tr(\"Some coins could not be updated. Try again.\");\n applyWalletState(std::move(result->snapshot));\n scheduleFeeEstimates();\n } else {\n m_coin_lock_error = tr(\"Coins could not be updated or reloaded. Try again.\");\n requestWalletStateRefresh();\n }\n }\n m_coin_lock_pending = false;\n Q_EMIT coinLockStateChanged();\n if (walletStateRefreshNeeded()) scheduleWalletStateRefresh();\n });\n return true;\n}\n\nbool WalletQmlModel::isLockedCoin(const COutPoint& output)\n{\n if (!m_wallet) {\n return false;\n }\n return m_wallet_state.locked_coins.contains(output);\n}\n\nvoid WalletQmlModel::listLockedCoins(std::vector<COutPoint>& outputs)\n{\n if (!m_wallet) {\n return;\n }\n m_wallet->listLockedCoins(outputs);\n}\n\nvoid WalletQmlModel::selectCoin(const COutPoint& output)\n{\n const bool was_selected{m_coin_control.IsSelected(output)};\n m_coin_control.Select(output);\n if (!was_selected) {\n refreshSelectedAvailableBalance(true);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::unselectCoin(const COutPoint& output)\n{\n const bool was_selected{m_coin_control.IsSelected(output)};\n m_coin_control.UnSelect(output);\n if (was_selected) {\n refreshSelectedAvailableBalance(true);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n scheduleFeeEstimates();\n}\n\nbool WalletQmlModel::isSelectedCoin(const COutPoint& output)\n{\n return m_coin_control.IsSelected(output);\n}\n\nstd::vector<COutPoint> WalletQmlModel::listSelectedCoins() const\n{\n return m_coin_control.ListSelected();\n}\n\nvoid WalletQmlModel::clearSelectedCoins()\n{\n setMaximumRecipient(nullptr);\n if (m_coin_control.HasSelected()) setSelectedCoins({});\n}\n\nvoid WalletQmlModel::setSelectedCoins(const std::vector<COutPoint>& outputs)\n{\n // Restoring a cancelled coin-picker edit preserves the maximum recipient.\n m_coin_control.UnSelectAll();\n for (const auto& output : outputs) m_coin_control.Select(output);\n if (m_coins_list_model) m_coins_list_model->refreshSelection();\n refreshSelectedAvailableBalance(true);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::followPrefilledNote()\n{\n if (m_prefilled_note_address.isEmpty()) return;\n // A pending Receive command checks the request's revision; follow the label once it finishes.\n if (m_receive_operation_pending) {\n m_prefilled_note_follow_pending = true;\n return;\n }\n auto* request = m_current_payment_request;\n if (!request->id().isEmpty() || request->address() != m_prefilled_note_address || request->noteSelf() != m_prefilled_note) {\n m_prefilled_note_address.clear();\n return;\n }\n // An untouched prefill follows the label, so saving it cannot restore an older one.\n m_prefilled_note = getAddressLabel(m_prefilled_note_address);\n request->setNoteSelf(m_prefilled_note);\n}\n\nCAmount WalletQmlModel::sendAvailableBalance() const\n{\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efd7e4986698..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | The wallet-refactor commit adds an unexplained QML package.github/workflows/ci.yml | still_present | AssessmentThe supplied old and new CI excerpts are identical at the package list and do not show the requested preparatory dependency commit, explanatory commit message, or removal of the package edits. The evidence therefore does not demonstrate the suggested review-flow change. old_source: .github/workflows/ci.yml; new_source: .github/workflows/ci.yml [
{
"bounded": true,
"end_line": 110,
"evidence_id": "4b46f9e477c14ed5bdb8e78c0468c585",
"finding_id": "finding:9",
"kind": "old_source",
"line": 36,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": ".github/workflows/ci.yml",
"revision": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"source_generation": 4,
"source_job_id": 3018,
"text": " svg_package: 'qt6-svg-dev'\n effects_package: 'qml6-module-qtquick-effects'\n cmake_env: 'cmake -E env CXXFLAGS=\"-Wno-error=trailing-whitespace\" --'\n cmake_options: '-DCMAKE_COMPILE_WARNING_AS_ERROR=ON'\n\n env:\n BUILD_APP_TESTS: ON\n steps:\n - name: Checkout\n uses: actions/checkout@v7\n with:\n submodules: recursive\n\n - name: Install dependencies\n run: |\n sudo apt-get update\n sudo apt-get install -y \\\n build-essential \\\n cmake \\\n ninja-build \\\n pkg-config \\\n libsqlite3-dev \\\n zlib1g-dev \\\n libboost-all-dev \\\n ${{ matrix.svg_package }} qt6-base-dev \\\n qt6-base-dev-tools \\\n qt6-tools-dev \\\n qt6-l10n-tools \\\n qt6-tools-dev-tools \\\n qt6-declarative-dev \\\n qml6-module-qt-labs-folderlistmodel \\\n qml6-module-qt-labs-platform \\\n qml6-module-qt-labs-settings \\\n qml6-module-qtquick \\\n qml6-module-qtquick-controls \\\n qml6-module-qtquick-dialogs \\\n qml6-module-qtquick-shapes qml6-module-qtquick-layouts \\\n qml6-module-qtquick-templates \\\n qml6-module-qtquick-window \\\n qml6-module-qtqml-models qml6-module-qtqml \\\n qml6-module-qtqml-workerscript \\\n ${{ matrix.effects_package }} \\\n libgl-dev \\\n libqrencode-dev \\\n ${{ matrix.extra_packages }}\n\n - name: Configure (CMake)\n run: |\n ${{ matrix.cmake_env }} \\\n cmake -S . -B build -G Ninja \\\n -DCMAKE_BUILD_TYPE=Release \\\n -DBUILD_APP_TESTS=${{ env.BUILD_APP_TESTS }} \\\n -DENABLE_IPC=OFF \\\n ${{ matrix.cmake_options }}\n\n - name: Build\n run: cmake --build build --parallel\n\n - name: Run tests\n if: env.BUILD_APP_TESTS == 'ON'\n run: |\n mkdir -p build/test-reports\n ${{ matrix.test_wrapper }} ctest --test-dir build --output-on-failure \\\n --output-junit \"${PWD}/build/test-reports/ctest.xml\"\n\n - name: Upload test reports and failed profiles\n uses: actions/upload-artifact@v7\n if: always()\n with:\n name: app-test-results-${{ matrix.image }}\n path: |\n build/test-reports/\n build/test-profiles/\n build/Testing/Temporary/\n if-no-files-found: ignore",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 110,
"evidence_id": "741aa008724c4ab69d5d549ee94e1dd1",
"finding_id": "finding:9",
"kind": "new_source",
"line": 36,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": ".github/workflows/ci.yml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 4,
"source_job_id": 3018,
"text": " svg_package: 'qt6-svg-dev'\n effects_package: 'qml6-module-qtquick-effects'\n cmake_env: 'cmake -E env CXXFLAGS=\"-Wno-error=trailing-whitespace\" --'\n cmake_options: '-DCMAKE_COMPILE_WARNING_AS_ERROR=ON'\n\n env:\n BUILD_APP_TESTS: ON\n steps:\n - name: Checkout\n uses: actions/checkout@v7\n with:\n submodules: recursive\n\n - name: Install dependencies\n run: |\n sudo apt-get update\n sudo apt-get install -y \\\n build-essential \\\n cmake \\\n ninja-build \\\n pkg-config \\\n libsqlite3-dev \\\n zlib1g-dev \\\n libboost-all-dev \\\n ${{ matrix.svg_package }} qt6-base-dev \\\n qt6-base-dev-tools \\\n qt6-tools-dev \\\n qt6-l10n-tools \\\n qt6-tools-dev-tools \\\n qt6-declarative-dev \\\n qml6-module-qt-labs-folderlistmodel \\\n qml6-module-qt-labs-platform \\\n qml6-module-qt-labs-settings \\\n qml6-module-qtquick \\\n qml6-module-qtquick-controls \\\n qml6-module-qtquick-dialogs \\\n qml6-module-qtquick-shapes qml6-module-qtquick-layouts \\\n qml6-module-qtquick-templates \\\n qml6-module-qtquick-window \\\n qml6-module-qtqml-models qml6-module-qtqml \\\n qml6-module-qtqml-workerscript \\\n ${{ matrix.effects_package }} \\\n libgl-dev \\\n libqrencode-dev \\\n ${{ matrix.extra_packages }}\n\n - name: Configure (CMake)\n run: |\n ${{ matrix.cmake_env }} \\\n cmake -S . -B build -G Ninja \\\n -DCMAKE_BUILD_TYPE=Release \\\n -DBUILD_APP_TESTS=${{ env.BUILD_APP_TESTS }} \\\n -DENABLE_IPC=OFF \\\n ${{ matrix.cmake_options }}\n\n - name: Build\n run: cmake --build build --parallel\n\n - name: Run tests\n if: env.BUILD_APP_TESTS == 'ON'\n run: |\n mkdir -p build/test-reports\n ${{ matrix.test_wrapper }} ctest --test-dir build --output-on-failure \\\n --output-junit \"${PWD}/build/test-reports/ctest.xml\"\n\n - name: Upload test reports and failed profiles\n uses: actions/upload-artifact@v7\n if: always()\n with:\n name: app-test-results-${{ matrix.image }}\n path: |\n build/test-reports/\n build/test-profiles/\n build/Testing/Temporary/\n if-no-files-found: ignore",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b993e673e332..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | RememberAddress performs an unused full-wallet readqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe new head still executes `auto state = read(node);` before dispatch, including for RememberAddress, and the RememberAddress branch does not use that state. The final reconciliation read remains separate, so the unnecessary pre-read persists. new_source: qml/models/walletstatesnapshot.cpp [
{
"bounded": true,
"end_line": 441,
"evidence_id": "fd4fd3c58c3c40e884cf83df5f36887c",
"finding_id": "finding:8",
"kind": "new_source",
"line": 386,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 4,
"source_job_id": 3018,
"text": " if (maximum >= std::numeric_limits<unsigned int>::max()) { result.error = Tr(\"No more payment requests can be saved.\"); return complete(); }\n entry.id = maximum + 1;\n entry.date = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch());\n if (entry.recipient.address.empty()) entry.recipient.address = new_address(entry.recipient.noteSelf).toStdString();\n if (entry.recipient.address.empty()) return complete();\n if (command.note_is_prefill) {\n std::string label;\n if (m_wallet->getAddress(DecodeDestination(entry.recipient.address), &label, nullptr)) entry.recipient.noteSelf = label;\n }\n }\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(entry.recipient.address), util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) { result.error = Tr(\"The payment request could not be saved.\"); return complete(); }\n result.saved_entry = entry;\n result.success = true;\n const auto address = QString::fromStdString(entry.recipient.address);\n std::string old_label_text;\n m_wallet->getAddress(DecodeDestination(entry.recipient.address), &old_label_text, nullptr);\n const auto old_label = QString::fromStdString(old_label_text);\n const auto note = QString::fromStdString(entry.recipient.noteSelf);\n const bool note_changed = existing == state.receive_requests.end() || existing->recipient.noteSelf != entry.recipient.noteSelf;\n if (note_changed && old_label != note && (!note.isEmpty() || (existing != state.receive_requests.end() && old_label.toStdString() == existing->recipient.noteSelf))) {\n if (!m_wallet->setAddressBook(DecodeDestination(entry.recipient.address), entry.recipient.noteSelf, wallet::AddressPurpose::RECEIVE)) result.error = Tr(\"The request was saved, but its address label could not be saved.\");\n }\n wallet_lock.reset();\n if (command.reserve_receiving_address) {\n settings.remove(address_key);\n settings.sync();\n // Harmless once the request is saved, so log it instead of failing.\n if (settings.status() != QSettings::NoError) qWarning() << \"Could not clear the receiving address preference for\" << address_key;\n }\n } else if (command.kind == ReceiveCommand::Kind::Remove) {\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == command.entry.id; });\n result.success = existing != state.receive_requests.end() && m_wallet->setAddressReceiveRequest(DecodeDestination(existing->recipient.address), util::ToString(existing->id), {});\n if (!result.success) result.error = Tr(\"The payment request could not be removed.\");\n } else if (command.kind == ReceiveCommand::Kind::Label) {\n const auto destination = DecodeDestination(command.address.toStdString());\n wallet::AddressPurpose purpose{};\n result.success = IsValidDestination(destination) && m_wallet->getAddress(destination, nullptr, &purpose) && m_wallet->setAddressBook(destination, command.label.toStdString(), purpose);\n if (result.success) {\n for (auto entry : state.receive_requests) {\n if (entry.recipient.address != command.address.toStdString() || entry.recipient.noteSelf == command.label.toStdString()) continue;\n entry.recipient.noteSelf = command.label.toStdString();\n if (!m_wallet->setAddressReceiveRequest(destination, util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) result.error = Tr(\"The address label was saved, but a payment request note could not be saved.\");\n }\n } else result.error = Tr(\"The address label could not be saved.\");\n } else if (command.kind == ReceiveCommand::Kind::AddressType) {\n result.success = type && SupportsType(state, *type) && setAddressType(node, type_text);\n if (!result.success) result.error = Tr(\"The receiving address preference could not be saved.\");\n } else if (command.kind == ReceiveCommand::Kind::RememberAddress) {\n if (command.address.isEmpty()) settings.remove(address_key);\n else settings.setValue(address_key, command.address);\n settings.sync();\n result.success = settings.status() == QSettings::NoError;\n if (!result.success) result.error = Tr(\"The receiving address preference could not be saved.\");\n }\n return complete();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b993e673e332..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Async coin locking discards the selection needed for retryqml/components/CoinsList.qml | still_present | AssessmentlockMarked() still clears markedIds immediately when setCoinsLocked() accepts the asynchronous operation. The supplied new-head excerpt shows no completion-based retention or restoration of those marks. new_source: qml/components/CoinsList.qml [
{
"bounded": true,
"end_line": 183,
"evidence_id": "04e981b439aa4d008e09d7db3fc7ae4e",
"finding_id": "finding:7",
"kind": "new_source",
"line": 34,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/components/CoinsList.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 4,
"source_job_id": 3018,
"text": " readonly property int activeFilterCount: !coins ? 0 : (coins.filter !== \"all\" ? 1 : 0) + (coins.minAmount >= 0 || coins.maxAmount >= 0 ? 1 : 0)\n spacing: Theme.space.l\n onWalletChanged: { markedIds = []; walletSelectionActive = false; pendingLockedCoinId = \"\"; errorText = \"\" }\n\n BitcoinAmount { id: targetAmount; unit: optionsModel.displayUnit; satoshi: root.target }\n BitcoinAmount { id: selectedAmountText; unit: optionsModel.displayUnit; satoshi: root.selectedAmount }\n BitcoinAmount { id: remainingAmountText; unit: optionsModel.displayUnit; satoshi: root.remainingAmount }\n BitcoinAmount { id: changeAmountText; unit: optionsModel.displayUnit; satoshi: root.changeAmount }\n BitcoinAmount { id: totalAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi : 0 }\n BitcoinAmount { id: spendableAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi - root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lockedAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lowerAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.lowerValue }\n BitcoinAmount { id: upperAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.upperValue }\n\n function toggleRow(row, coinId, locked, marked) {\n if (selectionMode && locked && !marked) {\n pendingLockedCoinId = coinId\n lockedCoinAlert.open()\n } else if (selectionMode) coins.toggleCoinSelection(row)\n else if (walletSelectionActive) {\n const ids = markedIds.slice()\n const i = ids.indexOf(coinId)\n if (i < 0) ids.push(coinId); else ids.splice(i, 1)\n markedIds = ids\n }\n }\n function lockMarked(locked) {\n if (!coins || lockOperationPending) return\n if (coins.setCoinsLocked(markedIds, locked)) {\n errorText = \"\"\n markedIds = []\n } else {\n errorText = qsTr(\"Some coins could not be updated. Try again.\")\n }\n }\n function setCoinLocked(coinId, locked) {\n if (!coins || lockOperationPending) return\n errorText = coins.setCoinsLocked([coinId], locked) ? \"\" : qsTr(\"This coin could not be updated. Try again.\")\n }\n function openMenu(menu, button) {\n menu.openBelow(button, Theme.space.s)\n }\n function clearFilters() {\n if (!coins) return\n coins.filter = \"all\"\n coins.minAmount = -1\n coins.maxAmount = -1\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: 10\n SearchBar {\n objectName: \"coinBrowserSearch\"\n fieldObjectName: \"coinBrowserSearchField\"\n Layout.fillWidth: true\n placeholderText: SizeClass.isCompact(root.width) ? qsTr(\"Search coins\") : qsTr(\"Search notes, addresses or transaction IDs\")\n accessibleName: qsTr(\"Search coins\")\n text: root.coins ? root.coins.searchText : \"\"\n onTextChanged: if (root.coins) root.coins.searchText = text\n }\n IconButton {\n id: sortButton\n objectName: \"coinBrowserSortButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/arrow-up-down.svg\"\n accessibleName: qsTr(\"Sort coins\")\n onClicked: root.openMenu(sortMenu, sortButton)\n }\n IconButton {\n id: groupButton\n objectName: \"coinBrowserGroupButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/group-by.svg\"\n accessibleName: qsTr(\"Group coins\")\n onClicked: root.openMenu(groupMenu, groupButton)\n }\n IconButton {\n id: selectionButton\n objectName: \"walletCoinsSelectionButton\"\n visible: !root.selectionMode\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/checklist.svg\"\n accessibleName: qsTr(\"Select coins\")\n checked: root.walletSelectionActive\n Accessible.checkable: true\n Accessible.checked: root.walletSelectionActive\n onClicked: {\n root.walletSelectionActive = !root.walletSelectionActive\n if (!root.walletSelectionActive) root.markedIds = []\n }\n }\n }\n\n Flow {\n Layout.fillWidth: true\n Layout.preferredHeight: childrenRect.height\n spacing: 10\n FilterButton {\n id: activeFiltersButton\n objectName: \"coinBrowserActiveFiltersButton\"\n visible: root.activeFilterCount > 0\n active: true\n count: root.activeFilterCount\n size: coinTypeButton.height\n iconSize: Theme.size.icon.l\n text: count === 1 ? qsTr(\"1 active filter\") : qsTr(\"%1 active filters\").arg(count)\n onClicked: root.openMenu(clearFiltersMenu, activeFiltersButton)\n }\n DropdownButton {\n id: coinTypeButton\n objectName: \"coinBrowserFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: !root.coins || root.coins.filter === \"all\" ? qsTr(\"Coin type\") : root.coins.filter === \"locked\" ? qsTr(\"Locked\") : qsTr(\"Spendable\")\n active: root.coins && root.coins.filter !== \"all\"\n opened: filterMenu.opened\n onClicked: root.openMenu(filterMenu, coinTypeButton)\n }\n DropdownButton {\n id: amountFilterButton\n objectName: \"coinBrowserAmountFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: qsTr(\"Amount\")\n active: root.coins && (root.coins.minAmount >= 0 || root.coins.maxAmount >= 0)\n opened: amountPopup.opened\n onClicked: root.openMenu(amountPopup, amountFilterButton)\n }\n }\n\n ListView {\n id: list\n objectName: \"coinSelectionListView\"\n Layout.fillWidth: true; Layout.fillHeight: true; Layout.minimumHeight: 120\n clip: true; model: root.coins; reuseItems: true\n boundsBehavior: Flickable.StopAtBounds\n ScrollBar.vertical: ScrollBar {}\n section.property: \"groupTitle\"\n section.criteria: ViewSection.FullString\n section.delegate: Item {\n required property string section\n width: list.width; height: 44\n CoreText {\n anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom; anchors.bottomMargin: 8\n anchors.leftMargin: Theme.space.xs; anchors.rightMargin: Theme.space.xs",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b993e673e332..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Receive holds cs_wallet and the unlock session across a full scanqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe new head still acquires cs_wallet for Save/EnsureAddress and calls the full read(node) before command dispatch, so the pre-write scan remains under both the wallet lock and the unlock session. The security-state helper changes do not narrow that scan or measure its duration. path_diff: qml/models/walletstatesnapshot.cpp; new_source: qml/models/walletstatesnapshot.cpp [
{
"evidence_id": "06414d1e139c4e27a5004fbddf326b6f",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/models/walletstatesnapshot.cpp",
"source_generation": 4,
"source_job_id": 3018,
"text": "diff --git a/qml/models/walletstatesnapshot.cpp b/qml/models/walletstatesnapshot.cpp\nindex 60787ad8e5..89b50ee8a3 100644\n--- a/qml/models/walletstatesnapshot.cpp\n+++ b/qml/models/walletstatesnapshot.cpp\n@@ -64,6 +64,21 @@ bool SupportsType(const WalletStateSnapshot& state, OutputType type)\n {\n return state.can_get_addresses && type != OutputType::UNKNOWN && (type != OutputType::BECH32M || state.taproot_enabled);\n }\n+\n+struct SecurityState {\n+ bool encrypted;\n+ bool locked;\n+};\n+\n+// EncryptWallet() adds the master keys under cs_wallet, but IsLocked() and HasEncryptionKeys() check them without it.\n+SecurityState ReadSecurityState(interfaces::Wallet& wallet)\n+{\n+ if (auto* local = wallet.wallet()) {\n+ LOCK(local->cs_wallet);\n+ return {local->HasEncryptionKeys(), local->IsLocked()};\n+ }\n+ return {wallet.isCrypted(), wallet.isLocked()};\n+}\n } // namespace\n \n WalletKeyScheme ReadWalletKeyScheme(interfaces::Wallet& wallet)\n@@ -126,8 +141,9 @@ WalletStateSnapshot WalletStateBackend::read(interfaces::Node* node)\n state.balance = m_wallet->getBalance();\n state.available_balance = m_wallet->getAvailableBalance(wallet::CCoinControl{});\n state.key_scheme = ReadWalletKeyScheme(*m_wallet);\n- state.encrypted = m_wallet->isCrypted();\n- state.locked = m_wallet->isLocked();\n+ const auto security = ReadSecurityState(*m_wallet);\n+ state.encrypted = security.encrypted;\n+ state.locked = security.locked;\n state.private_keys_disabled = m_wallet->privateKeysDisabled();\n state.external_signer = m_wallet->hasExternalSigner();\n state.can_get_addresses = m_wallet->canGetAddresses();\n@@ -288,7 +304,7 @@ ReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, Receive\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n- if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && m_wallet->isCrypted())) {\n+ if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n@@ -327,7 +343,8 @@ ReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, Receive\n }\n const auto destination = m_wallet->getNewDestination(*type, label);\n if (!destination || !IsValidDestination(*destination)) {\n- result.needs_unlock = m_wallet->isCrypted() && m_wallet->isLocked();\n+ const auto security = ReadSecurityState(*m_wallet);\n+ result.needs_unlock = security.encrypted && security.locked;\n result.error = result.needs_unlock ? Tr(\"Enter your wallet password to create an address.\") : Tr(\"A receiving address could not be generated. Please try again.\");\n return {};\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 431,
"evidence_id": "e18c00db075f4bc5813174ffe655d059",
"finding_id": "finding:5",
"kind": "new_source",
"line": 282,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 4,
"source_job_id": 3018,
"text": " // Read and merge inside the shared writer lock: other wallet\n // queues may update their own entry in the same settings object.\n QmlCoreSettings::SetRwSetting(*context->args, QStringLiteral(\"qml_receive_address_types\"), updated_preferences());\n return true;\n });\n }\n node->updateRwSetting(\"qml_receive_address_types\", updated_preferences());\n return true;\n}\n\nReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, ReceiveCommand command)\n{\n ReceiveCommandResult result;\n auto finish = [&] {\n try {\n result.snapshot = read(node);\n } catch (...) {\n // Persistence may already have succeeded. Keep its result and ID\n // so retrying the refresh cannot create another request.\n result.refresh_error = Tr(\"Wallet information could not be refreshed. It will be retried.\");\n }\n return std::move(result);\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n if (command.passphrase) {\n const auto unlocked = TryUnlockWithPassphrase(*m_wallet, *command.passphrase);\n command.passphrase.reset();\n if (unlocked == WalletUnlockResult::IncorrectPassphrase) {\n result.error = Tr(\"The wallet password you entered was incorrect.\");\n return finish();\n }\n relock = unlocked == WalletUnlockResult::UnlockedNowRelockRequired;\n }\n WalletRelockGuard guard{*m_wallet, [] {}, relock};\n // Release cs_wallet before settings I/O and before relocking, which takes the relock mutex first.\n std::unique_ptr<UniqueLock<RecursiveMutex>> wallet_lock;\n if (command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) {\n if (auto* wallet = m_wallet->wallet()) {\n wallet_lock = std::make_unique<UniqueLock<RecursiveMutex>>(wallet->cs_wallet, \"wallet->cs_wallet\", __FILE__, __LINE__);\n }\n }\n auto state = read(node);\n auto complete = [&] {\n wallet_lock.reset();\n guard.relock();\n if (unlock_session) unlock_session.unlock();\n return finish();\n };\n QSettings settings;\n const auto address_key = settingsKey();\n const auto type_text = command.address_type.isEmpty() ? state.receive_address_type : command.address_type;\n const auto type = ParseOutputType(type_text.toStdString());\n auto new_address = [&](const std::string& label) -> QString {\n if (!type || !SupportsType(state, *type)) {\n result.error = Tr(\"The selected address type is unavailable.\");\n return {};\n }\n const auto destination = m_wallet->getNewDestination(*type, label);\n if (!destination || !IsValidDestination(*destination)) {\n const auto security = ReadSecurityState(*m_wallet);\n result.needs_unlock = security.encrypted && security.locked;\n result.error = result.needs_unlock ? Tr(\"Enter your wallet password to create an address.\") : Tr(\"A receiving address could not be generated. Please try again.\");\n return {};\n }\n return Address(*destination);\n };\n const auto saved_address = [&](const QString& address) {\n return std::any_of(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& entry) {\n return entry.recipient.address == address.toStdString();\n });\n };\n if (command.kind == ReceiveCommand::Kind::EnsureAddress) {\n auto address = command.address.isEmpty() ? settings.value(address_key).toString() : command.address;\n const auto destination = DecodeDestination(address.toStdString());\n wallet::AddressPurpose purpose{};\n const auto old_type = AddressType(destination);\n if (command.next || !IsValidDestination(destination) || !m_wallet->getAddress(destination, nullptr, &purpose) || purpose != wallet::AddressPurpose::RECEIVE || m_observed_addresses.contains(address) || saved_address(address) || (!command.address_type.isEmpty() && (!old_type || !type || *old_type != *type))) {\n address = new_address({});\n }\n if (address.isEmpty()) return complete();\n wallet_lock.reset();\n settings.setValue(address_key, address);\n settings.sync();\n if (settings.status() != QSettings::NoError || !setAddressType(node, type_text)) result.error = Tr(\"The receiving address preference could not be saved.\");\n else { result.receiving_address = address; result.success = true; }\n } else if (command.kind == ReceiveCommand::Kind::Save) {\n auto entry = command.entry;\n if (!MoneyRange(entry.recipient.amount)) { result.error = Tr(\"The request amount is invalid.\"); return complete(); }\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == entry.id; });\n if (entry.id != 0) {\n if (existing == state.receive_requests.end() || existing->recipient.address != entry.recipient.address) { result.error = Tr(\"The payment request is no longer available.\"); return complete(); }\n entry.payment_received = existing->payment_received;\n entry.date = existing->date;\n if (entry.payment_received && (entry.recipient.amount != existing->recipient.amount || entry.recipient.label != existing->recipient.label || entry.recipient.message != existing->recipient.message)) { result.error = Tr(\"A paid payment request cannot be changed.\"); return complete(); }\n } else {\n if (command.reserve_receiving_address && (entry.recipient.address.empty() || m_observed_addresses.contains(QString::fromStdString(entry.recipient.address)))) { result.error = Tr(\"This address has received a payment. Create a new receiving address.\"); return complete(); }\n if (command.reserve_receiving_address && saved_address(QString::fromStdString(entry.recipient.address))) { result.error = Tr(\"This address already belongs to a saved request. Create a new receiving address.\"); return complete(); }\n int64_t maximum{0};\n for (const auto& item : state.receive_requests) maximum = std::max(maximum, item.id);\n if (maximum >= std::numeric_limits<unsigned int>::max()) { result.error = Tr(\"No more payment requests can be saved.\"); return complete(); }\n entry.id = maximum + 1;\n entry.date = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch());\n if (entry.recipient.address.empty()) entry.recipient.address = new_address(entry.recipient.noteSelf).toStdString();\n if (entry.recipient.address.empty()) return complete();\n if (command.note_is_prefill) {\n std::string label;\n if (m_wallet->getAddress(DecodeDestination(entry.recipient.address), &label, nullptr)) entry.recipient.noteSelf = label;\n }\n }\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(entry.recipient.address), util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) { result.error = Tr(\"The payment request could not be saved.\"); return complete(); }\n result.saved_entry = entry;\n result.success = true;\n const auto address = QString::fromStdString(entry.recipient.address);\n std::string old_label_text;\n m_wallet->getAddress(DecodeDestination(entry.recipient.address), &old_label_text, nullptr);\n const auto old_label = QString::fromStdString(old_label_text);\n const auto note = QString::fromStdString(entry.recipient.noteSelf);\n const bool note_changed = existing == state.receive_requests.end() || existing->recipient.noteSelf != entry.recipient.noteSelf;\n if (note_changed && old_label != note && (!note.isEmpty() || (existing != state.receive_requests.end() && old_label.toStdString() == existing->recipient.noteSelf))) {\n if (!m_wallet->setAddressBook(DecodeDestination(entry.recipient.address), entry.recipient.noteSelf, wallet::AddressPurpose::RECEIVE)) result.error = Tr(\"The request was saved, but its address label could not be saved.\");\n }\n wallet_lock.reset();\n if (command.reserve_receiving_address) {\n settings.remove(address_key);\n settings.sync();\n // Harmless once the request is saved, so log it instead of failing.\n if (settings.status() != QSettings::NoError) qWarning() << \"Could not clear the receiving address preference for\" << address_key;\n }\n } else if (command.kind == ReceiveCommand::Kind::Remove) {\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == command.entry.id; });\n result.success = existing != state.receive_requests.end() && m_wallet->setAddressReceiveRequest(DecodeDestination(existing->recipient.address), util::ToString(existing->id), {});\n if (!result.success) result.error = Tr(\"The payment request could not be removed.\");\n } else if (command.kind == ReceiveCommand::Kind::Label) {\n const auto destination = DecodeDestination(command.address.toStdString());\n wallet::AddressPurpose purpose{};\n result.success = IsValidDestination(destination) && m_wallet->getAddress(destination, nullptr, &purpose) && m_wallet->setAddressBook(destination, command.label.toStdString(), purpose);\n if (result.success) {\n for (auto entry : state.receive_requests) {\n if (entry.recipient.address != command.address.toStdString() || entry.recipient.noteSelf == command.label.toStdString()) continue;\n entry.recipient.noteSelf = command.label.toStdString();\n if (!m_wallet->setAddressReceiveRequest(destination, util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) result.error = Tr(\"The address label was saved, but a payment request note could not be saved.\");\n }\n } else result.error = Tr(\"The address label could not be saved.\");\n } else if (command.kind == ReceiveCommand::Kind::AddressType) {\n result.success = type && SupportsType(state, *type) && setAddressType(node, type_text);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b993e673e332..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Worker security-state reads race GUI wallet encryptionqml/models/walletstatesnapshot.cpp | addressed | AssessmentReadSecurityState() now acquires cs_wallet before reading encryption and lock state, and snapshot reads and Receive worker checks use that helper instead of the previously unprotected calls. path_diff: qml/models/walletstatesnapshot.cpp; new_source: qml/models/walletstatesnapshot.cpp [
{
"evidence_id": "77810bbe957c47b5ae0d62f6e14a309c",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/models/walletstatesnapshot.cpp",
"source_generation": 4,
"source_job_id": 3018,
"text": "diff --git a/qml/models/walletstatesnapshot.cpp b/qml/models/walletstatesnapshot.cpp\nindex 60787ad8e5..89b50ee8a3 100644\n--- a/qml/models/walletstatesnapshot.cpp\n+++ b/qml/models/walletstatesnapshot.cpp\n@@ -64,6 +64,21 @@ bool SupportsType(const WalletStateSnapshot& state, OutputType type)\n {\n return state.can_get_addresses && type != OutputType::UNKNOWN && (type != OutputType::BECH32M || state.taproot_enabled);\n }\n+\n+struct SecurityState {\n+ bool encrypted;\n+ bool locked;\n+};\n+\n+// EncryptWallet() adds the master keys under cs_wallet, but IsLocked() and HasEncryptionKeys() check them without it.\n+SecurityState ReadSecurityState(interfaces::Wallet& wallet)\n+{\n+ if (auto* local = wallet.wallet()) {\n+ LOCK(local->cs_wallet);\n+ return {local->HasEncryptionKeys(), local->IsLocked()};\n+ }\n+ return {wallet.isCrypted(), wallet.isLocked()};\n+}\n } // namespace\n \n WalletKeyScheme ReadWalletKeyScheme(interfaces::Wallet& wallet)\n@@ -126,8 +141,9 @@ WalletStateSnapshot WalletStateBackend::read(interfaces::Node* node)\n state.balance = m_wallet->getBalance();\n state.available_balance = m_wallet->getAvailableBalance(wallet::CCoinControl{});\n state.key_scheme = ReadWalletKeyScheme(*m_wallet);\n- state.encrypted = m_wallet->isCrypted();\n- state.locked = m_wallet->isLocked();\n+ const auto security = ReadSecurityState(*m_wallet);\n+ state.encrypted = security.encrypted;\n+ state.locked = security.locked;\n state.private_keys_disabled = m_wallet->privateKeysDisabled();\n state.external_signer = m_wallet->hasExternalSigner();\n state.can_get_addresses = m_wallet->canGetAddresses();\n@@ -288,7 +304,7 @@ ReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, Receive\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n- if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && m_wallet->isCrypted())) {\n+ if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n@@ -327,7 +343,8 @@ ReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, Receive\n }\n const auto destination = m_wallet->getNewDestination(*type, label);\n if (!destination || !IsValidDestination(*destination)) {\n- result.needs_unlock = m_wallet->isCrypted() && m_wallet->isLocked();\n+ const auto security = ReadSecurityState(*m_wallet);\n+ result.needs_unlock = security.encrypted && security.locked;\n result.error = result.needs_unlock ? Tr(\"Enter your wallet password to create an address.\") : Tr(\"A receiving address could not be generated. Please try again.\");\n return {};\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 248,
"evidence_id": "9a57cbfad15d4ac9ab5248d260f7d37c",
"finding_id": "finding:3",
"kind": "new_source",
"line": 99,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 4,
"source_job_id": 3018,
"text": " }\n if (wallet.privateKeysDisabled()) {\n return WalletKeyScheme::WatchOnly;\n }\n return WalletKeyScheme::SingleKey;\n}\n\nWalletStateBackend::WalletStateBackend(std::shared_ptr<interfaces::Wallet> wallet, std::shared_ptr<WalletUnlockSession> unlock_session,\n std::shared_ptr<const std::atomic<uint64_t>> notification_count)\n : m_wallet(std::move(wallet)), m_unlock_session(std::move(unlock_session)), m_notification_count(std::move(notification_count)) {}\n\nCoinLockResult WalletStateBackend::setCoinsLocked(interfaces::Node* node, const std::vector<COutPoint>& outputs, bool locked)\n{\n CoinLockResult result;\n for (const auto& output : outputs) {\n // RPC changes do not notify the GUI. Apply the requested state even if\n // the last published snapshot already matches it.\n const bool success = locked ? m_wallet->lockCoin(output, true) : m_wallet->unlockCoin(output);\n result.success = success && result.success;\n }\n // A failed database write can still change the in-memory lock state.\n result.snapshot = read(node);\n return result;\n}\n\nQString WalletStateBackend::settingsKey() const\n{\n return QStringLiteral(\"receiveAddressTypes/%1/address\").arg(QString::fromStdString(m_wallet->getWalletName()));\n}\n\nWalletStateSnapshot WalletStateBackend::read(interfaces::Node* node)\n{\n // Capture the wallet's processed tip before reading. If it advances during\n // the scan, the next poll will reconcile again. Failed reads remain dirty.\n m_last_processed_block.reset();\n const uint64_t notification_count = m_notification_count ? m_notification_count->load() : 0;\n interfaces::WalletBalances balances;\n uint256 processed_block;\n const bool have_processed_block = m_wallet->tryGetBalances(balances, processed_block);\n WalletStateSnapshot state;\n state.notification_count = notification_count;\n state.name = QString::fromStdString(m_wallet->getWalletName());\n state.balance = m_wallet->getBalance();\n state.available_balance = m_wallet->getAvailableBalance(wallet::CCoinControl{});\n state.key_scheme = ReadWalletKeyScheme(*m_wallet);\n const auto security = ReadSecurityState(*m_wallet);\n state.encrypted = security.encrypted;\n state.locked = security.locked;\n state.private_keys_disabled = m_wallet->privateKeysDisabled();\n state.external_signer = m_wallet->hasExternalSigner();\n state.can_get_addresses = m_wallet->canGetAddresses();\n state.taproot_enabled = m_wallet->taprootEnabled();\n state.default_address_type = m_wallet->getDefaultAddressType();\n state.dust_relay_fee = node ? node->getDustRelayFee() : CFeeRate{DUST_RELAY_TX_FEE};\n state.receive_address_type = state.taproot_enabled ? QStringLiteral(\"bech32m\") : QStringLiteral(\"bech32\");\n if (node) {\n const auto preferences = node->getPersistentSetting(\"qml_receive_address_types\");\n const auto& saved = preferences[state.name.toStdString()];\n if (saved.isStr()) {\n const auto type = ParseOutputType(saved.get_str());\n if (type && SupportsType(state, *type)) state.receive_address_type = QString::fromStdString(saved.get_str());\n }\n }\n state.addresses = m_wallet->getAddresses();\n std::set<QString> receive_addresses;\n for (const auto& address : state.addresses) {\n const auto text = Address(address.dest);\n state.labels[text] = QString::fromStdString(address.name);\n if (address.is_mine && address.purpose == wallet::AddressPurpose::RECEIVE) receive_addresses.insert(text);\n }\n state.coins = m_wallet->listCoins();\n std::vector<COutPoint> locked;\n m_wallet->listLockedCoins(locked);\n state.locked_coins.insert(locked.begin(), locked.end());\n m_locked_coins = state.locked_coins;\n state.receive_requests = ReceiveRequestHistoryModel::DeserializeEntries(m_wallet->getAddressReceiveRequests());\n std::set<QString> request_addresses;\n for (const auto& request : state.receive_requests) {\n const auto address = QString::fromStdString(request.recipient.address);\n request_addresses.insert(address);\n if (request.payment_received) m_observed_addresses.insert(address);\n }\n std::set<Txid> unconfirmed_payment_txids;\n std::set<COutPoint> change_outputs;\n for (const auto& tx : m_wallet->getWalletTxs()) {\n if (!tx.tx) continue;\n std::map<QString, CAmount> received;\n for (size_t i = 0; i < tx.tx->vout.size(); ++i) {\n if (i < tx.txout_is_change.size() && tx.txout_is_change[i]) change_outputs.emplace(tx.tx->GetHash(), i);\n if (i >= tx.txout_is_mine.size() || !tx.txout_is_mine[i]) continue;\n CTxDestination destination;\n const auto& output = tx.tx->vout[i];\n if (!ExtractDestination(output.scriptPubKey, destination)) continue;\n const auto address = Address(destination);\n if (receive_addresses.contains(address) && (i >= tx.txout_is_change.size() || !tx.txout_is_change[i])) state.used_addresses.insert(address);\n if (output.nValue <= 0) continue;\n m_observed_addresses.insert(address);\n if (request_addresses.contains(address)) received[address] += output.nValue;\n }\n if (received.empty()) continue;\n interfaces::WalletTxStatus status{};\n std::vector<std::string> messages;\n std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int blocks{0};\n m_wallet->getWalletTxDetails(tx.tx->GetHash(), status, messages, payment_requests, in_mempool, blocks);\n const bool replaced = tx.replaced_by_txid.has_value();\n if (status.depth_in_main_chain < 0 || status.is_abandoned || (status.depth_in_main_chain == 0 && (!in_mempool || replaced))) continue;\n if (status.depth_in_main_chain == 0) unconfirmed_payment_txids.insert(tx.tx->GetHash());\n for (const auto& [address, amount] : received) state.received_amounts[address] += amount;\n }\n for (const auto& [ancestor, coins] : state.coins) {\n for (const auto& [outpoint, output] : coins) {\n CTxDestination destination;\n if (!ExtractDestination(output.txout.scriptPubKey, destination)) continue;\n const auto address = Address(destination);\n state.address_balances[address] += output.txout.nValue;\n if (output.txout.nValue > 0 && change_outputs.contains(outpoint)) state.change_addresses.insert(address);\n }\n }\n state.observed_addresses = m_observed_addresses;\n for (auto& request : state.receive_requests) {\n if (request.payment_received || !m_observed_addresses.contains(QString::fromStdString(request.recipient.address))) continue;\n request.payment_received = true;\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(request.recipient.address), util::ToString(request.id), ReceiveRequestHistoryModel::SerializeEntry(request))) {\n state.persistence_error = Tr(\"The received-payment status could not be saved. The address will not be reused.\");\n }\n }\n if (have_processed_block) m_last_processed_block = processed_block;\n state.unconfirmed_payments = !unconfirmed_payment_txids.empty();\n m_unconfirmed_payment_txids = std::move(unconfirmed_payment_txids);\n return state;\n}\n\nstd::optional<WalletStateSnapshot> WalletStateBackend::poll(interfaces::Node* node)\n{\n // A node-tip notification can precede wallet processing, and maturity does\n // not emit a transaction notification. Retry busy wallets on the next poll.\n uint256 processed_block;\n if (auto* wallet = m_wallet->wallet()) {\n // tryGetBalances() would also sum every wallet output; only the block hash is needed here.\n TRY_LOCK(wallet->cs_wallet, locked_wallet);\n if (!locked_wallet) return std::nullopt;\n processed_block = wallet->GetLastBlockHash();\n } else {\n interfaces::WalletBalances balances;\n if (!m_wallet->tryGetBalances(balances, processed_block)) return std::nullopt;\n }\n if (m_last_processed_block != processed_block) return read(node);\n",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b993e673e332..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Reconciliation can report a persisted request as failedqml/models/walletqmlmodel.cpp | addressed | AssessmentWhile a receive operation is pending, followPrefilledNote now defers the label reconciliation and sets a pending flag. The flag is processed when the operation completes (and on its failure path), preventing the in-flight refresh from changing the draft revision before save completion. The added regression test exercises a refresh queued ahead of the save and verifies successful completion and the updated note. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "4d396528b4414e199f723e5c08cd1620",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 4,
"source_job_id": 3018,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 9910070284..d022922234 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -776,6 +776,7 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n if (!received) {\n m_receive_operation_pending = false;\n m_receive_operation_error = tr(\"The wallet operation failed. Please try again.\");\n+ if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n@@ -826,6 +827,7 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }\n+ if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n@@ -2596,6 +2598,11 @@ void WalletQmlModel::setSelectedCoins(const std::vector<COutPoint>& outputs)\n void WalletQmlModel::followPrefilledNote()\n {\n if (m_prefilled_note_address.isEmpty()) return;\n+ // A pending Receive command checks the request's revision; follow the label once it finishes.\n+ if (m_receive_operation_pending) {\n+ m_prefilled_note_follow_pending = true;\n+ return;\n+ }\n auto* request = m_current_payment_request;\n if (!request->id().isEmpty() || request->address() != m_prefilled_note_address || request->noteSelf() != m_prefilled_note) {\n m_prefilled_note_address.clear();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b993e673e332..efd7e4986698 2026-11-24T16:23:58Z · gpt-6-luna |
| gui#1146 | Hidden Activity drops export feedback, and rejected exports are silentqml/pages/wallet/ActivityListPage.qml | partially_addressed | AssessmentThe page now saves hidden export completion results and opens the popup when Activity becomes visible again, addressing lost asynchronous completion feedback. exportActivity() still discards the return value of exportCsv(), so synchronous rejection remains unhandled. path_diff: qml/pages/wallet/ActivityListPage.qml; new_source: qml/pages/wallet/ActivityListPage.qml [
{
"evidence_id": "65fa96eb9b85496dbe2bf89a3b8e36ea",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/pages/wallet/ActivityListPage.qml",
"source_generation": 4,
"source_job_id": 3018,
"text": "diff --git a/qml/pages/wallet/ActivityListPage.qml b/qml/pages/wallet/ActivityListPage.qml\nindex 874bab783b..574cf89ee2 100644\n--- a/qml/pages/wallet/ActivityListPage.qml\n+++ b/qml/pages/wallet/ActivityListPage.qml\n@@ -15,6 +15,7 @@ Page {\n objectName: \"activityPage\"\n property var wallet: null\n property bool exportSucceeded: true\n+ property bool exportResultPending: false\n property bool ready: false\n readonly property bool activitySourceEmpty: !wallet || wallet.transactionActivityModel.count === 0\n readonly property bool typeFilterActive: activityFilterProxy.typeFilters.length > 0\n@@ -99,7 +100,9 @@ Page {\n target: activityFilterProxy\n function onExportFinished(success) {\n root.exportSucceeded = success\n+ // A hidden page shows the result once it is visible again.\n if (root.visible) exportResultPopup.open()\n+ else root.exportResultPending = true\n }\n }\n \n@@ -539,7 +542,14 @@ Page {\n objectName: \"activityExplorerLinkPopup\"\n }\n \n- onVisibleChanged: if (!visible) deleteRequestConfirmation.stopReporting()\n+ onVisibleChanged: {\n+ if (!visible) {\n+ deleteRequestConfirmation.stopReporting()\n+ } else if (exportResultPending) {\n+ exportResultPending = false\n+ exportResultPopup.open()\n+ }\n+ }\n \n PaymentRequestDeleteConfirmation {\n id: deleteRequestConfirmation\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 221,
"evidence_id": "2e381bea77e54067b1698f9ecea265eb",
"finding_id": "finding:1",
"kind": "new_source",
"line": 72,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"path": "qml/pages/wallet/ActivityListPage.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 4,
"source_job_id": 3018,
"text": " if (wallet && wallet.transactionActivityModel.loadError) return wallet.transactionActivityModel.loadError\n if (activitySourceEmpty && wallet && wallet.transactionActivityModel.loading) return \"\"\n if (activitySourceEmpty)\n return nodeModel.blockSyncActive ? qsTr(\"Transactions may appear as your wallet catches up.\")\n : qsTr(\"Your transactions and payment requests will appear here.\")\n return qsTr(\"Try changing your search, date, type, or amount filters.\")\n }\n function exportResultTitle() { return exportSucceeded ? qsTr(\"Export complete\") : qsTr(\"Export failed\") }\n function exportResultDescription() {\n return exportSucceeded ? qsTr(\"Your Activity CSV has been saved.\")\n : activityFilterProxy.exportError\n }\n\n function normalizeLocalPath(path) {\n var value = String(path)\n if (value.indexOf(\"file:///\") === 0) {\n if (Qt.platform.os === \"windows\") {\n return decodeURIComponent(value.substring(8))\n }\n return decodeURIComponent(value.substring(7))\n }\n if (value.indexOf(\"file://\") === 0) {\n return decodeURIComponent(value.substring(7))\n }\n return value\n }\n\n Connections {\n target: activityFilterProxy\n function onExportFinished(success) {\n root.exportSucceeded = success\n // A hidden page shows the result once it is visible again.\n if (root.visible) exportResultPopup.open()\n else root.exportResultPending = true\n }\n }\n\n function exportActivity(path) {\n activityFilterProxy.exportCsv(normalizeLocalPath(path))\n }\n\n // A filter popup right-aligns to its button, but a wide popup on a\n // button near the left edge (the date preset menu, sized for the\n // calendar) would spill past the page. Clamp x so the popup stays\n // within the page horizontally instead of overflowing the list area.\n // Callers assign this from onAboutToShow rather than binding x to\n // it: mapToItem is not dependency-tracked, so a binding would keep\n // a clamp computed from stale geometry.\n function filterPopupX(button, popup) {\n const anchorX = button.mapToItem(root, 0, 0).x\n const rightAligned = button.width - popup.width\n const minX = -anchorX\n const maxX = root.width - popup.width - anchorX\n return Math.max(minX, Math.min(rightAligned, maxX))\n }\n\n // A QDate read back from the model reaches QML as a JS Date at UTC\n // midnight; rebuild it at local midnight on the same calendar day so\n // seeding the calendar does not read it a day early west of UTC (the\n // read-side mirror of the Apply path, which hands the model ISO\n // strings for the same reason).\n function modelDateToLocal(date) {\n return (date && !isNaN(date.getTime()))\n ? new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())\n : null\n }\n\n function toggleActivityType(value) {\n const selected = Array.from(activityFilterProxy.typeFilters)\n const index = selected.indexOf(value)\n if (index < 0) selected.push(value)\n else selected.splice(index, 1)\n activityFilterProxy.typeFilters = selected\n }\n\n function applyAmountRange() {\n const lower = Math.round(amountSlider.lowerValue)\n const upper = Math.round(amountSlider.upperValue)\n if (lower === 0 && upper === activityFilterProxy.availableMaxAmount)\n activityFilterProxy.setAmountRange(-1, -1)\n else activityFilterProxy.setAmountRange(lower, upper)\n }\n\n ActivityFilterProxyModel {\n id: activityFilterProxy\n objectName: \"activityFilterProxyModel\"\n sourceModel: root.wallet ? root.wallet.transactionActivityModel : null\n displayUnit: optionsModel.displayUnit\n groupBy: activitySettings.activityGrouping === \"day\" ? ActivityFilterProxyModel.Day : ActivityFilterProxyModel.Month\n }\n BitcoinAmount {\n id: lowerAmountFormatter\n unit: optionsModel.displayUnit\n satoshi: Math.round(amountSlider.lowerValue)\n }\n BitcoinAmount {\n id: upperAmountFormatter\n unit: optionsModel.displayUnit\n satoshi: Math.round(amountSlider.upperValue)\n }\n AppSettings {\n id: activitySettings\n property string activityGrouping: \"month\"\n property string activityDisplayDensity: \"comfortable\"\n }\n AppFileDialog {\n id: exportDialog\n objectName: \"activityExportDialog\"\n defaultSuffix: \"csv\"\n fileMode: AppFileDialog.SaveFile\n nameFilters: [qsTr(\"Comma separated file (*.csv)\")]\n onAccepted: root.exportActivity(exportDialog.selectedFile.toString())\n }\n TextField {\n id: automationExportPathField\n objectName: \"activityExportPathField\"\n visible: false\n }\n Shortcut {\n sequences: [StandardKey.Find]\n enabled: root.visible\n onActivated: searchField.focusSearch()\n }\n\n ColumnLayout {\n id: content\n anchors.top: parent.top\n anchors.bottom: parent.bottom\n anchors.topMargin: 28\n anchors.bottomMargin: 16\n anchors.left: parent.left\n anchors.right: parent.right\n spacing: 0\n\n RowLayout {\n Layout.fillWidth: true\n Layout.leftMargin: root.activitySideInset\n Layout.rightMargin: root.activitySideInset\n Layout.bottomMargin: 28\n spacing: 16\n ColumnLayout {\n Layout.fillWidth: true\n spacing: 6\n CoreText {\n Layout.fillWidth: true\n text: qsTr(\"Activity\")\n textStyle: Theme.text.headline\n horizontalAlignment: Text.AlignLeft\n }\n CoreText {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b993e673e332..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | An unknown selected-coin balance is presented as insufficient fundsqml/models/walletqmlmodel.cpp | partially_addressed | AssessmentThe new code adds sendBalancePending() guards so sendAmountExhaustsBalance() does not report insufficient funds while the selected-balance query is pending, and it avoids resetting the maximum remainder during that pending state. However, the supplied excerpts do not show that Review is disabled while pending, as the finding also requests. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "110d6e0f8012488f97164454b9f5e6c4",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 3,
"source_job_id": 3007,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex c6dc2f7b10..d022922234 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -706,7 +706,7 @@ void WalletQmlModel::applyWalletState(WalletStateSnapshot state)\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n- m_wallet_state_error = m_wallet_subscription_error.isEmpty() ? m_wallet_state.persistence_error : m_wallet_subscription_error;\n+ m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n@@ -776,6 +776,7 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n if (!received) {\n m_receive_operation_pending = false;\n m_receive_operation_error = tr(\"The wallet operation failed. Please try again.\");\n+ if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n@@ -787,8 +788,14 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n+ std::optional<QmlRecentRequestEntry> saved_entry;\n+ if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n+ // The final read can already include a payment that arrived after the write.\n+ if (saved_entry) {\n+ if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n+ }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n@@ -804,11 +811,11 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n- if (result.success && result.saved_entry) applySavedRequest(held, *result.saved_entry);\n+ if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n- if (result.success && result.saved_entry) {\n- if (m_detail_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_detail_payment_request, *result.saved_entry);\n- if (!held && m_current_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_current_payment_request, *result.saved_entry);\n+ if (saved_entry) {\n+ if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n+ if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n@@ -820,6 +827,7 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }\n+ if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n@@ -1009,7 +1017,7 @@ CFeeRate WalletQmlModel::dustRelayFee() const\n \n bool WalletQmlModel::sendAmountExhaustsBalance() const\n {\n- if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid()) {\n+ if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid() || sendBalancePending()) {\n return false;\n }\n \n@@ -1149,6 +1157,8 @@ bool WalletQmlModel::encryptWallet(const QString& passphrase)\n return false;\n }\n \n+ // Core locks the wallet after encrypting it; show that before the next snapshot.\n+ applySecurityState(true, true);\n refreshSecurityState();\n return true;\n }\n@@ -1173,6 +1183,12 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return false;\n }\n \n+ // Core relocks after the change only if the wallet was locked when it started.\n+ const auto unlock_session = m_unlock_session->tryAcquire();\n+ if (!unlock_session) {\n+ setSettingsError(tr(\"The wallet is busy with another operation. Try again in a moment.\"));\n+ return false;\n+ }\n SecureString secure_old_passphrase{QmlUtil::SecureStringFromQString(old_passphrase)};\n SecureString secure_new_passphrase{QmlUtil::SecureStringFromQString(new_passphrase)};\n const bool changed{m_wallet->changeWalletPassphrase(secure_old_passphrase, secure_new_passphrase)};\n@@ -1544,7 +1560,7 @@ void WalletQmlModel::scheduleFeeEstimates()\n \n // Until a destination is entered, show the gross remainder. A valid\n // address enables the sendall preview, which replaces it with the net amount.\n- if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty()) {\n+ if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty() && !sendBalancePending()) {\n CAmount remainder = sendAvailableBalance();\n for (const auto* recipient : m_send_recipients->recipients()) {\n if (recipient != m_maximum_recipient) remainder -= recipient->cAmount();\n@@ -2582,6 +2598,11 @@ void WalletQmlModel::setSelectedCoins(const std::vector<COutPoint>& outputs)\n void WalletQmlModel::followPrefilledNote()\n {\n if (m_prefilled_note_address.isEmpty()) return;\n+ // A pending Receive command checks the request's revision; follow the label once it finishes.\n+ if (m_receive_operation_pending) {\n+ m_prefilled_note_follow_pending = true;\n+ return;\n+ }\n auto* request = m_current_payment_request;\n if (!request->id().isEmpty() || request->address() != m_prefilled_note_address || request->noteSelf() != m_prefilled_note) {\n m_prefilled_note_address.clear();\n@@ -2595,7 +2616,7 @@ void WalletQmlModel::followPrefilledNote()\n CAmount WalletQmlModel::sendAvailableBalance() const\n {\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n- // Until the worker reports the selected inputs, treat them as covering nothing.\n+ // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);\n }\n \n@@ -2613,9 +2634,12 @@ void WalletQmlModel::refreshSelectedAvailableBalance(bool selection_changed)\n [this, request](BackendExecutor::Outcome<CAmount> outcome) {\n if (request != m_selected_balance_request) return;\n m_selected_balance_task.reset();\n- const auto* balance = std::get_if<0>(&outcome);\n- if (!balance || m_selected_available_balance == *balance) return;\n- m_selected_available_balance = *balance;\n+ if (std::holds_alternative<BackendExecutor::Cancelled>(outcome)) return;\n+ // A failed read covers nothing rather than leaving Send pending.\n+ const auto* read = std::get_if<0>(&outcome);\n+ const CAmount balance{read ? *read : 0};\n+ if (m_selected_available_balance == balance) return;\n+ m_selected_available_balance = balance;\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n });\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 2725,
"evidence_id": "701779dd6f5147f3b90d609f54c0a934",
"finding_id": "finding:9",
"kind": "new_source",
"line": 2576,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 3,
"source_job_id": 3007,
"text": "std::vector<COutPoint> WalletQmlModel::listSelectedCoins() const\n{\n return m_coin_control.ListSelected();\n}\n\nvoid WalletQmlModel::clearSelectedCoins()\n{\n setMaximumRecipient(nullptr);\n if (m_coin_control.HasSelected()) setSelectedCoins({});\n}\n\nvoid WalletQmlModel::setSelectedCoins(const std::vector<COutPoint>& outputs)\n{\n // Restoring a cancelled coin-picker edit preserves the maximum recipient.\n m_coin_control.UnSelectAll();\n for (const auto& output : outputs) m_coin_control.Select(output);\n if (m_coins_list_model) m_coins_list_model->refreshSelection();\n refreshSelectedAvailableBalance(true);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::followPrefilledNote()\n{\n if (m_prefilled_note_address.isEmpty()) return;\n // A pending Receive command checks the request's revision; follow the label once it finishes.\n if (m_receive_operation_pending) {\n m_prefilled_note_follow_pending = true;\n return;\n }\n auto* request = m_current_payment_request;\n if (!request->id().isEmpty() || request->address() != m_prefilled_note_address || request->noteSelf() != m_prefilled_note) {\n m_prefilled_note_address.clear();\n return;\n }\n // An untouched prefill follows the label, so saving it cannot restore an older one.\n m_prefilled_note = getAddressLabel(m_prefilled_note_address);\n request->setNoteSelf(m_prefilled_note);\n}\n\nCAmount WalletQmlModel::sendAvailableBalance() const\n{\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);\n}\n\nvoid WalletQmlModel::refreshSelectedAvailableBalance(bool selection_changed)\n{\n if (m_selected_balance_task) m_backend_executor->cancel(*m_selected_balance_task);\n m_selected_balance_task.reset();\n if (selection_changed) m_selected_available_balance.reset();\n const quint64 request = ++m_selected_balance_request;\n if (!m_wallet || m_stopping || !m_coin_control.HasSelected()) return;\n wallet::CCoinControl control{m_coin_control};\n ApplySelectedInputsPolicy(control);\n m_selected_balance_task = m_backend_executor->submitTask(this,\n [wallet = m_wallet, control] { return wallet->getAvailableBalance(control); },\n [this, request](BackendExecutor::Outcome<CAmount> outcome) {\n if (request != m_selected_balance_request) return;\n m_selected_balance_task.reset();\n if (std::holds_alternative<BackendExecutor::Cancelled>(outcome)) return;\n // A failed read covers nothing rather than leaving Send pending.\n const auto* read = std::get_if<0>(&outcome);\n const CAmount balance{read ? *read : 0};\n if (m_selected_available_balance == balance) return;\n m_selected_available_balance = balance;\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n });\n}\n\nunsigned int WalletQmlModel::feeTargetBlocks() const\n{\n return m_coin_control.m_confirm_target.value_or(DEFAULT_STANDARD_FEE_TARGET);\n}\n\nvoid WalletQmlModel::setFeeTargetBlocks(unsigned int target_blocks)\n{\n if (m_coin_control.m_confirm_target != target_blocks) {\n m_coin_control.m_confirm_target = target_blocks;\n updateMaximumAmount();\n Q_EMIT feeTargetBlocksChanged();\n Q_EMIT estimatedFeeChanged();\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n}\n\nvoid WalletQmlModel::setCustomFeeEnabled(const bool enabled)\n{\n if (m_custom_fee_enabled != enabled) {\n m_custom_fee_enabled = enabled;\n Q_EMIT customFeeEnabledChanged();\n Q_EMIT estimatedFeeChanged();\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n }\n}\n\nvoid WalletQmlModel::setCustomFeeRate(const QString& fee_rate)\n{\n const QString trimmed_fee_rate = fee_rate.trimmed();\n const bool was_valid = customFeeRateValid();\n\n if (m_custom_fee_rate == trimmed_fee_rate) {\n return;\n }\n\n m_custom_fee_rate = trimmed_fee_rate;\n m_custom_fee_estimate.reset();\n\n if (m_wallet) {\n if (const auto requested_rate = ParseCustomFeeRatePerKvB(m_custom_fee_rate, MinimumCustomFeeRatePerKvB(m_wallet.get()))) {\n std::array<CAmount, CUSTOM_FEE_TARGETS.size()> target_rates{};\n for (size_t i = 0; i < CUSTOM_FEE_TARGETS.size(); ++i) {\n wallet::CCoinControl control{m_coin_control};\n control.m_feerate.reset();\n control.m_confirm_target = CUSTOM_FEE_TARGETS[i];\n target_rates[i] = m_wallet->getMinimumFee(FEE_RATE_BASIS_VBYTES, control, nullptr, nullptr);\n }\n\n // When the estimator has no target-specific data, moving the thumb\n // would imply a confirmation estimate we do not actually have.\n if (std::any_of(target_rates.begin() + 1, target_rates.end(), [&](CAmount rate) {\n return rate != target_rates.front();\n })) {\n unsigned int inferred_target = CUSTOM_FEE_TARGETS.back();\n for (size_t i = 0; i < CUSTOM_FEE_TARGETS.size(); ++i) {\n if (target_rates[i] > 0 && *requested_rate >= target_rates[i]) {\n inferred_target = CUSTOM_FEE_TARGETS[i];\n break;\n }\n }\n setFeeTargetBlocks(inferred_target);\n }\n }\n }\n\n Q_EMIT customFeeRateChanged();\n if (was_valid != customFeeRateValid()) {\n Q_EMIT customFeeRateValidChanged();\n }\n Q_EMIT estimatedFeeChanged();\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::setDisplayUnit(int unit)\n{\n if (unit != m_display_unit) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Lightweight Receive commands perform an unnecessary full pre-readqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe new-head excerpt still unconditionally executes auto state = read(node) before command dispatch, so lightweight commands still perform the full pre-read described in the finding. new_source: qml/models/walletstatesnapshot.cpp [
{
"bounded": true,
"end_line": 424,
"evidence_id": "e90c77d360a74637b608f15fe549373b",
"finding_id": "finding:8",
"kind": "new_source",
"line": 275,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 3,
"source_job_id": 3007,
"text": " auto preferences = node->getPersistentSetting(\"qml_receive_address_types\");\n if (!preferences.isObject()) preferences = common::SettingsValue{UniValue::VOBJ};\n preferences.pushKV(m_wallet->getWalletName(), type.toStdString());\n return preferences;\n };\n if (auto* context = node->context(); context && context->args) {\n return QmlCoreSettings::PersistSettings(*context->args, {QStringLiteral(\"qml_receive_address_types\")}, [&] {\n // Read and merge inside the shared writer lock: other wallet\n // queues may update their own entry in the same settings object.\n QmlCoreSettings::SetRwSetting(*context->args, QStringLiteral(\"qml_receive_address_types\"), updated_preferences());\n return true;\n });\n }\n node->updateRwSetting(\"qml_receive_address_types\", updated_preferences());\n return true;\n}\n\nReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, ReceiveCommand command)\n{\n ReceiveCommandResult result;\n auto finish = [&] {\n try {\n result.snapshot = read(node);\n } catch (...) {\n // Persistence may already have succeeded. Keep its result and ID\n // so retrying the refresh cannot create another request.\n result.refresh_error = Tr(\"Wallet information could not be refreshed. It will be retried.\");\n }\n return std::move(result);\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n if (command.passphrase) {\n const auto unlocked = TryUnlockWithPassphrase(*m_wallet, *command.passphrase);\n command.passphrase.reset();\n if (unlocked == WalletUnlockResult::IncorrectPassphrase) {\n result.error = Tr(\"The wallet password you entered was incorrect.\");\n return finish();\n }\n relock = unlocked == WalletUnlockResult::UnlockedNowRelockRequired;\n }\n WalletRelockGuard guard{*m_wallet, [] {}, relock};\n // Release cs_wallet before settings I/O and before relocking, which takes the relock mutex first.\n std::unique_ptr<UniqueLock<RecursiveMutex>> wallet_lock;\n if (command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) {\n if (auto* wallet = m_wallet->wallet()) {\n wallet_lock = std::make_unique<UniqueLock<RecursiveMutex>>(wallet->cs_wallet, \"wallet->cs_wallet\", __FILE__, __LINE__);\n }\n }\n auto state = read(node);\n auto complete = [&] {\n wallet_lock.reset();\n guard.relock();\n if (unlock_session) unlock_session.unlock();\n return finish();\n };\n QSettings settings;\n const auto address_key = settingsKey();\n const auto type_text = command.address_type.isEmpty() ? state.receive_address_type : command.address_type;\n const auto type = ParseOutputType(type_text.toStdString());\n auto new_address = [&](const std::string& label) -> QString {\n if (!type || !SupportsType(state, *type)) {\n result.error = Tr(\"The selected address type is unavailable.\");\n return {};\n }\n const auto destination = m_wallet->getNewDestination(*type, label);\n if (!destination || !IsValidDestination(*destination)) {\n const auto security = ReadSecurityState(*m_wallet);\n result.needs_unlock = security.encrypted && security.locked;\n result.error = result.needs_unlock ? Tr(\"Enter your wallet password to create an address.\") : Tr(\"A receiving address could not be generated. Please try again.\");\n return {};\n }\n return Address(*destination);\n };\n const auto saved_address = [&](const QString& address) {\n return std::any_of(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& entry) {\n return entry.recipient.address == address.toStdString();\n });\n };\n if (command.kind == ReceiveCommand::Kind::EnsureAddress) {\n auto address = command.address.isEmpty() ? settings.value(address_key).toString() : command.address;\n const auto destination = DecodeDestination(address.toStdString());\n wallet::AddressPurpose purpose{};\n const auto old_type = AddressType(destination);\n if (command.next || !IsValidDestination(destination) || !m_wallet->getAddress(destination, nullptr, &purpose) || purpose != wallet::AddressPurpose::RECEIVE || m_observed_addresses.contains(address) || saved_address(address) || (!command.address_type.isEmpty() && (!old_type || !type || *old_type != *type))) {\n address = new_address({});\n }\n if (address.isEmpty()) return complete();\n wallet_lock.reset();\n settings.setValue(address_key, address);\n settings.sync();\n if (settings.status() != QSettings::NoError || !setAddressType(node, type_text)) result.error = Tr(\"The receiving address preference could not be saved.\");\n else { result.receiving_address = address; result.success = true; }\n } else if (command.kind == ReceiveCommand::Kind::Save) {\n auto entry = command.entry;\n if (!MoneyRange(entry.recipient.amount)) { result.error = Tr(\"The request amount is invalid.\"); return complete(); }\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == entry.id; });\n if (entry.id != 0) {\n if (existing == state.receive_requests.end() || existing->recipient.address != entry.recipient.address) { result.error = Tr(\"The payment request is no longer available.\"); return complete(); }\n entry.payment_received = existing->payment_received;\n entry.date = existing->date;\n if (entry.payment_received && (entry.recipient.amount != existing->recipient.amount || entry.recipient.label != existing->recipient.label || entry.recipient.message != existing->recipient.message)) { result.error = Tr(\"A paid payment request cannot be changed.\"); return complete(); }\n } else {\n if (command.reserve_receiving_address && (entry.recipient.address.empty() || m_observed_addresses.contains(QString::fromStdString(entry.recipient.address)))) { result.error = Tr(\"This address has received a payment. Create a new receiving address.\"); return complete(); }\n if (command.reserve_receiving_address && saved_address(QString::fromStdString(entry.recipient.address))) { result.error = Tr(\"This address already belongs to a saved request. Create a new receiving address.\"); return complete(); }\n int64_t maximum{0};\n for (const auto& item : state.receive_requests) maximum = std::max(maximum, item.id);\n if (maximum >= std::numeric_limits<unsigned int>::max()) { result.error = Tr(\"No more payment requests can be saved.\"); return complete(); }\n entry.id = maximum + 1;\n entry.date = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch());\n if (entry.recipient.address.empty()) entry.recipient.address = new_address(entry.recipient.noteSelf).toStdString();\n if (entry.recipient.address.empty()) return complete();\n if (command.note_is_prefill) {\n std::string label;\n if (m_wallet->getAddress(DecodeDestination(entry.recipient.address), &label, nullptr)) entry.recipient.noteSelf = label;\n }\n }\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(entry.recipient.address), util::ToString(entry.id), ReceiveRequestHistoryModel::SerializeEntry(entry))) { result.error = Tr(\"The payment request could not be saved.\"); return complete(); }\n result.saved_entry = entry;\n result.success = true;\n const auto address = QString::fromStdString(entry.recipient.address);\n std::string old_label_text;\n m_wallet->getAddress(DecodeDestination(entry.recipient.address), &old_label_text, nullptr);\n const auto old_label = QString::fromStdString(old_label_text);\n const auto note = QString::fromStdString(entry.recipient.noteSelf);\n const bool note_changed = existing == state.receive_requests.end() || existing->recipient.noteSelf != entry.recipient.noteSelf;\n if (note_changed && old_label != note && (!note.isEmpty() || (existing != state.receive_requests.end() && old_label.toStdString() == existing->recipient.noteSelf))) {\n if (!m_wallet->setAddressBook(DecodeDestination(entry.recipient.address), entry.recipient.noteSelf, wallet::AddressPurpose::RECEIVE)) result.error = Tr(\"The request was saved, but its address label could not be saved.\");\n }\n wallet_lock.reset();\n if (command.reserve_receiving_address) {\n settings.remove(address_key);\n settings.sync();\n // Harmless once the request is saved, so log it instead of failing.\n if (settings.status() != QSettings::NoError) qWarning() << \"Could not clear the receiving address preference for\" << address_key;\n }\n } else if (command.kind == ReceiveCommand::Kind::Remove) {\n const auto existing = std::find_if(state.receive_requests.begin(), state.receive_requests.end(), [&](const auto& item) { return item.id == command.entry.id; });\n result.success = existing != state.receive_requests.end() && m_wallet->setAddressReceiveRequest(DecodeDestination(existing->recipient.address), util::ToString(existing->id), {});\n if (!result.success) result.error = Tr(\"The payment request could not be removed.\");\n } else if (command.kind == ReceiveCommand::Kind::Label) {\n const auto destination = DecodeDestination(command.address.toStdString());\n wallet::AddressPurpose purpose{};\n result.success = IsValidDestination(destination) && m_wallet->getAddress(destination, nullptr, &purpose) && m_wallet->setAddressBook(destination, command.label.toStdString(), purpose);\n if (result.success) {\n for (auto entry : state.receive_requests) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | A busy wallet makes a label edit report that the address is unavailableqml/pages/wallet/AddressList.qml | addressed | AssessmentThe label-edit failure path now checks whether the wallet has a pending Receive operation and displays the retry message instead of saying the address is unavailable. The new test covers both the busy-wallet case and the unavailable-address fallback. path_diff: qml/pages/wallet/AddressList.qml; new_source: qml/pages/wallet/AddressList.qml [
{
"evidence_id": "6d6c504ab7be405c8062bd167abad5c6",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/pages/wallet/AddressList.qml",
"source_generation": 3,
"source_job_id": 3007,
"text": "diff --git a/qml/pages/wallet/AddressList.qml b/qml/pages/wallet/AddressList.qml\nindex 2da643e65b..5cf24db1aa 100644\n--- a/qml/pages/wallet/AddressList.qml\n+++ b/qml/pages/wallet/AddressList.qml\n@@ -53,8 +53,8 @@ SettingsPage {\n if (closeAction) {\n closeAction();\n }\n- if (wallet && wallet.receiveOperationPending) {\n- root.errorText = qsTr(\"The wallet is saving another change. Try again in a moment.\");\n+ if (root.walletBusy()) {\n+ root.errorText = root.walletBusyText();\n return;\n }\n addressModel.refresh();\n@@ -87,10 +87,14 @@ SettingsPage {\n if (root.addressModel.labelChangePending) return false\n root.errorText = \"\"\n if (root.addressModel.setAddressLabel(address, label)) return true\n- root.errorText = qsTr(\"The address label could not be saved. Please try again.\")\n+ root.errorText = root.walletBusy() ? root.walletBusyText()\n+ : qsTr(\"The address label could not be saved. Please try again.\")\n return false\n }\n \n+ function walletBusy() { return !!root.wallet && root.wallet.receiveOperationPending }\n+ function walletBusyText() { return qsTr(\"The wallet is saving another change. Try again in a moment.\") }\n+\n Connections {\n target: root.addressModel\n function onLabelChangeFinished(address, label, success, error) {\n@@ -160,7 +164,8 @@ SettingsPage {\n if (root.updateAddressLabel(address, label)) {\n noteErrorText = \"\";\n } else {\n- noteErrorText = qsTr(\"This address is no longer available.\");\n+ noteErrorText = root.walletBusy() ? root.walletBusyText()\n+ : qsTr(\"This address is no longer available.\");\n }\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 208,
"evidence_id": "bf0afda8d23c4b8b96190877b207f4bf",
"finding_id": "finding:7",
"kind": "new_source",
"line": 59,
"new_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/pages/wallet/AddressList.qml",
"revision": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"source_generation": 3,
"source_job_id": 3007,
"text": " }\n addressModel.refresh();\n root.errorText = qsTr(\"This address is no longer available.\");\n }\n\n function pendingNote(address, fallbackLabel) {\n const note = root.pendingNotesByAddress[address]\n return note === undefined ? fallbackLabel : note\n }\n\n function updatePendingNote(address, note) {\n const notes = {}\n for (const key in root.pendingNotesByAddress) {\n notes[key] = root.pendingNotesByAddress[key]\n }\n notes[address] = note\n root.pendingNotesByAddress = notes\n }\n\n function clearPendingNote(address) {\n const notes = {}\n for (const key in root.pendingNotesByAddress) {\n if (key !== address) notes[key] = root.pendingNotesByAddress[key]\n }\n root.pendingNotesByAddress = notes\n }\n\n function updateAddressLabel(address, label) {\n if (root.addressModel.labelChangePending) return false\n root.errorText = \"\"\n if (root.addressModel.setAddressLabel(address, label)) return true\n root.errorText = root.walletBusy() ? root.walletBusyText()\n : qsTr(\"The address label could not be saved. Please try again.\")\n return false\n }\n\n function walletBusy() { return !!root.wallet && root.wallet.receiveOperationPending }\n function walletBusyText() { return qsTr(\"The wallet is saving another change. Try again in a moment.\") }\n\n Connections {\n target: root.addressModel\n function onLabelChangeFinished(address, label, success, error) {\n if (success && root.selectedAddress === address) root.selectedLabel = label\n if (success && root.pendingNotesByAddress[address] === label) root.clearPendingNote(address)\n root.errorText = error\n if (root.selectedAddress === address) addressDetails.noteErrorText = error\n }\n }\n\n rightItem: OverflowMenuButton {\n objectName: \"addressesMenuButton\"\n checked: pageMenu.opened\n onClicked: {\n pageMenu.openBelow(this, 0);\n }\n }\n\n Component.onCompleted: addressModel.refresh()\n\n ContextMenu {\n id: pageMenu\n parent: Overlay.overlay\n modal: true\n dim: false\n focus: true\n\n ContextMenuToggle {\n checkable: false\n text: qsTr(\"Show used addresses\")\n checked: addressModel.showUsed\n onClicked: addressModel.showUsed = !addressModel.showUsed\n }\n }\n\n DialogPopup {\n id: detailsPopup\n objectName: \"addressDetailsPopup\"\n parent: Overlay.overlay\n title: qsTr(\"Address details\")\n implicitWidth: 640\n contentItem: ScrollView {\n id: detailsScroll\n contentWidth: availableWidth\n clip: true\n ScrollBar.horizontal.policy: ScrollBar.AlwaysOff\n\n AddressDetails {\n id: addressDetails\n width: detailsScroll.availableWidth\n address: root.selectedAddress\n label: root.selectedLabel\n amount: root.selectedAmount\n hasAmount: root.selectedHasAmount\n category: root.selectedCategory\n scriptType: root.selectedScriptType\n used: root.selectedUsed\n hasPaymentRequest: root.selectedHasPaymentRequest\n labelChangePending: root.addressModel.labelChangePending\n receiveOperationPending: !!root.wallet && root.wallet.receiveOperationPending\n onCloseRequested: detailsPopup.close()\n onCreatePaymentRequestRequested: {\n root.createPaymentRequestFromSelected(function() { detailsPopup.close(); });\n }\n onEditLabelRequested: (address, label) => {\n if (root.addressModel.labelChangePending) return\n if (root.updateAddressLabel(address, label)) {\n noteErrorText = \"\";\n } else {\n noteErrorText = root.walletBusy() ? root.walletBusyText()\n : qsTr(\"This address is no longer available.\");\n }\n }\n }\n }\n }\n\n PageHeading {\n objectName: \"addressListIntroduction\"\n Layout.fillWidth: true\n descriptionTextFormat: Text.StyledText\n description: qsTr(\"View addresses generated by this wallet.\") + \"<br><br>\"\n + qsTr(\"<b>Single-use</b> addresses are intended for receiving one payment; avoiding address reuse helps protect your privacy.\") + \"<br>\"\n + qsTr(\"<b>Change</b> addresses are created and managed automatically when you send bitcoin, receiving any remaining amount back into your wallet.\")\n }\n\n SegmentedPicker {\n Accessible.name: qsTr(\"Addresses\")\n Layout.fillWidth: true\n Layout.maximumWidth: 360\n Layout.alignment: Qt.AlignHCenter\n model: addressModel.categoryOptions\n currentIndex: Math.max(0, addressModel.categoryOptions.findIndex(option => option.value === addressModel.category))\n onSelected: (index, option) => {\n root.errorText = \"\";\n addressModel.category = option.value;\n }\n }\n\n CoreText {\n Layout.fillWidth: true\n visible: root.errorText.length > 0\n text: root.errorText\n color: Theme.color.dangerText\n textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n }\n\n CoreText {\n Layout.fillWidth: true\n visible: addressModel.count === 0",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..b993e673e332 2026-11-24T03:44:24Z · gpt-6-luna |
| gui#1146 | Idle wallet polling recomputes balances that it does not useqml/models/walletqmlmodel.cpp | addressed | Assessmentpoll() now reads GetLastBlockHash() under cs_wallet rather than calling tryGetBalances() on the real wallet, avoiding the reported balance scan just to check the processed-block hash. The fallback still uses tryGetBalances() when no underlying wallet pointer is available. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "4d665bd3b36d48f28619611907e82f21",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 3,
"source_job_id": 3007,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex c6dc2f7b10..9910070284 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -706,7 +706,7 @@ void WalletQmlModel::applyWalletState(WalletStateSnapshot state)\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n- m_wallet_state_error = m_wallet_subscription_error.isEmpty() ? m_wallet_state.persistence_error : m_wallet_subscription_error;\n+ m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n@@ -787,8 +787,14 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n+ std::optional<QmlRecentRequestEntry> saved_entry;\n+ if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n+ // The final read can already include a payment that arrived after the write.\n+ if (saved_entry) {\n+ if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n+ }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n@@ -804,11 +810,11 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n- if (result.success && result.saved_entry) applySavedRequest(held, *result.saved_entry);\n+ if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n- if (result.success && result.saved_entry) {\n- if (m_detail_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_detail_payment_request, *result.saved_entry);\n- if (!held && m_current_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_current_payment_request, *result.saved_entry);\n+ if (saved_entry) {\n+ if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n+ if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n@@ -1009,7 +1015,7 @@ CFeeRate WalletQmlModel::dustRelayFee() const\n \n bool WalletQmlModel::sendAmountExhaustsBalance() const\n {\n- if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid()) {\n+ if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid() || sendBalancePending()) {\n return false;\n }\n \n@@ -1149,6 +1155,8 @@ bool WalletQmlModel::encryptWallet(const QString& passphrase)\n return false;\n }\n \n+ // Core locks the wallet after encrypting it; show that before the next snapshot.\n+ applySecurityState(true, true);\n refreshSecurityState();\n return true;\n }\n@@ -1173,6 +1181,12 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return false;\n }\n \n+ // Core relocks after the change only if the wallet was locked when it started.\n+ const auto unlock_session = m_unlock_session->tryAcquire();\n+ if (!unlock_session) {\n+ setSettingsError(tr(\"The wallet is busy with another operation. Try again in a moment.\"));\n+ return false;\n+ }\n SecureString secure_old_passphrase{QmlUtil::SecureStringFromQString(old_passphrase)};\n SecureString secure_new_passphrase{QmlUtil::SecureStringFromQString(new_passphrase)};\n const bool changed{m_wallet->changeWalletPassphrase(secure_old_passphrase, secure_new_passphrase)};\n@@ -1544,7 +1558,7 @@ void WalletQmlModel::scheduleFeeEstimates()\n \n // Until a destination is entered, show the gross remainder. A valid\n // address enables the sendall preview, which replaces it with the net amount.\n- if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty()) {\n+ if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty() && !sendBalancePending()) {\n CAmount remainder = sendAvailableBalance();\n for (const auto* recipient : m_send_recipients->recipients()) {\n if (recipient != m_maximum_recipient) remainder -= recipient->cAmount();\n@@ -2595,7 +2609,7 @@ void WalletQmlModel::followPrefilledNote()\n CAmount WalletQmlModel::sendAvailableBalance() const\n {\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n- // Until the worker reports the selected inputs, treat them as covering nothing.\n+ // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);\n }\n \n@@ -2613,9 +2627,12 @@ void WalletQmlModel::refreshSelectedAvailableBalance(bool selection_changed)\n [this, request](BackendExecutor::Outcome<CAmount> outcome) {\n if (request != m_selected_balance_request) return;\n m_selected_balance_task.reset();\n- const auto* balance = std::get_if<0>(&outcome);\n- if (!balance || m_selected_available_balance == *balance) return;\n- m_selected_available_balance = *balance;\n+ if (std::holds_alternative<BackendExecutor::Cancelled>(outcome)) return;\n+ // A failed read covers nothing rather than leaving Send pending.\n+ const auto* read = std::get_if<0>(&outcome);\n+ const CAmount balance{read ? *read : 0};\n+ if (m_selected_available_balance == balance) return;\n+ m_selected_available_balance = balance;\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n });\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..b993e673e332 2026-11-24T03:44:24Z · gpt-6-luna |
| gui#1146 | isEncrypted stays stale after successful initial encryptionqml/models/walletqmlmodel.cpp | addressed | AssessmentAfter successful encryption, encryptWallet() now immediately calls applySecurityState(true, true) before requesting asynchronous reconciliation, so the encrypted and locked state is available immediately. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "069a0750b7c14eb28bd1e0afbc82c079",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 3,
"source_job_id": 3007,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex c6dc2f7b10..9910070284 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -706,7 +706,7 @@ void WalletQmlModel::applyWalletState(WalletStateSnapshot state)\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n- m_wallet_state_error = m_wallet_subscription_error.isEmpty() ? m_wallet_state.persistence_error : m_wallet_subscription_error;\n+ m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n@@ -787,8 +787,14 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n+ std::optional<QmlRecentRequestEntry> saved_entry;\n+ if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n+ // The final read can already include a payment that arrived after the write.\n+ if (saved_entry) {\n+ if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n+ }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n@@ -804,11 +810,11 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n- if (result.success && result.saved_entry) applySavedRequest(held, *result.saved_entry);\n+ if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n- if (result.success && result.saved_entry) {\n- if (m_detail_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_detail_payment_request, *result.saved_entry);\n- if (!held && m_current_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_current_payment_request, *result.saved_entry);\n+ if (saved_entry) {\n+ if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n+ if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n@@ -1009,7 +1015,7 @@ CFeeRate WalletQmlModel::dustRelayFee() const\n \n bool WalletQmlModel::sendAmountExhaustsBalance() const\n {\n- if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid()) {\n+ if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid() || sendBalancePending()) {\n return false;\n }\n \n@@ -1149,6 +1155,8 @@ bool WalletQmlModel::encryptWallet(const QString& passphrase)\n return false;\n }\n \n+ // Core locks the wallet after encrypting it; show that before the next snapshot.\n+ applySecurityState(true, true);\n refreshSecurityState();\n return true;\n }\n@@ -1173,6 +1181,12 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return false;\n }\n \n+ // Core relocks after the change only if the wallet was locked when it started.\n+ const auto unlock_session = m_unlock_session->tryAcquire();\n+ if (!unlock_session) {\n+ setSettingsError(tr(\"The wallet is busy with another operation. Try again in a moment.\"));\n+ return false;\n+ }\n SecureString secure_old_passphrase{QmlUtil::SecureStringFromQString(old_passphrase)};\n SecureString secure_new_passphrase{QmlUtil::SecureStringFromQString(new_passphrase)};\n const bool changed{m_wallet->changeWalletPassphrase(secure_old_passphrase, secure_new_passphrase)};\n@@ -1544,7 +1558,7 @@ void WalletQmlModel::scheduleFeeEstimates()\n \n // Until a destination is entered, show the gross remainder. A valid\n // address enables the sendall preview, which replaces it with the net amount.\n- if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty()) {\n+ if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty() && !sendBalancePending()) {\n CAmount remainder = sendAvailableBalance();\n for (const auto* recipient : m_send_recipients->recipients()) {\n if (recipient != m_maximum_recipient) remainder -= recipient->cAmount();\n@@ -2595,7 +2609,7 @@ void WalletQmlModel::followPrefilledNote()\n CAmount WalletQmlModel::sendAvailableBalance() const\n {\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n- // Until the worker reports the selected inputs, treat them as covering nothing.\n+ // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);\n }\n \n@@ -2613,9 +2627,12 @@ void WalletQmlModel::refreshSelectedAvailableBalance(bool selection_changed)\n [this, request](BackendExecutor::Outcome<CAmount> outcome) {\n if (request != m_selected_balance_request) return;\n m_selected_balance_task.reset();\n- const auto* balance = std::get_if<0>(&outcome);\n- if (!balance || m_selected_available_balance == *balance) return;\n- m_selected_available_balance = *balance;\n+ if (std::holds_alternative<BackendExecutor::Cancelled>(outcome)) return;\n+ // A failed read covers nothing rather than leaving Send pending.\n+ const auto* read = std::get_if<0>(&outcome);\n+ const CAmount balance{read ? *read : 0};\n+ if (m_selected_available_balance == balance) return;\n+ m_selected_available_balance = balance;\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n });\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..b993e673e332 2026-11-24T03:44:24Z · gpt-6-luna |
| gui#1146 | Reopening a request during deletion leaves the deleted request displayed as savedqml/components/PaymentRequestCard.qml | unclear | AssessmentThe supplied PaymentRequestCard excerpt does not show the deletedInEarlierOpening handler or the logic that updates the detail request after deletion. It therefore cannot establish whether the reopened deleted request remains displayed or is invalidated. new_source: qml/components/PaymentRequestCard.qml [
{
"bounded": true,
"end_line": 377,
"evidence_id": "2a2b917de6e145a5bbe73d444992c3f8",
"finding_id": "finding:4",
"kind": "new_source",
"line": 228,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/components/PaymentRequestCard.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 3,
"source_job_id": 3007,
"text": " if (imageSave.save(result.image, fileUrl))\n root.saveOpening = opening\n else\n root.showActionFailure(qsTr(\"QR code not saved\"), qsTr(\"The QR code could not be saved. Please try again.\"))\n })\n }\n // Asks first; the request is deleted once the user confirms.\n function deleteRequest() {\n if (!wallet || !saved) return false\n deleteOpening = opening\n deleteConfirmation.confirmDelete(wallet, request.id)\n return true\n }\n\n AlertPopup {\n id: actionFailurePopup\n objectName: \"requestPaymentActionFailurePopup\"\n messageObjectName: \"requestPaymentActionFailureMessage\"\n\n AlertAction {\n text: qsTr(\"OK\")\n buttonObjectName: \"requestPaymentActionFailureCloseButton\"\n }\n }\n\n PaymentRequestDeleteConfirmation {\n id: deleteConfirmation\n objectName: \"requestPaymentDeleteConfirmation\"\n reportsFailures: false\n onDeleted: function(requestId, requestWallet) {\n if (root.deleteOpening !== root.opening || requestWallet !== root.wallet) {\n root.deletedInEarlierOpening(requestId, requestWallet)\n return\n }\n // Discard local edits so closing the modal cannot try to save a deleted request.\n root.resetFields()\n root.deleted(requestId, requestWallet)\n }\n onDeleteFailed: function(requestId, error, requestWallet) {\n if (root.deleteOpening === root.opening && requestWallet === root.wallet) deleteConfirmation.showFailure(error)\n }\n }\n\n ImageSaveModel {\n id: imageSave\n objectName: \"requestPaymentImageSave\"\n onFinished: function(success) {\n if (!success && root.saveOpening === root.opening)\n root.showActionFailure(qsTr(\"QR code not saved\"), qsTr(\"The QR code could not be saved. Please try again.\"))\n }\n }\n // Keep notification handlers owned by the card when their targets change.\n readonly property Connections walletCompletion: Connections {\n target: root.wallet\n function onReceiveOperationFinished(operation, success) {\n if (root.pendingOperation !== operation) return\n root.pendingOperation = \"\"\n if (root.pendingOpening !== root.opening) {\n root.pendingRequestId = \"\"\n return\n }\n const operationError = root.wallet.receiveOperationError\n root.actionErrorText = operationError\n if (!success) return\n if (operation === \"save\") root.created(root.request.id)\n else if (operation === \"update\") root.resetFields()\n root.pendingRequestId = \"\"\n root.actionErrorText = operationError\n }\n }\n\n BitcoinAmount {\n id: displayAmount\n satoshi: root.request ? root.request.amount.satoshi : 0\n unit: root.amountUnit\n }\n BitcoinAmount {\n id: receivedAmount\n satoshi: root.request ? root.request.receivedAmountSatoshi : 0\n unit: optionsModel.displayUnit\n }\n readonly property Connections requestNotifications: Connections {\n target: root.request\n function onIsEditingChanged() { root.revealTemplateFields() }\n function onLabelChanged() {\n // Make a recipient name supplied by \"Request again\" visible in the draft.\n if (!root.modalView && root.request.label.trim() !== \"\") root.showRecipientName = true\n }\n function onPaymentReceivedChanged() {\n if (!root.paymentReceived) return\n amountInput.reset()\n labelInput.reset()\n messageInput.reset()\n root.amountErrorText = \"\"\n root.actionErrorText = \"\"\n saveDialog.close()\n moreMenu.close()\n qrMenu.close()\n }\n function onIdChanged() { if (!root.saved) root.resetFields() }\n }\n\n Component {\n id: customizationControl\n\n LinkButton {\n id: customizeButton\n objectName: \"requestPaymentCustomizeButton\"\n text: qsTr(\"Customize\")\n iconSource: \"qrc:/icons/slider.horizontal.svg\"\n onClicked: fieldsMenu.opened ? fieldsMenu.close() : fieldsMenu.open()\n\n ContextMenu {\n id: fieldsMenu\n objectName: \"requestPaymentFieldsMenu\"\n x: customizeButton.width - width\n y: customizeButton.height + 6\n modal: true\n dim: false\n\n ContextMenuPicker {\n objectName: \"requestPaymentFieldsPicker\"\n objectNameRole: \"objectName\"\n multiSelect: true\n selectedValues: {\n const fields = []\n if (root.showAmount) fields.push(\"amount\")\n if (root.showMessage) fields.push(\"message\")\n if (root.showRecipientName) fields.push(\"recipient\")\n return fields\n }\n model: [\n { text: qsTr(\"Amount\"), value: \"amount\", objectName: \"requestPaymentShowAmount\" },\n { text: qsTr(\"Message\"), value: \"message\", objectName: \"requestPaymentShowMessage\" },\n { text: qsTr(\"Recipient name\"), value: \"recipient\", objectName: \"requestPaymentShowRecipientName\" }\n ]\n onActivated: function(value) {\n if (value === \"amount\") root.showAmount = !root.showAmount\n else if (value === \"message\") root.showMessage = !root.showMessage\n else if (value === \"recipient\") root.showRecipientName = !root.showRecipientName\n }\n }\n }\n }\n }\n\n Component {\n id: noteRecommendation\n\n CoreText {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | A request metadata warning hides the successfully loaded wallet balanceqml/models/walletqmlmodel.cpp | addressed | AssessmentapplyWalletState() now sets walletStateError from the subscription error alone, and the persistence error is exposed separately as walletStateWarning. The badge receives that warning separately, allowing a successfully loaded balance to remain visible. new_source: qml/models/walletqmlmodel.cpp; path_diff: qml/models/walletqmlmodel.cpp [
{
"bounded": true,
"end_line": 828,
"evidence_id": "e8cde740988745f19accf2317f68c170",
"finding_id": "finding:3",
"kind": "new_source",
"line": 679,
"new_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"source_generation": 3,
"source_job_id": 3007,
"text": " }\n }\n if (walletStateRefreshNeeded()) scheduleWalletStateRefresh();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n });\n}\n\nvoid WalletQmlModel::applySecurityState(bool encrypted, bool locked)\n{\n if (m_is_encrypted == encrypted && m_is_locked == locked) return;\n m_is_encrypted = encrypted;\n m_is_locked = locked;\n m_wallet_state.encrypted = encrypted;\n m_wallet_state.locked = locked;\n Q_EMIT securityStateChanged();\n}\n\nvoid WalletQmlModel::applyWalletState(WalletStateSnapshot state)\n{\n if (m_stopping) return;\n m_snapshot_notification_count = std::max(m_snapshot_notification_count, state.notification_count);\n m_state_refresh_retry_timer.stop();\n m_state_refresh_retry_ms = 0;\n const bool name_changed = state.name != m_wallet_state.name;\n const bool labels_changed = state.labels != m_wallet_state.labels;\n const bool balance_changed = !m_wallet_state_ready || state.balance != m_wallet_state.balance || state.available_balance != m_wallet_state.available_balance;\n const bool was_encrypted = m_is_encrypted;\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n m_receive_requests->setEntries(std::vector<QmlRecentRequestEntry>{m_wallet_state.receive_requests});\n for (auto* request : {m_receiving_address, m_current_payment_request, m_detail_payment_request}) {\n if (!request) continue;\n if (m_wallet_state.observed_addresses.contains(request->address())) request->setPaymentReceived(true);\n if (const auto entry = m_receive_requests->entryById(request->id()); entry && !request->isEditing()) {\n applySavedRequest(request, *entry);\n }\n }\n updateReceivedPaymentRequestAmounts();\n m_receive_reconciliation_applying = false;\n if (name_changed) { Q_EMIT nameChanged(); Q_EMIT displayNameChanged(); }\n if (was_encrypted != m_is_encrypted || was_locked != m_is_locked) Q_EMIT securityStateChanged();\n Q_EMIT walletStateChanged();\n if (labels_changed) {\n followPrefilledNote();\n Q_EMIT addressListChanged();\n }\n if (balance_changed) Q_EMIT balanceChanged();\n refreshSelectedAvailableBalance(false);\n Q_EMIT sendAmountExhaustsBalanceChanged();\n // New funds and lock changes affect previews without editing the draft.\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::applySavedRequest(PaymentRequest* request, const QmlRecentRequestEntry& entry)\n{\n if (!request) return;\n request->setDestination(DecodeDestination(entry.recipient.address));\n request->setId(static_cast<unsigned int>(entry.id));\n request->setCreated(entry.date);\n request->amount()->setSatoshi(entry.recipient.amount);\n request->setLabel(QString::fromStdString(entry.recipient.label));\n request->setMessage(QString::fromStdString(entry.recipient.message));\n request->setNoteSelf(QString::fromStdString(entry.recipient.noteSelf));\n request->setPaymentReceived(entry.payment_received);\n request->setReceivedAmountSatoshi(receivedPaymentRequestAmount(request->address()));\n request->setIsEditing(false);\n request->setNeedsUnlock(false);\n request->setUnlockError({});\n}\n\nbool WalletQmlModel::canSubmitReceiveCommand() const\n{\n return available() && !m_stopping && m_wallet_state_backend && !m_receive_operation_pending;\n}\n\nbool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operation, PaymentRequest* request)\n{\n if (!canSubmitReceiveCommand()) return false;\n m_receive_operation_pending = true;\n m_receive_operation_error.clear();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n const auto backend = m_wallet_state_backend;\n const auto node = m_node;\n const QPointer<PaymentRequest> held{request};\n const auto revision = request ? request->revision() : 0;\n const bool reserve = command.reserve_receiving_address;\n m_backend_executor->submitTask(this,\n [backend, node, command = std::move(command)]() mutable { return backend->execute(node, std::move(command)); },\n [this, held, revision, operation, reserve](BackendExecutor::Outcome<ReceiveCommandResult> outcome) {\n auto* received = std::get_if<0>(&outcome);\n if (!received) {\n m_receive_operation_pending = false;\n m_receive_operation_error = tr(\"The wallet operation failed. Please try again.\");\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, false);\n requestWalletStateRefresh();\n return;\n }\n auto& result = *received;\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n std::optional<QmlRecentRequestEntry> saved_entry;\n if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n // The final read can already include a payment that arrived after the write.\n if (saved_entry) {\n if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n if (result.success && result.saved_entry) m_receive_requests->prependOrReplace(*result.saved_entry);\n m_wallet_state_error = result.refresh_error;\n Q_EMIT walletStateChanged();\n requestWalletStateRefresh();\n }\n if (current_request) {\n held->setNeedsUnlock(result.needs_unlock);\n held->setUnlockError(result.error);\n if (result.success && !result.receiving_address.isEmpty()) {\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n if (saved_entry) {\n if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n if (result.success && reserve && result.saved_entry &&\n m_receiving_address->address().toStdString() == result.saved_entry->recipient.address) {\n m_receiving_address->clear();\n }\n if (held && !current_request) {\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"evidence_id": "423618101a7c49c0bf4affca88cacc67",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "b993e673e3321a8b1c2f2f3c2d101f9e2193277b",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 3,
"source_job_id": 3007,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex c6dc2f7b10..9910070284 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -706,7 +706,7 @@ void WalletQmlModel::applyWalletState(WalletStateSnapshot state)\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n- m_wallet_state_error = m_wallet_subscription_error.isEmpty() ? m_wallet_state.persistence_error : m_wallet_subscription_error;\n+ m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n@@ -787,8 +787,14 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n+ std::optional<QmlRecentRequestEntry> saved_entry;\n+ if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n+ // The final read can already include a payment that arrived after the write.\n+ if (saved_entry) {\n+ if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n+ }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n@@ -804,11 +810,11 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n- if (result.success && result.saved_entry) applySavedRequest(held, *result.saved_entry);\n+ if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n- if (result.success && result.saved_entry) {\n- if (m_detail_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_detail_payment_request, *result.saved_entry);\n- if (!held && m_current_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_current_payment_request, *result.saved_entry);\n+ if (saved_entry) {\n+ if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n+ if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n@@ -1009,7 +1015,7 @@ CFeeRate WalletQmlModel::dustRelayFee() const\n \n bool WalletQmlModel::sendAmountExhaustsBalance() const\n {\n- if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid()) {\n+ if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid() || sendBalancePending()) {\n return false;\n }\n \n@@ -1149,6 +1155,8 @@ bool WalletQmlModel::encryptWallet(const QString& passphrase)\n return false;\n }\n \n+ // Core locks the wallet after encrypting it; show that before the next snapshot.\n+ applySecurityState(true, true);\n refreshSecurityState();\n return true;\n }\n@@ -1173,6 +1181,12 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return false;\n }\n \n+ // Core relocks after the change only if the wallet was locked when it started.\n+ const auto unlock_session = m_unlock_session->tryAcquire();\n+ if (!unlock_session) {\n+ setSettingsError(tr(\"The wallet is busy with another operation. Try again in a moment.\"));\n+ return false;\n+ }\n SecureString secure_old_passphrase{QmlUtil::SecureStringFromQString(old_passphrase)};\n SecureString secure_new_passphrase{QmlUtil::SecureStringFromQString(new_passphrase)};\n const bool changed{m_wallet->changeWalletPassphrase(secure_old_passphrase, secure_new_passphrase)};\n@@ -1544,7 +1558,7 @@ void WalletQmlModel::scheduleFeeEstimates()\n \n // Until a destination is entered, show the gross remainder. A valid\n // address enables the sendall preview, which replaces it with the net amount.\n- if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty()) {\n+ if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty() && !sendBalancePending()) {\n CAmount remainder = sendAvailableBalance();\n for (const auto* recipient : m_send_recipients->recipients()) {\n if (recipient != m_maximum_recipient) remainder -= recipient->cAmount();\n@@ -2595,7 +2609,7 @@ void WalletQmlModel::followPrefilledNote()\n CAmount WalletQmlModel::sendAvailableBalance() const\n {\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n- // Until the worker reports the selected inputs, treat them as covering nothing.\n+ // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);\n }\n \n@@ -2613,9 +2627,12 @@ void WalletQmlModel::refreshSelectedAvailableBalance(bool selection_changed)\n [this, request](BackendExecutor::Outcome<CAmount> outcome) {\n if (request != m_selected_balance_request) return;\n m_selected_balance_task.reset();\n- const auto* balance = std::get_if<0>(&outcome);\n- if (!balance || m_selected_available_balance == *balance) return;\n- m_selected_available_balance = *balance;\n+ if (std::holds_alternative<BackendExecutor::Cancelled>(outcome)) return;\n+ // A failed read covers nothing rather than leaving Send pending.\n+ const auto* read = std::get_if<0>(&outcome);\n+ const CAmount balance{read ? *read : 0};\n+ if (m_selected_available_balance == balance) return;\n+ m_selected_available_balance = balance;\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n });\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..b993e673e332 2026-11-24T03:44:24Z · gpt-6-luna |
| gui#1146 | An older save receipt can undo the following snapshot's payment reconciliationqml/models/walletqmlmodel.cpp | addressed | AssessmentWhen a snapshot is available, the completion now looks up the request entry after applying that snapshot and uses the reconciled entry for matching request objects. The saved receipt is retained as fallback when no snapshot is available. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "909ae2bd5f2144bd81ad8cc05c1338a8",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 3,
"source_job_id": 3007,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex c6dc2f7b10..d022922234 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -706,7 +706,7 @@ void WalletQmlModel::applyWalletState(WalletStateSnapshot state)\n const bool was_locked = m_is_locked;\n m_wallet_state = std::move(state);\n m_wallet_state_ready = true;\n- m_wallet_state_error = m_wallet_subscription_error.isEmpty() ? m_wallet_state.persistence_error : m_wallet_subscription_error;\n+ m_wallet_state_error = m_wallet_subscription_error;\n m_is_encrypted = m_wallet_state.encrypted;\n m_is_locked = m_wallet_state.locked;\n m_receive_reconciliation_applying = true;\n@@ -776,6 +776,7 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n if (!received) {\n m_receive_operation_pending = false;\n m_receive_operation_error = tr(\"The wallet operation failed. Please try again.\");\n+ if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n@@ -787,8 +788,14 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n+ std::optional<QmlRecentRequestEntry> saved_entry;\n+ if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n+ // The final read can already include a payment that arrived after the write.\n+ if (saved_entry) {\n+ if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n+ }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n@@ -804,11 +811,11 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n- if (result.success && result.saved_entry) applySavedRequest(held, *result.saved_entry);\n+ if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n- if (result.success && result.saved_entry) {\n- if (m_detail_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_detail_payment_request, *result.saved_entry);\n- if (!held && m_current_payment_request->id() == QString::number(result.saved_entry->id)) applySavedRequest(m_current_payment_request, *result.saved_entry);\n+ if (saved_entry) {\n+ if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n+ if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n@@ -820,6 +827,7 @@ bool WalletQmlModel::submitReceiveCommand(ReceiveCommand command, QString operat\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }\n+ if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n@@ -1009,7 +1017,7 @@ CFeeRate WalletQmlModel::dustRelayFee() const\n \n bool WalletQmlModel::sendAmountExhaustsBalance() const\n {\n- if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid()) {\n+ if (!m_wallet || !m_send_recipients || !m_send_recipients->allValid() || sendBalancePending()) {\n return false;\n }\n \n@@ -1149,6 +1157,8 @@ bool WalletQmlModel::encryptWallet(const QString& passphrase)\n return false;\n }\n \n+ // Core locks the wallet after encrypting it; show that before the next snapshot.\n+ applySecurityState(true, true);\n refreshSecurityState();\n return true;\n }\n@@ -1173,6 +1183,12 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return false;\n }\n \n+ // Core relocks after the change only if the wallet was locked when it started.\n+ const auto unlock_session = m_unlock_session->tryAcquire();\n+ if (!unlock_session) {\n+ setSettingsError(tr(\"The wallet is busy with another operation. Try again in a moment.\"));\n+ return false;\n+ }\n SecureString secure_old_passphrase{QmlUtil::SecureStringFromQString(old_passphrase)};\n SecureString secure_new_passphrase{QmlUtil::SecureStringFromQString(new_passphrase)};\n const bool changed{m_wallet->changeWalletPassphrase(secure_old_passphrase, secure_new_passphrase)};\n@@ -1544,7 +1560,7 @@ void WalletQmlModel::scheduleFeeEstimates()\n \n // Until a destination is entered, show the gross remainder. A valid\n // address enables the sendall preview, which replaces it with the net amount.\n- if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty()) {\n+ if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty() && !sendBalancePending()) {\n CAmount remainder = sendAvailableBalance();\n for (const auto* recipient : m_send_recipients->recipients()) {\n if (recipient != m_maximum_recipient) remainder -= recipient->cAmount();\n@@ -2582,6 +2598,11 @@ void WalletQmlModel::setSelectedCoins(const std::vector<COutPoint>& outputs)\n void WalletQmlModel::followPrefilledNote()\n {\n if (m_prefilled_note_address.isEmpty()) return;\n+ // A pending Receive command checks the request's revision; follow the label once it finishes.\n+ if (m_receive_operation_pending) {\n+ m_prefilled_note_follow_pending = true;\n+ return;\n+ }\n auto* request = m_current_payment_request;\n if (!request->id().isEmpty() || request->address() != m_prefilled_note_address || request->noteSelf() != m_prefilled_note) {\n m_prefilled_note_address.clear();\n@@ -2595,7 +2616,7 @@ void WalletQmlModel::followPrefilledNote()\n CAmount WalletQmlModel::sendAvailableBalance() const\n {\n if (!m_coin_control.HasSelected()) return m_wallet_state.available_balance;\n- // Until the worker reports the selected inputs, treat them as covering nothing.\n+ // Callers check sendBalancePending() before trusting this; zero covers nothing.\n return m_selected_available_balance.value_or(0);\n }\n \n@@ -2613,9 +2634,12 @@ void WalletQmlModel::refreshSelectedAvailableBalance(bool selection_changed)\n [this, request](BackendExecutor::Outcome<CAmount> outcome) {\n if (request != m_selected_balance_request) return;\n m_selected_balance_task.reset();\n- const auto* balance = std::get_if<0>(&outcome);\n- if (!balance || m_selected_available_balance == *balance) return;\n- m_selected_available_balance = *balance;\n+ if (std::holds_alternative<BackendExecutor::Cancelled>(outcome)) return;\n+ // A failed read covers nothing rather than leaving Send pending.\n+ const auto* read = std::get_if<0>(&outcome);\n+ const CAmount balance{read ? *read : 0};\n+ if (m_selected_available_balance == balance) return;\n+ m_selected_available_balance = balance;\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n });\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 929,
"evidence_id": "dda8f099533c40b1863a5617b656b5a0",
"finding_id": "finding:2",
"kind": "new_source",
"line": 780,
"new_head": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "efd7e49866980cba7dbb13383eb9e04398cd20e8",
"source_generation": 3,
"source_job_id": 3007,
"text": " Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, false);\n requestWalletStateRefresh();\n return;\n }\n auto& result = *received;\n const bool current_request = held && held->revision() == revision;\n m_receive_operation_pending = false;\n m_receive_operation_error = result.error;\n std::optional<QmlRecentRequestEntry> saved_entry;\n if (result.success) saved_entry = result.saved_entry;\n if (result.snapshot) {\n applyWalletState(std::move(*result.snapshot));\n // The final read can already include a payment that arrived after the write.\n if (saved_entry) {\n if (auto entry = m_receive_requests->entryById(QString::number(saved_entry->id))) saved_entry = std::move(entry);\n }\n } else {\n // The write receipt is authoritative even when the rest of\n // the wallet could not be reloaded. Keep the saved row usable.\n if (result.success && result.saved_entry) m_receive_requests->prependOrReplace(*result.saved_entry);\n m_wallet_state_error = result.refresh_error;\n Q_EMIT walletStateChanged();\n requestWalletStateRefresh();\n }\n if (current_request) {\n held->setNeedsUnlock(result.needs_unlock);\n held->setUnlockError(result.error);\n if (result.success && !result.receiving_address.isEmpty()) {\n held->clear();\n held->setDestination(DecodeDestination(result.receiving_address.toStdString()));\n }\n if (saved_entry) applySavedRequest(held, *saved_entry);\n }\n if (saved_entry) {\n if (m_detail_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_detail_payment_request, *saved_entry);\n if (!held && m_current_payment_request->id() == QString::number(saved_entry->id)) applySavedRequest(m_current_payment_request, *saved_entry);\n }\n // Saving retires the submitted address even if switching wallets\n // cleared the draft. Preserve a different address selected meanwhile.\n if (result.success && reserve && result.saved_entry &&\n m_receiving_address->address().toStdString() == result.saved_entry->recipient.address) {\n m_receiving_address->clear();\n }\n if (held && !current_request) {\n result.success = false;\n m_receive_operation_error = tr(\"The request changed while the operation was running. Check Activity for saved requests.\");\n }\n if (std::exchange(m_prefilled_note_follow_pending, false)) followPrefilledNote();\n Q_EMIT receiveOperationPendingChanged();\n Q_EMIT receiveOperationErrorChanged();\n Q_EMIT receiveRequestReconciliationPendingChanged();\n Q_EMIT receiveOperationFinished(operation, result.success);\n if (walletStateRefreshNeeded()) scheduleWalletStateRefresh();\n });\n return true;\n}\n\nvoid WalletQmlModel::beginShutdown(bool remove_wallet)\n{\n if (m_stopping) return;\n m_stopping = true;\n const bool was_available{available()};\n m_unload_requested->store(true);\n if (was_available) Q_EMIT availableChanged();\n m_wallet_poll_timer.stop();\n m_state_refresh_retry_timer.stop();\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n // Move subscriptions into the last backend job. Callback delivery targets\n // the separately retained bridge, never a raw pointer to this model.\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),\n std::move(m_handler_transaction_changed), std::move(m_handler_can_get_addresses_changed), std::move(m_handler_unload));\n if (m_bump_transaction_model) m_bump_transaction_model->detachWallet();\n if (m_imported_psbt_model) m_imported_psbt_model->detachWallet();\n auto wallet = std::move(m_wallet);\n auto backend = std::move(m_wallet_state_backend);\n m_sign_verify_message_model->setWallet({});\n m_sign_verify_message_model->setSecurityStateChangedFn({});\n m_backend_executor->submit(this, [wallet = std::move(wallet), backend = std::move(backend), handlers = std::move(handlers), remove_wallet]() mutable {\n std::apply([](auto&... handler) { ((handler ? handler->disconnect() : void()), ...); }, handlers);\n if (wallet && remove_wallet) wallet->remove();\n }, [] {});\n m_backend_executor->shutdown();\n}\n\nTransactionActivityModel* WalletQmlModel::transactionActivityModel()\n{\n // Instantiate when the activity screen first asks for it.\n if (!m_transaction_activity_model) m_transaction_activity_model = new TransactionActivityModel(this);\n return m_transaction_activity_model;\n}\n\nvoid WalletQmlModel::setNode(interfaces::Node* node)\n{\n m_node = node;\n if (m_imported_psbt_model) {\n m_imported_psbt_model->setNode(node);\n }\n}\n\nvoid WalletQmlModel::initializeFeeEstimator()\n{\n m_fee_estimation_timer = new QTimer(this);\n m_fee_estimation_timer->setSingleShot(true);\n m_fee_estimation_timer->setInterval(FEE_ESTIMATE_DEBOUNCE_MS);\n connect(m_fee_estimation_timer, &QTimer::timeout, this, &WalletQmlModel::requestFeeEstimatesNow);\n}\n\nQString WalletQmlModel::balance() const\n{\n return QmlBitcoinUnits::formatForDisplay(QmlBitcoinUnits::fromDisplayUnit(m_display_unit), m_wallet_state.balance);\n}\n\nqint64 WalletQmlModel::balanceSatoshi() const\n{\n return m_wallet_state.balance;\n}\n\nQString WalletQmlModel::estimatedFee() const\n{\n if (m_custom_fee_enabled) {\n return customFeeRateValid() && m_custom_fee_estimate.has_value()\n ? FormatFeeEstimate(m_custom_fee_estimate->fee)\n : QString{};\n }\n return estimatedFeeForTarget(feeTargetBlocks());\n}\n\nstd::optional<SendFeePreview> WalletQmlModel::selectedFeePreview() const\n{\n if (m_custom_fee_enabled) return customFeeRateValid() ? m_custom_fee_estimate : std::nullopt;\n const auto it = m_fee_estimates.constFind(feeTargetBlocks());\n return it == m_fee_estimates.constEnd() ? std::nullopt : std::make_optional(it.value());\n}\n\nstd::optional<CAmount> WalletQmlModel::selectedFeeEstimate() const\n{\n const auto preview = selectedFeePreview();\n return preview ? std::make_optional(preview->fee) : std::nullopt;\n}\n\nqint64 WalletQmlModel::estimatedFeeSatoshi() const\n{\n return selectedFeeEstimate().value_or(-1);\n}\n\nQString WalletQmlModel::estimatedFeeRate() const",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..efd7e4986698 2026-11-24T16:23:58Z · gpt-6-luna |
| gui#1146 | Failed batch coin-lock operations discard the marked selectionqml/components/CoinsList.qml | still_present | AssessmentThe supplied new-head CoinsList excerpt still clears markedIds immediately when setCoinsLocked() returns true. It does not retain the submitted selection until asynchronous success. new_source: qml/components/CoinsList.qml [
{
"bounded": true,
"end_line": 183,
"evidence_id": "8eabcd1a271d4b459a21eeb20237b18e",
"finding_id": "finding:12",
"kind": "new_source",
"line": 34,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"path": "qml/components/CoinsList.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 3,
"source_job_id": 3007,
"text": " readonly property int activeFilterCount: !coins ? 0 : (coins.filter !== \"all\" ? 1 : 0) + (coins.minAmount >= 0 || coins.maxAmount >= 0 ? 1 : 0)\n spacing: Theme.space.l\n onWalletChanged: { markedIds = []; walletSelectionActive = false; pendingLockedCoinId = \"\"; errorText = \"\" }\n\n BitcoinAmount { id: targetAmount; unit: optionsModel.displayUnit; satoshi: root.target }\n BitcoinAmount { id: selectedAmountText; unit: optionsModel.displayUnit; satoshi: root.selectedAmount }\n BitcoinAmount { id: remainingAmountText; unit: optionsModel.displayUnit; satoshi: root.remainingAmount }\n BitcoinAmount { id: changeAmountText; unit: optionsModel.displayUnit; satoshi: root.changeAmount }\n BitcoinAmount { id: totalAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi : 0 }\n BitcoinAmount { id: spendableAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.totalSatoshi - root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lockedAmountText; unit: optionsModel.displayUnit; satoshi: root.coins ? root.coins.lockedSatoshi : 0 }\n BitcoinAmount { id: lowerAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.lowerValue }\n BitcoinAmount { id: upperAmountText; unit: optionsModel.displayUnit; satoshi: amountSlider.upperValue }\n\n function toggleRow(row, coinId, locked, marked) {\n if (selectionMode && locked && !marked) {\n pendingLockedCoinId = coinId\n lockedCoinAlert.open()\n } else if (selectionMode) coins.toggleCoinSelection(row)\n else if (walletSelectionActive) {\n const ids = markedIds.slice()\n const i = ids.indexOf(coinId)\n if (i < 0) ids.push(coinId); else ids.splice(i, 1)\n markedIds = ids\n }\n }\n function lockMarked(locked) {\n if (!coins || lockOperationPending) return\n if (coins.setCoinsLocked(markedIds, locked)) {\n errorText = \"\"\n markedIds = []\n } else {\n errorText = qsTr(\"Some coins could not be updated. Try again.\")\n }\n }\n function setCoinLocked(coinId, locked) {\n if (!coins || lockOperationPending) return\n errorText = coins.setCoinsLocked([coinId], locked) ? \"\" : qsTr(\"This coin could not be updated. Try again.\")\n }\n function openMenu(menu, button) {\n menu.openBelow(button, Theme.space.s)\n }\n function clearFilters() {\n if (!coins) return\n coins.filter = \"all\"\n coins.minAmount = -1\n coins.maxAmount = -1\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: 10\n SearchBar {\n objectName: \"coinBrowserSearch\"\n fieldObjectName: \"coinBrowserSearchField\"\n Layout.fillWidth: true\n placeholderText: SizeClass.isCompact(root.width) ? qsTr(\"Search coins\") : qsTr(\"Search notes, addresses or transaction IDs\")\n accessibleName: qsTr(\"Search coins\")\n text: root.coins ? root.coins.searchText : \"\"\n onTextChanged: if (root.coins) root.coins.searchText = text\n }\n IconButton {\n id: sortButton\n objectName: \"coinBrowserSortButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/arrow-up-down.svg\"\n accessibleName: qsTr(\"Sort coins\")\n onClicked: root.openMenu(sortMenu, sortButton)\n }\n IconButton {\n id: groupButton\n objectName: \"coinBrowserGroupButton\"\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/group-by.svg\"\n accessibleName: qsTr(\"Group coins\")\n onClicked: root.openMenu(groupMenu, groupButton)\n }\n IconButton {\n id: selectionButton\n objectName: \"walletCoinsSelectionButton\"\n visible: !root.selectionMode\n toolbar: true\n surfaceLevel: 1\n iconSize: Theme.size.icon.m\n iconSource: \"qrc:/icons/checklist.svg\"\n accessibleName: qsTr(\"Select coins\")\n checked: root.walletSelectionActive\n Accessible.checkable: true\n Accessible.checked: root.walletSelectionActive\n onClicked: {\n root.walletSelectionActive = !root.walletSelectionActive\n if (!root.walletSelectionActive) root.markedIds = []\n }\n }\n }\n\n Flow {\n Layout.fillWidth: true\n Layout.preferredHeight: childrenRect.height\n spacing: 10\n FilterButton {\n id: activeFiltersButton\n objectName: \"coinBrowserActiveFiltersButton\"\n visible: root.activeFilterCount > 0\n active: true\n count: root.activeFilterCount\n size: coinTypeButton.height\n iconSize: Theme.size.icon.l\n text: count === 1 ? qsTr(\"1 active filter\") : qsTr(\"%1 active filters\").arg(count)\n onClicked: root.openMenu(clearFiltersMenu, activeFiltersButton)\n }\n DropdownButton {\n id: coinTypeButton\n objectName: \"coinBrowserFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: !root.coins || root.coins.filter === \"all\" ? qsTr(\"Coin type\") : root.coins.filter === \"locked\" ? qsTr(\"Locked\") : qsTr(\"Spendable\")\n active: root.coins && root.coins.filter !== \"all\"\n opened: filterMenu.opened\n onClicked: root.openMenu(filterMenu, coinTypeButton)\n }\n DropdownButton {\n id: amountFilterButton\n objectName: \"coinBrowserAmountFilterButton\"\n implicitHeight: 40; surfaceLevel: 1\n text: qsTr(\"Amount\")\n active: root.coins && (root.coins.minAmount >= 0 || root.coins.maxAmount >= 0)\n opened: amountPopup.opened\n onClicked: root.openMenu(amountPopup, amountFilterButton)\n }\n }\n\n ListView {\n id: list\n objectName: \"coinSelectionListView\"\n Layout.fillWidth: true; Layout.fillHeight: true; Layout.minimumHeight: 120\n clip: true; model: root.coins; reuseItems: true\n boundsBehavior: Flickable.StopAtBounds\n ScrollBar.vertical: ScrollBar {}\n section.property: \"groupTitle\"\n section.criteria: ViewSection.FullString\n section.delegate: Item {\n required property string section\n width: list.width; height: 44\n CoreText {\n anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom; anchors.bottomMargin: 8\n anchors.leftMargin: Theme.space.xs; anchors.rightMargin: Theme.space.xs",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1efc5c73b6b7..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Changing the password during a temporary worker unlock can leave the wallet unlockedqml/models/walletunlock.h | unclear | AssessmentThe follow-up assessment was invalid: follow-up evidence belongs to another finding or comparison. invalid_assessment Source report · 1efc5c73b6b7..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1145 | Block-clock history retains disconnected blocks after a reorganizationsrc/qml/models/chainmodel.cpp | still_present | AssessmentThe new-head code still appends timestamp ratios without block identity or reorganization reconciliation; no relevant change appears in the supplied diff. new_source: src/qml/models/chainmodel.cpp [
{
"bounded": true,
"end_line": 109,
"evidence_id": "73920d184a9c43a1b97ea262a92d76ec",
"finding_id": "finding:9",
"kind": "new_source",
"line": 14,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/models/chainmodel.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": "using interfaces::FoundBlock;\n\nstatic constexpr int SECS_IN_12_HOURS{43200};\n\nChainModel::ChainModel(interfaces::Chain& chain)\n : m_assumed_blockchain_size{Params().AssumedBlockchainSize()},\n m_assumed_chainstate_size{Params().AssumedChainStateSize()},\n m_chain{chain}\n{\n QTimer* timer = new QTimer(this);\n connect(timer, &QTimer::timeout, this, &ChainModel::setCurrentTimeRatio);\n timer->start(1000);\n}\n\nvoid ChainModel::setCurrentNetworkName(QString network_name)\n{\n m_current_network_name = network_name.toUpper();\n Q_EMIT currentNetworkNameChanged();\n}\n\nvoid ChainModel::setTimeRatioList(int new_time)\n{\n if (m_time_ratio_list.isEmpty()) {\n setTimeRatioListInitial();\n }\n int time_at_meridian = timestampAtMeridian();\n\n if (new_time < time_at_meridian) {\n return;\n }\n m_time_ratio_list.push_back(double(new_time - time_at_meridian) / SECS_IN_12_HOURS);\n\n Q_EMIT timeRatioListChanged();\n}\n\nint ChainModel::timestampAtMeridian()\n{\n int secs_since_meridian = (QTime::currentTime().msecsSinceStartOfDay() / 1000) % SECS_IN_12_HOURS;\n int current_timestamp = QDateTime::currentSecsSinceEpoch();\n\n return current_timestamp - secs_since_meridian;\n}\n\nvoid ChainModel::setTimeRatioListInitial()\n{\n int time_at_meridian = timestampAtMeridian();\n m_time_ratio_list.clear();\n /* m_time_ratio_list[0] = current_time_ratio\n * m_time_ratio_list[1] = 0\n * These two positions remain fixed for these\n * values in m_time_ratio_list */\n m_time_ratio_list.push_back(double(QDateTime::currentSecsSinceEpoch() - time_at_meridian) / SECS_IN_12_HOURS);\n m_time_ratio_list.push_back(0);\n\n if (!m_chain.getHeight()) {\n Q_EMIT timeRatioListChanged();\n return;\n }\n\n int first_block_height;\n int active_chain_height = m_chain.getHeight().value();\n bool success = m_chain.findFirstBlockWithTimeAndHeight(/*min_time=*/time_at_meridian, /*min_height=*/0, interfaces::FoundBlock().height(first_block_height));\n\n if (!success) {\n Q_EMIT timeRatioListChanged();\n return;\n }\n\n for (int height = first_block_height; height < active_chain_height + 1; height++) {\n uint256 block_hash{m_chain.getBlockHash(height)};\n int64_t block_time;\n m_chain.findBlock(block_hash, FoundBlock().time(block_time));\n m_time_ratio_list.push_back(double(block_time - time_at_meridian) / SECS_IN_12_HOURS);\n }\n\n Q_EMIT timeRatioListChanged();\n}\n\nvoid ChainModel::setCurrentTimeRatio()\n{\n int secs_since_meridian = (QTime::currentTime().msecsSinceStartOfDay() / 1000) % SECS_IN_12_HOURS;\n double current_time_ratio = double(secs_since_meridian) / SECS_IN_12_HOURS;\n\n if (current_time_ratio < m_time_ratio_list[0].toDouble()) { // That means time has crossed a meridian\n m_time_ratio_list.clear();\n }\n\n if (m_time_ratio_list.isEmpty()) {\n m_time_ratio_list.push_back(current_time_ratio);\n m_time_ratio_list.push_back(0);\n } else {\n m_time_ratio_list[0] = current_time_ratio;\n }\n\n Q_EMIT timeRatioListChanged();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Existing writable data directories require a writable parentsrc/qml/datadir.cpp | still_present | AssessmentThe new-head validation still proceeds from validating an existing target to checking parent writability; it does not return success for a valid existing directory. new_source: src/qml/datadir.cpp [
{
"bounded": true,
"end_line": 257,
"evidence_id": "0b8d0489456444718e73b450e6ab66e2",
"finding_id": "finding:7",
"kind": "new_source",
"line": 108,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/datadir.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": " return DataDirTr(\"Choose a data directory.\");\n }\n\n QFileInfo target_info(local_path);\n if (target_info.exists()) {\n if (!target_info.isDir()) {\n return DataDirTr(\"The selected path exists and is not a directory.\");\n }\n bool accessible{target_info.isReadable()};\n#ifndef Q_OS_WIN\n accessible = accessible && target_info.isExecutable();\n#endif\n if (!accessible) {\n //: Error shown during onboarding when the selected data directory cannot be read or entered.\n return DataDirTr(\"The selected directory is not accessible.\");\n }\n if (!target_info.isWritable()) {\n return DataDirTr(\"The selected directory is not writable.\");\n }\n }\n\n QString parent_path = target_info.absoluteDir().absolutePath();\n while (!QFileInfo::exists(parent_path)) {\n const QString current = parent_path;\n parent_path = QFileInfo(parent_path).absoluteDir().absolutePath();\n if (parent_path.isEmpty() || parent_path == current) {\n return DataDirTr(\"The data directory cannot be created here.\");\n }\n }\n QFileInfo parent_info(parent_path);\n if (!parent_info.isDir() || !parent_info.isWritable()) {\n return DataDirTr(\"The parent directory is not writable.\");\n }\n return {};\n#endif\n}\n\nStorageSpaceResult CheckStorageSpace(const QString& path)\n{\n StorageSpaceResult result;\n result.path = NormalizeLocalPath(path);\n if (result.path.isEmpty()) {\n result.message = DataDirTr(\"Choose a data directory.\");\n return result;\n }\n\n const fs::path data_dir = QStringToPath(result.path);\n fs::path parent_dir = data_dir;\n fs::path previous_parent;\n try {\n while (parent_dir.has_parent_path() && !fs::exists(parent_dir)) {\n parent_dir = parent_dir.parent_path();\n if (parent_dir == previous_parent) break;\n previous_parent = parent_dir;\n }\n\n if (!fs::exists(parent_dir)) {\n result.message = DataDirTr(\"Cannot create data directory here.\");\n return result;\n }\n\n const auto space_info = fs::space(parent_dir);\n result.checked_path = QString::fromStdString(fs::PathToString(parent_dir));\n result.available_bytes = space_info.available;\n result.capacity_bytes = space_info.capacity;\n result.path_exists = fs::exists(data_dir);\n result.path_is_directory = result.path_exists && fs::is_directory(data_dir);\n\n if (result.path_exists) {\n if (result.path_is_directory) {\n result.ok = true;\n result.message = DataDirTr(\"Directory already exists.\");\n } else {\n result.message = DataDirTr(\"Path already exists, and is not a directory.\");\n }\n } else {\n result.ok = true;\n result.message = DataDirTr(\"A new data directory will be created.\");\n }\n } catch (const fs::filesystem_error&) {\n result.message = DataDirTr(\"Cannot create data directory here.\");\n }\n return result;\n}\n\nbool EnsureDataDir(const QString& path, QString* error)\n{\n const QString local_path = NormalizeLocalPath(path);\n const QString validation_error = ValidateCustomDataDir(local_path);\n if (!validation_error.isEmpty()) {\n if (error) *error = validation_error;\n return false;\n }\n\n try {\n const fs::path data_dir_path = QStringToPath(local_path);\n if (TryCreateDirectories(data_dir_path)) {\n TryCreateDirectories(data_dir_path / \"wallets\");\n }\n } catch (const fs::filesystem_error&) {\n if (error) *error = DataDirTr(\"The selected data directory could not be created.\");\n return false;\n }\n if (error) error->clear();\n return true;\n}\n\nbool PersistGuiDataDirSelection(const QString& path, QString* error)\n{\n const QString local_path = NormalizeLocalPath(path);\n if (!EnsureDataDir(local_path, error)) return false;\n\n QSettings settings;\n if (IsDefaultDataDir(local_path)) {\n settings.remove(SettingsKeys::DATA_DIR);\n } else {\n settings.setValue(SettingsKeys::DATA_DIR, local_path);\n }\n settings.setValue(RESET_GUI_SETTINGS_KEY, false);\n QmlLegacySettings::ClearLegacyGuiSettings(QString::fromStdString(Params().GetChainTypeString()));\n return true;\n}\n\nvoid PersistDefaultDataDirSelection()\n{\n QSettings settings;\n settings.remove(SettingsKeys::DATA_DIR);\n settings.setValue(RESET_GUI_SETTINGS_KEY, false);\n QmlLegacySettings::ClearLegacyGuiSettings(QString::fromStdString(Params().GetChainTypeString()));\n}\n\nbool HasExplicitDataDirArg(const ArgsManager& args)\n{\n return args.IsArgSet(\"-datadir\") && !args.GetPathArg(\"-datadir\").empty();\n}\n\nQString ValidateExplicitDataDir(const ArgsManager& args)\n{\n if (!HasExplicitDataDirArg(args)) return {};\n try {\n if (CheckDataDirOption(args)) return {};\n } catch (const std::exception& e) {\n return QString::fromStdString(e.what());\n }\n\n //: Startup error shown when a data directory explicitly supplied on the command line does not exist. %1 is the supplied path.\n return DataDirTr(\"Specified data directory \\\"%1\\\" does not exist.\")\n .arg(QString::fromStdString(args.GetArg(\"-datadir\", \"\")));\n}\n",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Conflicting network flags escape startup error handlingsrc/qml/bitcoin.cpp | still_present | AssessmentThe new-head startup still evaluates `gArgs.GetChainTypeString()` directly in the early `SetupChainQSettings()` call, without the reported error handling. new_source: src/qml/bitcoin.cpp [
{
"bounded": true,
"end_line": 311,
"evidence_id": "18083df180114135a9cd714d6e69102b",
"finding_id": "finding:6",
"kind": "new_source",
"line": 220,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/bitcoin.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": " SetupServerArgs(gArgs, init->canListenIpc());\n SetupQmlGuiArgs(gArgs);\n std::string error;\n if (!gArgs.ParseParameters(argc, argv, error)) {\n InitError(Untranslated(strprintf(\"Error parsing command line arguments: %s\", error)));\n return EXIT_FAILURE;\n }\n\n const auto test_automation_socket{gArgs.GetArg(\"-test-automation\")};\n if (test_automation_socket && test_automation_socket->empty()) {\n InitError(Untranslated(\"The -test-automation option requires a socket path.\"));\n return EXIT_FAILURE;\n }\n\n if (HelpRequested(gArgs) || gArgs.GetBoolArg(\"-version\", false)) {\n std::cout << init->exeName() << \" \" << FormatFullVersion() << \"\\n\";\n if (gArgs.GetBoolArg(\"-version\", false)) std::cout << FormatParagraph(LicenseInfo());\n else std::cout << \"\\n\" << gArgs.GetHelpMessage();\n return EXIT_SUCCESS;\n }\n for (int i = 1; i < argc; ++i) {\n if (!IsSwitchChar(argv[i][0])) {\n InitError(Untranslated(strprintf(\n \"Command line contains unexpected token '%s', see %s -h for a list of options.\",\n argv[i], init->exeName())));\n return EXIT_FAILURE;\n }\n }\n\n ApplyTestSettingsDir();\n SetupChainQSettings(app, QString::fromStdString(gArgs.GetChainTypeString()));\n const auto bootstrap_gui_settings{QmlOnboardingSettings::CurrentGuiSettingsStore()};\n\n LoadFontResource(QStringLiteral(\":/fonts/bitcoincoresans/regular\"));\n LoadFontResource(QStringLiteral(\":/fonts/bitcoincoresans/semibold\"));\n LoadFontResource(QStringLiteral(\":/fonts/robotomono/regular\"));\n\n app.installLanguage(TranslationManager::ResolveLanguage(gArgs));\n\n std::vector<std::string> command_line_args;\n command_line_args.reserve(argc);\n for (int i = 0; i < argc; ++i) command_line_args.emplace_back(argv[i]);\n\n PreInitOnboardingContext pre_init_context;\n const PreInitOnboardingStatus onboarding_status{RunPreInitOnboarding(\n pre_init_context, app.translations(), command_line_args, init->canListenIpc(), test_automation_socket)};\n if (onboarding_status == PreInitOnboardingStatus::CANCELED) return EXIT_SUCCESS;\n if (onboarding_status == PreInitOnboardingStatus::FAILED) return EXIT_FAILURE;\n\n std::optional<QmlOnboardingSettings::SettingsFileBackup> settings_file_backup;\n QString settings_file_backup_error;\n if (auto config_error{common::InitConfig(gArgs, [&](const bilingual_str& message, const std::vector<std::string>& details) {\n return ErrorSettingsRead(message, details, settings_file_backup, settings_file_backup_error);\n })}) {\n if (!settings_file_backup_error.isEmpty()) {\n InitError(Untranslated(settings_file_backup_error.toStdString()));\n } else if (config_error->status != common::ConfigStatus::ABORTED) {\n InitError(config_error->message, config_error->details);\n }\n return EXIT_FAILURE;\n }\n // The user may have selected a different profile while onboarding was open.\n if (test_automation_socket && gArgs.GetChainTypeString() != \"regtest\") {\n InitError(Untranslated(\"The -test-automation option is only available on regtest.\"));\n return EXIT_FAILURE;\n }\n SetupChainQSettings(app, QString::fromStdString(gArgs.GetChainTypeString()));\n QString finalize_error;\n if (!QmlOnboardingSettings::FinalizeStartupSettings(\n gArgs, bootstrap_gui_settings,\n pre_init_context.pending_apply ? &*pre_init_context.pending_apply : nullptr,\n nullptr, &finalize_error, settings_file_backup ? &*settings_file_backup : nullptr)) {\n InitError(Untranslated(finalize_error.toStdString()));\n return EXIT_FAILURE;\n }\n app.installLanguage(TranslationManager::ResolveLanguage(gArgs));\n app.parameterSetup();\n app.createNode(*init);\n if (!app.baseInitialize()) return EXIT_FAILURE;\n\n if (pre_init_context.window) app.setInitialWindowGeometry(pre_init_context.window->geometry());\n pre_init_context.close();\n if (!app.createWindow()) return EXIT_FAILURE;\n\n if (test_automation_socket &&\n !app.createTestBridge(QString::fromStdString(*test_automation_socket))) {\n return EXIT_FAILURE;\n }\n\n app.requestInitialize();\n return app.exec();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Block-clock history loading can abort when the chain shrinkssrc/qml/models/chainmodel.cpp | still_present | AssessmentThe new-head excerpt still captures the active-chain height and loops through `getBlockHash(height)`; there is no stable-tip ancestry traversal or fallible lookup. new_source: src/qml/models/chainmodel.cpp [
{
"bounded": true,
"end_line": 109,
"evidence_id": "41f574e708a4463c9498bbf2c902140d",
"finding_id": "finding:5",
"kind": "new_source",
"line": 53,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/models/chainmodel.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": "\n return current_timestamp - secs_since_meridian;\n}\n\nvoid ChainModel::setTimeRatioListInitial()\n{\n int time_at_meridian = timestampAtMeridian();\n m_time_ratio_list.clear();\n /* m_time_ratio_list[0] = current_time_ratio\n * m_time_ratio_list[1] = 0\n * These two positions remain fixed for these\n * values in m_time_ratio_list */\n m_time_ratio_list.push_back(double(QDateTime::currentSecsSinceEpoch() - time_at_meridian) / SECS_IN_12_HOURS);\n m_time_ratio_list.push_back(0);\n\n if (!m_chain.getHeight()) {\n Q_EMIT timeRatioListChanged();\n return;\n }\n\n int first_block_height;\n int active_chain_height = m_chain.getHeight().value();\n bool success = m_chain.findFirstBlockWithTimeAndHeight(/*min_time=*/time_at_meridian, /*min_height=*/0, interfaces::FoundBlock().height(first_block_height));\n\n if (!success) {\n Q_EMIT timeRatioListChanged();\n return;\n }\n\n for (int height = first_block_height; height < active_chain_height + 1; height++) {\n uint256 block_hash{m_chain.getBlockHash(height)};\n int64_t block_time;\n m_chain.findBlock(block_hash, FoundBlock().time(block_time));\n m_time_ratio_list.push_back(double(block_time - time_at_meridian) / SECS_IN_12_HOURS);\n }\n\n Q_EMIT timeRatioListChanged();\n}\n\nvoid ChainModel::setCurrentTimeRatio()\n{\n int secs_since_meridian = (QTime::currentTime().msecsSinceStartOfDay() / 1000) % SECS_IN_12_HOURS;\n double current_time_ratio = double(secs_since_meridian) / SECS_IN_12_HOURS;\n\n if (current_time_ratio < m_time_ratio_list[0].toDouble()) { // That means time has crossed a meridian\n m_time_ratio_list.clear();\n }\n\n if (m_time_ratio_list.isEmpty()) {\n m_time_ratio_list.push_back(current_time_ratio);\n m_time_ratio_list.push_back(0);\n } else {\n m_time_ratio_list[0] = current_time_ratio;\n }\n\n Q_EMIT timeRatioListChanged();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Deferred NAT-PMP changes can execute after shutdown beginssrc/qml/models/options_model.cpp | still_present | AssessmentThe new-head code still schedules an unconditional delayed `m_node.mapPort()` call and shows no cancellation, shutdown suppression, or serialization with shutdown. new_source: src/qml/models/options_model.cpp [
{
"bounded": true,
"end_line": 294,
"evidence_id": "9e79489f0beb49f99f9cdc7e80723728",
"finding_id": "finding:4",
"kind": "new_source",
"line": 145,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/models/options_model.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": " snapshot.storage = storageSettingsDirty();\n snapshot.developer = developerSettingsDirty();\n snapshot.mempool = mempoolSettingsDirty();\n snapshot.proxy = proxySettingsDirty();\n snapshot.restart = restartRequired();\n return snapshot;\n}\n\nvoid OptionsQmlModel::emitDirtySignals(const DirtySnapshot& before)\n{\n if (connectionSettingsDirty() != before.connection) Q_EMIT connectionSettingsDirtyChanged();\n if (storageSettingsDirty() != before.storage) Q_EMIT storageSettingsDirtyChanged();\n if (developerSettingsDirty() != before.developer) Q_EMIT developerSettingsDirtyChanged();\n if (mempoolSettingsDirty() != before.mempool) Q_EMIT mempoolSettingsDirtyChanged();\n if (proxySettingsDirty() != before.proxy) Q_EMIT proxySettingsDirtyChanged();\n if (restartRequired() != before.restart) Q_EMIT restartRequiredChanged();\n}\n\nvoid OptionsQmlModel::applyRuntimeCoreChange(const QmlCoreSettings::Change& change, const DirtySnapshot& before)\n{\n if (!change.accepted || !QmlCoreSettings::ValuesChanged(change)) return;\n m_core_settings.writeToNode(m_node, m_args, change.setting_name);\n refreshCoreSettingStatuses();\n QmlCoreSettings::EmitCoreSettingSignals(*this, change);\n if (change.setting_name == QStringLiteral(\"natpmp\")) {\n // NAT-PMP mirrors Qt Widgets as a live-applied option, not a\n // restart-required connection setting.\n // Disabling NAT-PMP joins the mapport thread and can briefly block.\n // Defer the live apply so the switch state and animation are not\n // held behind that work.\n QTimer::singleShot(200, this, [this, natpmp = change.after.natpmp] {\n m_node.mapPort(natpmp);\n });\n }\n emitDirtySignals(before);\n}\n\ncommon::SettingsValue OptionsQmlModel::currentCoreSettingValue(const QString& name) const\n{\n if (QmlCoreSettings::OnboardingCoreSettingNames().contains(name)) return m_core_settings.settingValue(name);\n if (name == QStringLiteral(\"dbcache\")) return m_dbcache_size_mib;\n if (name == QStringLiteral(\"par\")) return m_script_threads;\n if (name == QStringLiteral(\"maxmempool\")) return m_max_mempool_size_mb;\n return {};\n}\n\nbool OptionsQmlModel::canEditCoreSetting(const QString& name) const\n{\n if (QmlCoreSettings::OnboardingCoreSettingNames().contains(name)) return m_core_settings.canEdit(name);\n const QVariantMap status = coreSettingStatus(name);\n return status.isEmpty() ? QmlCoreSettings::CanEditCoreSetting(m_args, name) : status.value(QStringLiteral(\"canEdit\"), true).toBool();\n}\n\nbool OptionsQmlModel::writeCoreSettingOverride(const QString& name, const common::SettingsValue& value)\n{\n if (!canEditCoreSetting(name)) return false;\n QmlCoreSettings::UpdateRwSetting(m_node, name, QmlCoreSettings::GuiOverrideValue(m_args, name, value));\n refreshCoreSettingStatuses();\n return true;\n}\n\nvoid OptionsQmlModel::refreshCoreSettingStatuses()\n{\n const QVariantMap statuses = QmlCoreSettings::BuildCoreSettingStatuses(m_args, QmlCoreSettings::CoreSettingNames());\n if (statuses == m_core_setting_statuses) return;\n m_core_setting_statuses = statuses;\n m_core_settings.setStatuses(CoreSettingStatusesForNames(m_core_setting_statuses, QmlCoreSettings::OnboardingCoreSettingNames()));\n Q_EMIT coreSettingStatusesChanged();\n}\n\nvoid OptionsQmlModel::setDbcacheSizeMiB(int new_dbcache_size_mib)\n{\n if (!canEditCoreSetting(QStringLiteral(\"dbcache\"))) return;\n if (new_dbcache_size_mib != m_dbcache_size_mib) {\n const DirtySnapshot before = dirtySnapshot();\n m_dbcache_size_mib = new_dbcache_size_mib;\n writeCoreSettingOverride(QStringLiteral(\"dbcache\"), currentCoreSettingValue(QStringLiteral(\"dbcache\")));\n Q_EMIT dbcacheSizeMiBChanged(new_dbcache_size_mib);\n emitDirtySignals(before);\n }\n}\n\nvoid OptionsQmlModel::setListen(bool new_listen)\n{\n m_core_settings.changeListen(new_listen);\n}\n\nvoid OptionsQmlModel::setMaxMempoolSizeMB(int new_max_mempool_size_mb)\n{\n if (!canEditCoreSetting(QStringLiteral(\"maxmempool\"))) return;\n if (new_max_mempool_size_mb != m_max_mempool_size_mb) {\n const DirtySnapshot before = dirtySnapshot();\n m_max_mempool_size_mb = new_max_mempool_size_mb;\n writeCoreSettingOverride(QStringLiteral(\"maxmempool\"), currentCoreSettingValue(QStringLiteral(\"maxmempool\")));\n Q_EMIT maxMempoolSizeMBChanged(new_max_mempool_size_mb);\n emitDirtySignals(before);\n }\n}\n\nvoid OptionsQmlModel::setNatpmp(bool new_natpmp)\n{\n m_core_settings.changeNatpmp(new_natpmp);\n}\n\nvoid OptionsQmlModel::setPrune(bool new_prune)\n{\n m_core_settings.changePrune(new_prune);\n}\n\nvoid OptionsQmlModel::setPruneSizeGB(int new_prune_size_gb)\n{\n m_core_settings.changePruneSizeGB(new_prune_size_gb);\n}\n\nvoid OptionsQmlModel::setScriptThreads(int new_script_threads)\n{\n if (!canEditCoreSetting(QStringLiteral(\"par\"))) return;\n if (new_script_threads != m_script_threads) {\n const DirtySnapshot before = dirtySnapshot();\n m_script_threads = new_script_threads;\n writeCoreSettingOverride(QStringLiteral(\"par\"), currentCoreSettingValue(QStringLiteral(\"par\")));\n Q_EMIT scriptThreadsChanged(new_script_threads);\n emitDirtySignals(before);\n }\n}\n\nvoid OptionsQmlModel::setServer(bool new_server)\n{\n m_core_settings.changeServer(new_server);\n}\n\nvoid OptionsQmlModel::setProxyEnabled(bool enabled)\n{\n m_core_settings.changeProxyEnabled(enabled);\n}\n\nvoid OptionsQmlModel::setProxyAddress(const QString& address)\n{\n commitProxyLocation(address);\n}\n\nvoid OptionsQmlModel::setTorEnabled(bool enabled)\n{\n m_core_settings.changeTorEnabled(enabled);\n}\n\nvoid OptionsQmlModel::setTorAddress(const QString& address)\n{\n commitTorLocation(address);\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Onboarding commits settings.json before checking the directory locksrc/qml/bitcoin.cpp | still_present | AssessmentThe new-head startup sequence still calls `FinalizeStartupSettings()` before `app.baseInitialize()`, where the directory lock is acquired; the diff does not alter this ordering. new_source: src/qml/bitcoin.cpp [
{
"bounded": true,
"end_line": 311,
"evidence_id": "833230741b9a4a2995bd88715ae8ebe3",
"finding_id": "finding:3",
"kind": "new_source",
"line": 258,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/bitcoin.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": "\n std::vector<std::string> command_line_args;\n command_line_args.reserve(argc);\n for (int i = 0; i < argc; ++i) command_line_args.emplace_back(argv[i]);\n\n PreInitOnboardingContext pre_init_context;\n const PreInitOnboardingStatus onboarding_status{RunPreInitOnboarding(\n pre_init_context, app.translations(), command_line_args, init->canListenIpc(), test_automation_socket)};\n if (onboarding_status == PreInitOnboardingStatus::CANCELED) return EXIT_SUCCESS;\n if (onboarding_status == PreInitOnboardingStatus::FAILED) return EXIT_FAILURE;\n\n std::optional<QmlOnboardingSettings::SettingsFileBackup> settings_file_backup;\n QString settings_file_backup_error;\n if (auto config_error{common::InitConfig(gArgs, [&](const bilingual_str& message, const std::vector<std::string>& details) {\n return ErrorSettingsRead(message, details, settings_file_backup, settings_file_backup_error);\n })}) {\n if (!settings_file_backup_error.isEmpty()) {\n InitError(Untranslated(settings_file_backup_error.toStdString()));\n } else if (config_error->status != common::ConfigStatus::ABORTED) {\n InitError(config_error->message, config_error->details);\n }\n return EXIT_FAILURE;\n }\n // The user may have selected a different profile while onboarding was open.\n if (test_automation_socket && gArgs.GetChainTypeString() != \"regtest\") {\n InitError(Untranslated(\"The -test-automation option is only available on regtest.\"));\n return EXIT_FAILURE;\n }\n SetupChainQSettings(app, QString::fromStdString(gArgs.GetChainTypeString()));\n QString finalize_error;\n if (!QmlOnboardingSettings::FinalizeStartupSettings(\n gArgs, bootstrap_gui_settings,\n pre_init_context.pending_apply ? &*pre_init_context.pending_apply : nullptr,\n nullptr, &finalize_error, settings_file_backup ? &*settings_file_backup : nullptr)) {\n InitError(Untranslated(finalize_error.toStdString()));\n return EXIT_FAILURE;\n }\n app.installLanguage(TranslationManager::ResolveLanguage(gArgs));\n app.parameterSetup();\n app.createNode(*init);\n if (!app.baseInitialize()) return EXIT_FAILURE;\n\n if (pre_init_context.window) app.setInitialWindowGeometry(pre_init_context.window->geometry());\n pre_init_context.close();\n if (!app.createWindow()) return EXIT_FAILURE;\n\n if (test_automation_socket &&\n !app.createTestBridge(QString::fromStdString(*test_automation_socket))) {\n return EXIT_FAILURE;\n }\n\n app.requestInitialize();\n return app.exec();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Build guides still associate BUILD_GUI with Widgets QR supportCMakeLists.txt | unclear | AssessmentThe follow-up assessment was invalid: definitive assessments require current evidence and a reason. invalid_assessment Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Removing legacy strDataDir loses the Widgets directory selectionsrc/qml/legacy_settings_migration.cpp | still_present | AssessmentThe new-head migration code still removes the legacy data-directory key for `DataDirAndReset`, with no preservation marker or documented compatibility change in the supplied evidence. new_source: src/qml/legacy_settings_migration.cpp [
{
"bounded": true,
"end_line": 633,
"evidence_id": "baf0cdb4b362451d9c355dae02c000b5",
"finding_id": "finding:11",
"kind": "new_source",
"line": 484,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/legacy_settings_migration.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": " const qlonglong dbcache = value.toLongLong();\n return IntValue(settings_version < 130000 && dbcache == 100 ? node::GetDefaultDBCache() >> 20 : dbcache);\n });\n changed |= MigrateSimpleSetting(args, settings, mode, QStringLiteral(\"nThreadsScriptVerif\"), QStringLiteral(\"par\"), [](const QVariant& value) {\n return IntValue(value.toLongLong());\n });\n changed |= MigrateSimpleSetting(args, settings, mode, QStringLiteral(\"fUseNatpmp\"), QStringLiteral(\"natpmp\"), [](const QVariant& value) {\n return BoolValue(value.toBool());\n });\n changed |= MigrateSimpleSetting(args, settings, mode, QStringLiteral(\"fListen\"), QStringLiteral(\"listen\"), [](const QVariant& value) {\n return BoolValue(value.toBool());\n });\n changed |= MigrateSimpleSetting(args, settings, mode, QStringLiteral(\"server\"), QStringLiteral(\"server\"), [](const QVariant& value) {\n return BoolValue(value.toBool());\n });\n changed |= MigratePruneSettings(args, settings, mode);\n changed |= MigrateProxySettings(args, settings, mode, QStringLiteral(\"addrProxy\"), QStringLiteral(\"fUseProxy\"), QStringLiteral(\"proxy\"));\n changed |= MigrateProxySettings(args, settings, mode, QStringLiteral(\"addrSeparateProxyTor\"), QStringLiteral(\"fUseSeparateProxyTor\"), QStringLiteral(\"onion\"));\n if (include_language) {\n changed |= MigrateSimpleSetting(args, settings, mode, QStringLiteral(\"language\"), QStringLiteral(\"lang\"), [](const QVariant& value) {\n return StringValue(value.toString());\n });\n }\n\n return changed;\n}\n\nvoid ApplyGuiCleanup(QSettings& settings, QmlLegacySettings::GuiCleanup cleanup)\n{\n if (cleanup == QmlLegacySettings::GuiCleanup::DataDirAndReset) {\n settings.remove(SettingsKeys::DATA_DIR);\n }\n if (cleanup != QmlLegacySettings::GuiCleanup::None) {\n settings.remove(QString::fromUtf8(RESET_GUI_SETTINGS_KEY));\n }\n}\n} // namespace\n\nnamespace QmlLegacySettings {\n\nQString ReadLegacyGuiDataDir()\n{\n const std::unique_ptr<QSettings> settings = OpenLegacyDataDirSettings();\n return settings->value(SettingsKeys::DATA_DIR).toString();\n}\n\nbool ReadLegacyGuiReset()\n{\n const std::unique_ptr<QSettings> settings = OpenLegacyDataDirSettings();\n return settings->value(QString::fromUtf8(RESET_GUI_SETTINGS_KEY), false).toBool();\n}\n\nint ReadLegacyGuiDisplayUnit(const QString& chain, int fallback)\n{\n RegisterLegacyBitcoinUnitMetaType();\n const std::unique_ptr<QSettings> settings = OpenSettings(QString::fromUtf8(QT_ORG_NAME), AppNameForChain(chain, /*legacy_qt=*/true));\n if (!settings->contains(SettingsKeys::DISPLAY_UNIT)) {\n return fallback;\n }\n\n bool ok{false};\n const int display_unit = settings->value(SettingsKeys::DISPLAY_UNIT).toInt(&ok);\n if (!ok || display_unit < 0 || display_unit > 3) {\n return fallback;\n }\n return display_unit;\n}\n\nQString ReadLegacyGuiLanguage(const QString& chain)\n{\n const std::unique_ptr<QSettings> chain_settings = OpenSettings(QString::fromUtf8(QT_ORG_NAME), AppNameForChain(chain, /*legacy_qt=*/true));\n QString chain_language = chain_settings->value(SettingsKeys::LANGUAGE).toString();\n if (!chain_language.isEmpty()) {\n return chain_language;\n }\n const std::unique_ptr<QSettings> default_settings = OpenSettings(QString::fromUtf8(QT_ORG_NAME), QString::fromUtf8(QT_APP_NAME_DEFAULT));\n return default_settings->value(SettingsKeys::LANGUAGE).toString();\n}\n\nQString ReadGuiLanguage(const QString& chain)\n{\n const auto settings = OpenSettings(QStringLiteral(QAPP_ORG_NAME), AppNameForChain(chain, /*legacy_qt=*/false));\n return settings->value(SettingsKeys::LANGUAGE, ReadLegacyGuiLanguage(chain)).toString();\n}\n\nbool ClearLegacyGuiSettings(const QString& chain, QString* error)\n{\n std::vector<SettingsStore> stores{CoreSettingsStores(chain)};\n const size_t core_store_count{stores.size()};\n SettingsStore& data_dir_store{LegacyDataDirStore(stores)};\n const std::vector<QVariantMap> snapshots{SnapshotStores(stores)};\n\n for (size_t i = 0; i < core_store_count; ++i) {\n SettingsStore& store{stores[i]};\n for (const QString& key : LegacyCoreKeys(store.legacy_qt)) {\n store.settings->remove(key);\n }\n store.settings->remove(SettingsKeys::DISPLAY_UNIT);\n }\n ApplyGuiCleanup(*data_dir_store.settings, GuiCleanup::DataDirAndReset);\n MarkChangedStores(stores, snapshots);\n\n //: Name of the operation that removes obsolete GUI settings during startup.\n const QString cleanup_action{QObject::tr(\"Legacy GUI settings cleanup\")};\n return CommitStores(stores, snapshots, cleanup_action, error);\n}\n\nMigrationResult MigrateCoreSettings(ArgsManager& args, MigrationMode mode, GuiCleanup cleanup)\n{\n MigrationResult result;\n const bool settings_enabled{args.GetSettingsPath()};\n if (!settings_enabled && (mode == MigrationMode::Preview || cleanup == GuiCleanup::None)) {\n return result;\n }\n\n std::vector<SettingsStore> stores;\n if (settings_enabled) {\n stores = CoreSettingsStores(QString::fromStdString(args.GetChainTypeString()));\n }\n const size_t core_store_count{stores.size()};\n SettingsStore* data_dir_store{nullptr};\n if (mode == MigrationMode::Persist && cleanup != GuiCleanup::None) {\n data_dir_store = &LegacyDataDirStore(stores);\n }\n\n std::vector<QVariantMap> snapshots;\n std::map<std::string, common::SettingsValue> original_rw_settings;\n if (mode == MigrationMode::Persist) {\n snapshots = SnapshotStores(stores);\n original_rw_settings = SnapshotRwSettings(args);\n }\n\n try {\n for (size_t i = 0; i < core_store_count; ++i) {\n result.settings_changed |= MigrateStore(args, stores[i], mode);\n }\n if (data_dir_store) {\n ApplyGuiCleanup(*data_dir_store->settings, cleanup);\n }\n if (mode == MigrationMode::Persist) {\n MarkChangedStores(stores, snapshots);\n }\n if (mode == MigrationMode::Persist) {\n //: Name of the operation that moves settings from older Bitcoin GUI versions during startup.\n const QString migration_action{QObject::tr(\"Legacy GUI settings migration\")};\n if (!CommitStores(stores, snapshots, migration_action, &result.error)) {\n RestoreRwSettings(args, original_rw_settings);\n }\n }\n } catch (const std::exception& e) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | -min is accepted but ignored by the QML windowsrc/qml/guiargs.cpp | still_present | AssessmentThe new-head `SetupQmlGuiArgs()` still only registers `-min`; the supplied excerpt shows no startup handling, and the cited startup-path behavior is not changed in the diff. new_source: src/qml/guiargs.cpp [
{
"bounded": true,
"end_line": 18,
"evidence_id": "29c6cf41801d4f89808ac9ab1e177750",
"finding_id": "finding:10",
"kind": "new_source",
"line": 1,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/guiargs.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/guiargs.h>\n\n#include <common/args.h>\n\nvoid SetupQmlGuiArgs(ArgsManager& argsman)\n{\n argsman.AddArg(\"-choosedatadir\", \"Choose data directory on startup (default: 0)\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n argsman.AddArg(\"-lang=<lang>\", \"Set language, for example \\\"de_DE\\\" (default: system locale)\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n argsman.AddArg(\"-min\", \"Start minimized\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n argsman.AddArg(\"-resetguisettings\", \"Reset all settings changed in the GUI\", ArgsManager::ALLOW_ANY, OptionsCategory::GUI);\n argsman.AddHiddenArgs({\"-qml_onboarded\"});\n argsman.AddArg(\"-test-automation=<path>\", \"Enable the GUI test automation bridge at the given local socket path\", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION | ArgsManager::DISALLOW_ELISION | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI);\n argsman.AddArg(\"-test-settings-dir=<dir>\", \"Store QSettings in this directory while GUI test automation is enabled\", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION | ArgsManager::DISALLOW_ELISION | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI);\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1145 | Onboarding carries edits into a different data-directory profilesrc/qml/models/onboardingoptionsmodel.cpp | still_present | AssessmentThe supplied new-head excerpt shows `setDataDir()` still calls `refreshPreview()` without resetting or scoping touched settings; the relevant implementation remains unchanged. new_source: src/qml/models/onboardingoptionsmodel.cpp [
{
"bounded": true,
"end_line": 241,
"evidence_id": "7dc95cb801174289afca5ea8dcbff3fa",
"finding_id": "finding:1",
"kind": "new_source",
"line": 92,
"new_head": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"old_head": "699f494cad0a39de81a53a882fa88495f60f5f74",
"path": "src/qml/models/onboardingoptionsmodel.cpp",
"revision": "934b8fffb78e197a61b291e48ebc79f3c03072f4",
"source_generation": 7,
"source_job_id": 3005,
"text": " m_data_dir_source = QmlOnboardingSettings::DataDirSource::UserSelection;\n if (source_changed && local_path == m_data_dir) {\n refreshPreview();\n return true;\n }\n setDataDir(local_path);\n return true;\n}\n\nvoid OnboardingOptionsModel::useDefaultDataDir()\n{\n if (!m_custom_datadir_string.isEmpty()) {\n m_custom_datadir_string.clear();\n Q_EMIT customDataDirStringChanged({});\n }\n const QString default_data_dir = getDefaultDataDirString();\n const bool source_changed = m_data_dir_source != QmlOnboardingSettings::DataDirSource::UserSelection;\n m_data_dir_source = QmlOnboardingSettings::DataDirSource::UserSelection;\n if (source_changed && default_data_dir == m_data_dir) {\n refreshPreview();\n return;\n }\n setDataDir(default_data_dir);\n}\n\nvoid OnboardingOptionsModel::setDataDir(const QString& path)\n{\n const QString normalized = QmlDataDir::NormalizeLocalPath(path);\n const QString effective = normalized.isEmpty() ? getDefaultDataDirString() : normalized;\n if (effective == m_data_dir) return;\n m_data_dir = effective;\n Q_EMIT dataDirChanged(m_data_dir);\n refreshPreview();\n}\n\nvoid OnboardingOptionsModel::setPrune(bool prune)\n{\n m_core_settings.changePrune(prune);\n}\n\nvoid OnboardingOptionsModel::setPruneSizeGB(int prune_size_gb)\n{\n m_core_settings.changePruneSizeGB(prune_size_gb);\n}\n\nvoid OnboardingOptionsModel::setListen(bool listen)\n{\n m_core_settings.changeListen(listen);\n}\n\nvoid OnboardingOptionsModel::setNatpmp(bool natpmp)\n{\n m_core_settings.changeNatpmp(natpmp);\n}\n\nvoid OnboardingOptionsModel::setServer(bool server)\n{\n m_core_settings.changeServer(server);\n}\n\nvoid OnboardingOptionsModel::setProxyEnabled(bool enabled)\n{\n m_core_settings.changeProxyEnabled(enabled);\n}\n\nvoid OnboardingOptionsModel::setProxyAddress(const QString& address)\n{\n commitProxyLocation(address);\n}\n\nvoid OnboardingOptionsModel::setTorEnabled(bool enabled)\n{\n m_core_settings.changeTorEnabled(enabled);\n}\n\nvoid OnboardingOptionsModel::setTorAddress(const QString& address)\n{\n commitTorLocation(address);\n}\n\nQString OnboardingOptionsModel::validateProxyLocation(const QString& location) const\n{\n return m_core_settings.validateProxyLocation(location);\n}\n\nbool OnboardingOptionsModel::commitProxyLocation(const QString& location)\n{\n const QmlCoreSettings::Change change = m_core_settings.changeProxyLocation(location);\n return change.accepted;\n}\n\nbool OnboardingOptionsModel::commitTorLocation(const QString& location)\n{\n const QmlCoreSettings::Change change = m_core_settings.changeTorLocation(location);\n return change.accepted;\n}\n\nQString OnboardingOptionsModel::defaultProxyAddress() const\n{\n return m_core_settings.defaultProxyAddress();\n}\n\nQString OnboardingOptionsModel::storageStatus() const\n{\n return storageInfo().status;\n}\n\nint OnboardingOptionsModel::storageAvailableGB() const\n{\n return storageInfo().available_gb;\n}\n\nQString OnboardingOptionsModel::storageAvailableText() const\n{\n return storageInfo().available_text;\n}\n\nQString OnboardingOptionsModel::storageWarningText() const\n{\n return storageInfo().warning_text;\n}\n\nint OnboardingOptionsModel::storageMinimumRequiredGB() const\n{\n return storageInfo().minimum_required_gb;\n}\n\nint OnboardingOptionsModel::fullStorageRequiredGB() const\n{\n return storageInfo().full_required_gb;\n}\n\nint OnboardingOptionsModel::prunedStorageRequiredGB() const\n{\n return storageInfo().pruned_required_gb;\n}\n\nint OnboardingOptionsModel::selectedStorageRequiredGB() const\n{\n return storageInfo().selected_required_gb;\n}\n\nbool OnboardingOptionsModel::storageEnoughForSelected() const\n{\n return storageInfo().enough_for_selected;\n}\n\nbool OnboardingOptionsModel::storageEnoughForFull() const\n{\n return storageInfo().enough_for_full;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 699f494cad0a..934b8fffb78e 2026-11-23T22:26:22Z · gpt-6-luna |
| gui#1146 | Unused label aliases contradict their documented contractsqml/models/walletqmlmodel.cpp | still_present | AssessmentThe new-head excerpt still defines writeAddressBookLabel() as an alias for setAddressLabel() and syncPaymentRequestNoteToAddress() as another call to setAddressLabel(); neither misleading entry point was removed. new_source: qml/models/walletqmlmodel.cpp [
{
"bounded": true,
"end_line": 1629,
"evidence_id": "46fd1dc1e0714800ba61c9914283aa06",
"finding_id": "finding:2",
"kind": "new_source",
"line": 1480,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "948fb9be347a6c983ec0eb68ca36157884787b88",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 2,
"source_job_id": 3002,
"text": " if (!entry) return;\n const CTxDestination destination = DecodeDestination(entry->recipient.address);\n\n // A repeated request starts with a fresh receiving address, allocated by\n // the Receive page (including its normal wallet-unlock flow).\n m_receiving_address->clear();\n ReceiveCommand command;\n command.kind = ReceiveCommand::Kind::RememberAddress;\n submitReceiveCommand(std::move(command), QStringLiteral(\"rememberAddress\"));\n m_current_payment_request->clear();\n m_current_payment_request->setLabel(QString::fromStdString(entry->recipient.label));\n m_current_payment_request->setMessage(QString::fromStdString(entry->recipient.message));\n m_current_payment_request->setNoteSelf(QString::fromStdString(entry->recipient.noteSelf));\n m_current_payment_request->amount()->setSatoshi(entry->recipient.amount);\n m_current_payment_request->setAddressType(OutputTypeIdFromDestination(destination));\n\n // Toggle isEditing to re-trigger QML input sync with populated values\n m_current_payment_request->setIsEditing(false);\n m_current_payment_request->setIsEditing(true);\n}\n\nunsigned int WalletQmlModel::nextPaymentRequestId() const\n{\n if (!m_receive_requests) return 1;\n const int64_t max_id = m_receive_requests->maxId();\n if (max_id <= 0 || max_id >= std::numeric_limits<unsigned int>::max() - 1) return 1;\n return static_cast<unsigned int>(max_id + 1);\n}\n\nQString WalletQmlModel::getAddressLabel(const QString& address) const\n{\n const auto found = m_wallet_state.labels.find(address);\n return found == m_wallet_state.labels.end() ? QString{} : found->second;\n}\n\nbool WalletQmlModel::setAddressLabel(const QString& address, const QString& label)\n{\n ReceiveCommand command;\n command.kind = ReceiveCommand::Kind::Label;\n command.address = address;\n command.label = label;\n return submitReceiveCommand(std::move(command), QStringLiteral(\"label\"));\n}\n\nbool WalletQmlModel::writeAddressBookLabel(const QString& address, const QString& label)\n{\n return setAddressLabel(address, label);\n}\n\nvoid WalletQmlModel::syncPaymentRequestNoteToAddress(const QString& address, const QString& label)\n{\n setAddressLabel(address, label);\n}\n\nstd::vector<interfaces::WalletAddress> WalletQmlModel::getAddresses() const\n{\n return m_wallet_state.addresses;\n}\n\nstd::map<QString, CAmount> WalletQmlModel::addressBalances() const\n{\n return m_wallet_state.address_balances;\n}\n\nstd::set<QString> WalletQmlModel::usedAddresses() const\n{\n return m_wallet_state.used_addresses;\n}\n\nstd::set<QString> WalletQmlModel::changeAddresses() const\n{\n return m_wallet_state.change_addresses;\n}\n\nvoid WalletQmlModel::scheduleFeeEstimates()\n{\n if (m_updating_maximum || m_fee_estimation_timer == nullptr) {\n return;\n }\n m_fee_estimation_timer->stop();\n\n // Until a destination is entered, show the gross remainder. A valid\n // address enables the sendall preview, which replaces it with the net amount.\n if (m_wallet && m_maximum_recipient && m_maximum_recipient->address()->address().isEmpty() && !sendBalancePending()) {\n CAmount remainder = sendAvailableBalance();\n for (const auto* recipient : m_send_recipients->recipients()) {\n if (recipient != m_maximum_recipient) remainder -= recipient->cAmount();\n }\n QScopedValueRollback<bool> updating{m_updating_maximum, true};\n m_maximum_recipient->amount()->setSatoshi(std::max(CAmount{0}, remainder));\n }\n\n if (!m_wallet || !m_send_recipients || !BuildRecipients(*m_send_recipients, m_maximum_recipient).has_value()) {\n clearFeeEstimates();\n return;\n }\n\n ++m_fee_estimate_request_id;\n\n bool estimates_changed{!m_fee_estimates.isEmpty()};\n bool custom_estimate_changed{m_custom_fee_estimate.has_value()};\n if (estimates_changed) {\n m_fee_estimates.clear();\n }\n if (custom_estimate_changed) {\n m_custom_fee_estimate.reset();\n }\n if (estimates_changed || custom_estimate_changed) {\n Q_EMIT estimatedFeeChanged();\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n\n bool pending_changed{!m_fee_estimate_pending};\n if (pending_changed) {\n m_fee_estimate_pending = true;\n Q_EMIT feeEstimatePendingChanged();\n }\n\n if (estimates_changed || custom_estimate_changed || pending_changed) {\n ++m_fee_estimate_revision;\n Q_EMIT feeEstimateRevisionChanged();\n }\n\n m_fee_estimation_timer->start();\n}\n\nvoid WalletQmlModel::requestFeeEstimatesNow()\n{\n if (!m_wallet || !m_send_recipients) {\n clearFeeEstimates();\n return;\n }\n\n const auto recipients = BuildRecipients(*m_send_recipients, m_maximum_recipient);\n if (!recipients.has_value()) {\n clearFeeEstimates();\n return;\n }\n\n const int remainder_index = m_send_recipients->recipients().indexOf(m_maximum_recipient);\n const quint64 request_id = ++m_fee_estimate_request_id;\n const wallet::CCoinControl base_coin_control{m_coin_control};\n const OutputType preview_change_type{base_coin_control.m_change_type.value_or(m_wallet->getDefaultAddressType())};\n const bool custom_fee_enabled{m_custom_fee_enabled};\n const std::optional<CAmount> custom_fee_rate_per_kvb{\n ParseCustomFeeRatePerKvB(m_custom_fee_rate, MinimumCustomFeeRatePerKvB(m_wallet.get()))};\n const auto wallet = m_wallet;\n\n if (!m_fee_estimate_pending) {\n m_fee_estimate_pending = true;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 948fb9be347a..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Password changes can race temporary unlocks and leave the wallet unlockedqml/models/signverifymessagemodel.cpp | unclear | AssessmentThe follow-up assessment was invalid: follow-up evidence belongs to another finding or comparison. invalid_assessment Source report · 948fb9be347a..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1142 | The lifetime-guard commit also changes password-prompt behaviorqml/controls/AlertPopup.qml | unclear | AssessmentThe source excerpts show the error-dismissal and bound-prompt behavior, but the finding concerns whether those changes were separated and accurately described in commit messages. No relevant commit descriptions or history are supplied. new_source: qml/controls/AlertPopup.qml [
{
"bounded": true,
"end_line": 158,
"evidence_id": "d9ec1c6326184514b0c607666e7dc121",
"finding_id": "finding:5",
"kind": "new_source",
"line": 9,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "bc79778bb5661ea6fee9ae084801919772328532",
"path": "qml/controls/AlertPopup.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 15,
"source_job_id": 2992,
"text": "\nDialogPopup {\n id: root\n\n enum Tone {\n Default,\n Success,\n Warning,\n Error\n }\n\n property string titleObjectName: \"alertTitle\"\n property string message: \"\"\n property string messageObjectName: \"alertMessage\"\n property int messageTextFormat: Text.PlainText\n property int messageWrapMode: Text.WordWrap\n property int messageAlignment: Text.AlignHCenter\n property int tone: AlertPopup.Default\n // Success shows a check on a filled badge; other tones tint the icon.\n property url iconSource: tone === AlertPopup.Success ? \"qrc:/icons/check.svg\" : \"\"\n readonly property color toneColor: tone === AlertPopup.Success ? Theme.color.success\n : tone === AlertPopup.Warning ? Theme.color.warning\n : tone === AlertPopup.Error ? Theme.color.danger\n : Theme.color.neutral9\n property string errorText: \"\"\n property string errorTextObjectName: \"alertErrorText\"\n property var errorDetailsModel: null\n property bool showErrorDetails: false\n // Hides the error once the user has answered it, such as by editing the\n // field it is about. A new error shows again.\n property bool errorDismissed: false\n readonly property string shownErrorText: errorDismissed ? \"\" : errorText\n onErrorTextChanged: {\n showErrorDetails = false\n errorDismissed = false\n }\n // Extra controls between the message and the actions, such as a field.\n property alias content: contentColumn.data\n default property alias actions: actionStore.data\n // Replaces the declared actions, for actions built from data.\n property var actionList: null\n // Answered by Escape; defaults to the first Cancel or Neutral action.\n property AlertAction escapeAction: null\n // Answered by Return outside a button; defaults to the only Normal action,\n // so Return never confirms a destructive action.\n property AlertAction returnAction: null\n // Bind to show the alert from state, such as a controller's prompt:\n // shown: review.prompt === TransactionReviewController.Password\n // A bound alert opens and closes only with this property. Where it would\n // close itself (an action that closes it, Escape) it emits\n // closeRequested() instead; the owner answers and its state closes it.\n property var shown: undefined\n readonly property bool bound: shown !== undefined\n signal closeRequested()\n\n property var visibleActions: [defaultAction]\n readonly property real minimumActionWidth: {\n let width = 0\n for (let i = 0; i < visibleActions.length; ++i) {\n width = Math.max(width, Math.ceil(actionFontMetrics.advanceWidth(visibleActions[i].text)) + 40)\n }\n return width\n }\n readonly property real horizontalActionsWidth: minimumActionWidth * visibleActions.length\n + 10 * Math.max(0, visibleActions.length - 1)\n\n property FontMetrics actionMetrics: FontMetrics {\n id: actionFontMetrics\n font: Theme.text.buttonStrong.font\n }\n\n // Escape runs cancel() instead, which answers with the cancel action.\n closePolicy: Popup.NoAutoClose\n closesOnPressOutside: false\n surfaceObjectName: \"alertPopupSurface\"\n padding: 0\n horizontalPadding: 0\n implicitWidth: Math.max(360, horizontalActionsWidth + 40)\n implicitHeight: columnLayout.implicitHeight\n\n property Item actionStoreItem: Item {\n id: actionStore\n visible: false\n }\n property AlertAction defaultAction: AlertAction { text: qsTr(\"OK\") }\n\n function refreshActions() {\n if (actionList && actionList.length > 0) {\n visibleActions = actionList\n } else {\n // Children that aren't actions (such as Connections) also land here.\n const declared = []\n for (let i = 0; i < actionStore.data.length; ++i) {\n if (actionStore.data[i].closesPopup !== undefined) declared.push(actionStore.data[i])\n }\n visibleActions = declared.length > 0 ? declared : [defaultAction]\n }\n }\n\n function followShown() {\n if (!bound) return\n if (shown) {\n if (!visible) open()\n } else if (visible) {\n close()\n }\n }\n\n function requestClose() {\n if (bound) closeRequested()\n else close()\n }\n\n function trigger(action) {\n if (!action.enabled) return\n if (action.closesPopup) requestClose()\n action.triggered()\n // A disabled action can leave focus on the popup shell, outside the\n // content's key handlers. Keep Escape and Return inside the content.\n if (opened && !action.enabled && popupItem && popupItem.activeFocus) contentItem.forceActiveFocus(Qt.PopupFocusReason)\n }\n\n function focusAction(action, reason) {\n const index = visibleActions.indexOf(action)\n const delegate = index >= 0 ? actionRepeater.itemAt(index) : null\n if (delegate) delegate.button.forceActiveFocus(reason === undefined ? Qt.OtherFocusReason : reason) // qmllint disable missing-property\n }\n\n function cancelAction() {\n if (escapeAction) return escapeAction\n for (let i = 0; i < visibleActions.length; ++i) {\n const action = visibleActions[i]\n if (action.role === AlertAction.Cancel || action.role === AlertAction.Neutral) {\n return action\n }\n }\n return null\n }\n\n function acceptAction() {\n if (returnAction) return returnAction\n let found = null\n for (let i = 0; i < visibleActions.length; ++i) {\n if (visibleActions[i].role !== AlertAction.Normal) continue\n if (found) return null\n found = visibleActions[i]\n }\n return found\n }\n",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bc79778bb566..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The fee and signer helper commits describe enforcement added laterqml/models/psbtfee.cpp | unclear | AssessmentThe new-head helper source is unchanged in the supplied evidence, but the finding concerns commit descriptions and issue attribution. No relevant commit messages or history are supplied to judge whether those were amended. new_source: qml/models/psbtfee.cpp [
{
"bounded": true,
"end_line": 100,
"evidence_id": "bd8163835b1d4ec3aa71f55e9e4f0369",
"finding_id": "finding:4",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "bc79778bb5661ea6fee9ae084801919772328532",
"path": "qml/models/psbtfee.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 15,
"source_job_id": 2992,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/models/psbtfee.h>\n\n#include <set>\n\nnamespace {\nbool AddAmount(CAmount& total, CAmount value)\n{\n if (!MoneyRange(value) || value > MAX_MONEY - total) return false;\n total += value;\n return true;\n}\n}\n\npsbtfee::Analysis psbtfee::Analyze(const PartiallySignedTransaction& psbt, const Outputs& verified)\n{\n Analysis result;\n const auto tx = psbt.GetUnsignedTx();\n if (!tx || tx->vin.empty() || tx->vout.empty()) return result;\n result.commitment = tx->GetHash();\n for (const auto& output : tx->vout) {\n if (!AddAmount(result.output_total, output.nValue)) return result;\n }\n result.outputs_valid = true;\n CAmount input_total{0};\n bool missing{false};\n std::set<COutPoint> seen;\n for (const auto& input : psbt.inputs) {\n const auto outpoint = input.GetOutPoint();\n if (!seen.insert(outpoint).second) return result;\n if (!input.witness_utxo.IsNull() && !MoneyRange(input.witness_utxo.nValue)) return result;\n const auto trusted = verified.find(outpoint);\n std::optional<CTxOut> prevout;\n if (input.non_witness_utxo) {\n if (input.non_witness_utxo->GetHash() != outpoint.hash || outpoint.n >= input.non_witness_utxo->vout.size()) return result;\n prevout = input.non_witness_utxo->vout[outpoint.n];\n if (trusted != verified.end() && trusted->second != *prevout) return result;\n } else if (trusted != verified.end()) {\n prevout = trusted->second;\n } else {\n missing = true;\n }\n if (prevout) {\n if (!input.witness_utxo.IsNull() && input.witness_utxo != *prevout) return result;\n if (!AddAmount(input_total, prevout->nValue)) return result;\n result.verified.emplace(outpoint, *prevout);\n }\n result.prevouts.push_back(std::move(prevout));\n }\n if (missing) {\n result.state = State::Missing;\n return result;\n }\n if (input_total < result.output_total) return result;\n result.state = State::Known;\n result.amount = input_total - result.output_total;\n return result;\n}\n\npsbtfee::Analysis psbtfee::Prepared(const CTransaction& transaction, CAmount fee)\n{\n Analysis result;\n if (!MoneyRange(fee)) return result;\n const PartiallySignedTransaction psbt{CMutableTransaction{transaction}, /*version=*/2};\n result.commitment = psbt.GetUnsignedTx()->GetHash();\n result.amount = fee;\n result.state = State::Known;\n result.wallet_prepared = true;\n return result;\n}\n\nbool psbtfee::MatchesReview(const PartiallySignedTransaction& psbt, const Analysis& proof, std::optional<CAmount> approved_fee)\n{\n if (proof.state != State::Known || !approved_fee || proof.amount != approved_fee) return false;\n const auto tx = psbt.GetUnsignedTx();\n if (!tx || proof.commitment != tx->GetHash()) return false;\n if (proof.wallet_prepared) {\n // This aggregate fee came from Core's construction of these exact\n // inputs/outputs, not from PSBT metadata. Metadata may only contradict\n // that fact; it must never establish or replace it.\n Outputs claims;\n for (const auto& input : psbt.inputs) {\n if (!input.witness_utxo.IsNull()) claims.emplace(input.GetOutPoint(), input.witness_utxo);\n }\n const auto claimed = Analyze(psbt, claims);\n return claimed.state != State::Invalid && (!claimed.amount || claimed.amount == approved_fee);\n }\n return Analyze(psbt, proof.verified).amount == approved_fee;\n}\n\nvoid psbtfee::FillMissing(PartiallySignedTransaction& psbt, const Analysis& proof)\n{\n for (auto& input : psbt.inputs) {\n const auto found = proof.verified.find(input.GetOutPoint());\n if (!input.non_witness_utxo && input.witness_utxo.IsNull() && found != proof.verified.end()) input.witness_utxo = found->second;\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bc79778bb566..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Speed Up omits the avoid_reuse policy now enforced by Sendqml/walletbump.cpp | unclear | AssessmentThe supplied new diff changes bump preparation and lifetime handling, but does not show `CCoinControl` being configured with `m_avoid_address_reuse`. The relevant construction lines are absent from the new excerpt, so it is insufficient to establish whether the policy gap remains or was fixed. path_diff: qml/walletbump.cpp; new_source: qml/walletbump.cpp [
{
"evidence_id": "3aae1cb595024673988691a53067fe0f",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "bc79778bb5661ea6fee9ae084801919772328532",
"path": "qml/walletbump.cpp",
"source_generation": 15,
"source_job_id": 2992,
"text": "diff --git a/qml/walletbump.cpp b/qml/walletbump.cpp\nindex bf7cd5152b..def2576023 100644\n--- a/qml/walletbump.cpp\n+++ b/qml/walletbump.cpp\n@@ -3,7 +3,6 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/walletbump.h>\n-#include <qml/walletopening.h>\n #include <qml/walletsend.h>\n #include <qml/models/signertransaction.h>\n #include <wallet/coincontrol.h>\n@@ -11,7 +10,9 @@\n #include <QObject>\n #include <algorithm>\n #include <set>\n+#include <string>\n #include <utility>\n+#include <vector>\n \n namespace walletbump {\n namespace {\n@@ -39,7 +40,12 @@ Error CheckApprovedScope(interfaces::Wallet& wallet, const Prepared& review)\n if (!wallet.transactionCanBeBumped(review.original)) return Error::Ineligible;\n interfaces::WalletTxStatus status{};\n int blocks{0}; int64_t block_time{0};\n- if (!wallet.tryGetTxStatus(review.original, status, blocks, block_time)) return Error::Unavailable;\n+ // A busy wallet is not a missing transaction. Waiting is safe on Core.\n+ if (!wallet.tryGetTxStatus(review.original, status, blocks, block_time)) {\n+ std::vector<std::string> messages, payment_requests;\n+ bool in_mempool{false};\n+ if (!wallet.getWalletTxDetails(review.original, status, messages, payment_requests, in_mempool, blocks).tx) return Error::Unavailable;\n+ }\n if (status.is_abandoned || status.depth_in_main_chain != 0) return Error::Ineligible;\n const auto original = wallet.getTx(review.original);\n if (!original || original->GetHash() != review.original\n@@ -80,7 +86,7 @@ void Observe(interfaces::Wallet& wallet, Commit& result, bool exact_witness = fa\n } // namespace\n \n Preparation Prepare(interfaces::Wallet& wallet, const QString& txid, unsigned int target,\n- const std::shared_ptr<walletopening::Session>& opening)\n+ std::shared_ptr<Prepared> review)\n {\n Preparation result;\n try {\n@@ -89,17 +95,7 @@ Preparation Prepare(interfaces::Wallet& wallet, const QString& txid, unsigned in\n if (target < 1 || target > 1008) { result.error = Error::Invalid; return result; }\n const auto original = Txid::FromUint256(*parsed);\n if (!wallet.transactionCanBeBumped(original)) { result.error = Error::Ineligible; return result; }\n- // A transaction review is backend data, potentially much larger than\n- // its GUI fee strings. Reserve cleanup before constructing it so the\n- // last facade/command release never tears transaction vectors down on GUI.\n- struct ReviewStorage { std::unique_ptr<Prepared> value; };\n- const auto review_storage = std::make_shared<ReviewStorage>();\n- auto cleanup_borrower = opening->holdValues([review_storage] { review_storage->value.reset(); });\n- if (!cleanup_borrower) { result.error = Error::Uncertain; return result; }\n- const auto review_lifetime = std::make_shared<execution::ResourceLease>(std::move(*cleanup_borrower.lease));\n- review_storage->value = std::make_unique<Prepared>();\n- // The review alias pins the borrower until reserved cleanup can run.\n- auto review = std::shared_ptr<Prepared>{review_lifetime, review_storage->value.get()};\n+ if (!review) { result.error = Error::Uncertain; return result; }\n review->original = original;\n review->target_blocks = target;\n const auto original_transaction = wallet.getTx(original);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 228,
"evidence_id": "83b95067446b4cd9ab3f6e1fa3819054",
"finding_id": "finding:3",
"kind": "new_source",
"line": 80,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "bc79778bb5661ea6fee9ae084801919772328532",
"path": "qml/walletbump.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 15,
"source_job_id": 2992,
"text": " else result.submission = in_mempool ? Submission::Mempool : Submission::NotInMempool;\n } catch (...) {\n result.record = Record::Unknown;\n result.submission = Submission::Unknown;\n }\n}\n} // namespace\n\nPreparation Prepare(interfaces::Wallet& wallet, const QString& txid, unsigned int target,\n std::shared_ptr<Prepared> review)\n{\n Preparation result;\n try {\n const auto parsed = txid.size() == 64 ? uint256::FromHex(txid.toStdString()) : std::nullopt;\n if (!parsed) { result.error = Error::InvalidId; return result; }\n if (target < 1 || target > 1008) { result.error = Error::Invalid; return result; }\n const auto original = Txid::FromUint256(*parsed);\n if (!wallet.transactionCanBeBumped(original)) { result.error = Error::Ineligible; return result; }\n if (!review) { result.error = Error::Uncertain; return result; }\n review->original = original;\n review->target_blocks = target;\n const auto original_transaction = wallet.getTx(original);\n if (!original_transaction || original_transaction->GetHash().ToUint256() != *parsed) {\n result.error = Error::Ineligible; return result;\n }\n review->original_inputs = Inputs(*original_transaction);\n wallet::CCoinControl control;\n control.m_signal_bip125_rbf = true;\n control.m_confirm_target = target;\n // Preserve the original transaction's absolute and relative timing\n // through the public builder controls, before capturing a new review.\n control.m_version = original_transaction->version;\n control.m_locktime = original_transaction->nLockTime;\n for (const auto& input : original_transaction->vin)\n control.Select(input.prevout).SetSequence(input.nSequence);\n std::vector<bilingual_str> errors;\n if (!wallet.createBumpTransaction(original, control, errors, review->old_fee, review->new_fee, review->transaction)) {\n result.error = Error::Create; result.message = Message(errors); return result;\n }\n review->approved_inputs = Inputs(review->transaction);\n const std::set<COutPoint> original_inputs(review->original_inputs.begin(), review->original_inputs.end());\n const std::set<COutPoint> approved_inputs(review->approved_inputs.begin(), review->approved_inputs.end());\n if (original_inputs.size() != review->original_inputs.size()\n || approved_inputs.size() != review->approved_inputs.size()\n || !std::includes(approved_inputs.begin(), approved_inputs.end(), original_inputs.begin(), original_inputs.end())) {\n result.error = Error::Changed; return result;\n }\n for (const auto& input : review->approved_inputs) {\n if (!original_inputs.contains(input)) review->added_inputs.push_back(input);\n }\n if (!MoneyRange(review->old_fee) || !MoneyRange(review->new_fee) || review->new_fee < review->old_fee) {\n result.error = Error::Invalid; return result;\n }\n if (const auto scope_error = CheckApprovedScope(wallet, *review); scope_error != Error::None) {\n result.error = scope_error; return result;\n }\n review->old_txid = QString::fromStdString(original.GetHex());\n result.review = std::move(review);\n } catch (...) { result.error = Error::Uncertain; }\n return result;\n}\n\nCommit Execute(interfaces::Wallet& wallet, const Prepared& review, std::optional<SecureString> passphrase,\n secretinput::Captured captured, const Services& services)\n{\n Commit result;\n result.original = review.original;\n bool relock_required{false};\n const auto restoreWalletLock = [&] {\n if (!std::exchange(relock_required, false)) return;\n try {\n result.relock_failed = !wallet.lock();\n } catch (...) {\n result.relock_failed = true;\n }\n if (result.relock_failed && !result.committed) result.error = Error::RelockFailed;\n };\n const auto finishAfterRelock = [&] {\n restoreWalletLock();\n passphrase.reset();\n return result;\n };\n try {\n if (captured) passphrase = secretinput::Materialize(captured);\n captured.reset();\n if (const auto scope_error = CheckApprovedScope(wallet, review); scope_error != Error::None) {\n result.error = scope_error; return finishAfterRelock();\n }\n if (!wallet.privateKeysDisabled() && wallet.isCrypted() && wallet.isLocked()) {\n if (!passphrase) { result.error = Error::NeedsUnlock; return finishAfterRelock(); }\n relock_required = true;\n if (!wallet.unlock(*passphrase)) { relock_required = false; result.error = Error::IncorrectPassphrase; return finishAfterRelock(); }\n }\n CMutableTransaction signed_tx{review.transaction};\n // An external signer helper failure throws before any commit. It is a\n // definite signing failure, not an uncertain replacement outcome.\n bool signed_replacement{false};\n try { signed_replacement = wallet.signBumpTransaction(signed_tx); } catch (...) {}\n if (!signed_replacement) { result.error = Error::Sign; return finishAfterRelock(); }\n if (!MatchesUnsignedTransaction(review.transaction, signed_tx)) { result.error = Error::Changed; return finishAfterRelock(); }\n if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n }\n if (const auto scope_error = CheckApprovedScope(wallet, review); scope_error != Error::None) {\n result.error = scope_error; return finishAfterRelock();\n }\n // No further key operation is needed. Restore authorization before\n // commit, and never publish a successful spend with failed restoration.\n restoreWalletLock(); passphrase.reset();\n if (result.relock_failed) return result;\n if (services.admission) {\n const auto exact = MakeTransactionRef(signed_tx);\n const auto decision = psbtpolicy::Evaluate(services.admission(exact, review.new_fee));\n if (decision.state == psbtpolicy::State::Blocked) {\n result.error = Error::Policy;\n result.message = decision.explanation;\n return result;\n }\n }\n std::vector<bilingual_str> errors;\n Txid txid;\n const CTransaction exact{signed_tx};\n result.candidate_txid = exact.GetHash();\n result.candidate_wtxid = exact.GetWitnessHash();\n result.commit_attempted = true;\n if (!wallet.commitBumpTransaction(review.original, std::move(signed_tx), errors, txid)) {\n result.error = Error::Commit; result.message = Message(errors); return result;\n }\n result.txid = txid;\n result.committed = true;\n Observe(wallet, result);\n } catch (const secretinput::Failure&) {\n result.error = Error::Invalid; result.message = QObject::tr(\"The wallet password could not be prepared. No fee bump was submitted.\");\n } catch (...) { result.error = Error::Uncertain; }\n return finishAfterRelock();\n}\nCommit ObserveOutcome(interfaces::Wallet& wallet, const Commit& original)\n{\n auto result = original;\n result.record = Record::Unknown;\n result.submission = Submission::Unknown;\n if (!original.commit_attempted || original.candidate_txid == Txid{}) return result;\n result.txid = original.candidate_txid;\n Observe(wallet, result, true);\n // Observing a record cannot manufacture the original call's missing\n // persistence/replacement-metadata receipt. Keep its uncertainty explicit.\n return result;\n}\n} // namespace walletbump",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bc79778bb566..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Send omits partial-spend avoidance in avoid_reuse walletsqml/models/coinselection.h | still_present | AssessmentThe new-head `ApplyInputPolicy` still sets only `m_avoid_address_reuse`; it does not set `m_avoid_partial_spends`, so the reported partial-spend behavior remains possible. new_source: qml/models/coinselection.h [
{
"bounded": true,
"end_line": 152,
"evidence_id": "9a854aa8bdd046eab3f7f55c084c8a9b",
"finding_id": "finding:2",
"kind": "new_source",
"line": 3,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "bc79778bb5661ea6fee9ae084801919772328532",
"path": "qml/models/coinselection.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 15,
"source_job_id": 2992,
"text": "// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_QML_MODELS_COINSELECTION_H\n#define BITCOIN_QML_MODELS_COINSELECTION_H\n\n#include <wallet/coincontrol.h>\n\n#include <algorithm>\n#include <cstdint>\n#include <functional>\n#include <iterator>\n#include <memory>\n#include <optional>\n#include <set>\n#include <utility>\n\nnamespace coinselection {\n\n// Automatic and Manual are user intent. In particular, an empty Manual\n// selection must remain empty instead of being interpreted as a request to\n// let Core choose wallet inputs.\nenum class InputMode { Automatic, Manual };\n\ninline void ApplyInputPolicy(wallet::CCoinControl& control, const InputMode mode)\n{\n control.m_allow_other_inputs = mode == InputMode::Automatic;\n\n // Core applies this filter only when the wallet has avoid_reuse enabled.\n // Setting it on every app-generated control therefore preserves ordinary\n // wallet behavior while honoring the wallet's opt-in policy.\n control.m_avoid_address_reuse = true;\n}\n\n// Deterministic intent reducer for the temporary coin-selection editor. It\n// owns no wallet or GUI objects; the caller supplies the value-retention\n// boundary used by an opening session.\nclass Session\n{\npublic:\n using Selection = std::set<COutPoint>;\n using Snapshot = std::shared_ptr<const Selection>;\n using Retain = std::function<Snapshot(Selection)>;\n enum class Intent { Select, Unselect, Toggle, Replace, Begin, Apply, Cancel, ChooseAutomatic, ChooseManual };\n struct Transition { Snapshot selection; std::uint64_t revision{0}; InputMode mode{InputMode::Automatic}; bool failed{false}; bool changed{false}; };\n struct MarkChange { Snapshot marks; std::uint64_t revision{0}; bool failed{false}; };\n\n explicit Session(Retain retain) : m_retain{std::move(retain)}\n {\n m_empty = m_retain({});\n m_selection = m_marks = m_empty;\n }\n\n bool ready() const { return bool(m_empty); }\n Snapshot selection() const { return m_selection; }\n Snapshot marks() const { return m_marks; }\n std::uint64_t revision() const { return m_revision; }\n std::uint64_t marksRevision() const { return m_marks_revision; }\n std::uint64_t catalogVersion() const { return m_catalog_version; }\n InputMode inputMode() const { return m_mode; }\n const Selection& missing() const { return m_missing; }\n bool editing() const { return bool(m_baseline); }\n\n Transition apply(Intent intent, std::optional<COutPoint> outpoint = {}, Snapshot replacement = {})\n {\n if (!ready()) return result(true, false);\n if (intent == Intent::Begin) {\n if (!m_baseline) m_baseline = m_selection;\n return result(false, false);\n }\n if (intent == Intent::Apply) {\n m_baseline.reset();\n if (!m_catalog_known) return result(false, false);\n Selection retained;\n std::set_intersection(m_selection->begin(), m_selection->end(), m_catalog.begin(), m_catalog.end(), std::inserter(retained, retained.end()));\n return replaceSelection(std::move(retained));\n }\n if (intent == Intent::Cancel) {\n if (!m_baseline) return result(false, false);\n auto restored = m_baseline;\n m_baseline.reset();\n if (restored == m_selection) return result(false, false);\n m_selection = std::move(restored);\n updateMissing();\n ++m_revision;\n return result(false, true);\n }\n if (intent == Intent::ChooseAutomatic || intent == Intent::ChooseManual) {\n const auto mode = intent == Intent::ChooseManual ? InputMode::Manual : InputMode::Automatic;\n if (m_mode == mode && (mode == InputMode::Manual || m_selection->empty())) return result(false, false);\n if (mode == InputMode::Automatic && !m_selection->empty()) {\n auto empty = m_retain({});\n if (!empty) return result(true, false);\n m_selection = std::move(empty);\n updateMissing();\n }\n m_mode = mode;\n m_baseline.reset();\n ++m_revision;\n return result(false, true);\n }\n\n Selection next;\n if (intent == Intent::Replace) {\n if (replacement) next = *replacement;\n } else {\n next = *m_selection;\n if (outpoint) {\n if (intent == Intent::Unselect || (intent == Intent::Toggle && next.contains(*outpoint))) next.erase(*outpoint);\n else next.insert(*outpoint);\n }\n }\n if (next == *m_selection) return result(false, false);\n if (auto retained = m_retain(std::move(next))) {\n m_selection = std::move(retained);\n ++m_revision;\n return result(false, true);\n }\n return result(true, false);\n }\n\n MarkChange toggleMark(std::optional<COutPoint> outpoint = {})\n {\n if (!ready()) return {m_marks, m_marks_revision, true};\n Selection next = outpoint ? *m_marks : Selection{};\n if (outpoint) {\n if (next.contains(*outpoint)) next.erase(*outpoint);\n else next.insert(*outpoint);\n }\n if (next == *m_marks) return {m_marks, m_marks_revision, false};\n auto retained = m_retain(std::move(next));\n if (!retained) return {m_marks, m_marks_revision, true};\n m_marks = std::move(retained);\n ++m_marks_revision;\n return {m_marks, m_marks_revision, false};\n }\n\n bool reconcileCatalog(const Selection& catalog)\n {\n if (m_catalog_known && catalog == m_catalog) return false;\n m_catalog = catalog;\n m_catalog_known = true;\n ++m_catalog_version;\n updateMissing();\n return true;\n }\n\n // Bulk marks name outputs of the current catalog only. A spent output\n // must not keep a stale count or become a later Lock/Unlock target.\n bool retainMarks(const Selection& catalog)\n {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bc79778bb566..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The console labels implicit wallet RPCs as node commandsqml/models/rpccommandexecutor.cpp | unclear | AssessmentThe supplied new-head excerpt for `RpcCommandExecutor::Execute` still uses the context target to choose the URI, but it does not include the console's target-selection/history logic or a relevant diff. Whether the sole-wallet fallback and consistent history capture were implemented cannot be determined from this evidence. new_source: qml/models/rpccommandexecutor.cpp [
{
"bounded": true,
"end_line": 329,
"evidence_id": "e2ead8d17a604e8482c4945bd1452f1a",
"finding_id": "finding:1",
"kind": "new_source",
"line": 251,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "bc79778bb5661ea6fee9ae084801919772328532",
"path": "qml/models/rpccommandexecutor.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 15,
"source_job_id": 2992,
"text": " return {};\n }\n}\n\nstd::string RpcCommandExecutor::Execute(interfaces::Node& node, const Prepared& command,\n const RpcCommandContext& context, bool& attempted)\n{\n attempted = false;\n const auto& plan = *command.m_plan;\n std::vector<UniValue> results;\n results.reserve(plan.calls.size());\n const auto value = [&](const Plan::Argument& argument) {\n UniValue result{argument.literal};\n if (argument.result) {\n result = std::move(results.at(*argument.result));\n results.at(*argument.result).setNull();\n }\n for (const auto& query : argument.queries) {\n UniValue next;\n if (result.isArray()) {\n const auto index = ToIntegral<size_t>(query);\n if (!index) throw std::runtime_error(\"Invalid result query\");\n next = result[*index];\n } else if (result.isObject()) next = result.find_value(query);\n else throw std::runtime_error(\"Invalid result query\");\n result = std::move(next);\n }\n return result.isStr() ? result.get_str() : result.write(2);\n };\n std::string uri;\n if (context.target == RpcCommandContext::Target::Wallet) {\n const auto encoded = QUrl::toPercentEncoding(context.wallet_name);\n uri = \"/wallet/\" + std::string{encoded.constData(), size_t(encoded.size())};\n }\n for (const auto& call : plan.calls) {\n const auto method = value(call.front());\n std::vector<std::string> arguments;\n for (size_t i = 1; i < call.size(); ++i) {\n auto argument = value(call[i]);\n // Widgets omits a nested string result when that string is empty.\n if (!call[i].result || !argument.empty()) arguments.push_back(std::move(argument));\n }\n const auto params = [&] {\n try { return RPCConvertValues(method, arguments); }\n catch (const std::runtime_error&) {\n // Core's public JSON converter includes the rejected argument\n // in its exception. That is still original input, not an RPC\n // reply; the history redaction policy must cover it as well.\n if (HISTORY_FILTER.contains(QString::fromStdString(method), Qt::CaseInsensitive))\n throw std::runtime_error(QCoreApplication::translate(\"RpcCommandExecutor\", \"Invalid RPC arguments.\").toStdString());\n throw;\n }\n }();\n attempted = true;\n results.push_back(node.executeRpc(method, params, uri));\n }\n return plan.result.result ? value(plan.result) : std::string{};\n}\n\nbool RpcCommandExecutor::RPCParseCommandLine(interfaces::Node* node, std::string& result,\n const std::string& command, bool execute, std::string* filtered, const QString& wallet)\n{\n return RPCParseCommandLine(node, result, command, execute, filtered,\n wallet.isEmpty() ? RpcCommandContext::ForNode() : RpcCommandContext::ForWallet(wallet));\n}\n\nbool RpcCommandExecutor::RPCParseCommandLine(interfaces::Node* node, std::string& result,\n const std::string& command, bool execute, std::string* filtered, const RpcCommandContext& context)\n{\n const auto prepared = Prepare(command);\n if (!prepared) return false;\n if (filtered) *filtered = prepared->filtered();\n if (execute) {\n if (!node) throw std::invalid_argument(\"RPC execution requires a node\");\n bool attempted{false};\n result = Execute(*node, *prepared, context, attempted);\n }\n return true;\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · bc79778bb566..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Preparatory fix commits claim behavior supplied by later workflow commitsqml/models/psbtfee.h | unclear | AssessmentThe provided evidence is source code for a helper, not the relevant commit descriptions or history. It cannot establish whether the preparatory commit messages, issue attribution, or stale references were corrected. new_source: qml/models/psbtfee.h [
{
"bounded": true,
"end_line": 34,
"evidence_id": "78e7f2b78c484f68bfd9c367f84ad43c",
"finding_id": "finding:5",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "e21b05a5f98cc077eb54213f14367a85179a9b01",
"path": "qml/models/psbtfee.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 14,
"source_job_id": 2988,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_QML_MODELS_PSBTFEE_H\n#define BITCOIN_QML_MODELS_PSBTFEE_H\n\n#include <psbt.h>\n\n#include <map>\n#include <optional>\n#include <vector>\n\nnamespace psbtfee {\nenum class State { Known, Missing, Invalid };\nusing Outputs = std::map<COutPoint, CTxOut>;\nstruct Analysis {\n State state{State::Invalid};\n std::optional<CAmount> amount;\n std::optional<Txid> commitment;\n Outputs verified;\n std::vector<std::optional<CTxOut>> prevouts;\n CAmount output_total{0};\n bool outputs_valid{false};\n bool wallet_prepared{false};\n};\n/** Only full transaction commitments or independently verified outputs prove input amounts. */\nAnalysis Analyze(const PartiallySignedTransaction& psbt, const Outputs& verified = {});\nAnalysis Prepared(const CTransaction& transaction, CAmount fee);\nbool MatchesReview(const PartiallySignedTransaction& psbt, const Analysis& proof, std::optional<CAmount> approved_fee);\nvoid FillMissing(PartiallySignedTransaction& psbt, const Analysis& proof);\n} // namespace psbtfee\n\n#endif // BITCOIN_QML_MODELS_PSBTFEE_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · e21b05a5f98c..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The obsolete tst_requestpayment.qml deletion sits in an unrelated QR-wait committest/qml/bitcoin_qmltests.qrc | unclear | AssessmentThe supplied new-head manifest excerpt does not show `tst_requestpayment.qml`, so it cannot establish whether the deletion was moved into the extraction commit or whether the commit history/message concern was corrected. The excerpt is bounded and no relevant commit metadata or diff is supplied. new_source: test/qml/bitcoin_qmltests.qrc [
{
"bounded": true,
"end_line": 68,
"evidence_id": "6088a18e6c59406fbc37ca1baa1723d6",
"finding_id": "finding:4",
"kind": "new_source",
"line": 14,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "e21b05a5f98cc077eb54213f14367a85179a9b01",
"path": "test/qml/bitcoin_qmltests.qrc",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 14,
"source_job_id": 2988,
"text": " <file>tst_r10_coins.qml</file>\n <file>tst_r10_windows.qml</file>\n <file>tst_buttonkeyactivation.qml</file>\n <file>tst_contextmenubutton.qml</file>\n <file>tst_contextmenudivider.qml</file>\n <file>tst_contextmenupicker.qml</file>\n <file>tst_contextmenu.qml</file>\n <file>tst_contextmenutoggle.qml</file>\n <file>tst_copybutton.qml</file>\n <file>tst_walletcreationflow.qml</file>\n <file>tst_debuglogview.qml</file>\n <file>tst_designsystem.qml</file>\n <file>tst_dialogpopup.qml</file>\n <file>tst_desktopmenuactions.qml</file>\n <file>tst_desktopwallets.qml</file>\n <file>tst_walletviews.qml</file>\n <file>tst_dropdownbutton.qml</file>\n <file>tst_externalpopup.qml</file>\n <file>tst_externalsignerreviewactions.qml</file>\n <file>tst_formcontrols.qml</file>\n <file>tst_mainrouting.qml</file>\n <file>tst_monospaceoutputview.qml</file>\n <file>tst_navbutton.qml</file>\n <file>tst_navigationsplitview.qml</file>\n <file>tst_nodefeedback.qml</file>\n <file>tst_onboarding_datadir.qml</file>\n <file>tst_onboardingmotion.qml</file>\n <file>tst_onboardingview.qml</file>\n <file>tst_peeractions.qml</file>\n <file>tst_popuppicker.qml</file>\n <file>tst_typedreceive.qml</file>\n <file>tst_searchbar.qml</file>\n <file>tst_rangeslider.qml</file>\n <file>tst_slider.qml</file>\n <file>tst_sendcreate.qml</file>\n <file>tst_sendcomplete.qml</file>\n <file>tst_sendcreateoptionspopup.qml</file>\n <file>tst_sendfeeselection.qml</file>\n <file>tst_signverifymessage.qml</file>\n <file>tst_settingsheader.qml</file>\n <file>tst_settingsnavigation.qml</file>\n <file>tst_effectivesettings.qml</file>\n <file>tst_settingsstatus.qml</file>\n <file>tst_themecontrast.qml</file>\n <file>tst_thememotion.qml</file>\n <file>tst_themepalettes.qml</file>\n <file>tst_toastbanner.qml</file>\n <file>tst_tooltip.qml</file>\n <file>tst_utils.qml</file>\n <file>tst_walletpassphrasepopup.qml</file>\n <file>tst_walletpasswordsettings.qml</file>\n <file>tst_walletselect.qml</file>\n <file>tst_onboardinghandoff.qml</file>\n </qresource>\n</RCC>",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · e21b05a5f98c..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A stale fee-policy failure can clear a newer read's pending stateqml/models/feeselectionmodel.cpp | still_present | AssessmentThe new-head `request()` and `publishPolicy()` logic is unchanged: a result without a snapshot bypasses the generation check and clears pending state. The supplied diff does not show the suggested stale-failure discard or overlap regression. new_source: qml/models/feeselectionmodel.cpp [
{
"bounded": true,
"end_line": 199,
"evidence_id": "e2568208bc8443d8a722ce554efe4314",
"finding_id": "finding:3",
"kind": "new_source",
"line": 126,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "e21b05a5f98cc077eb54213f14367a85179a9b01",
"path": "qml/models/feeselectionmodel.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 14,
"source_job_id": 2988,
"text": "}\nvoid FeeSelectionModel::editRate(const QString& text)\n{\n if (m_closed) return;\n const auto captured = text.left(33);\n if (m_manual_rate && m_manual_text == captured) return;\n m_manual_text = captured; m_manual_rate = true; request(true);\n}\nvoid FeeSelectionModel::observe(CAmount minimum, QHash<unsigned int, CAmount> rates)\n{\n if (m_closed || (m_minimum == minimum && m_rates == rates)) return;\n m_minimum = minimum; m_rates = std::move(rates); ++m_observations; request(false);\n}\nvoid FeeSelectionModel::request(bool intent)\n{\n if (m_closed) return;\n ++m_generation; if (intent) ++m_intent; m_pending = true; m_rate->m_pending = true;\n if (m_manual_rate) m_rate->m_text = m_manual_text;\n { std::lock_guard lock{m_input->mutex};\n m_input->desired = {m_generation, m_intent, m_observations, m_target, 1, 3, m_manual_mode, m_manual_rate, m_manual_text, {}, {}};\n m_input->minimum = m_minimum; m_input->rates = m_rates; m_input->decimal = QLocale().decimalPoint().at(0); }\n const QPointer<FeeSelectionModel> guard{this};\n if (intent) { Q_EMIT intentChanged(); if (!guard || m_closed) return; }\n Q_EMIT m_rate->changed(); if (!guard || m_closed) return;\n Q_EMIT policyChanged(); if (!guard || m_closed) return;\n if (m_query) m_query->request();\n}\nvoid FeeSelectionModel::publishPolicy()\n{\n if (m_closed || !m_query) return;\n const auto result = m_query->take(); if (!result) return;\n if (result->snapshot && result->snapshot->generation != m_generation) return;\n m_pending = false; m_rate->m_pending = false;\n const QPointer<FeeSelectionModel> guard{this};\n if (!result->snapshot) { m_snapshot.reset(); m_rate->m_valid = false; m_rate->m_error = tr(\"The fee policy could not be validated. Try again.\"); }\n else { m_snapshot = *result->snapshot; m_target = m_snapshot->target; m_rate->m_text = m_snapshot->text; m_rate->m_valid = m_snapshot->rate.has_value(); m_rate->m_error = m_snapshot->error; }\n Q_EMIT m_rate->changed(); if (guard && !m_closed) Q_EMIT policyChanged();\n}\nvoid FeeSelectionModel::retryPublications() { if (!m_closed) publishPolicy(); }\nvoid FeeSelectionModel::close() { if (m_closed) return; m_closed = true; if (m_query) m_query->close(); m_pending = false; m_rate->m_pending = false; m_rate->m_valid = false; m_fresh = false; m_estimate_state = Stopping; }\nvoid FeeSelectionModel::finishStop() { if (m_closed) m_estimate_state = Stopped; }\nint FeeSelectionModel::presetIndex() const { return m_manual_mode ? 3 : m_target == 2 ? 0 : m_target == 10 ? 2 : 1; }\nint FeeSelectionModel::targetIndex() const { return m_snapshot ? m_snapshot->target_index : 3; }\nstd::optional<CAmount> FeeSelectionModel::ratePerKvB() const { return !m_closed && !m_pending && m_snapshot && m_snapshot->generation == m_generation ? m_snapshot->rate : std::nullopt; }\nbool FeeSelectionModel::estimatePending() const { return m_estimate_state == Scheduled || m_estimate_state == Reading || m_estimate_state == ReadingWithPendingWork || m_estimate_state == Applying; }\nstd::optional<SendFeePreview> FeeSelectionModel::retainedPreview() const\n{\n if (m_manual_mode) return m_estimates.custom;\n const auto found = m_estimates.estimates.constFind(m_target); return found == m_estimates.estimates.cend() ? std::nullopt : std::make_optional(*found);\n}\nstd::optional<SendFeePreview> FeeSelectionModel::selectedPreview() const { return m_fresh ? retainedPreview() : std::nullopt; }\nstd::optional<SendFeePreview> FeeSelectionModel::preview(unsigned int target) const { if (!m_fresh) return {}; const auto found = m_estimates.estimates.constFind(target); return found == m_estimates.estimates.cend() ? std::nullopt : std::make_optional(*found); }\nqint64 FeeSelectionModel::estimatedFeeSatoshi() const { const auto p = retainedPreview(); return p ? p->fee : -1; }\nQString FeeSelectionModel::estimatedRate() const { const auto p = retainedPreview(); return p ? feepolicy::FormatRate(p->rate_per_kvb) : QString{}; }\nFeeSelectionModel::Provenance FeeSelectionModel::provenance() const { const auto p = selectedPreview(); return p ? static_cast<Provenance>(p->provenance) : Unknown; }\nbool FeeSelectionModel::hasEstimatorTarget() const { const auto p = selectedPreview(); return p && p->provenance == feeestimate::Provenance::Estimated && p->observed_target > 0; }\nvoid FeeSelectionModel::invalidateEstimate(EstimateState state) { if (m_closed) return; m_fresh = false; m_estimate_state = state; m_error = NoError; m_error_text.clear(); Q_EMIT estimateChanged(); }\nvoid FeeSelectionModel::publishEstimate(feeestimate::Phase phase, FeeReadResult result, bool fresh, feeestimate::Dependencies dependencies, bool retain_previous)\n{\n if (m_closed) return;\n const auto text = m_manual_mode ? result.custom_error : result.errors.value(m_target);\n const bool selected = m_manual_mode ? result.custom.has_value() : result.estimates.contains(m_target);\n if (fresh && !selected) {\n fresh = false; phase = feeestimate::Phase::Failed;\n if (result.error == feeestimate::Error::None) result.error = feeestimate::Error::Unavailable;\n if (result.message.isEmpty()) result.message = text.isEmpty() ? tr(\"Fee estimation is unavailable. Choose Custom to enter a rate.\") : text;\n }\n m_estimate_state = static_cast<EstimateState>(phase); m_fresh = fresh; m_error = static_cast<Error>(result.error); m_error_text = result.message;\n // A successful other preset cannot replace the selected policy's last\n // valid data after a partial failure. Keep its exact previous provenance.\n if (fresh || retain_previous) { m_estimates = std::move(result); m_estimate_dependencies = dependencies; }\n if (m_error_text.isEmpty()) m_error_text = text;\n Q_EMIT estimateChanged();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · e21b05a5f98c..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The extracted Receive editor drops direct address copyingqml/components/ReceiveEditorFields.qml | addressed | AssessmentThe new fields add a visible Copy address button that copies `root.editor.address` to the clipboard, restoring direct bare-address copying. path_diff: qml/components/ReceiveEditorFields.qml [
{
"evidence_id": "449906134e34482580a600c46462cd81",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "e21b05a5f98cc077eb54213f14367a85179a9b01",
"path": "qml/components/ReceiveEditorFields.qml",
"source_generation": 14,
"source_job_id": 2988,
"text": "diff --git a/qml/components/ReceiveEditorFields.qml b/qml/components/ReceiveEditorFields.qml\nindex 2a367a0fc6..a1b8eb5339 100644\n--- a/qml/components/ReceiveEditorFields.qml\n+++ b/qml/components/ReceiveEditorFields.qml\n@@ -17,7 +17,22 @@ ColumnLayout {\n value: ApplicationModels.optionsModel.displayUnit\n when: root.editor !== null\n }\n- CoreText { Layout.fillWidth: true; text: root.editor ? root.editor.address : \"\"; wrapMode: Text.WrapAnywhere }\n+ RowLayout {\n+ Layout.fillWidth: true\n+ spacing: 8\n+ CoreText {\n+ objectName: \"receiveEditorAddressText\"\n+ Layout.fillWidth: true\n+ text: root.editor ? root.editor.address : \"\"\n+ wrapMode: Text.WrapAnywhere\n+ }\n+ NeutralButton {\n+ objectName: \"receiveCopyAddressButton\"\n+ text: qsTr(\"Copy address\")\n+ visible: root.editor !== null && root.editor.address.length > 0\n+ onClicked: Clipboard.setText(root.editor.address)\n+ }\n+ }\n CoreText {\n Layout.fillWidth: true\n visible: root.editor !== null && root.editor.historicallyUsed\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · e21b05a5f98c..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Close leaves the inline Receive editor displayed but unusableqml/components/ReceiveRequestEditorCard.qml | addressed | AssessmentThe new `closable` property controls the Close button, and `ReceivePage.qml` sets `closable: false` for the inline workspace. This prevents the clean inline editor from being closed into the reported unusable state. path_diff: qml/components/ReceiveRequestEditorCard.qml [
{
"evidence_id": "c745568526874df38df1dc4cb0e2e499",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "e21b05a5f98cc077eb54213f14367a85179a9b01",
"path": "qml/components/ReceiveRequestEditorCard.qml",
"source_generation": 14,
"source_job_id": 2988,
"text": "diff --git a/qml/components/ReceiveRequestEditorCard.qml b/qml/components/ReceiveRequestEditorCard.qml\nindex 05e336236f..f0af8be559 100644\n--- a/qml/components/ReceiveRequestEditorCard.qml\n+++ b/qml/components/ReceiveRequestEditorCard.qml\n@@ -12,7 +12,7 @@ Pane {\n property WalletReceiveModel receive: null\n property PaymentRequestEditorModel editor: null\n readonly property PaymentRequestEditorModel deleteEditor: deletion.deletion\n- RequestDeleteController {\n+ PaymentRequestDeleteController {\n id: deletion\n objectName: \"savedRequestDeleteController\"\n receive: root.receive\n@@ -21,6 +21,7 @@ Pane {\n // A question belongs to the request it was asked about.\n onEditorChanged: deletion.reset()\n property bool viewActive: true\n+ property bool closable: true\n readonly property RequestSharingModel sharing: receive && editor && editor.requestId.length > 0 ? receive.sharing(editor, root) : null\n signal closeRequested()\n signal requestAgain(string id)\n@@ -93,7 +94,7 @@ Pane {\n }\n ReceiveEditorCloseQuestion { Layout.fillWidth: true; editor: root.deleteEditor }\n CoreText { Layout.fillWidth: true; text: deletion.error; visible: text.length > 0; color: Theme.color.dangerText }\n- NeutralButton { objectName: \"savedRequestCloseButton\"; text: qsTr(\"Close\"); enabled: root.editor !== null; onClicked: root.editor.requestClose() }\n+ NeutralButton { objectName: \"savedRequestCloseButton\"; visible: root.closable; text: qsTr(\"Close\"); enabled: root.editor !== null; onClicked: root.editor.requestClose() }\n }\n Connections {\n target: root.editor\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · e21b05a5f98c..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1146 | QR and CSV models start dedicated workers before any exportqml/models/imagesavemodel.h | unclear | AssessmentThe new header changes ImageSaveModel to hold a unique_ptr, but the supplied excerpt does not show when the executor is constructed. There is no new evidence for ActivityFilterProxyModel's executor either, so the evidence does not establish that both workers are created lazily. path_diff: qml/models/imagesavemodel.h; new_source: qml/models/imagesavemodel.h [
{
"evidence_id": "acd8e14dce3044c6b3ca52579777ff6a",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/models/imagesavemodel.h",
"source_generation": 1,
"source_job_id": 2950,
"text": "diff --git a/qml/models/imagesavemodel.h b/qml/models/imagesavemodel.h\nindex 87a708f190..a30c2bea54 100644\n--- a/qml/models/imagesavemodel.h\n+++ b/qml/models/imagesavemodel.h\n@@ -11,6 +11,8 @@\n #include <QObject>\n #include <QUrl>\n \n+#include <memory>\n+\n class ImageSaveModel : public QObject\n {\n Q_OBJECT\n@@ -25,7 +27,8 @@ Q_SIGNALS:\n void finished(bool success);\n \n private:\n- BackendExecutor m_executor;\n+ // Created on first save so retained wallet views keep no idle worker thread.\n+ std::unique_ptr<BackendExecutor> m_executor;\n bool m_pending{false};\n };\n \n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 35,
"evidence_id": "f61e491b4faa4f38a591fe6963528564",
"finding_id": "finding:5",
"kind": "new_source",
"line": 1,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/models/imagesavemodel.h",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 1,
"source_job_id": 2950,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_QML_MODELS_IMAGESAVEMODEL_H\n#define BITCOIN_QML_MODELS_IMAGESAVEMODEL_H\n\n#include <qml/backendexecutor.h>\n\n#include <QImage>\n#include <QObject>\n#include <QUrl>\n\n#include <memory>\n\nclass ImageSaveModel : public QObject\n{\n Q_OBJECT\n Q_PROPERTY(bool pending READ pending NOTIFY pendingChanged)\npublic:\n explicit ImageSaveModel(QObject* parent = nullptr) : QObject(parent) {}\n bool pending() const { return m_pending; }\n Q_INVOKABLE bool save(const QImage& image, const QUrl& destination);\n\nQ_SIGNALS:\n void pendingChanged();\n void finished(bool success);\n\nprivate:\n // Created on first save so retained wallet views keep no idle worker thread.\n std::unique_ptr<BackendExecutor> m_executor;\n bool m_pending{false};\n};\n\n#endif // BITCOIN_QML_MODELS_IMAGESAVEMODEL_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 8020f4f60549..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Delayed CSV-export and QR-save results open over another wallet or requestqml/pages/wallet/ActivityListPage.qml | partially_addressed | AssessmentCSV completion now records a pending result while the Activity page is hidden and displays it when that page becomes visible. The supplied PaymentRequestCard excerpt still reports a failed QR save based only on saveOpening matching opening, without checking whether the originating view is visible; the QR portion remains unresolved. path_diff: qml/pages/wallet/ActivityListPage.qml; new_source: qml/pages/wallet/ActivityListPage.qml [
{
"evidence_id": "f5a63420c0204ff6910db2f09d040f24",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/pages/wallet/ActivityListPage.qml",
"source_generation": 1,
"source_job_id": 2950,
"text": "diff --git a/qml/pages/wallet/ActivityListPage.qml b/qml/pages/wallet/ActivityListPage.qml\nindex 13f0eea2fb..574cf89ee2 100644\n--- a/qml/pages/wallet/ActivityListPage.qml\n+++ b/qml/pages/wallet/ActivityListPage.qml\n@@ -15,6 +15,7 @@ Page {\n objectName: \"activityPage\"\n property var wallet: null\n property bool exportSucceeded: true\n+ property bool exportResultPending: false\n property bool ready: false\n readonly property bool activitySourceEmpty: !wallet || wallet.transactionActivityModel.count === 0\n readonly property bool typeFilterActive: activityFilterProxy.typeFilters.length > 0\n@@ -99,7 +100,9 @@ Page {\n target: activityFilterProxy\n function onExportFinished(success) {\n root.exportSucceeded = success\n- exportResultPopup.open()\n+ // A hidden page shows the result once it is visible again.\n+ if (root.visible) exportResultPopup.open()\n+ else root.exportResultPending = true\n }\n }\n \n@@ -539,7 +542,14 @@ Page {\n objectName: \"activityExplorerLinkPopup\"\n }\n \n- onVisibleChanged: if (!visible) deleteRequestConfirmation.stopReporting()\n+ onVisibleChanged: {\n+ if (!visible) {\n+ deleteRequestConfirmation.stopReporting()\n+ } else if (exportResultPending) {\n+ exportResultPending = false\n+ exportResultPopup.open()\n+ }\n+ }\n \n PaymentRequestDeleteConfirmation {\n id: deleteRequestConfirmation\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 221,
"evidence_id": "25c4b6c2dd5044778d98bf30449e47b9",
"finding_id": "finding:4",
"kind": "new_source",
"line": 72,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/pages/wallet/ActivityListPage.qml",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 1,
"source_job_id": 2950,
"text": " if (wallet && wallet.transactionActivityModel.loadError) return wallet.transactionActivityModel.loadError\n if (activitySourceEmpty && wallet && wallet.transactionActivityModel.loading) return \"\"\n if (activitySourceEmpty)\n return nodeModel.blockSyncActive ? qsTr(\"Transactions may appear as your wallet catches up.\")\n : qsTr(\"Your transactions and payment requests will appear here.\")\n return qsTr(\"Try changing your search, date, type, or amount filters.\")\n }\n function exportResultTitle() { return exportSucceeded ? qsTr(\"Export complete\") : qsTr(\"Export failed\") }\n function exportResultDescription() {\n return exportSucceeded ? qsTr(\"Your Activity CSV has been saved.\")\n : activityFilterProxy.exportError\n }\n\n function normalizeLocalPath(path) {\n var value = String(path)\n if (value.indexOf(\"file:///\") === 0) {\n if (Qt.platform.os === \"windows\") {\n return decodeURIComponent(value.substring(8))\n }\n return decodeURIComponent(value.substring(7))\n }\n if (value.indexOf(\"file://\") === 0) {\n return decodeURIComponent(value.substring(7))\n }\n return value\n }\n\n Connections {\n target: activityFilterProxy\n function onExportFinished(success) {\n root.exportSucceeded = success\n // A hidden page shows the result once it is visible again.\n if (root.visible) exportResultPopup.open()\n else root.exportResultPending = true\n }\n }\n\n function exportActivity(path) {\n activityFilterProxy.exportCsv(normalizeLocalPath(path))\n }\n\n // A filter popup right-aligns to its button, but a wide popup on a\n // button near the left edge (the date preset menu, sized for the\n // calendar) would spill past the page. Clamp x so the popup stays\n // within the page horizontally instead of overflowing the list area.\n // Callers assign this from onAboutToShow rather than binding x to\n // it: mapToItem is not dependency-tracked, so a binding would keep\n // a clamp computed from stale geometry.\n function filterPopupX(button, popup) {\n const anchorX = button.mapToItem(root, 0, 0).x\n const rightAligned = button.width - popup.width\n const minX = -anchorX\n const maxX = root.width - popup.width - anchorX\n return Math.max(minX, Math.min(rightAligned, maxX))\n }\n\n // A QDate read back from the model reaches QML as a JS Date at UTC\n // midnight; rebuild it at local midnight on the same calendar day so\n // seeding the calendar does not read it a day early west of UTC (the\n // read-side mirror of the Apply path, which hands the model ISO\n // strings for the same reason).\n function modelDateToLocal(date) {\n return (date && !isNaN(date.getTime()))\n ? new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())\n : null\n }\n\n function toggleActivityType(value) {\n const selected = Array.from(activityFilterProxy.typeFilters)\n const index = selected.indexOf(value)\n if (index < 0) selected.push(value)\n else selected.splice(index, 1)\n activityFilterProxy.typeFilters = selected\n }\n\n function applyAmountRange() {\n const lower = Math.round(amountSlider.lowerValue)\n const upper = Math.round(amountSlider.upperValue)\n if (lower === 0 && upper === activityFilterProxy.availableMaxAmount)\n activityFilterProxy.setAmountRange(-1, -1)\n else activityFilterProxy.setAmountRange(lower, upper)\n }\n\n ActivityFilterProxyModel {\n id: activityFilterProxy\n objectName: \"activityFilterProxyModel\"\n sourceModel: root.wallet ? root.wallet.transactionActivityModel : null\n displayUnit: optionsModel.displayUnit\n groupBy: activitySettings.activityGrouping === \"day\" ? ActivityFilterProxyModel.Day : ActivityFilterProxyModel.Month\n }\n BitcoinAmount {\n id: lowerAmountFormatter\n unit: optionsModel.displayUnit\n satoshi: Math.round(amountSlider.lowerValue)\n }\n BitcoinAmount {\n id: upperAmountFormatter\n unit: optionsModel.displayUnit\n satoshi: Math.round(amountSlider.upperValue)\n }\n AppSettings {\n id: activitySettings\n property string activityGrouping: \"month\"\n property string activityDisplayDensity: \"comfortable\"\n }\n AppFileDialog {\n id: exportDialog\n objectName: \"activityExportDialog\"\n defaultSuffix: \"csv\"\n fileMode: AppFileDialog.SaveFile\n nameFilters: [qsTr(\"Comma separated file (*.csv)\")]\n onAccepted: root.exportActivity(exportDialog.selectedFile.toString())\n }\n TextField {\n id: automationExportPathField\n objectName: \"activityExportPathField\"\n visible: false\n }\n Shortcut {\n sequences: [StandardKey.Find]\n enabled: root.visible\n onActivated: searchField.focusSearch()\n }\n\n ColumnLayout {\n id: content\n anchors.top: parent.top\n anchors.bottom: parent.bottom\n anchors.topMargin: 28\n anchors.bottomMargin: 16\n anchors.left: parent.left\n anchors.right: parent.right\n spacing: 0\n\n RowLayout {\n Layout.fillWidth: true\n Layout.leftMargin: root.activitySideInset\n Layout.rightMargin: root.activitySideInset\n Layout.bottomMargin: 28\n spacing: 16\n ColumnLayout {\n Layout.fillWidth: true\n spacing: 6\n CoreText {\n Layout.fillWidth: true\n text: qsTr(\"Activity\")\n textStyle: Theme.text.headline\n horizontalAlignment: Text.AlignLeft\n }\n CoreText {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 8020f4f60549..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1146 | Locking a selected coin no longer notifies selection-count bindingsqml/models/coinslistmodel.cpp | addressed | AssessmentCoinsListModel now compares the current selection with m_announced_selection and calls refreshSelection() when they differ. That refresh emits selectedCoinsCountChanged, covering selection changes made before the model update, including the reported lock-result case. path_diff: qml/models/coinslistmodel.cpp; new_source: qml/models/coinslistmodel.cpp [
{
"evidence_id": "6521131a27cf4a9d9eabf5fff432a957",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/models/coinslistmodel.cpp",
"source_generation": 1,
"source_job_id": 2950,
"text": "diff --git a/qml/models/coinslistmodel.cpp b/qml/models/coinslistmodel.cpp\nindex b4ea5e9732..916767fea9 100644\n--- a/qml/models/coinslistmodel.cpp\n+++ b/qml/models/coinslistmodel.cpp\n@@ -74,19 +74,22 @@ void CoinsListModel::update()\n }\n // Remove spent inputs without changing surviving manual selections. Locked\n // coins remain valid when the user explicitly selects them.\n- const auto selection = m_wallet_model->listSelectedCoins();\n- for (const auto& selected : selection) {\n+ for (const auto& selected : m_wallet_model->listSelectedCoins()) {\n if (std::none_of(coins.begin(), coins.end(), [&](const auto& coin) { return coin.outpoint == selected; }))\n m_wallet_model->unselectCoin(selected);\n }\n- beginResetModel();\n- m_coins = std::move(coins);\n- m_visible.clear();\n- endResetModel();\n- rebuildView();\n- Q_EMIT coinCountChanged();\n- Q_EMIT lockedCoinsCountChanged();\n- if (selection != m_wallet_model->listSelectedCoins()) Q_EMIT selectedCoinsCountChanged();\n+ // Each new block refreshes wallet state; keep the rows when no coin changed.\n+ if (coins != m_coins) {\n+ beginResetModel();\n+ m_coins = std::move(coins);\n+ m_visible.clear();\n+ endResetModel();\n+ rebuildView();\n+ Q_EMIT coinCountChanged();\n+ Q_EMIT lockedCoinsCountChanged();\n+ }\n+ // The wallet model can also drop selected coins before this refresh.\n+ if (m_wallet_model->listSelectedCoins() != m_announced_selection) refreshSelection();\n }\n void CoinsListModel::rebuildView()\n {\n@@ -150,6 +153,7 @@ bool CoinsListModel::toggleCoinSelectionById(const QString& coin_id)\n void CoinsListModel::refreshSelection()\n {\n if (rowCount()) Q_EMIT dataChanged(index(0), index(rowCount() - 1), {SelectedRole});\n+ m_announced_selection = m_wallet_model->listSelectedCoins();\n Q_EMIT selectedCoinsCountChanged();\n }\n void CoinsListModel::beginSelection()\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 208,
"evidence_id": "9f30c67d6473433e92a706457a597491",
"finding_id": "finding:3",
"kind": "new_source",
"line": 59,
"new_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/models/coinslistmodel.cpp",
"revision": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"source_generation": 1,
"source_job_id": 2950,
"text": "}\nvoid CoinsListModel::update()\n{\n if (!m_wallet_model) return;\n std::vector<Coin> coins;\n for (const auto& [ancestor, outputs] : m_wallet_model->listCoins()) {\n for (const auto& [outpoint, output] : outputs) {\n if (output.is_spent) continue;\n // listCoins groups change under its ancestor. Show the actual output address.\n CTxDestination destination;\n if (!ExtractDestination(output.txout.scriptPubKey, destination)) destination = ancestor;\n const auto address = QString::fromStdString(EncodeDestination(destination));\n coins.push_back({outpoint, address, m_wallet_model->getAddressLabel(address), output.txout.nValue,\n QDateTime::fromSecsSinceEpoch(output.time), m_wallet_model->isLockedCoin(outpoint)});\n }\n }\n // Remove spent inputs without changing surviving manual selections. Locked\n // coins remain valid when the user explicitly selects them.\n for (const auto& selected : m_wallet_model->listSelectedCoins()) {\n if (std::none_of(coins.begin(), coins.end(), [&](const auto& coin) { return coin.outpoint == selected; }))\n m_wallet_model->unselectCoin(selected);\n }\n // Each new block refreshes wallet state; keep the rows when no coin changed.\n if (coins != m_coins) {\n beginResetModel();\n m_coins = std::move(coins);\n m_visible.clear();\n endResetModel();\n rebuildView();\n Q_EMIT coinCountChanged();\n Q_EMIT lockedCoinsCountChanged();\n }\n // The wallet model can also drop selected coins before this refresh.\n if (m_wallet_model->listSelectedCoins() != m_announced_selection) refreshSelection();\n}\nvoid CoinsListModel::rebuildView()\n{\n beginResetModel();\n m_visible.clear();\n for (size_t i = 0; i < m_coins.size(); ++i) {\n const auto& coin = m_coins[i];\n if (!m_search.isEmpty() &&\n !coin.note.contains(m_search, Qt::CaseInsensitive) &&\n !coin.address.contains(m_search, Qt::CaseInsensitive) &&\n !coin.id().contains(m_search, Qt::CaseInsensitive)) continue;\n if (m_filter == \"locked\" && !coin.locked) continue;\n if (m_filter == \"spendable\" && coin.locked) continue;\n if (m_min_amount >= 0 && coin.amount < m_min_amount) continue;\n if (m_max_amount >= 0 && coin.amount > m_max_amount) continue;\n m_visible.push_back(i);\n }\n std::sort(m_visible.begin(), m_visible.end(), [&](size_t a, size_t b) {\n const auto& x = m_coins[a]; const auto& y = m_coins[b];\n if (m_group == \"address\" && x.address != y.address) return x.address < y.address;\n if (m_group == \"month\" || m_group == \"date\") {\n const auto format = m_group == \"month\" ? \"yyyyMM\" : \"yyyyMMdd\";\n const auto xm = x.date.toString(format), ym = y.date.toString(format);\n if (xm != ym) return m_descending ? xm > ym : xm < ym;\n }\n int cmp = 0;\n if (m_sort == \"amount\") cmp = x.amount < y.amount ? -1 : x.amount > y.amount ? 1 : 0;\n else if (m_sort == \"label\") cmp = QString::localeAwareCompare(x.note.toCaseFolded(), y.note.toCaseFolded());\n else cmp = x.date < y.date ? -1 : x.date > y.date ? 1 : 0;\n return cmp == 0 ? x.outpoint < y.outpoint : m_descending ? cmp > 0 : cmp < 0;\n });\n endResetModel();\n Q_EMIT viewChanged();\n}\nvoid CoinsListModel::setSearchText(const QString& v) { if (m_search != v) { m_search = v; rebuildView(); } }\nvoid CoinsListModel::setSortBy(const QString& v) { if ((v == \"date\" || v == \"amount\" || v == \"label\") && m_sort != v) { m_sort = v; rebuildView(); } }\nvoid CoinsListModel::setSortDescending(bool v) { if (m_descending != v) { m_descending = v; rebuildView(); } }\nvoid CoinsListModel::setFilter(const QString& v) { if ((v == \"all\" || v == \"spendable\" || v == \"locked\") && m_filter != v) { m_filter = v; rebuildView(); } }\nvoid CoinsListModel::setGroupBy(const QString& v) { if ((v == \"date\" || v == \"month\" || v == \"address\") && m_group != v) { m_group = v; rebuildView(); } }\nvoid CoinsListModel::setMinAmount(qint64 v) { v = v < 0 ? -1 : v; if (m_min_amount != v) { m_min_amount = v; rebuildView(); } }\nvoid CoinsListModel::setMaxAmount(qint64 v) { v = v < 0 ? -1 : v; if (m_max_amount != v) { m_max_amount = v; rebuildView(); } }\nvoid CoinsListModel::toggleCoinSelection(int row)\n{\n if (!m_wallet_model || row < 0 || row >= rowCount()) return;\n const auto& coin = m_coins[m_visible[row]];\n toggleCoinSelectionById(coin.id());\n}\n\nbool CoinsListModel::toggleCoinSelectionById(const QString& coin_id)\n{\n if (!m_wallet_model) return false;\n const auto coin = std::find_if(m_coins.begin(), m_coins.end(), [&coin_id](const Coin& candidate) {\n return candidate.id() == coin_id;\n });\n if (coin == m_coins.end()) return false;\n if (m_wallet_model->isSelectedCoin(coin->outpoint)) m_wallet_model->unselectCoin(coin->outpoint);\n else m_wallet_model->selectCoin(coin->outpoint);\n refreshSelection();\n return true;\n}\nvoid CoinsListModel::refreshSelection()\n{\n if (rowCount()) Q_EMIT dataChanged(index(0), index(rowCount() - 1), {SelectedRole});\n m_announced_selection = m_wallet_model->listSelectedCoins();\n Q_EMIT selectedCoinsCountChanged();\n}\nvoid CoinsListModel::beginSelection()\n{\n if (!m_wallet_model || m_previous_selection) return;\n m_wallet_model->requestWalletStateRefresh();\n m_previous_selection = m_wallet_model->listSelectedCoins();\n}\nvoid CoinsListModel::applySelection() { m_previous_selection.reset(); }\nvoid CoinsListModel::cancelSelection()\n{\n if (!m_wallet_model || !m_previous_selection) return;\n const auto previous = *m_previous_selection;\n m_previous_selection.reset();\n std::vector<COutPoint> restored;\n for (const auto& outpoint : previous) {\n if (std::any_of(m_coins.begin(), m_coins.end(), [&](const auto& c) { return c.outpoint == outpoint; }))\n restored.push_back(outpoint);\n }\n m_wallet_model->setSelectedCoins(restored);\n}\nbool CoinsListModel::setCoinsLocked(const QStringList& ids, bool locked)\n{\n if (!m_wallet_model) return false;\n std::vector<COutPoint> outputs;\n for (const auto& coin : m_coins) {\n if (ids.contains(coin.id())) outputs.push_back(coin.outpoint);\n }\n return m_wallet_model->setCoinsLocked(std::move(outputs), locked);\n}\nbool CoinsListModel::lockOperationPending() const { return m_wallet_model && m_wallet_model->coinLockPending(); }\nQString CoinsListModel::lockOperationError() const { return m_wallet_model ? m_wallet_model->coinLockError() : QString{}; }\nint CoinsListModel::lockedCoinsCount() const { return std::count_if(m_coins.begin(), m_coins.end(), [](const auto& c) { return c.locked; }); }\nint CoinsListModel::selectedCoinsCount() const { return m_wallet_model ? static_cast<int>(m_wallet_model->listSelectedCoins().size()) : 0; }\nqint64 CoinsListModel::totalSelectedSatoshi() const\n{\n qint64 total = 0;\n if (m_wallet_model) for (const auto& c : m_coins) if (m_wallet_model->isSelectedCoin(c.outpoint)) total += c.amount;\n return total;\n}\nqint64 CoinsListModel::totalSatoshi() const { qint64 total = 0; for (const auto& c : m_coins) total += c.amount; return total; }\nqint64 CoinsListModel::lockedSatoshi() const { qint64 total = 0; for (const auto& c : m_coins) if (c.locked) total += c.amount; return total; }\nqint64 CoinsListModel::availableMinAmount() const\n{\n if (m_coins.empty()) return 0;\n return std::min_element(m_coins.begin(), m_coins.end(), [](const auto& a, const auto& b) { return a.amount < b.amount; })->amount;\n}\nqint64 CoinsListModel::availableMaxAmount() const\n{\n if (m_coins.empty()) return 0;\n return std::max_element(m_coins.begin(), m_coins.end(), [](const auto& a, const auto& b) { return a.amount < b.amount; })->amount;\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 8020f4f60549..1efc5c73b6b7 2026-11-23T18:54:55Z · gpt-6-luna |
| gui#1146 | A delayed signing password prompt can open over another wallet or pageqml/pages/wallet/SignVerifyMessage.qml | addressed | AssessmentThe completion handler now opens the unlock prompt only when root.visible is true, preventing the reported delayed prompt from appearing after the originating page is hidden. path_diff: qml/pages/wallet/SignVerifyMessage.qml [
{
"evidence_id": "8fc562c433194ecda11e553b4632e3e7",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "1efc5c73b6b7f2631a1e3ddc2384eb9c7ee50e32",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/pages/wallet/SignVerifyMessage.qml",
"source_generation": 1,
"source_job_id": 2950,
"text": "diff --git a/qml/pages/wallet/SignVerifyMessage.qml b/qml/pages/wallet/SignVerifyMessage.qml\nindex d66c557ae8..a49d6249e5 100644\n--- a/qml/pages/wallet/SignVerifyMessage.qml\n+++ b/qml/pages/wallet/SignVerifyMessage.qml\n@@ -81,7 +81,7 @@ SettingsPage {\n function onSigningFinished(success) {\n signPassphrasePopup.busy = false\n if (success) signPassphrasePopup.close()\n- else if (root.signVerifyModel.signingNeedsUnlock) {\n+ else if (root.signVerifyModel.signingNeedsUnlock && root.visible) {\n signPassphrasePopup.errorText = \"\"\n signPassphrasePopup.open()\n } else if (signPassphrasePopup.visible) signPassphrasePopup.errorText = root.signVerifyModel.signingError\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 8020f4f60549..1efc5c73b6b7 2026-11-23T18:54:55Z · gpt-6-luna |
| gui#1146 | Newly sampled block tips reset unchanged Addresses and Coins listsqml/models/walletstatesnapshot.cpp | still_present | AssessmentThe polling path still calls read(node) whenever the processed block changes, so it continues to build a full snapshot. The supplied diff does not show conditional list-model notifications or separate balance/maturity updates; the reported list rebuild issue is therefore not shown as fixed. path_diff: qml/models/walletstatesnapshot.cpp; new_source: qml/models/walletstatesnapshot.cpp [
{
"evidence_id": "42eedc2436834edb8d05bf5655ce818e",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/models/walletstatesnapshot.cpp",
"source_generation": 1,
"source_job_id": 2950,
"text": "diff --git a/qml/models/walletstatesnapshot.cpp b/qml/models/walletstatesnapshot.cpp\nindex 7002db8fa3..89b50ee8a3 100644\n--- a/qml/models/walletstatesnapshot.cpp\n+++ b/qml/models/walletstatesnapshot.cpp\n@@ -64,6 +64,21 @@ bool SupportsType(const WalletStateSnapshot& state, OutputType type)\n {\n return state.can_get_addresses && type != OutputType::UNKNOWN && (type != OutputType::BECH32M || state.taproot_enabled);\n }\n+\n+struct SecurityState {\n+ bool encrypted;\n+ bool locked;\n+};\n+\n+// EncryptWallet() adds the master keys under cs_wallet, but IsLocked() and HasEncryptionKeys() check them without it.\n+SecurityState ReadSecurityState(interfaces::Wallet& wallet)\n+{\n+ if (auto* local = wallet.wallet()) {\n+ LOCK(local->cs_wallet);\n+ return {local->HasEncryptionKeys(), local->IsLocked()};\n+ }\n+ return {wallet.isCrypted(), wallet.isLocked()};\n+}\n } // namespace\n \n WalletKeyScheme ReadWalletKeyScheme(interfaces::Wallet& wallet)\n@@ -126,8 +141,9 @@ WalletStateSnapshot WalletStateBackend::read(interfaces::Node* node)\n state.balance = m_wallet->getBalance();\n state.available_balance = m_wallet->getAvailableBalance(wallet::CCoinControl{});\n state.key_scheme = ReadWalletKeyScheme(*m_wallet);\n- state.encrypted = m_wallet->isCrypted();\n- state.locked = m_wallet->isLocked();\n+ const auto security = ReadSecurityState(*m_wallet);\n+ state.encrypted = security.encrypted;\n+ state.locked = security.locked;\n state.private_keys_disabled = m_wallet->privateKeysDisabled();\n state.external_signer = m_wallet->hasExternalSigner();\n state.can_get_addresses = m_wallet->canGetAddresses();\n@@ -218,9 +234,16 @@ std::optional<WalletStateSnapshot> WalletStateBackend::poll(interfaces::Node* no\n {\n // A node-tip notification can precede wallet processing, and maturity does\n // not emit a transaction notification. Retry busy wallets on the next poll.\n- interfaces::WalletBalances balances;\n uint256 processed_block;\n- if (!m_wallet->tryGetBalances(balances, processed_block)) return std::nullopt;\n+ if (auto* wallet = m_wallet->wallet()) {\n+ // tryGetBalances() would also sum every wallet output; only the block hash is needed here.\n+ TRY_LOCK(wallet->cs_wallet, locked_wallet);\n+ if (!locked_wallet) return std::nullopt;\n+ processed_block = wallet->GetLastBlockHash();\n+ } else {\n+ interfaces::WalletBalances balances;\n+ if (!m_wallet->tryGetBalances(balances, processed_block)) return std::nullopt;\n+ }\n if (m_last_processed_block != processed_block) return read(node);\n \n // lockunspent does not notify the wallet either.\n@@ -281,7 +304,7 @@ ReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, Receive\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n- if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && m_wallet->isCrypted())) {\n+ if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n@@ -320,7 +343,8 @@ ReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, Receive\n }\n const auto destination = m_wallet->getNewDestination(*type, label);\n if (!destination || !IsValidDestination(*destination)) {\n- result.needs_unlock = m_wallet->isCrypted() && m_wallet->isLocked();\n+ const auto security = ReadSecurityState(*m_wallet);\n+ result.needs_unlock = security.encrypted && security.locked;\n result.error = result.needs_unlock ? Tr(\"Enter your wallet password to create an address.\") : Tr(\"A receiving address could not be generated. Please try again.\");\n return {};\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 343,
"evidence_id": "75883a2f034f4156af60f5ffe45cc284",
"finding_id": "finding:1",
"kind": "new_source",
"line": 194,
"new_head": "82f801e1302e0510696329058e2176e51012c1de",
"old_head": "8020f4f605498982af510417864d066d3851012e",
"path": "qml/models/walletstatesnapshot.cpp",
"revision": "82f801e1302e0510696329058e2176e51012c1de",
"source_generation": 1,
"source_job_id": 2950,
"text": " if (output.nValue <= 0) continue;\n m_observed_addresses.insert(address);\n if (request_addresses.contains(address)) received[address] += output.nValue;\n }\n if (received.empty()) continue;\n interfaces::WalletTxStatus status{};\n std::vector<std::string> messages;\n std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int blocks{0};\n m_wallet->getWalletTxDetails(tx.tx->GetHash(), status, messages, payment_requests, in_mempool, blocks);\n const bool replaced = tx.replaced_by_txid.has_value();\n if (status.depth_in_main_chain < 0 || status.is_abandoned || (status.depth_in_main_chain == 0 && (!in_mempool || replaced))) continue;\n if (status.depth_in_main_chain == 0) unconfirmed_payment_txids.insert(tx.tx->GetHash());\n for (const auto& [address, amount] : received) state.received_amounts[address] += amount;\n }\n for (const auto& [ancestor, coins] : state.coins) {\n for (const auto& [outpoint, output] : coins) {\n CTxDestination destination;\n if (!ExtractDestination(output.txout.scriptPubKey, destination)) continue;\n const auto address = Address(destination);\n state.address_balances[address] += output.txout.nValue;\n if (output.txout.nValue > 0 && change_outputs.contains(outpoint)) state.change_addresses.insert(address);\n }\n }\n state.observed_addresses = m_observed_addresses;\n for (auto& request : state.receive_requests) {\n if (request.payment_received || !m_observed_addresses.contains(QString::fromStdString(request.recipient.address))) continue;\n request.payment_received = true;\n if (!m_wallet->setAddressReceiveRequest(DecodeDestination(request.recipient.address), util::ToString(request.id), ReceiveRequestHistoryModel::SerializeEntry(request))) {\n state.persistence_error = Tr(\"The received-payment status could not be saved. The address will not be reused.\");\n }\n }\n if (have_processed_block) m_last_processed_block = processed_block;\n state.unconfirmed_payments = !unconfirmed_payment_txids.empty();\n m_unconfirmed_payment_txids = std::move(unconfirmed_payment_txids);\n return state;\n}\n\nstd::optional<WalletStateSnapshot> WalletStateBackend::poll(interfaces::Node* node)\n{\n // A node-tip notification can precede wallet processing, and maturity does\n // not emit a transaction notification. Retry busy wallets on the next poll.\n uint256 processed_block;\n if (auto* wallet = m_wallet->wallet()) {\n // tryGetBalances() would also sum every wallet output; only the block hash is needed here.\n TRY_LOCK(wallet->cs_wallet, locked_wallet);\n if (!locked_wallet) return std::nullopt;\n processed_block = wallet->GetLastBlockHash();\n } else {\n interfaces::WalletBalances balances;\n if (!m_wallet->tryGetBalances(balances, processed_block)) return std::nullopt;\n }\n if (m_last_processed_block != processed_block) return read(node);\n\n // lockunspent does not notify the wallet either.\n std::vector<COutPoint> locked;\n m_wallet->listLockedCoins(locked);\n if (std::set<COutPoint>(locked.begin(), locked.end()) != m_locked_coins) return read(node);\n\n // Mempool eviction need not notify the receiving wallet. Check only the\n // outstanding payments; an unchanged payment must not rebuild every wallet\n // model (and destroy an address label editor) on each timer tick.\n for (const auto& txid : m_unconfirmed_payment_txids) {\n interfaces::WalletTxStatus status{};\n std::vector<std::string> messages;\n std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int blocks{0};\n const auto tx = m_wallet->getWalletTxDetails(txid, status, messages, payment_requests, in_mempool, blocks);\n if (status.depth_in_main_chain != 0 || status.is_abandoned || !in_mempool || tx.replaced_by_txid.has_value()) {\n return read(node);\n }\n }\n return std::nullopt;\n}\n\nbool WalletStateBackend::setAddressType(interfaces::Node* node, const QString& type)\n{\n if (!node) return true;\n const auto updated_preferences = [&] {\n auto preferences = node->getPersistentSetting(\"qml_receive_address_types\");\n if (!preferences.isObject()) preferences = common::SettingsValue{UniValue::VOBJ};\n preferences.pushKV(m_wallet->getWalletName(), type.toStdString());\n return preferences;\n };\n if (auto* context = node->context(); context && context->args) {\n return QmlCoreSettings::PersistSettings(*context->args, {QStringLiteral(\"qml_receive_address_types\")}, [&] {\n // Read and merge inside the shared writer lock: other wallet\n // queues may update their own entry in the same settings object.\n QmlCoreSettings::SetRwSetting(*context->args, QStringLiteral(\"qml_receive_address_types\"), updated_preferences());\n return true;\n });\n }\n node->updateRwSetting(\"qml_receive_address_types\", updated_preferences());\n return true;\n}\n\nReceiveCommandResult WalletStateBackend::execute(interfaces::Node* node, ReceiveCommand command)\n{\n ReceiveCommandResult result;\n auto finish = [&] {\n try {\n result.snapshot = read(node);\n } catch (...) {\n // Persistence may already have succeeded. Keep its result and ID\n // so retrying the refresh cannot create another request.\n result.refresh_error = Tr(\"Wallet information could not be refreshed. It will be retried.\");\n }\n return std::move(result);\n };\n // Deriving addresses can depend on an encrypted wallet being unlocked.\n std::unique_lock<std::mutex> unlock_session;\n if (command.passphrase || ((command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) && ReadSecurityState(*m_wallet).encrypted)) {\n unlock_session = m_unlock_session->acquire();\n }\n bool relock{false};\n if (command.passphrase) {\n const auto unlocked = TryUnlockWithPassphrase(*m_wallet, *command.passphrase);\n command.passphrase.reset();\n if (unlocked == WalletUnlockResult::IncorrectPassphrase) {\n result.error = Tr(\"The wallet password you entered was incorrect.\");\n return finish();\n }\n relock = unlocked == WalletUnlockResult::UnlockedNowRelockRequired;\n }\n WalletRelockGuard guard{*m_wallet, [] {}, relock};\n // Release cs_wallet before settings I/O and before relocking, which takes the relock mutex first.\n std::unique_ptr<UniqueLock<RecursiveMutex>> wallet_lock;\n if (command.kind == ReceiveCommand::Kind::Save || command.kind == ReceiveCommand::Kind::EnsureAddress) {\n if (auto* wallet = m_wallet->wallet()) {\n wallet_lock = std::make_unique<UniqueLock<RecursiveMutex>>(wallet->cs_wallet, \"wallet->cs_wallet\", __FILE__, __LINE__);\n }\n }\n auto state = read(node);\n auto complete = [&] {\n wallet_lock.reset();\n guard.relock();\n if (unlock_session) unlock_session.unlock();\n return finish();\n };\n QSettings settings;\n const auto address_key = settingsKey();\n const auto type_text = command.address_type.isEmpty() ? state.receive_address_type : command.address_type;\n const auto type = ParseOutputType(type_text.toStdString());\n auto new_address = [&](const std::string& label) -> QString {\n if (!type || !SupportsType(state, *type)) {\n result.error = Tr(\"The selected address type is unavailable.\");\n return {};\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 8020f4f60549..82f801e1302e 2026-11-24T20:21:27Z · gpt-6-luna |
| gui#1142 | Cancelled clipboard checks accumulate as child QObjectsqml/models/sendimportmodel.cpp | still_present | AssessmentThe new-head `cancelImport()`, `cancelAll()`, and `checkClipboard()` still disconnect and call `cancel()` without deleting or otherwise retiring the cancelled child operation. The reported accumulation remains. new_source: qml/models/sendimportmodel.cpp [
{
"bounded": true,
"end_line": 248,
"evidence_id": "bece873d25e641b989318b597fde3622",
"finding_id": "finding:9",
"kind": "new_source",
"line": 201,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/models/sendimportmodel.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 13,
"source_job_id": 2941,
"text": " if (operation != m_operation) return;\n presentReview();\n Q_EMIT changed();\n });\n}\n\nvoid SendImportModel::cancelImport()\n{\n m_presented_result.clear();\n if (const auto operation = std::exchange(m_operation, nullptr)) {\n disconnect(operation, nullptr, this, nullptr);\n operation->cancel();\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::cancelAll()\n{\n cancelImport();\n if (const auto check = std::exchange(m_clipboard_check, nullptr)) {\n disconnect(check, nullptr, this, nullptr);\n check->cancel();\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::checkClipboard()\n{\n if (const auto check = std::exchange(m_clipboard_check, nullptr)) {\n disconnect(check, nullptr, this, nullptr);\n check->cancel();\n }\n if (m_active && m_target && m_target->available() && !m_target->importPending() && !m_clipboard_text.trimmed().isEmpty()) {\n m_offered_text = m_clipboard_text;\n m_clipboard_check = m_target->importText(m_offered_text, this);\n if (m_clipboard_check) connect(m_clipboard_check, &ImportOperation::changed, this, &SendImportModel::changed);\n }\n Q_EMIT changed();\n}\n\nvoid SendImportModel::presentReview()\n{\n if (!m_operation || !m_operation->reviewOpened() || !m_target || !m_target->available()) return;\n const auto token = m_operation->resultToken();\n if (token.isEmpty() || token == m_presented_result || m_target->importedReviewToken() != token) return;\n m_presented_result = token;\n Q_EMIT reviewReady();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Closing Address details during loading silently drops a typed noteqml/pages/wallet/AddressDetails.qml | still_present | AssessmentThe diff changes only the close dialog's overlay parent. The note field still uses `readOnly: ... !root.editor.available`, so the reported Loading-time edit path remains unaddressed; no initial-read gating or regression is shown. path_diff: qml/pages/wallet/AddressDetails.qml; new_source: qml/pages/wallet/AddressDetails.qml [
{
"evidence_id": "b0d254b95b85450d95e01d0bb61ca93f",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/pages/wallet/AddressDetails.qml",
"source_generation": 13,
"source_job_id": 2941,
"text": "diff --git a/qml/pages/wallet/AddressDetails.qml b/qml/pages/wallet/AddressDetails.qml\nindex 07013ea9d8..b45555f650 100644\n--- a/qml/pages/wallet/AddressDetails.qml\n+++ b/qml/pages/wallet/AddressDetails.qml\n@@ -164,7 +164,14 @@ ColumnLayout {\n readonly property Dialog dialog: Dialog {\n id: noteCloseDialog\n objectName: \"addressNoteClosePrompt\"\n- parent: root.Overlay.overlay\n+ // Keeps the overlay when the page leaves the window. A popup whose parent\n+ // goes null there loses its window while its item is still in the overlay,\n+ // and a hover event then crashes Qt 6.8.4 and newer.\n+ Binding on parent {\n+ when: root.Overlay.overlay !== null\n+ value: root.Overlay.overlay\n+ restoreMode: Binding.RestoreNone\n+ }\n modal: true\n width: Math.min(620, parent ? parent.width - 40 : 620)\n x: parent ? (parent.width - width) / 2 : 0\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 225,
"evidence_id": "3cd42cd758444d6bace5e064ac1e5b00",
"finding_id": "finding:8",
"kind": "new_source",
"line": 76,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/pages/wallet/AddressDetails.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 13,
"source_job_id": 2941,
"text": " topPadding: 2\n bottomPadding: 2\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsAmountRow\"\n amountValue: true\n hidesAmount: true\n Layout.fillWidth: true\n title: qsTr(\"Amount\")\n value: root.amount\n valueColor: root.hasAmount ? Theme.color.txIncoming : Theme.color.neutral6\n dividerColor: Theme.color.surfaceDivider\n }\n\n TextFieldRow {\n id: noteRow\n objectName: \"addressDetailsNoteRow\"\n visible: root.canEditLabel\n Layout.fillWidth: true\n //: Private address note, also used as the payment request's note to self.\n title: qsTr(\"Note to self\")\n fieldObjectName: \"addressDetailsNoteField\"\n fieldWidth: Math.min(320, Math.max(180, root.width * 0.55))\n text: root.label\n textInput: root.editor ? root.editor.text : null\n //: Placeholder shown when an address has no private note yet.\n placeholderText: qsTr(\"Add note…\")\n enabled: root.canEditLabel\n readOnly: !root.canEditLabel || (root.editor !== null && !root.editor.available)\n errorText: root.editor ? root.editor.error.message : root.noteErrorText\n dividerColor: Theme.color.surfaceDivider\n onEditingFinished: {\n if (!root.editor && text !== root.label) {\n root.editLabelRequested(root.address, text)\n }\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Type\")\n value: root.category === \"change\" ? qsTr(\"Change\") : qsTr(\"Receive\")\n dividerColor: Theme.color.surfaceDivider\n }\n\n ValueRow {\n objectName: \"addressDetailsAddressTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Address type\")\n value: root.scriptType === \"\" ? qsTr(\"Unknown\") : root.scriptType\n showDivider: false\n }\n }\n\n GridLayout {\n columns: 2\n visible: root.editor !== null && (root.editor.dirty || root.editor.conflict)\n Layout.fillWidth: true\n NeutralButton {\n objectName: \"addressDetailsDiscardNoteButton\"\n text: qsTr(\"Discard edits\")\n enabled: root.editor !== null && root.editor.canDiscard\n onClicked: root.editor.discard()\n }\n NeutralButton {\n objectName: \"addressDetailsUseCurrentNoteButton\"\n text: qsTr(\"Use current note\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.UseCurrent)\n }\n NeutralButton {\n objectName: \"addressDetailsKeepEditedNoteButton\"\n text: qsTr(\"Keep my edit\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.KeepEdit)\n }\n PrimaryButton {\n objectName: \"addressDetailsSaveNoteButton\"\n text: qsTr(\"Save note\")\n enabled: root.editor !== null && root.editor.canSave\n onClicked: root.editor.save()\n }\n }\n\n QtObject {\n readonly property Dialog dialog: Dialog {\n id: noteCloseDialog\n objectName: \"addressNoteClosePrompt\"\n // Keeps the overlay when the page leaves the window. A popup whose parent\n // goes null there loses its window while its item is still in the overlay,\n // and a hover event then crashes Qt 6.8.4 and newer.\n Binding on parent {\n when: root.Overlay.overlay !== null\n value: root.Overlay.overlay\n restoreMode: Binding.RestoreNone\n }\n modal: true\n width: Math.min(620, parent ? parent.width - 40 : 620)\n x: parent ? (parent.width - width) / 2 : 0\n y: parent ? (parent.height - height) / 2 : 0\n closePolicy: Popup.NoAutoClose\n visible: root.visible && root.editor !== null && root.editor.available && root.editor.closePrompt !== null\n title: qsTr(\"Save note edits?\")\n contentItem: GridLayout {\n columns: noteCloseDialog.width < 480 ? 1 : 3\n NeutralButton {\n id: keepEditingButton\n objectName: \"addressNoteKeepEditingButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: keepEditingButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Keep editing\")\n onClicked: if (keepEditingButton.pressedPrompt) keepEditingButton.pressedPrompt.answer(TextEditClosePrompt.KeepEditing)\n }\n NeutralButton {\n id: discardAndCloseButton\n objectName: \"addressNoteDiscardAndCloseButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: discardAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Discard\")\n onClicked: if (discardAndCloseButton.pressedPrompt) discardAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Discard)\n }\n PrimaryButton {\n id: saveAndCloseButton\n objectName: \"addressNoteSaveAndCloseButton\"\n Layout.fillWidth: true\n property TextEditClosePrompt pressedPrompt: null\n onPressed: saveAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Save\")\n enabled: root.editor !== null && root.editor.valid && !root.editor.conflict && !root.editor.busy\n onClicked: if (saveAndCloseButton.pressedPrompt) saveAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Save)\n }\n }\n }\n }\n Keys.onEscapePressed: function(event) {\n if (root.editor) root.editor.requestClose()\n else root.closeRequested()\n event.accepted = true\n }\n\n PrimaryButton {\n objectName: \"addressDetailsCreatePaymentRequestButton\"\n Layout.fillWidth: true",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Receive keeps a refused address type hidden after descriptor importqml/walletopening.cpp | unclear | AssessmentThe diff is truncated before any relevant invalidation or re-probe of the unavailable receive-type cache can be confirmed. The supplied new-head excerpt shows the cache is still consulted, but does not establish whether the capability-change notification now clears or refreshes it. path_diff: qml/walletopening.cpp; new_source: qml/walletopening.cpp [
{
"evidence_id": "bfa1f69783a44f828b8bedab86f95176",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/walletopening.cpp",
"source_generation": 13,
"source_job_id": 2941,
"text": "diff --git a/qml/walletopening.cpp b/qml/walletopening.cpp\nindex 4386af6572..3d26d7a3c1 100644\n--- a/qml/walletopening.cpp\n+++ b/qml/walletopening.cpp\n@@ -3,6 +3,8 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/walletopening.h>\n+#include <qml/executor.h>\n+#include <qml/retainedvalue.h>\n \n #include <common/args.h>\n #include <interfaces/chain.h>\n@@ -11,19 +13,23 @@\n #include <univalue.h>\n \n #include <algorithm>\n+#include <cassert>\n+#include <exception>\n #include <stdexcept>\n #include <utility>\n \n namespace walletopening {\n struct Session::Resources {\n- std::shared_ptr<interfaces::Wallet> wallet;\n+ std::unique_ptr<interfaces::Wallet> wallet;\n+ std::shared_ptr<interfaces::Wallet> shared_wallet;\n+ std::unique_ptr<interfaces::Handler> unload_handler;\n std::vector<std::unique_ptr<interfaces::Handler>> handlers;\n+ bool acquired{false};\n+\n+ interfaces::Wallet* get() const { return wallet ? wallet.get() : shared_wallet.get(); }\n };\n+\n namespace {\n-struct Borrower {\n- execution::ResourceLease lease;\n- std::shared_ptr<interfaces::Wallet> wallet;\n-};\n Metadata ReadMetadata(interfaces::Wallet& wallet, const Session::Preferences& preferences, std::vector<std::string> unavailable_receive_types)\n {\n auto name = wallet.getWalletName();\n@@ -38,50 +44,96 @@ Metadata ReadMetadata(interfaces::Wallet& wallet, const Session::Preferences& pr\n return {std::move(name), wallet.privateKeysDisabled(), wallet.hasExternalSigner(), wallet.isCrypted(), wallet.isLocked(),\n wallet.canGetAddresses(), wallet.taprootEnabled(), std::move(saved), std::move(configured), std::move(unavailable_receive_types)};\n }\n+\n+execution::SubmitResult PostUtility(execution::SerialQueue& queue, std::function<void()> work)\n+{\n+ const bool accepted = queue.post([work = std::move(work)] {\n+ // These turns have no outcome callback. A failed turn must still\n+ // leave the worker available for the next one.\n+ try {\n+ work();\n+ } catch (...) {}\n+ });\n+ return {{}, accepted ? execution::Rejection::None : execution::Rejection::Transport};\n+}\n }\n \n-Session::Session(std::shared_ptr<execution::Scheduler> commands,\n- std::shared_ptr<execution::Scheduler> retirement,\n- std::shared_ptr<std::atomic_bool> closed, Notify notify, Preferences preferences, Clock clock, std::shared_ptr<std::atomic_bool> shutdown_gate, NativeEvents native_events)\n- : m_commands(std::move(commands)), m_retirement(std::move(retirement)),\n- m_command_key(m_commands->allocateKey()), m_retirement_key(m_retirement->allocateKey()),\n- m_closed(std::move(closed)), m_shutdown_gate(std::move(shutdown_gate)), m_notify(std::move(notify)), m_preferences(std::move(preferences)), m_clock(std::move(clock)), m_native_events(std::move(native_events)), m_resources(std::make_shared<Resources>())\n+Session::Session(std::shared_ptr<std::atomic_bool> closed, Notify notify, Preferences preferences, Clock clock,\n+ std::shared_ptr<std::atomic_bool> shutdown_gate, NativeEvents native_events, Queues queues)\n+ : m_closed(std::move(closed)), m_shutdown_gate(std::move(shutdown_gate)), m_notify(std::move(notify)), m_preferences(std::move(preferences)), m_clock(std::move(clock)), m_native_events(std::move(native_events)),\n+ m_cleanup_queue(std::move(queues.cleanup)), m_core_queue(std::move(queues.core)), m_outcomes(std::move(queues.outcomes)),\n+ m_value_cleanup(std::make_shared<execution::ValueCleanupQueue>(m_cleanup_queue)),\n+ m_native_cleanup(std::make_shared<execution::ValueCleanupQueue>(queues.native_cleanup ? queues.native_cleanup : m_cleanup_queue)),\n+ m_outcome_delivery(std::make_shared<execution::ValueCleanupQueue>(m_outcomes)),\n+ m_stop_work(std::move(queues.stop_work))\n {\n+ assert(m_cleanup_queue && m_core_queue && m_outcomes && m_stop_work);\n }\n \n Session::Start Session::start(const std::shared_ptr<interfaces::Wallet>& wallet)\n {\n- {\n- std::lock_guard lock{m_mutex};\n- if (std::exchange(m_started, true)) return {{{}, execution::Rejection::Invalid}, {}};\n- }\n+ return startWith([&](Resources& resources) { resources.shared_wallet = wallet; });\n+}\n+\n+Session::Start Session::start(std::unique_ptr<interfaces::Wallet>& wallet, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ return startWith([&](Resources& resources) {\n+ resources.wallet = std::move(wallet);\n+ resources.unload_handler = std::move(unload_handler);\n+ });\n+}\n+\n+Session::Start Session::start(Source& source, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ if (auto* wallet = std::get_if<std::unique_ptr<interfaces::Wallet>>(&source)) return start(*wallet, unload_handler);\n+ auto& wallet = std::get<std::shared_ptr<interfaces::Wallet>>(source);\n+ return startWith([&](Resources& resources) {\n+ resources.shared_wallet = std::move(wallet);\n+ resources.unload_handler = std::move(unload_handler);\n+ });\n+}\n+\n+void Session::retireUnclaimed(Source& source, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ struct UnclaimedWallet {\n+ Source source;\n+ std::unique_ptr<interfaces::Handler> handler;\n+\n+ ~UnclaimedWallet()\n+ {\n+ try {\n+ if (handler) handler->disconnect();\n+ } catch (...) {\n+ // Release both handles even when disconnection fails.\n+ }\n+ }\n+ };\n+ const auto make = [] { return std::make_unique<UnclaimedWallet>(); };\n+ const auto unused = walletopening::RetainValues<UnclaimedWallet>(shared_from_this(), make);\n+ if (!unused) std::terminate();\n+ unused->source = std::move(source);\n+ unused->handler = std::move(unload_handler);\n+}\n+\n+Session::Start Session::startWith(const std::function<void(Resources&)>& acquire)\n+{\n const auto self = shared_from_this();\n- const auto cleanup = execution::Submit(*m_retirement, [self] { return self->cleanup(); }, [self](bool failed) {\n- self->m_drained = true;\n- Update update; update.phase = Phase::Closed; update.failed = failed;\n- self->publish(std::move(update));\n- }, {}, {execution::Lane::Cleanup, m_retirement_key}, true);\n- if (!cleanup) {\n- m_closed->store(true);\n- m_drained = true;\n- Update failed; failed.phase = Phase::Closed; failed.failed = true; publish(std::move(failed));\n- return {cleanup, {}};\n- }\n+ std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{m_mutex};\n- m_cleanup = cleanup.id;\n- }\n- // Pin initialization before acquiring a native resource. A concurrent\n- // retirement-root shutdown may activate its reservation immediately.\n- auto initialization = m_retirement->borrow(m_retirement_key);\n- if (!initialization) {\n- retire();\n- return {{{}, initialization.rejection}, {}};\n- }\n- {\n- std::lock_guard lock{m_mutex};\n- m_resources->wallet = wallet;\n+ if (m_started) return {{{}, execution::Rejection::Invalid}, {}};\n+ if (m_drained || m_closed->load()) return {{{}, execution::Rejection::Closed}, {}};\n+ auto native = std::make_shared<Resources>();\n+ auto hold = m_native_cleanup->hold([self, native] {\n+ if (native->acquired) self->completeStop(self->cleanup(*native));\n+ });\n+ if (!hold) return {{{}, execution::Rejection::Closed}, {}};\n+ resources = std::shared_ptr<Resources>{std::move(hold), native.get()};\n+ acquire(*resources);\n+ resources->acquired = true;\n+ m_resources = resources;\n m_refresh_pending = true;\n+ m_started = true;\n }\n auto client = borrow();\n const auto admitted = read([self](interfaces::Wallet& value) {\n@@ -115,17 +167,14 @@ Session::Start Session::start(const std::shared_ptr<interfaces::Wallet>& wallet)\n std::shared_ptr<interfaces::Wallet> Session::borrow() const\n {\n std::lock_guard lock{m_mutex};\n- if (!observationOpen() || !m_resources->wallet) return {};\n- auto borrowed = m_retirement->borrow(m_retirement_key);\n- if (!borrowed) return {};\n- auto owner = std::make_shared<Borrower>(Borrower{std::move(*borrowed.lease), m_resources->wallet});\n- return {std::move(owner), m_resources->wallet.get()};\n+ if (!observationOpen() || !m_resources || !m_resources->get()) return {};\n+ return {m_resources, m_resources->get()};\n }\n \n void Session::close()\n {\n std::lock_guard lock{m_mutex};\n- m_admission_closed.store(true);\n+ m_actions_closed.store(true);\n m_source_epoch->closed.store(true);\n }\n \n@@ -139,34 +188,58 @@ bool Session::admitAction()\n \n bool Session::control(std::function<void()> effect)\n {\n- return bool(execution::Submit(*m_commands, [] {}, std::move(effect), {},\n- {execution::Lane::Control, m_command_key}));\n+ return bool(PostUtility(*m_outcomes, std::move(effect)));\n }\n \n-execution::Admission Session::postDomain(std::function<void()> work, execution::WorkClass kind)\n+execution::SubmitResult Session::postDomain(std::function<void()> work, execution::WorkClass kind)\n {\n if (kind == execution::WorkClass::Action ? !admitAction() : !available()) return {{}, execution::Rejection::Closed};\n const auto self = shared_from_this();\n- return execution::Submit(*m_commands, [self, work = std::move(work), kind] {\n+ auto run = [self, work = std::move(work), kind] {\n // Accepted command planning must consume its outcome even after close.\n if (kind == execution::WorkClass::Action || self->available()) work();\n- }, [] {}, {}, {execution::Lane::Domain, m_command_key, kind});\n+ };\n+ return PostUtility(*m_outcomes, std::move(run));\n }\n \n-execution::Admission Session::retireValues(std::function<void()> work)\n+execution::SubmitResult Session::postDomainTask(std::shared_ptr<execution::Task> packet, execution::WorkClass)\n {\n- return execution::Submit(*m_commands, std::move(work), [] {}, {},\n- {execution::Lane::Cleanup, {}, execution::WorkClass::Action});\n+ if (!observationOpen()) return {{}, execution::Rejection::Closed};\n+ return PostUtility(*m_outcomes, [packet = std::move(packet)] {\n+ packet->execute();\n+ packet->deliver();\n+ });\n }\n \n-execution::BorrowAdmission Session::holdValues(std::function<void()> cleanup)\n+std::function<execution::SubmitResult(std::shared_ptr<execution::Task>)> Session::observationPost(\n+ execution::Lane lane)\n {\n- const auto key = m_commands->allocateKey();\n- const auto reserved = execution::Submit(*m_commands, std::move(cleanup), [] {}, {},\n- {execution::Lane::Cleanup, key, execution::WorkClass::Action}, true);\n- if (!reserved) return {{}, reserved.rejection};\n- auto held = m_commands->borrow(key);\n- m_commands->activateCleanup(reserved.id);\n+ assert(lane == execution::Lane::Core || lane == execution::Lane::Domain);\n+ return [self = shared_from_this(), lane](std::shared_ptr<execution::Task> packet) {\n+ if (lane == execution::Lane::Domain) return self->postDomainTask(std::move(packet), execution::WorkClass::Observation);\n+ if (!self->observationOpen()) return execution::SubmitResult{{}, execution::Rejection::Closed};\n+ return self->postCore(std::move(packet));\n+ };\n+}\n+\n+execution::SubmitResult Session::retireValues(std::function<void()> work)\n+{\n+ return PostUtility(*m_outcomes, std::move(work));\n+}\n+\n+std::shared_ptr<void> Session::holdValues(std::function<void()> cleanup)\n+{\n+ // A rejected callback can release an action and reenter releaseWork().\n+ // Keep its captures alive until the admission lock has been released.\n+ auto retire = std::make_shared<Notify>(std::move(cleanup));\n+ std::lock_guard lock{m_mutex};\n+ if (m_stop_requested) return {};\n+ auto held = m_value_cleanup->hold([self = shared_from_this(), retire] {\n+ try { (*retire)(); } catch (...) {}\n+ *retire = {};\n+ self->releaseWork();\n+ });\n+ if (held) ++m_work_references;\n return held;\n }\n \n@@ -185,46 +258,54 @@ std::function<bool()> Session::observationGuard() const\n };\n }\n \n+Session::Action::~Action()\n+{\n+ if (m_owner) m_owner->releaseWork();\n+}\n+\n std::shared_ptr<const Session::Action> Session::startAction()\n {\n- auto scope = m_commands->openActionScope();\n- if (!scope) return {};\n- execution::ResourceKey work_key;\n- try { work_key = m_commands->allocateKey(); } catch (...) { return {}; }\n- if (!admitAction()) return {};\n- auto wallet = borrow();\n- if (!wallet) return {};\n- return std::shared_ptr<const Action>{new Action{m_identity, std::move(scope), work_key, std::move(wallet)}};\n+ auto action = std::shared_ptr<Action>{new Action{m_identity}};\n+ std::lock_guard lock{m_mutex};\n+ if (!available() || !m_resources || !m_resources->get()) return {};\n+ action->m_owner = shared_from_this();\n+ ++m_work_references;\n+ ++m_consequences;\n+ return action;\n }\n \n-execution::Admission Session::submitActionWork(const std::shared_ptr<const Action>& action,\n- std::function<void()> work)\n+void Session::releaseWork()\n {\n- if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Core, action->m_work_key, execution::WorkClass::Action});\n+ std::function<void(Notify)> stop_work;\n+ {\n+ std::lock_guard lock{m_mutex};\n+ assert(m_work_references > 0);\n+ if (--m_work_references == 0 && m_stop_requested) stop_work = std::exchange(m_stop_work, {});\n+ }\n+ if (stop_work) drainWork(std::move(stop_work));\n }\n \n-execution::Admission Session::reserveActionCleanup(const std::shared_ptr<const Action>& action,\n- std::function<void()> work)\n+interfaces::Wallet& Session::nativeWallet() const\n {\n- if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Cleanup, action->m_work_key, execution::WorkClass::Action}, true);\n+ std::lock_guard lock{m_mutex};\n+ auto* wallet = m_resources ? m_resources->get() : nullptr;\n+ if (!wallet) throw std::logic_error{\"The wallet opening has no native wallet\"};\n+ return *wallet;\n }\n \n-bool Session::activateActionCleanup(const std::shared_ptr<const Action>& action, execution::TaskId id)\n+execution::SubmitResult Session::postCore(std::shared_ptr<execution::Task> packet)\n {\n- if (!action || action->m_identity != m_identity) return false;\n- return action->m_scope->activateCleanup(id);\n+ // Reserve Utility delivery before admitting Core work. A rejected Core\n+ // submission releases the reservation with no completed packet.\n+ return m_outcome_delivery->postWithOutcome(*m_core_queue, std::move(packet));\n }\n \n-execution::Admission Session::planAction(const std::shared_ptr<const Action>& action,\n+execution::SubmitResult Session::planAction(const std::shared_ptr<const Action>& action,\n std::function<void()> work)\n {\n if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Domain, m_command_key, execution::WorkClass::Action});\n+ auto run = [action, work = std::move(work)] { work(); };\n+ return PostUtility(*m_outcomes, std::move(run));\n }\n \n void Session::onTransactions(Transactions consumer)\n@@ -278,29 +359,79 @@ void Session::answerClose(Question question, bool accept)\n \n void Session::retire(bool remove_wallet)\n {\n- std::optional<execution::TaskId> cleanup;\n+ // Native ingress can report an unload while the facade still needs to\n+ // stop its producers. The facade calls stop() after that handoff.\n+ std::lock_guard lock{m_mutex};\n+ m_closed->store(true);\n+ m_remove |= remove_wallet;\n+ m_pending = {};\n+}\n+\n+void Session::stop(bool remove_wallet, Notify done)\n+{\n+ std::function<void(Notify)> stop_work;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_remove |= remove_wallet;\n- cleanup = m_cleanup;\n m_pending = {};\n+ if (!m_drained) {\n+ if (done) m_stop_callbacks.push_back(std::exchange(done, {}));\n+ m_stop_requested = true;\n+ // Accepted actions can still schedule follow-ups, and retained\n+ // values can still post their final cleanup on Utility.\n+ if (m_work_references == 0) stop_work = std::exchange(m_stop_work, {});\n+ }\n }\n- if (cleanup) m_retirement->activateCleanup(*cleanup);\n+ if (stop_work) drainWork(std::move(stop_work));\n+ if (done) done();\n }\n \n-bool Session::cleanup()\n+void Session::drainWork(std::function<void(Notify)> stop_work)\n+{\n+ stop_work([self = shared_from_this()] {\n+ std::shared_ptr<Resources> resources;\n+ {\n+ std::lock_guard lock{self->m_mutex};\n+ resources = std::move(self->m_resources);\n+ }\n+ if (!resources) self->completeStop(false);\n+ // The last borrower releases the wallet on its cleanup worker.\n+ });\n+}\n+\n+void Session::completeStop(bool failed)\n+{\n+ std::vector<Notify> callbacks;\n+ {\n+ std::lock_guard lock{m_mutex};\n+ m_closed->store(true);\n+ m_drained = true;\n+ callbacks.swap(m_stop_callbacks);\n+ }\n+ Update update;\n+ update.phase = Phase::Closed;\n+ update.failed = failed;\n+ publish(std::move(update));\n+ for (const auto& callback : callbacks) callback();\n+}\n+\n+bool Session::cleanup(Resources& resources)\n {\n m_closed->store(true);\n bool failed{false};\n- for (auto& handler : m_resources->handlers) {\n+ for (auto& handler : resources.handlers) {\n try { if (handler) handler->disconnect(); } catch (...) { failed = true; }\n }\n- m_resources->handlers.clear();\n+ resources.handlers.clear();\n bool remove;\n { std::lock_guard lock{m_mutex}; remove = m_remove; }\n- try { if (m_resources->wallet && remove) m_resources->wallet->remove(); } catch (...) { failed = true; }\n- m_resources->wallet.reset();\n+ try { if (auto* wallet = resources.get(); wallet && remove) wallet->remove(); } catch (...) { failed = true; }\n+ // The original load observation records the removal before disconnecting.\n+ try { if (resources.unload_handler) resources.unload_handler->disconnect(); } catch (...) { failed = true; }\n+ resources.unload_handler.reset();\n+ resources.wallet.reset();\n+ resources.shared_wallet.reset();\n return failed;\n }\n \n@@ -308,7 +439,11 @@ void Session::ingress(int kind, const Txid& txid, ChangeType change)\n {\n m_source_epoch->advance();\n if (kind == 3) m_native_events.observeUnload();\n- auto callback_lifetime = m_retirement->borrow(m_retirement_key);\n+ std::shared_ptr<Resources> resources;\n+ {\n+ std::lock_guard lock{m_mutex};\n+ resources = m_resources;\n+ }\n if (kind == 3) {\n retire();\n Update closing; closing.unloaded = true; closing.phase = Phase::Closing;\n@@ -322,7 +457,7 @@ void Session::ingress(int kind, const Txid& txid, ChangeType change)\n });\n return;\n }\n- if (!callback_lifetime) {\n+ if (!resources) {\n if (available()) { retire(); Update failed; failed.failed = true; publish(std::move(failed)); }\n return;\n }\n@@ -414,7 +549,7 @@ std::vector<std::string> Session::unavailableReceiveTypes() const\n return ids;\n }\n \n-execution::Admission Session::setReceivePreference(std::string type, std::shared_ptr<const Action> original, std::functi\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 524,
"evidence_id": "d759ae6e52fa4aaea8ebc349db8c1ea0",
"finding_id": "finding:7",
"kind": "new_source",
"line": 375,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/walletopening.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 13,
"source_job_id": 2941,
"text": " m_closed->store(true);\n m_remove |= remove_wallet;\n m_pending = {};\n if (!m_drained) {\n if (done) m_stop_callbacks.push_back(std::exchange(done, {}));\n m_stop_requested = true;\n // Accepted actions can still schedule follow-ups, and retained\n // values can still post their final cleanup on Utility.\n if (m_work_references == 0) stop_work = std::exchange(m_stop_work, {});\n }\n }\n if (stop_work) drainWork(std::move(stop_work));\n if (done) done();\n}\n\nvoid Session::drainWork(std::function<void(Notify)> stop_work)\n{\n stop_work([self = shared_from_this()] {\n std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{self->m_mutex};\n resources = std::move(self->m_resources);\n }\n if (!resources) self->completeStop(false);\n // The last borrower releases the wallet on its cleanup worker.\n });\n}\n\nvoid Session::completeStop(bool failed)\n{\n std::vector<Notify> callbacks;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_drained = true;\n callbacks.swap(m_stop_callbacks);\n }\n Update update;\n update.phase = Phase::Closed;\n update.failed = failed;\n publish(std::move(update));\n for (const auto& callback : callbacks) callback();\n}\n\nbool Session::cleanup(Resources& resources)\n{\n m_closed->store(true);\n bool failed{false};\n for (auto& handler : resources.handlers) {\n try { if (handler) handler->disconnect(); } catch (...) { failed = true; }\n }\n resources.handlers.clear();\n bool remove;\n { std::lock_guard lock{m_mutex}; remove = m_remove; }\n try { if (auto* wallet = resources.get(); wallet && remove) wallet->remove(); } catch (...) { failed = true; }\n // The original load observation records the removal before disconnecting.\n try { if (resources.unload_handler) resources.unload_handler->disconnect(); } catch (...) { failed = true; }\n resources.unload_handler.reset();\n resources.wallet.reset();\n resources.shared_wallet.reset();\n return failed;\n}\n\nvoid Session::ingress(int kind, const Txid& txid, ChangeType change)\n{\n m_source_epoch->advance();\n if (kind == 3) m_native_events.observeUnload();\n std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{m_mutex};\n resources = m_resources;\n }\n if (kind == 3) {\n retire();\n Update closing; closing.unloaded = true; closing.phase = Phase::Closing;\n publish(std::move(closing));\n const auto self = shared_from_this();\n control([self] {\n self->m_state.retire();\n Update update; update.unloaded = true;\n update.phase = self->m_state.phase();\n self->publish(std::move(update));\n });\n return;\n }\n if (!resources) {\n if (available()) { retire(); Update failed; failed.failed = true; publish(std::move(failed)); }\n return;\n }\n {\n std::lock_guard lock{m_mutex};\n if (!observationOpen()) return;\n if (kind == 4) m_metadata_dirty = true;\n else if (kind == 0) m_pending.status = true;\n else if (kind == 1) m_pending.addresses = true;\n else {\n m_transactions_pending = true;\n m_pending.transaction_revision = ++m_transaction_revision;\n if (m_pending.transactions.size() < 256 || m_pending.transactions.contains(txid)) m_pending.transactions[txid] = change;\n else m_pending.rescan = true;\n }\n }\n scheduleRefresh();\n}\n\nvoid Session::scheduleRefresh()\n{\n Update events;\n {\n std::lock_guard lock{m_mutex};\n if (!observationOpen() || m_refresh_pending || m_clock() < m_retry_after) return;\n if (!m_metadata_dirty && !m_pending.status && !m_pending.addresses && !m_pending.rescan && m_pending.transactions.empty()) return;\n m_refresh_pending = true;\n events = std::exchange(m_pending, {});\n m_metadata_dirty = false;\n }\n const auto self = shared_from_this();\n const bool transactions = events.rescan || !events.transactions.empty();\n const auto admitted = read([self](interfaces::Wallet& wallet) { return ReadMetadata(wallet, self->m_preferences, self->unavailableReceiveTypes()); },\n [self, events = std::move(events)](Metadata metadata) mutable { self->refreshed(std::move(metadata), std::move(events)); },\n [self, transactions](std::exception_ptr) { self->refreshFailed(transactions); }, execution::WorkClass::Observation);\n if (!admitted) refreshFailed(transactions);\n}\n\nvoid Session::refreshFailed(bool transactions)\n{\n {\n std::lock_guard lock{m_mutex};\n m_refresh_pending = false;\n if (!observationOpen()) return;\n // Reconcile a failed/undelivered notice instead of dropping its\n // consequences. Retry only after the bounded backoff, on a new notice\n // or an explicit clock tick; never spin on admission failure.\n m_pending.status = m_pending.addresses = true;\n m_pending.rescan |= transactions;\n if (transactions) m_pending.transaction_revision = m_transaction_revision;\n m_retry_after = m_clock() + std::chrono::seconds{std::min(30U, 1U << m_refresh_failures)};\n m_refresh_failures = std::min(5U, m_refresh_failures + 1);\n }\n Update update; update.failed = true; publish(std::move(update));\n}\n\nOutputType Session::preferredReceiveType(interfaces::Wallet& wallet) const\n{\n const auto saved = m_preferences.read ? m_preferences.read(wallet.getWalletName()) : std::string{};\n const auto parsed = ParseOutputType(saved);\n // A saved choice wins, then an explicit -addresstype, then Taproot, the\n // app's own default (#932, #1137). Core's implicit default is not used.\n const OutputType preferred = parsed ? *parsed\n : gArgs.IsArgSet(\"-addresstype\") ? wallet.getDefaultAddressType()",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | PSBT readiness omits the fee caps enforced by node submissionqml/psbtpolicy.cpp | unclear | AssessmentThe supplied new-head psbtpolicy excerpt adds fee-cap handling, but does not show whether a refused deletion-editor admission is recorded in RequestDeleteController state or exposed and cleared as requested. The controller's new source is unavailable. new_source: qml/psbtpolicy.cpp [
{
"bounded": true,
"end_line": 153,
"evidence_id": "948bbed6eb4c401ba1baf54db78a781d",
"finding_id": "finding:6",
"kind": "new_source",
"line": 4,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/psbtpolicy.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 13,
"source_job_id": 2941,
"text": "\n#include <qml/psbtpolicy.h>\n#include <qml/bitcoinunits.h>\n\n#include <coins.h>\n#include <consensus/consensus.h>\n#include <consensus/tx_verify.h>\n#include <core_io.h>\n#include <interfaces/chain.h>\n#include <interfaces/node.h>\n#include <policy/policy.h>\n#include <univalue.h>\n#include <util/result.h>\n\n#include <QCoreApplication>\n\n#include <algorithm>\n#include <limits>\n#include <map>\n#include <utility>\n\nnamespace {\nQString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n\nvoid ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts, bool enforce_raw_fee_cap)\n{\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n // Raw PSBT broadcasts pass MAX_FEE_RATE to broadcastTransaction; wallet\n // sends and fee bumps already checked the wallet's own -maxtxfee limit.\n parameters.push_back(enforce_raw_fee_cap ? ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()) : UniValue{0});\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n if (!result.isObject() || !result.exists(\"txid\") || !result[\"txid\"].isStr()\n || !result.exists(\"wtxid\") || !result[\"wtxid\"].isStr()\n || result[\"txid\"].get_str() != transaction.GetHash().ToString()\n || result[\"wtxid\"].get_str() != transaction.GetWitnessHash().ToString()\n || !result.exists(\"allowed\") || !result[\"allowed\"].isBool()) return;\n\n const bool allowed = result[\"allowed\"].get_bool();\n QString reason;\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n // An allowed conflict is a replacement. Name what it evicts; until the\n // lookup completes, the review must not imply that nothing is evicted.\n facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n outpoint.pushKV(\"txid\", input.prevout.hash.GetHex());\n outpoint.pushKV(\"vout\", uint64_t{input.prevout.n});\n outpoints.push_back(std::move(outpoint));\n }\n UniValue spending_parameters{UniValue::VARR};\n spending_parameters.push_back(std::move(outpoints));\n const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n if (!spending.isArray()) return;\n for (const auto& item : spending.getValues()) {\n if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n}\n\nvoid ClearChainFacts(psbtpolicy::Facts& facts)\n{\n facts.observed = false;\n facts.missing_inputs = false;\n facts.immature_inputs = false;\n facts.final = true;\n facts.sufficient_fee = true;\n facts.chain_limits = true;\n facts.tip.clear();\n facts.chain_error.clear();\n}\n\nvoid ClearAdmissionFacts(psbtpolicy::Facts& facts)\n{\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n facts.replaces_unknown = false;\n}\n} // namespace\n\npsbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain, bool enforce_raw_fee_cap)\n{\n return [node, chain, enforce_raw_fee_cap](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n facts.within_fee_cap = !enforce_raw_fee_cap || !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n int height{-1}; int64_t mtp{0}; bool active{false};\n if (chain->findBlock(tip, interfaces::FoundBlock{}.height(height).mtpTime(mtp).inActiveChain(active))\n && active && height >= 0 && height < std::numeric_limits<int>::max()) {\n std::map<COutPoint, Coin> coins;\n for (const auto& input : transaction->vin) coins.try_emplace(input.prevout);\n chain->findCoins(coins); // Includes available mempool parents.\n for (const auto& [outpoint, coin] : coins) {\n facts.missing_inputs |= coin.IsSpent();\n facts.immature_inputs |= !coin.IsSpent() && coin.IsCoinBase()\n && int64_t(height) + 1 - coin.nHeight < COINBASE_MATURITY;\n }\n facts.final = IsFinalTx(*transaction, height + 1, mtp);\n const auto minimum = std::max(chain->mempoolMinFee(), chain->relayMinFee());\n facts.sufficient_fee = fee >= minimum.GetFee(GetVirtualTransactionSize(*transaction));\n const auto limits = chain->checkChainLimits(transaction);\n facts.chain_limits = bool(limits);\n if (!limits) facts.chain_error = QString::fromStdString(util::ErrorString(limits).translated).left(4096);\n // A reorg during this collection invalidates the whole observation.\n if (node->getBestBlockHash() == tip) {\n facts.tip = QString::fromStdString(tip.ToString());\n facts.observed = true;\n } else {\n ClearChainFacts(facts);\n }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The additive cluster check blocks otherwise acceptable replacementsqml/psbtpolicy.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A definite fee-bump refusal leaves Speed Up stuck in Uncertainqml/walletbump.cpp | still_present | AssessmentThe new-head walletbump excerpt still treats a false commitBumpTransaction result as Error::Commit, and the shown outcome handling does not establish that this definite refusal avoids the Uncertain state. new_source: qml/walletbump.cpp [
{
"bounded": true,
"end_line": 228,
"evidence_id": "d72e2314c77f4cc6a3df94b37b27715e",
"finding_id": "finding:4",
"kind": "new_source",
"line": 180,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/walletbump.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 13,
"source_job_id": 2941,
"text": " if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n }\n if (const auto scope_error = CheckApprovedScope(wallet, review); scope_error != Error::None) {\n result.error = scope_error; return finishAfterRelock();\n }\n // No further key operation is needed. Restore authorization before\n // commit, and never publish a successful spend with failed restoration.\n restoreWalletLock(); passphrase.reset();\n if (result.relock_failed) return result;\n if (services.admission) {\n const auto exact = MakeTransactionRef(signed_tx);\n const auto decision = psbtpolicy::Evaluate(services.admission(exact, review.new_fee));\n if (decision.state == psbtpolicy::State::Blocked) {\n result.error = Error::Policy;\n result.message = decision.explanation;\n return result;\n }\n }\n std::vector<bilingual_str> errors;\n Txid txid;\n const CTransaction exact{signed_tx};\n result.candidate_txid = exact.GetHash();\n result.candidate_wtxid = exact.GetWitnessHash();\n result.commit_attempted = true;\n if (!wallet.commitBumpTransaction(review.original, std::move(signed_tx), errors, txid)) {\n result.error = Error::Commit; result.message = Message(errors); return result;\n }\n result.txid = txid;\n result.committed = true;\n Observe(wallet, result);\n } catch (const secretinput::Failure&) {\n result.error = Error::Invalid; result.message = QObject::tr(\"The wallet password could not be prepared. No fee bump was submitted.\");\n } catch (...) { result.error = Error::Uncertain; }\n return finishAfterRelock();\n}\nCommit ObserveOutcome(interfaces::Wallet& wallet, const Commit& original)\n{\n auto result = original;\n result.record = Record::Unknown;\n result.submission = Submission::Unknown;\n if (!original.commit_attempted || original.candidate_txid == Txid{}) return result;\n result.txid = original.candidate_txid;\n Observe(wallet, result, true);\n // Observing a record cannot manufacture the original call's missing\n // persistence/replacement-metadata receipt. Keep its uncertainty explicit.\n return result;\n}\n} // namespace walletbump",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Open PSBT rejects files above 4 MiB that the app can exportqml/paymentimport.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Pre-creating /tmp/qml-intent-<uid> can prevent GUI startupqml/desktopintenttransport.cpp | addressed | AssessmentInitialization now places the transport directory beneath QStandardPaths::RuntimeLocation rather than the attacker-creatable fixed /tmp/qml-intent-<uid> path, addressing the described shared-/tmp pre-creation failure. path_diff: qml/desktopintenttransport.cpp; new_source: qml/desktopintenttransport.cpp [
{
"evidence_id": "0b3d93f0d1be463a81c6082ee96b48c3",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/desktopintenttransport.cpp",
"source_generation": 13,
"source_job_id": 2941,
"text": "diff --git a/qml/desktopintenttransport.cpp b/qml/desktopintenttransport.cpp\nindex 1bd50cb0e9..df095f879a 100644\n--- a/qml/desktopintenttransport.cpp\n+++ b/qml/desktopintenttransport.cpp\n@@ -2,7 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/desktopintenttransport.h>\n-#include <qml/retainedvalue.h>\n+#include <qml/asyncjoin.h>\n #include <util/fs.h>\n \n #include <QCoreApplication>\n@@ -17,6 +17,8 @@\n #include <QLocalSocket>\n #include <QLockFile>\n #include <QMetaObject>\n+#include <QScopeGuard>\n+#include <QStandardPaths>\n #include <QStringList>\n #include <QThread>\n #include <QTimer>\n@@ -196,25 +198,26 @@ struct Discovery {\n struct Service::Flags {\n std::atomic_bool admission_closed{false}, stopping{false}, started{false}, retired{false};\n std::mutex mutex;\n- execution::TaskId retired_task;\n- std::function<void()> completed_stop;\n+ std::vector<std::function<void()>> completed_stops;\n bool probed{false}, probe_pending{false}, probe_terminal{false}; // Protected by mutex.\n };\n struct Service::State {\n struct Native;\n- std::shared_ptr<execution::Scheduler> scope;\n std::shared_ptr<Owner> owner;\n Limits limits;\n- execution::ResourceKey key;\n const std::shared_ptr<Flags> flags{std::make_shared<Flags>()};\n- std::shared_ptr<execution::ResourceLease> native_lifetime;\n- std::mutex mutex;\n+ // The same lock protects admission, pending delivery and the receiver\n+ // used to post work to the transport thread.\n Native* native{nullptr};\n+ size_t pending_deliveries{0};\n+ bool post(std::function<void(Native&)> work);\n+ void finishDelivery();\n+ void retireWhenIdle();\n };\n \n struct Service::State::Native final : QObject {\n struct Query { QJsonArray results; QStringList keys; size_t remaining{0}; bool unknown{false}; };\n- struct Reply { std::optional<desktopintent::Admission> admission; std::optional<Receipt> receipt; };\n+ struct Reply { std::optional<desktopintent::Acceptance> admission; std::optional<Receipt> receipt; };\n struct Cell {\n std::mutex mutex;\n QObject* receiver{nullptr}; std::function<void()> notify;\n@@ -230,7 +233,7 @@ struct Service::State::Native final : QObject {\n };\n struct Pending { uint64_t connection; std::shared_ptr<Cell> cell; std::shared_ptr<Query> query{}; qsizetype index{0}; QStringList keys{}; };\n const std::shared_ptr<State> state;\n- QLocalServer server;\n+ QLocalServer server{this};\n std::unique_ptr<QLockFile> instance_lock;\n struct Client { QLocalSocket* socket; Limits::Time admitted; };\n std::map<uint64_t, Client> clients;\n@@ -306,7 +309,7 @@ struct Service::State::Native final : QObject {\n QStringList keys; for (const auto& input : inputs) keys.push_back(input.producer_key);\n const auto cell = reserve(id, {}, 0, std::move(keys)); if (!cell) { send(id, {{\"status\", \"rejected\"}}); return; }\n const auto admitted = state->owner->admit(std::move(inputs), [cell](auto result) { cell->complete({std::move(result), {}}); });\n- if (!admitted) cell->complete({desktopintent::Admission{Error::Closed, {}}, {}});\n+ if (!admitted) cell->complete({desktopintent::Acceptance{Error::Closed, {}}, {}});\n } else if (command == \"query\") {\n const auto keys = object.value(\"keys\").toArray();\n if (keys.empty() || keys.size() > static_cast<qsizetype>(Queue::MAX_PENDING) || replies.size() + static_cast<size_t>(keys.size()) > MAX_REPLIES) { socket->abort(); return; }\n@@ -351,17 +354,19 @@ struct Service::State::Native final : QObject {\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n- std::shared_ptr<execution::ResourceLease> lifetime;\n- { std::lock_guard lock{state->mutex}; state->native = nullptr; lifetime = std::move(state->native_lifetime); }\n- delete this;\n- lifetime.reset(); // Only now may the original Native event loop drain.\n+ QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n #ifndef Q_OS_WIN\n- private_directory = QDir{QStringLiteral(\"/tmp\")}.filePath(QStringLiteral(\"qml-intent-%1\").arg(getuid()));\n+ // The runtime directory belongs to this user (Qt checks its owner and\n+ // mode). A fixed name in the shared /tmp could be created first by\n+ // another user, which would block delivery for this one.\n+ const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n+ if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n+ private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n@@ -440,37 +445,83 @@ struct Service::State::Native final : QObject {\n }\n };\n \n+bool Service::State::post(std::function<void(Native&)> work)\n+{\n+ std::lock_guard lock{flags->mutex};\n+ return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n+ work(*receiver);\n+ }, Qt::QueuedConnection);\n+}\n+\n+void Service::State::finishDelivery()\n+{\n+ {\n+ std::lock_guard lock{flags->mutex};\n+ --pending_deliveries;\n+ }\n+ retireWhenIdle();\n+}\n+\n+void Service::State::retireWhenIdle()\n+{\n+ std::lock_guard lock{flags->mutex};\n+ if (!flags->stopping || pending_deliveries || !native) return;\n+ auto* receiver = std::exchange(native, nullptr);\n+ if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n+}\n+\n Service::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\n Service::~Service() { stop(); }\n-std::shared_ptr<Service> Service::Create(std::shared_ptr<execution::Scheduler> scheduler, std::shared_ptr<Owner> owner, Limits limits)\n+bool Service::post(std::function<void()> work) const\n+{\n+ const auto state = m_state.load();\n+ return state && state->post([work = std::move(work)](State::Native&) { work(); });\n+}\n+\n+std::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n {\n const auto maximum = std::chrono::seconds{30};\n- if (!scheduler || !owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n+ if (!owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n limits.connect <= std::chrono::milliseconds::zero() || limits.connect > limits.startup ||\n limits.acknowledge <= std::chrono::milliseconds::zero() || limits.acknowledge > limits.startup ||\n limits.query <= std::chrono::milliseconds::zero() || limits.query > limits.startup ||\n limits.client <= std::chrono::milliseconds::zero() || limits.client > maximum ||\n limits.slice <= std::chrono::milliseconds::zero() || limits.slice > std::chrono::milliseconds{100}) return {};\n- auto scope = scheduler->openActionScope(); if (!scope) return {};\n- auto state = execution::RetainValues<State>(scope, [] { return std::make_unique<State>(); }); if (!state) return {};\n- state->scope = scope; state->owner = std::move(owner); state->limits = std::move(limits); state->key = scope->allocateKey();\n- const auto retired = execution::Submit(*scope, [] {}, [state] {\n- std::function<void()> done;\n- { std::lock_guard lock{state->mutex}; state->owner.reset(); }\n- { std::lock_guard lock{state->flags->mutex}; state->flags->retired = true; done = std::move(state->flags->completed_stop); }\n- if (done) done();\n- }, {}, {execution::Lane::Cleanup, state->key}, true);\n- auto borrowed = retired ? scope->borrow(state->key) : execution::BorrowAdmission{{}, retired.rejection};\n- if (!borrowed) { if (retired) scope->activateCleanup(retired.id); return {}; }\n- state->flags->retired_task = retired.id;\n- state->native_lifetime = std::make_shared<execution::ResourceLease>(std::move(*borrowed.lease));\n- return std::shared_ptr<Service>{new Service(std::move(state))};\n+ auto* const app = QCoreApplication::instance();\n+ Q_ASSERT(app && QThread::currentThread() == app->thread());\n+ auto state = std::make_shared<State>();\n+ state->owner = std::move(owner);\n+ state->limits = std::move(limits);\n+ auto thread = std::make_unique<QThread>();\n+ thread->setObjectName(QStringLiteral(\"desktop transport\"));\n+ auto native = std::make_unique<State::Native>(state);\n+ auto service = std::shared_ptr<Service>{new Service(state)};\n+ QObject::connect(thread.get(), &QThread::finished, native.get(), &QObject::deleteLater);\n+ QObject::connect(thread.get(), &QThread::finished, app, [app, state, worker = thread.get()] {\n+ JoinThreadAsync([state, worker] {\n+ if (!worker->wait()) std::terminate();\n+ state->owner.reset();\n+ std::vector<std::function<void()>> completed;\n+ {\n+ std::lock_guard lock{state->flags->mutex};\n+ state->flags->retired = true;\n+ completed = std::move(state->flags->completed_stops);\n+ }\n+ for (const auto& done : completed) {\n+ try { done(); } catch (...) {}\n+ }\n+ }, app, [worker] { delete worker; });\n+ }, Qt::QueuedConnection);\n+ native->moveToThread(thread.get());\n+ state->native = native.release();\n+ thread.release()->start();\n+ return service;\n }\n-execution::Admission Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n+execution::SubmitResult Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n {\n return begin(std::move(directory), std::move(network), std::move(inputs), false, std::move(completed), {});\n }\n-execution::Admission Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n+execution::SubmitResult Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n {\n if (inputs.size() > Queue::MAX_PENDING) return {{}, execution::Rejection::Invalid};\n const auto callback = std::move(completed);\n@@ -487,7 +538,7 @@ execution::Admission Service::probeExisting(QString directory, QString network,\n const auto missing = [callback] { if (callback) callback({ProbeStatus::Missing, {}}); };\n return begin(std::move(directory), std::move(network), inputs, true, transfer, missing);\n }\n-execution::Admission Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n+execution::SubmitResult Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n std::function<void(StartResult)> completed, std::function<void()> missing)\n {\n const auto state = m_state.load();\n@@ -497,80 +548,82 @@ execution::Admission Service::begin(QString directory, QString network, std::vec\n return {{}, execution::Rejection::Closed};\n if (existing_only) { m_flags->probed = true; m_flags->probe_pending = true; }\n else m_flags->started = true;\n+ ++state->pending_deliveries;\n }\n- const auto reject = [flags = m_flags, existing_only](execution::Rejection reason) {\n- if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- return execution::Admission{{}, reason};\n- };\n+ auto release_rejected = qScopeGuard([&] {\n+ if (existing_only) {\n+ std::lock_guard lock{m_flags->mutex};\n+ m_flags->probe_pending = false;\n+ m_flags->probe_terminal = true;\n+ }\n+ state->finishDelivery();\n+ });\n if (directory.size() > 4096 || QString::fromUtf8(directory.toUtf8()) != directory || network.isEmpty() || network.size() > 128 || directory.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\n'}) || inputs.size() > Queue::MAX_PENDING)\n- return reject(execution::Rejection::Invalid);\n+ return {{}, execution::Rejection::Invalid};\n for (const auto& input : inputs) {\n- if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return reject(execution::Rejection::Capacity);\n+ if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return {{}, execution::Rejection::Capacity};\n }\n- auto held = state->scope->borrow(state->key); if (!held) return reject(held.rejection);\n- auto lifetime = std::make_shared<execution::ResourceLease>(std::move(*held.lease));\n- std::shared_ptr<Owner> owner;\n- { std::lock_guard lock{state->mutex}; owner = state->owner; }\n- const auto payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(inputs)); });\n- if (!payload) return reject(execution::Rejection::Closed);\n+ const auto owner = state->owner;\n+ const auto payload = std::make_shared<const std::vector<Input>>(std::move(inputs));\n const auto claimed = std::make_shared<std::atomic_bool>(false);\n- const auto finish = [done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n+ const auto finish = [state, done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n if (claimed->exchange(true)) return;\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- if (done) done(std::move(result));\n+ try { if (done) done(std::move(result)); } catch (...) {}\n };\n- const auto submitted = execution::Submit(*state->scope, [state, directory = std::move(directory), network = std::move(network), payload, lifetime, existing_only] {\n- if (state->flags->admission_closed || (QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))\n- return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start on its background worker.\"))};\n- auto native = std::make_unique<State::Native>(state);\n- auto discovery = native->initialize(directory, network, existing_only);\n- if (discovery.result.status == StartStatus::Primary) {\n- std::lock_guard lock{state->mutex};\n- if (!state->flags->stopping) state->native = native.release();\n- else discovery.result = Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n+ const auto submitted = state->post([state, owner, directory = std::move(directory), network = std::move(network),\n+ payload, finish, claimed, missing = std::move(missing), existing_only](State::Native& native) {\n+ if (state->flags->admission_closed) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n }\n- return discovery;\n- }, [state, owner, payload, finish, lifetime, claimed, missing = std::move(missing)](Discovery discovery) {\n+ auto discovery = [&] {\n+ try { return native.initialize(directory, network, existing_only); }\n+ catch (...) { return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start.\"))}; }\n+ }();\n if (discovery.missing) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n if (!claimed->exchange(true)) {\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n { std::lock_guard lock{state->flags->mutex}; state->flags->probe_pending = false; }\n- if (missing) missing();\n+ try { if (missing) missing(); } catch (...) {}\n }\n return;\n }\n if (!discovery.endpoint.isEmpty()) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n try {\n- const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish, lifetime](ForwardingSnapshot snapshot) {\n+ const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish](ForwardingSnapshot snapshot) {\n if (snapshot.error != Error::None || state->flags->admission_closed) {\n finish(Rejected(QStringLiteral(\"The GUI could not transfer its pending requests.\"))); return;\n }\n- const auto forward_payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(snapshot.inputs)); });\n- if (!forward_payload) { finish(Rejected(QStringLiteral(\"Pending requests could not be kept.\"))); return; }\n- const auto forwarded = execution::Submit(*state->scope, [state, endpoint, forward_payload, lifetime] {\n- if (state->flags->stopping) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n- // Once a frame may have left this process, an exception\n- // is an unknown outcome, never permission to replay.\n- try { return Forward(endpoint, *forward_payload, state->limits, state->flags->stopping); }\n- catch (...) { return Unknown(); }\n- }, [finish, lifetime, forward_payload](StartResult result) {\n- if (result.producer_keys.empty()) result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- }, [finish, lifetime, forward_payload](std::exception_ptr) {\n- auto result = Unknown(); result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- },\n- {execution::Lane::Core, state->key});\n- if (!forwarded) finish(Rejected(QStringLiteral(\"The GUI could not start payment delivery.\")));\n+ try {\n+ const auto forwarded = state->post([state, endpoint, inputs = std::move(snapshot.inputs), finish](State::Native&) {\n+ if (state->flags->stopping) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n+ }\n+ // An exception after sending may have left a frame\n+ // in the other process. Its outcome remains unknown.\n+ auto result = [&] {\n+ try { return Forward(endpoint, inputs, state->limits, state->flags->stopping); }\n+ catch (...) { return Unknown(); }\n+ }();\n+ \n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 483,
"evidence_id": "2389f6ef112c4b19ad74d3015058d76e",
"finding_id": "finding:2",
"kind": "new_source",
"line": 334,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/desktopintenttransport.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 13,
"source_job_id": 2941,
"text": " connect(deadline, &QTimer::timeout, this, [this, id] {\n const auto found = clients.find(id);\n if (found == clients.end()) return;\n try { if (!Remaining(state->limits, found->second.admitted, state->limits.client, 1)) found->second.socket->abort(); }\n catch (...) { found->second.socket->abort(); }\n });\n deadline->start(); ingress(id);\n }\n }\n void ingress(uint64_t id) {\n try { receive(id); }\n catch (...) {\n // Any already admitted queue mutation keeps its original receipt.\n // An unacknowledged caller can query; no exception becomes replay.\n const auto found = clients.find(id); if (found != clients.end()) found->second.socket->abort();\n }\n }\n void retire() {\n server.close();\n while (!replies.empty()) clearReply(replies.begin()->first);\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n#ifndef Q_OS_WIN\n // The runtime directory belongs to this user (Qt checks its owner and\n // mode). A fixed name in the shared /tmp could be created first by\n // another user, which would block delivery for this one.\n const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n if (lstat(encoded.constData(), &info)) {\n if (existing_only && errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n }\n if (!S_ISDIR(info.st_mode) || info.st_uid != getuid() || (info.st_mode & 0077))\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QFileInfo{private_directory}.canonicalFilePath();\n#else\n private_directory = QDir::tempPath();\n#endif\n const QString identity = canonical + QLatin1Char('\\n') + network;\n const auto digest = QCryptographicHash::hash(identity.toUtf8(), QCryptographicHash::Sha256).toHex().first(24);\n#ifndef Q_OS_WIN\n const auto endpoint = QDir{private_directory}.filePath(QString::fromLatin1(digest));\n if (QFile::encodeName(endpoint).size() > 100) return Rejected(QStringLiteral(\"The payment-delivery path is too long.\"));\n#else\n const QString endpoint = QStringLiteral(\"qml-intent-\") + QString::fromLatin1(digest);\n#endif\n if (existing_only) {\n // Discovery grants no listener/lock authority and mutates no local\n // queue. A known absent peer leaves normal final-profile startup\n // available; only a connected same-user peer permits forwarding.\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer)) {\n if (errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The payment-delivery endpoint could not be inspected.\"));\n }\n if (!S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during lookup.\"));\n const auto began = state->limits.now();\n const auto remaining = Remaining(state->limits, began, state->limits.startup, static_cast<int>(state->limits.connect.count()));\n if (!remaining) return Rejected(QStringLiteral(\"The payment-delivery lookup expired.\"));\n QLocalSocket probe; probe.connectToServer(endpoint);\n const bool connected = probe.waitForConnected(remaining);\n if (!connected) {\n if (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError)\n return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The existing payment-delivery endpoint could not be contacted.\"));\n }\n if (state->flags->admission_closed || !Remaining(state->limits, began, state->limits.startup, 1))\n return Rejected(QStringLiteral(\"The payment-delivery lookup expired or is closing.\"));\n if (!SameUser(probe)) return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n return {StartResult{}, endpoint};\n }\n instance_lock = std::make_unique<QLockFile>(QDir{private_directory}.filePath(QString::fromLatin1(digest) + QStringLiteral(\".lock\")));\n instance_lock->setStaleLockTime(0);\n if (instance_lock->tryLock(0)) {\n QLocalSocket probe; probe.connectToServer(endpoint); const bool live = probe.waitForConnected(200);\n bool reclaimable = !live && (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError);\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat socket_info{};\n if (lstat(path.constData(), &socket_info) == 0) {\n reclaimable &= S_ISSOCK(socket_info.st_mode) && socket_info.st_uid == getuid();\n if (reclaimable) reclaimable = QLocalServer::removeServer(endpoint);\n }\n#endif\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n if (reclaimable && !state->flags->admission_closed && server.listen(endpoint)) return StartResult{StartStatus::Primary, {}, {}};\n }\n instance_lock.reset();\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer) || !S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unavailable or unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n return {StartResult{}, endpoint};\n }\n};\n\nbool Service::State::post(std::function<void(Native&)> work)\n{\n std::lock_guard lock{flags->mutex};\n return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n work(*receiver);\n }, Qt::QueuedConnection);\n}\n\nvoid Service::State::finishDelivery()\n{\n {\n std::lock_guard lock{flags->mutex};\n --pending_deliveries;\n }\n retireWhenIdle();\n}\n\nvoid Service::State::retireWhenIdle()\n{\n std::lock_guard lock{flags->mutex};\n if (!flags->stopping || pending_deliveries || !native) return;\n auto* receiver = std::exchange(native, nullptr);\n if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n}\n\nService::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\nService::~Service() { stop(); }\nbool Service::post(std::function<void()> work) const\n{\n const auto state = m_state.load();\n return state && state->post([work = std::move(work)](State::Native&) { work(); });\n}\n\nstd::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n{\n const auto maximum = std::chrono::seconds{30};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | New-passphrase normalization makes the same clipboard fail at unlockqml/controls/PasswordTextField.qml | still_present | AssessmentThe new-head PasswordTextField source retains dropsLineEndings defaulted to false and only strips line endings when that flag is enabled. It shows no warning for pasted CR/LF in unlock or current-password fields. new_source: qml/controls/PasswordTextField.qml [
{
"bounded": true,
"end_line": 58,
"evidence_id": "81e797fdad554ba6b2e7aba54c70327d",
"finding_id": "finding:12",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/controls/PasswordTextField.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 13,
"source_job_id": 2941,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\n\nLabeledTextField {\n id: root\n\n property bool passwordVisible: false\n property string visibilityToggleObjectName: root.objectName.length > 0\n ? root.objectName + \"VisibilityToggle\"\n : \"\"\n\n // For a new passphrase only. A line ending cannot be typed into this\n // field, so one that arrives by paste is dropped instead of becoming a\n // character the user cannot see or type again. Fields that unlock an\n // existing wallet leave this off: a wallet encrypted with a pasted line\n // ending must still open with exactly that text.\n property bool dropsLineEndings: false\n\n function dropLineEndings() {\n const text = root.field.text\n if (!root.dropsLineEndings || !/[\\r\\n]/.test(text)) return\n const caret = text.slice(0, root.field.cursorPosition).replace(/[\\r\\n]/g, \"\").length\n root.field.text = text.replace(/[\\r\\n]/g, \"\")\n root.field.cursorPosition = caret\n }\n\n Connections {\n target: root.field\n function onTextChanged() { root.dropLineEndings() }\n }\n onDropsLineEndingsChanged: dropLineEndings()\n\n echoMode: passwordVisible ? TextInput.Normal : TextInput.Password\n // Qt never exposes a name for a password field, so the label also goes\n // into the description, which VoiceOver still reads.\n accessibleDescription: [label, errorText.length > 0 ? errorText : supportingText]\n .filter(function(part) { return part.length > 0 }).join(\". \")\n inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText\n\n trailingItem: IconButton {\n id: visibilityToggle\n objectName: root.visibilityToggleObjectName\n size: 30\n iconSize: 22\n iconSource: root.passwordVisible ? \"qrc:/icons/hidden\" : \"qrc:/icons/visible\"\n iconColor: Theme.color.neutral7\n activeColor: Theme.color.neutral9\n enabled: root.enabled\n // Clicking keeps focus in the field; Tab still reaches the toggle.\n focusPolicy: Qt.TabFocus\n accessibleName: root.passwordVisible ? qsTr(\"Hide password\") : qsTr(\"Show password\")\n background: null\n onClicked: root.passwordVisible = !root.passwordVisible\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Captured passphrases retain uncleansed UTF-16 storageqml/secretinput.cpp | still_present | AssessmentThe new-head source still stores the captured text in m_text and materialize() only cleanses the temporary UTF-8 buffer. No non-const member cleanup or cleansing destructor is shown. new_source: qml/secretinput.cpp [
{
"bounded": true,
"end_line": 73,
"evidence_id": "dd0c43153e0a4ea7ab3e87082e011168",
"finding_id": "finding:11",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/secretinput.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 13,
"source_job_id": 2941,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n#include <qml/secretinput.h>\n#include <bitcoin-build-config.h> // IWYU pragma: keep\n#include <qml/retainedvalue.h>\n#include <qml/walletopening.h>\n#include <support/cleanse.h>\n#include <QByteArray>\n#include <limits>\n\nnamespace secretinput {\nnamespace {\ntemplate <typename Retain>\nCaptureResult CaptureInput(const QString& text, Retain retain)\n{\n // Peak conservative accounting: retained UTF16 plus temporary UTF8 and\n // secure UTF8 allocation. No scan of the original literal is necessary.\n constexpr size_t BYTES_PER_CODE_UNIT{8};\n constexpr size_t OVERHEAD{512};\n const auto units = static_cast<size_t>(text.size());\n if (units > (std::numeric_limits<size_t>::max() - OVERHEAD) / BYTES_PER_CODE_UNIT)\n return {{}, Error::TransportBudget};\n const size_t bytes = OVERHEAD + units * BYTES_PER_CODE_UNIT;\n std::shared_ptr<Input> retained;\n try {\n retained = retain([&text, bytes] { return std::make_unique<Input>(text, bytes); });\n } catch (...) { return {{}, Error::Unavailable, bytes}; }\n const auto error = retained ? Error::None : Error::Unavailable;\n return {std::move(retained), error, bytes};\n}\n} // namespace\n\nInput::Input(QString text, size_t bytes) : m_text(std::move(text)), m_bytes(bytes) {}\nCaptureResult Capture(const execution::ValueCleanup& hold, const QString& text)\n{\n return CaptureInput(text, [&hold](auto make) { return execution::RetainValues<Input>(hold, make); });\n}\n\n#ifdef ENABLE_WALLET\nCaptureResult Capture(const std::shared_ptr<walletopening::Session>& opening, const QString& text)\n{\n return CaptureInput(text, [&opening](auto make) { return walletopening::RetainValues<Input>(opening, make); });\n}\n#endif\n\nsize_t Bytes(const Captured& input) { return input ? input->bytes() : 0; }\nSecureString Materialize(const Captured& input)\n{\n if (!input) throw Failure{Error::Unavailable};\n return input->materialize();\n}\nSecureString Input::materialize() const\n{\n // Native-only boundary. Manual executors intentionally control this same\n // action in tests without relying on a physical GUI/thread identity check.\n QByteArray utf8;\n try {\n utf8 = m_text.toUtf8();\n SecureString secret;\n try {\n secret.assign(utf8.constData(), utf8.constData() + utf8.size());\n } catch (...) {\n if (!utf8.isEmpty()) memory_cleanse(utf8.data(), static_cast<size_t>(utf8.size()));\n throw;\n }\n if (!utf8.isEmpty()) memory_cleanse(utf8.data(), static_cast<size_t>(utf8.size()));\n return secret;\n } catch (...) {\n throw Failure{Error::Materialization};\n }\n}\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | External-signer verification accepts SIGHASH_NONE and SIGHASH_SINGLEqml/walletsend.cpp | addressed | AssessmentThe new send path requires CommitsToAllOutputs for PSBTs and finalized external transactions, directly preventing accepted signatures that fail to commit to all outputs. path_diff: qml/walletsend.cpp; new_source: qml/walletsend.cpp [
{
"evidence_id": "611664999fe34dc8a89a8cfb3548d65d",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/walletsend.cpp",
"source_generation": 13,
"source_job_id": 2941,
"text": "diff --git a/qml/walletsend.cpp b/qml/walletsend.cpp\nindex d9919ab84f..5ba1a6231e 100644\n--- a/qml/walletsend.cpp\n+++ b/qml/walletsend.cpp\n@@ -95,7 +95,7 @@ bool VerifiedExternalTransaction(interfaces::Wallet& wallet, const CTransaction&\n document.inputs[i].final_script_sig = transaction.vin[i].scriptSig;\n document.inputs[i].final_script_witness = transaction.vin[i].scriptWitness;\n }\n- return VerifiedSignatures(document);\n+ return VerifiedSignatures(document) && psbtsignatures::CommitsToAllOutputs(document);\n } catch (...) { return false; }\n }\n struct Observation {\n@@ -178,6 +178,7 @@ Result Execute(interfaces::Wallet& wallet, Request request)\n if (request.assessed_complete && request.reviewed->GetWitnessHash() != MakeTransactionRef(extracted)->GetWitnessHash()) { result.error = Error::ChangedTransaction; return result; }\n if (!psbtfee::MatchesReview(psbt, *authenticated, request.approved_fee)) { result.error = Error::InvalidFee; return result; }\n if (!VerifiedSignatures(psbt)) { result.error = Error::InvalidSignature; return result; }\n+ if (!psbtsignatures::CommitsToAllOutputs(psbt)) { result.error = Error::UncommittedOutputs; return result; }\n transaction = MakeTransactionRef(std::move(extracted));\n } else if (wallet.privateKeysDisabled()) {\n if (!wallet.hasExternalSigner()) { result.error = Error::CannotSign; return result; }\n@@ -332,7 +333,7 @@ bool VerifyExternalTransaction(interfaces::Wallet& wallet, const CTransaction& t\n return VerifiedExternalTransaction(wallet, transaction);\n }\n \n-execution::Admission Operation::start(Request request, std::shared_ptr<const walletopening::Session::Action> action)\n+execution::SubmitResult SendTask::start(Request request, std::shared_ptr<const walletopening::Session::Action> action)\n {\n {\n std::lock_guard lock{m_mutex};\n@@ -363,7 +364,7 @@ execution::Admission Operation::start(Request request, std::shared_ptr<const wal\n return plan([self] { self->beginOnDomain(); });\n }\n \n-execution::Admission Operation::plan(std::function<void()> work)\n+execution::SubmitResult SendTask::plan(std::function<void()> work)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n { std::lock_guard lock{m_mutex}; action = m_action; }\n@@ -371,7 +372,7 @@ execution::Admission Operation::plan(std::function<void()> work)\n return m_opening->planAction(action, std::move(work));\n }\n \n-void Operation::beginOnDomain()\n+void SendTask::beginOnDomain()\n {\n Notice notice{Notice::SweepConsentRequired};\n bool wait_for_sweep{false}, cancelled{false};\n@@ -398,7 +399,7 @@ void Operation::beginOnDomain()\n dispatchNative();\n }\n \n-void Operation::dispatchNative(secretinput::Captured passphrase)\n+void SendTask::dispatchNative(secretinput::Captured passphrase)\n {\n Request request;\n std::shared_ptr<const walletopening::Session::Action> action;\n@@ -452,7 +453,7 @@ void Operation::dispatchNative(secretinput::Captured passphrase)\n if (!admitted) nativeCompleted(FailureResult(Error::Rejected));\n }\n \n-void Operation::nativeCompleted(Result result)\n+void SendTask::nativeCompleted(Result result)\n {\n if (!result.candidate) {\n std::lock_guard lock{m_mutex};\n@@ -488,7 +489,7 @@ void Operation::nativeCompleted(Result result)\n } else if (m_notes) {\n try {\n auto accepted = m_notes->submitSentLabels(action, result.committed->GetHash(), notes,\n- [notify = m_notify, weak = std::weak_ptr<Operation>{shared_from_this()}] {\n+ [notify = m_notify, weak = std::weak_ptr<SendTask>{shared_from_this()}] {\n try { notify(Notice::Notes); }\n catch (...) { if (const auto owner = weak.lock()) owner->publicationFailed(); }\n });\n@@ -499,7 +500,7 @@ void Operation::nativeCompleted(Result result)\n complete(std::move(result));\n }\n \n-execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t review_id)\n+execution::SubmitResult SendTask::confirmSweep(uint64_t attempt_id, uint64_t review_id)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -510,7 +511,7 @@ execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t revie\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id] {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id] {\n bool accepted{false}, cancelled{false};\n {\n std::lock_guard lock{self->m_mutex};\n@@ -527,11 +528,11 @@ execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t revie\n if (cancelled) self->complete(FailureResult(Error::Cancelled));\n else if (accepted) self->dispatchNative();\n });\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t review_id, secretinput::Captured passphrase)\n+execution::SubmitResult SendTask::providePassphrase(uint64_t attempt_id, uint64_t review_id, secretinput::Captured passphrase)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -542,7 +543,7 @@ execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id, passphrase = std::move(passphrase)]() mutable {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id, passphrase = std::move(passphrase)]() mutable {\n bool accepted{false}, cancelled{false};\n {\n std::lock_guard lock{self->m_mutex};\n@@ -559,11 +560,11 @@ execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t\n if (cancelled) self->complete(FailureResult(Error::Cancelled));\n else if (accepted) self->dispatchNative(std::move(passphrase));\n });\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t review_id)\n+execution::SubmitResult SendTask::cancelPrompt(uint64_t attempt_id, uint64_t review_id)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -575,7 +576,7 @@ execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t revie\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id] {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id] {\n {\n std::lock_guard lock{self->m_mutex};\n if (self->m_result || self->m_attempt_id != attempt_id || self->m_review_id != review_id ||\n@@ -586,18 +587,18 @@ execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t revie\n }\n self->complete(FailureResult(Error::Cancelled));\n });\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-Stage Operation::stage() const { std::lock_guard lock{m_mutex}; return m_stage; }\n-Error Operation::promptError() const { std::lock_guard lock{m_mutex}; return m_prompt_error; }\n+Stage SendTask::stage() const { std::lock_guard lock{m_mutex}; return m_stage; }\n+Error SendTask::promptError() const { std::lock_guard lock{m_mutex}; return m_prompt_error; }\n \n-std::optional<Result> Operation::result() const\n+std::optional<Result> SendTask::result() const\n {\n std::lock_guard lock{m_mutex}; return m_result;\n }\n-void Operation::complete(Result result)\n+void SendTask::complete(Result result)\n {\n Request discarded;\n std::shared_ptr<const walletopening::Session::Action> retired_action;\n@@ -626,7 +627,7 @@ void Operation::complete(Result result)\n try { m_notify(Notice::Finished); }\n catch (...) { publicationFailed(); }\n }\n-void Operation::publicationFailed()\n+void SendTask::publicationFailed()\n {\n std::lock_guard lock{m_mutex}; m_publication_failed = true;\n if (m_result) m_result->publication_failed = true;\n@@ -663,7 +664,8 @@ static Result ExecuteApproval(interfaces::Wallet& wallet, const Request& request\n const auto returned = document.GetUnsignedTx();\n if (returned && MatchesUnsignedTransaction(unsigned_tx, *returned) &&\n psbtfee::MatchesReview(document, *authenticated, request.approved_fee) &&\n- psbtsignatures::VerifyFinalizedInputs(document, /*require_all=*/false)) {\n+ psbtsignatures::VerifyFinalizedInputs(document, /*require_all=*/false) &&\n+ psbtsignatures::CommitsToAllOutputs(document)) {\n result.signature_status = psbtsignatures::VerifyContributions(*approved, document);\n if (result.signature_status == psbtsignatures::Status::Valid) {\n result.document = std::make_shared<const PartiallySignedTransaction>(document);\n@@ -694,6 +696,10 @@ static Result ExecuteApproval(interfaces::Wallet& wallet, const Request& request\n result.document = approved;\n result.error = Error::InvalidFee; return result;\n }\n+ if (!psbtsignatures::CommitsToAllOutputs(document)) {\n+ result.document = approved;\n+ result.error = Error::UncommittedOutputs; return result;\n+ }\n if (extracted) {\n if (!walletsend::VerifiedSignatures(document)) {\n // Finalization and a signer's completion flag do not prove\n@@ -803,7 +809,7 @@ void ApprovalOwner::publish(const std::shared_ptr<State>& state, const Notify& n\n if (notify) notify(project(*state));\n }\n \n-execution::Admission ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t view_revision)\n+execution::SubmitResult ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t view_revision)\n {\n if (!m_opening || m_close_requested.load()) return {{}, execution::Rejection::Closed};\n const auto state = m_state;\n@@ -839,7 +845,7 @@ execution::Admission ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t v\n });\n }\n \n-execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review_id, uint64_t view_revision,\n+execution::SubmitResult ApprovalOwner::request(uint64_t attempt_id, uint64_t review_id, uint64_t view_revision,\n std::shared_ptr<Request> retained_request)\n {\n if (!m_opening || m_close_requested.load() || attempt_id == 0 || !retained_request)\n@@ -959,10 +965,10 @@ execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review\n value.error = ApprovalExecutionError(std::move(error));\n finish(std::move(value));\n };\n- const auto admission = opening->perform(action, [request, output](interfaces::Wallet& wallet) {\n+ const auto started = opening->perform(action, [request, output](interfaces::Wallet& wallet) {\n return ApproveInto(wallet, *request, output);\n }, finish, failed);\n- if (!admission) {\n+ if (!started) {\n Result value;\n value.error = Error::Failed;\n finish(std::move(value));\n@@ -970,7 +976,7 @@ execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review\n });\n }\n \n-execution::Admission ApprovalOwner::close()\n+execution::SubmitResult ApprovalOwner::close()\n {\n if (m_close_requested.exchange(true)) return {{}, execution::Rejection::Invalid};\n if (!m_opening) return {{}, execution::Rejection::Closed};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 217,
"evidence_id": "bf82c5140e1649c28bcf2ae73e82606b",
"finding_id": "finding:10",
"kind": "new_source",
"line": 68,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/walletsend.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 13,
"source_job_id": 2941,
"text": " try {\n if (!KnownOutputs(wallet, outputs)) return {};\n const auto coins = wallet.getCoins(outputs);\n if (coins.size() != outputs.size()) return {};\n for (size_t i = 0; i < outputs.size(); ++i) {\n if (coins[i].txout.IsNull()) return {};\n verified.insert_or_assign(outputs[i], coins[i].txout);\n }\n } catch (...) { return {}; }\n }\n auto result = psbtfee::Analyze(document, verified);\n if (result.state != psbtfee::State::Known || result.amount != proof.amount) return {};\n return result;\n}\nbool VerifiedExternalTransaction(interfaces::Wallet& wallet, const CTransaction& transaction)\n{\n try {\n std::vector<COutPoint> outputs;\n outputs.reserve(transaction.vin.size());\n for (const auto& input : transaction.vin) outputs.push_back(input.prevout);\n if (!KnownOutputs(wallet, outputs)) return false;\n const auto coins = wallet.getCoins(outputs);\n if (outputs.empty() || coins.size() != outputs.size()) return false;\n PartiallySignedTransaction document{CMutableTransaction{transaction}, 2};\n for (size_t i = 0; i < outputs.size(); ++i) {\n if (coins[i].txout.IsNull()) return false;\n document.inputs[i].witness_utxo = coins[i].txout;\n document.inputs[i].final_script_sig = transaction.vin[i].scriptSig;\n document.inputs[i].final_script_witness = transaction.vin[i].scriptWitness;\n }\n return VerifiedSignatures(document) && psbtsignatures::CommitsToAllOutputs(document);\n } catch (...) { return false; }\n}\nstruct Observation {\n Record record{Record::Unknown};\n Submission submission{Submission::Unknown};\n};\nObservation ObserveSubmission(interfaces::Wallet& wallet, const CTransaction& transaction)\n{\n try {\n interfaces::WalletTxStatus status{}; bool in_mempool{false}; int num_blocks{0};\n std::vector<std::string> messages, payment_requests;\n const auto record = wallet.getWalletTxDetails(transaction.GetHash(), status, messages, payment_requests, in_mempool, num_blocks);\n if (!record.tx || record.tx->GetHash() != transaction.GetHash()) return {Record::AbsentAtObservation, Submission::Unknown};\n if (status.depth_in_main_chain > 0) return {Record::Recorded, Submission::Confirmed};\n if (status.depth_in_main_chain < 0) return {Record::Recorded, Submission::Conflicted};\n if (status.is_abandoned) return {Record::Recorded, Submission::Abandoned};\n return {Record::Recorded, in_mempool ? Submission::Mempool : Submission::NotInMempool};\n } catch (...) { return {}; }\n}\nResult Execute(interfaces::Wallet& wallet, Request request)\n{\n Result result;\n result.candidate = request.reviewed;\n bool relock_required{false};\n auto restoreWalletLock = [&] {\n if (!std::exchange(relock_required, false)) return;\n try {\n if (!wallet.lock()) result.relock_failed = true;\n } catch (...) {\n result.relock_failed = true;\n }\n };\n const auto restore_lock_on_exit = qScopeGuard([&] { restoreWalletLock(); });\n try {\n if (request.consent && request.consent->withdrawn()) { result.error = Error::Cancelled; return result; }\n if (request.captured_passphrase) {\n request.passphrase = secretinput::Materialize(request.captured_passphrase);\n request.captured_passphrase.reset();\n }\n CTransactionRef transaction = request.reviewed;\n if (request.psbt) {\n if (!request.reviewed || HasDuplicateInputs(*request.reviewed)) {\n result.error = Error::InvalidStructure; return result;\n }\n if (!request.proof || !psbtfee::MatchesReview(*request.psbt, *request.proof, request.approved_fee)) {\n result.error = Error::InvalidFee; return result;\n }\n const auto authenticated = AuthenticatedInputs(wallet, *request.psbt, *request.proof);\n if (!authenticated) { result.error = Error::InvalidFee; return result; }\n if (request.assessed_complete && !request.assessment) { result.error = Error::ChangedTransaction; return result; }\n if (request.assessed_complete) {\n const auto terms = request.assessment->GetUnsignedTx();\n if (!terms || !SameTransaction(*request.reviewed, *terms)) { result.error = Error::ChangedTransaction; return result; }\n if (!psbtfee::MatchesReview(*request.assessment, *authenticated, request.approved_fee)) { result.error = Error::InvalidFee; return result; }\n }\n PartiallySignedTransaction psbt{request.assessed_complete ? *request.assessment : *request.psbt};\n psbtfee::FillMissing(psbt, *authenticated);\n CMutableTransaction extracted;\n auto finalized = psbt;\n bool extracted_complete = FinalizeAndExtractPSBT(finalized, extracted);\n if (request.assessed_complete && !extracted_complete) { result.error = Error::Incomplete; return result; }\n if (!extracted_complete) {\n if (wallet.privateKeysDisabled() && !wallet.hasExternalSigner()) { result.error = Error::CannotSign; return result; }\n if (!wallet.privateKeysDisabled() && wallet.isCrypted() && wallet.isLocked()) {\n if (!request.passphrase) { result.error = Error::NeedsUnlock; return result; }\n relock_required = true;\n if (!wallet.unlock(*request.passphrase)) { relock_required = false; result.error = Error::IncorrectPassphrase; return result; }\n }\n // Drop the submitted secret before a potentially blocking signer.\n request.passphrase.reset();\n bool complete{false}; size_t signed_inputs{0};\n result.signer_error = wallet.fillPSBT({.sign = true, .bip32_derivs = true}, &signed_inputs, psbt, complete);\n if (result.signer_error) { result.error = Error::Signer; restoreWalletLock(); return result; }\n const auto returned = psbt.GetUnsignedTx();\n if (!returned || !SameTransaction(*request.reviewed, *returned)) { result.error = Error::ChangedTransaction; restoreWalletLock(); return result; }\n if (!complete || !FinalizeAndExtractPSBT(psbt, extracted)) { result.error = Error::Incomplete; restoreWalletLock(); return result; }\n restoreWalletLock();\n }\n if (!SameTransaction(*request.reviewed, extracted)) { result.error = Error::ChangedTransaction; return result; }\n if (request.assessed_complete && request.reviewed->GetWitnessHash() != MakeTransactionRef(extracted)->GetWitnessHash()) { result.error = Error::ChangedTransaction; return result; }\n if (!psbtfee::MatchesReview(psbt, *authenticated, request.approved_fee)) { result.error = Error::InvalidFee; return result; }\n if (!VerifiedSignatures(psbt)) { result.error = Error::InvalidSignature; return result; }\n if (!psbtsignatures::CommitsToAllOutputs(psbt)) { result.error = Error::UncommittedOutputs; return result; }\n transaction = MakeTransactionRef(std::move(extracted));\n } else if (wallet.privateKeysDisabled()) {\n if (!wallet.hasExternalSigner()) { result.error = Error::CannotSign; return result; }\n // A prepared external-wallet transaction is unsigned until an\n // explicit approval supplies valid signatures. A failed approval\n // must not make a later direct Send commit that original value.\n if (!VerifiedExternalTransaction(wallet, *transaction)) {\n result.error = Error::NeedsSignerApproval; return result;\n }\n }\n request.passphrase.reset();\n if (result.relock_failed) { result.error = Error::Uncertain; return result; }\n if (request.sweeps_wallet && !request.full_wallet_consent) { result.error = Error::Cancelled; return result; }\n if (request.policy && request.approved_fee) {\n const auto decision = psbtpolicy::Evaluate(request.policy(transaction, *request.approved_fee));\n if (decision.state == psbtpolicy::State::Blocked) {\n result.error = Error::NodePolicy; result.policy_error = decision.explanation; return result;\n }\n }\n // Core retains the supplied shared_ptr in wallet history. Its owner\n // must not be an app cleanup lease: that would make session retirement\n // wait for a transaction whose destruction waits for wallet retirement.\n // Copy only on Native, before the original public commit boundary.\n transaction = MakeTransactionRef(*transaction);\n if (request.consent && !request.consent->claim()) { result.error = Error::Cancelled; return result; }\n wallet.commitTransaction(transaction, {});\n result.committed = std::move(transaction);\n // The public commit API has no result value. Preserve the exact effect\n // candidate, then report only what a subsequent wallet read proves.\n const auto observed = ObserveSubmission(wallet, *result.committed);\n result.record = observed.record;\n result.submission = observed.submission;\n } catch (const secretinput::Failure&) { restoreWalletLock(); result.error = Error::Rejected; }\n catch (...) { restoreWalletLock(); result.error = Error::Uncertain; }\n return result;\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | Wallet backup can replace a loaded wallet's live wallet.datqml/models/backuppolicyio.cpp | addressed | AssessmentThe new implementation screens existing backup destinations against loaded wallet database files and journals before installation, and repeats that screening during the final recheck. A destination identified as a live wallet file is rejected rather than replaced. path_diff: qml/models/backuppolicyio.cpp; new_source: qml/models/backuppolicyio.cpp [
{
"evidence_id": "b70302c251ff45dbbd0aac8d8d7951b1",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/models/backuppolicyio.cpp",
"source_generation": 13,
"source_job_id": 2941,
"text": "diff --git a/qml/models/backuppolicyio.cpp b/qml/models/backuppolicyio.cpp\nindex 7f2a43eccc..8ce3d25dd0 100644\n--- a/qml/models/backuppolicyio.cpp\n+++ b/qml/models/backuppolicyio.cpp\n@@ -15,6 +15,7 @@\n #include <QUrl>\n \n #include <algorithm>\n+#include <system_error>\n #include <utility>\n \n namespace {\n@@ -123,8 +124,33 @@ backup::Proposal backup::InspectPng(const std::string& raw)\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n }\n \n+namespace {\n+bool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n+{\n+ if (!coordinator.wallet_files) return false;\n+ const fs::path destination{fs::PathFromString(path)};\n+ std::error_code error;\n+ for (const auto& file : coordinator.wallet_files()) {\n+ const fs::path database{fs::PathFromString(file)};\n+ // SQLite keeps a journal next to the database while it writes.\n+ for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n+ if (fs::equivalent(destination, candidate, error)) return true;\n+ }\n+ }\n+ return false;\n+}\n+} // namespace\n+\n+backup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n+{\n+ if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n+ proposal.error = Error::WalletFile;\n+ }\n+ return proposal;\n+}\n+\n backup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n- InstallCoordinator& coordinator, std::function<bool()> admission)\n+ InstallCoordinator& coordinator, std::function<bool()> submitted)\n {\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n@@ -138,12 +164,12 @@ backup::WriteResult backup::Write(const Proposal& approved, bool destination_app\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n- const auto current = ReadTarget(final_path);\n+ const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n- if (admission && !admission()) return {Error::Changed};\n+ if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 184,
"evidence_id": "e7c37d08067b4336b60b6886b2ed2e56",
"finding_id": "finding:1",
"kind": "new_source",
"line": 119,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "639b5fd00bab014779c6c43669b3276e169f7231",
"path": "qml/models/backuppolicyio.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 13,
"source_job_id": 2941,
"text": " if (!url.isValid() || !url.isLocalFile() || !QDir::isAbsolutePath(url.toLocalFile())) return {{}, {}, false, false, Error::InvalidPath};\n QString path = QDir::cleanPath(url.toLocalFile());\n if (path.contains(QChar{0}) || QFileInfo{path}.isDir()) return {{}, {}, false, false, Error::InvalidPath};\n const QString selected = path;\n if (!path.endsWith(QStringLiteral(\".png\"), Qt::CaseInsensitive)) path += QStringLiteral(\".png\");\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n}\n\nnamespace {\nbool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n{\n if (!coordinator.wallet_files) return false;\n const fs::path destination{fs::PathFromString(path)};\n std::error_code error;\n for (const auto& file : coordinator.wallet_files()) {\n const fs::path database{fs::PathFromString(file)};\n // SQLite keeps a journal next to the database while it writes.\n for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n if (fs::equivalent(destination, candidate, error)) return true;\n }\n }\n return false;\n}\n} // namespace\n\nbackup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n{\n if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n proposal.error = Error::WalletFile;\n }\n return proposal;\n}\n\nbackup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n InstallCoordinator& coordinator, std::function<bool()> submitted)\n{\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n const QString parent = QFileInfo{final_path}.absolutePath();\n QTemporaryDir staging{QDir{parent}.filePath(QStringLiteral(\".bitcoin-backup-XXXXXX\"))};\n if (!staging.isValid()) return {Error::Staging};\n const QString staged_path = staging.filePath(QStringLiteral(\"wallet.backup\"));\n if (!producer(Utf8(staged_path))) return {Error::CoreBackup};\n const QFileInfo staged_info{staged_path};\n if (!staged_info.isFile() || staged_info.isSymLink()) return {Error::CoreBackup};\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n } else {\n // QFile's non-replacing rename also protects against a destination\n // created after inspection; never use an overwriting rename here.\n installed = QFile::rename(staged_path, final_path);\n }\n if (!installed) return {Error::Install};\n DirectoryCommit(fs::PathFromString(Utf8(parent)));\n return {};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 639b5fd00bab..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Fee-authentication commit does not identify its later integration pointsqml/models/psbtfee.h | unclear | AssessmentThe supplied old and new psbtfee.h excerpts are identical and do not show commit-message changes or the later integration points. The evidence is insufficient to judge whether the reported commit-attribution concern was addressed. new_source: qml/models/psbtfee.h [
{
"bounded": true,
"end_line": 34,
"evidence_id": "177d0609808b4687a4c917f9342af241",
"finding_id": "finding:9",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/models/psbtfee.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 12,
"source_job_id": 2936,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_QML_MODELS_PSBTFEE_H\n#define BITCOIN_QML_MODELS_PSBTFEE_H\n\n#include <psbt.h>\n\n#include <map>\n#include <optional>\n#include <vector>\n\nnamespace psbtfee {\nenum class State { Known, Missing, Invalid };\nusing Outputs = std::map<COutPoint, CTxOut>;\nstruct Analysis {\n State state{State::Invalid};\n std::optional<CAmount> amount;\n std::optional<Txid> commitment;\n Outputs verified;\n std::vector<std::optional<CTxOut>> prevouts;\n CAmount output_total{0};\n bool outputs_valid{false};\n bool wallet_prepared{false};\n};\n/** Only full transaction commitments or independently verified outputs prove input amounts. */\nAnalysis Analyze(const PartiallySignedTransaction& psbt, const Outputs& verified = {});\nAnalysis Prepared(const CTransaction& transaction, CAmount fee);\nbool MatchesReview(const PartiallySignedTransaction& psbt, const Analysis& proof, std::optional<CAmount> approved_fee);\nvoid FillMissing(PartiallySignedTransaction& psbt, const Analysis& proof);\n} // namespace psbtfee\n\n#endif // BITCOIN_QML_MODELS_PSBTFEE_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 555450ae9b22..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Additive cluster check can block a replacement the node acceptsqml/psbtpolicy.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · 555450ae9b22..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Closing an address note during its initial read discards typed textqml/pages/wallet/AddressDetails.qml | still_present | AssessmentThe new-head AddressDetails excerpt still makes the field read-only only when the editor is unavailable; it does not exclude Loading. The diff changes the close-dialog parent, not the loading/editability behavior or the requested regression. new_source: qml/pages/wallet/AddressDetails.qml [
{
"bounded": true,
"end_line": 225,
"evidence_id": "8eb7cffa22824d89b80d8880bb6c62a1",
"finding_id": "finding:7",
"kind": "new_source",
"line": 76,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/pages/wallet/AddressDetails.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 12,
"source_job_id": 2936,
"text": " topPadding: 2\n bottomPadding: 2\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsAmountRow\"\n amountValue: true\n hidesAmount: true\n Layout.fillWidth: true\n title: qsTr(\"Amount\")\n value: root.amount\n valueColor: root.hasAmount ? Theme.color.txIncoming : Theme.color.neutral6\n dividerColor: Theme.color.surfaceDivider\n }\n\n TextFieldRow {\n id: noteRow\n objectName: \"addressDetailsNoteRow\"\n visible: root.canEditLabel\n Layout.fillWidth: true\n //: Private address note, also used as the payment request's note to self.\n title: qsTr(\"Note to self\")\n fieldObjectName: \"addressDetailsNoteField\"\n fieldWidth: Math.min(320, Math.max(180, root.width * 0.55))\n text: root.label\n textInput: root.editor ? root.editor.text : null\n //: Placeholder shown when an address has no private note yet.\n placeholderText: qsTr(\"Add note…\")\n enabled: root.canEditLabel\n readOnly: !root.canEditLabel || (root.editor !== null && !root.editor.available)\n errorText: root.editor ? root.editor.error.message : root.noteErrorText\n dividerColor: Theme.color.surfaceDivider\n onEditingFinished: {\n if (!root.editor && text !== root.label) {\n root.editLabelRequested(root.address, text)\n }\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Type\")\n value: root.category === \"change\" ? qsTr(\"Change\") : qsTr(\"Receive\")\n dividerColor: Theme.color.surfaceDivider\n }\n\n ValueRow {\n objectName: \"addressDetailsAddressTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Address type\")\n value: root.scriptType === \"\" ? qsTr(\"Unknown\") : root.scriptType\n showDivider: false\n }\n }\n\n GridLayout {\n columns: 2\n visible: root.editor !== null && (root.editor.dirty || root.editor.conflict)\n Layout.fillWidth: true\n NeutralButton {\n objectName: \"addressDetailsDiscardNoteButton\"\n text: qsTr(\"Discard edits\")\n enabled: root.editor !== null && root.editor.canDiscard\n onClicked: root.editor.discard()\n }\n NeutralButton {\n objectName: \"addressDetailsUseCurrentNoteButton\"\n text: qsTr(\"Use current note\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.UseCurrent)\n }\n NeutralButton {\n objectName: \"addressDetailsKeepEditedNoteButton\"\n text: qsTr(\"Keep my edit\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.KeepEdit)\n }\n PrimaryButton {\n objectName: \"addressDetailsSaveNoteButton\"\n text: qsTr(\"Save note\")\n enabled: root.editor !== null && root.editor.canSave\n onClicked: root.editor.save()\n }\n }\n\n QtObject {\n readonly property Dialog dialog: Dialog {\n id: noteCloseDialog\n objectName: \"addressNoteClosePrompt\"\n // Keeps the overlay when the page leaves the window. A popup whose parent\n // goes null there loses its window while its item is still in the overlay,\n // and a hover event then crashes Qt 6.8.4 and newer.\n Binding on parent {\n when: root.Overlay.overlay !== null\n value: root.Overlay.overlay\n restoreMode: Binding.RestoreNone\n }\n modal: true\n width: Math.min(620, parent ? parent.width - 40 : 620)\n x: parent ? (parent.width - width) / 2 : 0\n y: parent ? (parent.height - height) / 2 : 0\n closePolicy: Popup.NoAutoClose\n visible: root.visible && root.editor !== null && root.editor.available && root.editor.closePrompt !== null\n title: qsTr(\"Save note edits?\")\n contentItem: GridLayout {\n columns: noteCloseDialog.width < 480 ? 1 : 3\n NeutralButton {\n id: keepEditingButton\n objectName: \"addressNoteKeepEditingButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: keepEditingButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Keep editing\")\n onClicked: if (keepEditingButton.pressedPrompt) keepEditingButton.pressedPrompt.answer(TextEditClosePrompt.KeepEditing)\n }\n NeutralButton {\n id: discardAndCloseButton\n objectName: \"addressNoteDiscardAndCloseButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: discardAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Discard\")\n onClicked: if (discardAndCloseButton.pressedPrompt) discardAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Discard)\n }\n PrimaryButton {\n id: saveAndCloseButton\n objectName: \"addressNoteSaveAndCloseButton\"\n Layout.fillWidth: true\n property TextEditClosePrompt pressedPrompt: null\n onPressed: saveAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Save\")\n enabled: root.editor !== null && root.editor.valid && !root.editor.conflict && !root.editor.busy\n onClicked: if (saveAndCloseButton.pressedPrompt) saveAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Save)\n }\n }\n }\n }\n Keys.onEscapePressed: function(event) {\n if (root.editor) root.editor.requestClose()\n else root.closeRequested()\n event.accepted = true\n }\n\n PrimaryButton {\n objectName: \"addressDetailsCreatePaymentRequestButton\"\n Layout.fillWidth: true",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 555450ae9b22..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Refused request deletion gives no feedback in the modalqml/models/requestdeletecontroller.cpp | unclear | AssessmentThe supplied diff shows qml/models/requestdeletecontroller.cpp being deleted, but provides no new-head implementation or other evidence showing whether refused deletion requests now expose controller-owned failure state that dismiss() clears. path_diff: qml/models/requestdeletecontroller.cpp [
{
"evidence_id": "b92c42150c1c4027b1e0b835aead5c33",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/models/requestdeletecontroller.cpp",
"source_generation": 12,
"source_job_id": 2936,
"text": "diff --git a/qml/models/requestdeletecontroller.cpp b/qml/models/requestdeletecontroller.cpp\ndeleted file mode 100644\nindex d000dbbd44..0000000000\n--- a/qml/models/requestdeletecontroller.cpp\n+++ /dev/null\n@@ -1,97 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-#include <qml/models/requestdeletecontroller.h>\n-\n-#include <QQmlEngine>\n-\n-RequestDeleteController::RequestDeleteController(QObject* parent) : QObject(parent) {}\n-\n-RequestDeleteController::~RequestDeleteController()\n-{\n- if (!m_deletion) return;\n- disconnect(m_deletion, nullptr, this, nullptr);\n- if (!m_deletion->busy()) m_deletion->retire();\n- QQmlEngine::setObjectOwnership(m_deletion, QQmlEngine::JavaScriptOwnership);\n-}\n-\n-void RequestDeleteController::setReceive(WalletReceiveModel* receive)\n-{\n- if (m_receive == receive) return;\n- reset();\n- m_receive = receive;\n- Q_EMIT receiveChanged();\n-}\n-\n-bool RequestDeleteController::asking() const\n-{\n- return m_deletion && m_deletion->closePrompt() && !m_deletion->busy();\n-}\n-\n-bool RequestDeleteController::failed() const\n-{\n- if (!m_deletion || m_deletion->busy() || m_deletion->closePrompt()) return false;\n- const auto result = m_deletion->saveResult();\n- return (result.present && !result.erased) || m_deletion->error().code != TextEditError::None;\n-}\n-\n-QString RequestDeleteController::error() const\n-{\n- if (!failed()) return {};\n- const auto result = m_deletion->saveResult();\n- return !result.errorText.isEmpty() ? result.errorText : m_deletion->error().message;\n-}\n-\n-bool RequestDeleteController::request(const QString& id)\n-{\n- if (m_deletion || !m_receive) return false;\n- auto* deletion = m_receive->deleteRequest(id);\n- if (!deletion) return false;\n- // QML does not collect the question while this controller follows it.\n- QQmlEngine::setObjectOwnership(deletion, QQmlEngine::CppOwnership);\n- m_deletion = deletion;\n- connect(deletion, &PaymentRequestEditorModel::changed, this, &RequestDeleteController::changed);\n- connect(deletion, &PaymentRequestEditorModel::keptEditing, this, &RequestDeleteController::release);\n- connect(deletion, &PaymentRequestEditorModel::closed, this, &RequestDeleteController::release);\n- connect(deletion, &QObject::destroyed, this, &RequestDeleteController::changed);\n- connect(deletion, &PaymentRequestEditorModel::persisted, this, [this](const RequestSaveResult& result) {\n- if (result.erased) Q_EMIT deleted(result.requestId);\n- });\n- Q_EMIT changed();\n- return true;\n-}\n-\n-void RequestDeleteController::confirm()\n-{\n- if (asking()) m_deletion->closePrompt()->answer(TextEditClosePrompt::Save);\n-}\n-\n-void RequestDeleteController::cancel()\n-{\n- if (asking()) m_deletion->closePrompt()->answer(TextEditClosePrompt::KeepEditing);\n-}\n-\n-void RequestDeleteController::dismiss()\n-{\n- if (!failed()) return;\n- m_deletion->retire();\n- release();\n-}\n-\n-void RequestDeleteController::reset()\n-{\n- if (!m_deletion) return;\n- if (asking()) { cancel(); return; }\n- if (!m_deletion->busy()) m_deletion->retire();\n- release();\n-}\n-\n-void RequestDeleteController::release()\n-{\n- if (!m_deletion) return;\n- disconnect(m_deletion, nullptr, this, nullptr);\n- QQmlEngine::setObjectOwnership(m_deletion, QQmlEngine::JavaScriptOwnership);\n- m_deletion = nullptr;\n- Q_EMIT changed();\n-}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 555450ae9b22..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Readiness ignores the fee caps submission enforcesqml/psbtpolicy.cpp | addressed | AssessmentThe fee-rate cap passed to testmempoolaccept is now nonzero and aligned with the submission policy, and the new absolute-fee check blocks transactions above the fixed cap before an affirmative readiness result. path_diff: qml/psbtpolicy.cpp; new_source: qml/psbtpolicy.cpp [
{
"evidence_id": "5fa3025f275749769b6e09a3bdb96cb9",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/psbtpolicy.cpp",
"source_generation": 12,
"source_job_id": 2936,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex 97d6c8d9e8..dac47edbc0 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -3,6 +3,7 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/psbtpolicy.h>\n+#include <qml/bitcoinunits.h>\n \n #include <coins.h>\n #include <consensus/consensus.h>\n@@ -31,7 +32,8 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- parameters.push_back(0); // Disable only testmempoolaccept's independent client max-fee-rate cap.\n+ // The same fee-rate cap that submission passes to broadcastTransaction.\n+ parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -46,11 +48,14 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n+ if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n- // An allowed conflict is a replacement. Name what it evicts.\n+ // An allowed conflict is a replacement. Name what it evicts; until the\n+ // lookup completes, the review must not imply that nothing is evicted.\n+ facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n@@ -67,6 +72,7 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n+ facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n@@ -89,6 +95,7 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n+ facts.replaces_unknown = false;\n }\n } // namespace\n \n@@ -97,6 +104,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n+ facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -156,6 +164,7 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n+ if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n@@ -164,6 +173,9 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.replaces.isEmpty()) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n }\n+ if (facts.replaces_unknown) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n+ }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 153,
"evidence_id": "91764f8583ba4271b269cd06c9cdd1d0",
"finding_id": "finding:5",
"kind": "new_source",
"line": 4,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/psbtpolicy.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 12,
"source_job_id": 2936,
"text": "\n#include <qml/psbtpolicy.h>\n#include <qml/bitcoinunits.h>\n\n#include <coins.h>\n#include <consensus/consensus.h>\n#include <consensus/tx_verify.h>\n#include <core_io.h>\n#include <interfaces/chain.h>\n#include <interfaces/node.h>\n#include <policy/policy.h>\n#include <univalue.h>\n#include <util/result.h>\n\n#include <QCoreApplication>\n\n#include <algorithm>\n#include <limits>\n#include <map>\n#include <utility>\n\nnamespace {\nQString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n\nvoid ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n{\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n // The same fee-rate cap that submission passes to broadcastTransaction.\n parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n if (!result.isObject() || !result.exists(\"txid\") || !result[\"txid\"].isStr()\n || !result.exists(\"wtxid\") || !result[\"wtxid\"].isStr()\n || result[\"txid\"].get_str() != transaction.GetHash().ToString()\n || result[\"wtxid\"].get_str() != transaction.GetWitnessHash().ToString()\n || !result.exists(\"allowed\") || !result[\"allowed\"].isBool()) return;\n\n const bool allowed = result[\"allowed\"].get_bool();\n QString reason;\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n // An allowed conflict is a replacement. Name what it evicts; until the\n // lookup completes, the review must not imply that nothing is evicted.\n facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n outpoint.pushKV(\"txid\", input.prevout.hash.GetHex());\n outpoint.pushKV(\"vout\", uint64_t{input.prevout.n});\n outpoints.push_back(std::move(outpoint));\n }\n UniValue spending_parameters{UniValue::VARR};\n spending_parameters.push_back(std::move(outpoints));\n const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n if (!spending.isArray()) return;\n for (const auto& item : spending.getValues()) {\n if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n}\n\nvoid ClearChainFacts(psbtpolicy::Facts& facts)\n{\n facts.observed = false;\n facts.missing_inputs = false;\n facts.immature_inputs = false;\n facts.final = true;\n facts.sufficient_fee = true;\n facts.chain_limits = true;\n facts.tip.clear();\n facts.chain_error.clear();\n}\n\nvoid ClearAdmissionFacts(psbtpolicy::Facts& facts)\n{\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n facts.replaces_unknown = false;\n}\n} // namespace\n\npsbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n{\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n int height{-1}; int64_t mtp{0}; bool active{false};\n if (chain->findBlock(tip, interfaces::FoundBlock{}.height(height).mtpTime(mtp).inActiveChain(active))\n && active && height >= 0 && height < std::numeric_limits<int>::max()) {\n std::map<COutPoint, Coin> coins;\n for (const auto& input : transaction->vin) coins.try_emplace(input.prevout);\n chain->findCoins(coins); // Includes available mempool parents.\n for (const auto& [outpoint, coin] : coins) {\n facts.missing_inputs |= coin.IsSpent();\n facts.immature_inputs |= !coin.IsSpent() && coin.IsCoinBase()\n && int64_t(height) + 1 - coin.nHeight < COINBASE_MATURITY;\n }\n facts.final = IsFinalTx(*transaction, height + 1, mtp);\n const auto minimum = std::max(chain->mempoolMinFee(), chain->relayMinFee());\n facts.sufficient_fee = fee >= minimum.GetFee(GetVirtualTransactionSize(*transaction));\n const auto limits = chain->checkChainLimits(transaction);\n facts.chain_limits = bool(limits);\n if (!limits) facts.chain_error = QString::fromStdString(util::ErrorString(limits).translated).left(4096);\n // A reorg during this collection invalidates the whole observation.\n if (node->getBestBlockHash() == tip) {\n facts.tip = QString::fromStdString(tip.ToString());\n facts.observed = true;\n } else {\n ClearChainFacts(facts);\n }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 555450ae9b22..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Signer verification leaves output commitments uncheckedqml/walletsend.cpp | addressed | AssessmentThe new-head production paths invoke CommitsToAllOutputs for external transactions, PSBT sends, and approval results. The helper also checks PSBT sighash metadata and signature bytes, including finalized inputs, as shown in the related new-head helper evidence. path_diff: qml/walletsend.cpp; new_source: qml/walletsend.cpp [
{
"evidence_id": "ff9fbb89abaa46c3b3e338f7c71e72e0",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/walletsend.cpp",
"source_generation": 12,
"source_job_id": 2936,
"text": "diff --git a/qml/walletsend.cpp b/qml/walletsend.cpp\nindex d9919ab84f..5ba1a6231e 100644\n--- a/qml/walletsend.cpp\n+++ b/qml/walletsend.cpp\n@@ -95,7 +95,7 @@ bool VerifiedExternalTransaction(interfaces::Wallet& wallet, const CTransaction&\n document.inputs[i].final_script_sig = transaction.vin[i].scriptSig;\n document.inputs[i].final_script_witness = transaction.vin[i].scriptWitness;\n }\n- return VerifiedSignatures(document);\n+ return VerifiedSignatures(document) && psbtsignatures::CommitsToAllOutputs(document);\n } catch (...) { return false; }\n }\n struct Observation {\n@@ -178,6 +178,7 @@ Result Execute(interfaces::Wallet& wallet, Request request)\n if (request.assessed_complete && request.reviewed->GetWitnessHash() != MakeTransactionRef(extracted)->GetWitnessHash()) { result.error = Error::ChangedTransaction; return result; }\n if (!psbtfee::MatchesReview(psbt, *authenticated, request.approved_fee)) { result.error = Error::InvalidFee; return result; }\n if (!VerifiedSignatures(psbt)) { result.error = Error::InvalidSignature; return result; }\n+ if (!psbtsignatures::CommitsToAllOutputs(psbt)) { result.error = Error::UncommittedOutputs; return result; }\n transaction = MakeTransactionRef(std::move(extracted));\n } else if (wallet.privateKeysDisabled()) {\n if (!wallet.hasExternalSigner()) { result.error = Error::CannotSign; return result; }\n@@ -332,7 +333,7 @@ bool VerifyExternalTransaction(interfaces::Wallet& wallet, const CTransaction& t\n return VerifiedExternalTransaction(wallet, transaction);\n }\n \n-execution::Admission Operation::start(Request request, std::shared_ptr<const walletopening::Session::Action> action)\n+execution::SubmitResult SendTask::start(Request request, std::shared_ptr<const walletopening::Session::Action> action)\n {\n {\n std::lock_guard lock{m_mutex};\n@@ -363,7 +364,7 @@ execution::Admission Operation::start(Request request, std::shared_ptr<const wal\n return plan([self] { self->beginOnDomain(); });\n }\n \n-execution::Admission Operation::plan(std::function<void()> work)\n+execution::SubmitResult SendTask::plan(std::function<void()> work)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n { std::lock_guard lock{m_mutex}; action = m_action; }\n@@ -371,7 +372,7 @@ execution::Admission Operation::plan(std::function<void()> work)\n return m_opening->planAction(action, std::move(work));\n }\n \n-void Operation::beginOnDomain()\n+void SendTask::beginOnDomain()\n {\n Notice notice{Notice::SweepConsentRequired};\n bool wait_for_sweep{false}, cancelled{false};\n@@ -398,7 +399,7 @@ void Operation::beginOnDomain()\n dispatchNative();\n }\n \n-void Operation::dispatchNative(secretinput::Captured passphrase)\n+void SendTask::dispatchNative(secretinput::Captured passphrase)\n {\n Request request;\n std::shared_ptr<const walletopening::Session::Action> action;\n@@ -452,7 +453,7 @@ void Operation::dispatchNative(secretinput::Captured passphrase)\n if (!admitted) nativeCompleted(FailureResult(Error::Rejected));\n }\n \n-void Operation::nativeCompleted(Result result)\n+void SendTask::nativeCompleted(Result result)\n {\n if (!result.candidate) {\n std::lock_guard lock{m_mutex};\n@@ -488,7 +489,7 @@ void Operation::nativeCompleted(Result result)\n } else if (m_notes) {\n try {\n auto accepted = m_notes->submitSentLabels(action, result.committed->GetHash(), notes,\n- [notify = m_notify, weak = std::weak_ptr<Operation>{shared_from_this()}] {\n+ [notify = m_notify, weak = std::weak_ptr<SendTask>{shared_from_this()}] {\n try { notify(Notice::Notes); }\n catch (...) { if (const auto owner = weak.lock()) owner->publicationFailed(); }\n });\n@@ -499,7 +500,7 @@ void Operation::nativeCompleted(Result result)\n complete(std::move(result));\n }\n \n-execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t review_id)\n+execution::SubmitResult SendTask::confirmSweep(uint64_t attempt_id, uint64_t review_id)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -510,7 +511,7 @@ execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t revie\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id] {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id] {\n bool accepted{false}, cancelled{false};\n {\n std::lock_guard lock{self->m_mutex};\n@@ -527,11 +528,11 @@ execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t revie\n if (cancelled) self->complete(FailureResult(Error::Cancelled));\n else if (accepted) self->dispatchNative();\n });\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t review_id, secretinput::Captured passphrase)\n+execution::SubmitResult SendTask::providePassphrase(uint64_t attempt_id, uint64_t review_id, secretinput::Captured passphrase)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -542,7 +543,7 @@ execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id, passphrase = std::move(passphrase)]() mutable {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id, passphrase = std::move(passphrase)]() mutable {\n bool accepted{false}, cancelled{false};\n {\n std::lock_guard lock{self->m_mutex};\n@@ -559,11 +560,11 @@ execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t\n if (cancelled) self->complete(FailureResult(Error::Cancelled));\n else if (accepted) self->dispatchNative(std::move(passphrase));\n });\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t review_id)\n+execution::SubmitResult SendTask::cancelPrompt(uint64_t attempt_id, uint64_t review_id)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -575,7 +576,7 @@ execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t revie\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id] {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id] {\n {\n std::lock_guard lock{self->m_mutex};\n if (self->m_result || self->m_attempt_id != attempt_id || self->m_review_id != review_id ||\n@@ -586,18 +587,18 @@ execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t revie\n }\n self->complete(FailureResult(Error::Cancelled));\n });\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-Stage Operation::stage() const { std::lock_guard lock{m_mutex}; return m_stage; }\n-Error Operation::promptError() const { std::lock_guard lock{m_mutex}; return m_prompt_error; }\n+Stage SendTask::stage() const { std::lock_guard lock{m_mutex}; return m_stage; }\n+Error SendTask::promptError() const { std::lock_guard lock{m_mutex}; return m_prompt_error; }\n \n-std::optional<Result> Operation::result() const\n+std::optional<Result> SendTask::result() const\n {\n std::lock_guard lock{m_mutex}; return m_result;\n }\n-void Operation::complete(Result result)\n+void SendTask::complete(Result result)\n {\n Request discarded;\n std::shared_ptr<const walletopening::Session::Action> retired_action;\n@@ -626,7 +627,7 @@ void Operation::complete(Result result)\n try { m_notify(Notice::Finished); }\n catch (...) { publicationFailed(); }\n }\n-void Operation::publicationFailed()\n+void SendTask::publicationFailed()\n {\n std::lock_guard lock{m_mutex}; m_publication_failed = true;\n if (m_result) m_result->publication_failed = true;\n@@ -663,7 +664,8 @@ static Result ExecuteApproval(interfaces::Wallet& wallet, const Request& request\n const auto returned = document.GetUnsignedTx();\n if (returned && MatchesUnsignedTransaction(unsigned_tx, *returned) &&\n psbtfee::MatchesReview(document, *authenticated, request.approved_fee) &&\n- psbtsignatures::VerifyFinalizedInputs(document, /*require_all=*/false)) {\n+ psbtsignatures::VerifyFinalizedInputs(document, /*require_all=*/false) &&\n+ psbtsignatures::CommitsToAllOutputs(document)) {\n result.signature_status = psbtsignatures::VerifyContributions(*approved, document);\n if (result.signature_status == psbtsignatures::Status::Valid) {\n result.document = std::make_shared<const PartiallySignedTransaction>(document);\n@@ -694,6 +696,10 @@ static Result ExecuteApproval(interfaces::Wallet& wallet, const Request& request\n result.document = approved;\n result.error = Error::InvalidFee; return result;\n }\n+ if (!psbtsignatures::CommitsToAllOutputs(document)) {\n+ result.document = approved;\n+ result.error = Error::UncommittedOutputs; return result;\n+ }\n if (extracted) {\n if (!walletsend::VerifiedSignatures(document)) {\n // Finalization and a signer's completion flag do not prove\n@@ -803,7 +809,7 @@ void ApprovalOwner::publish(const std::shared_ptr<State>& state, const Notify& n\n if (notify) notify(project(*state));\n }\n \n-execution::Admission ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t view_revision)\n+execution::SubmitResult ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t view_revision)\n {\n if (!m_opening || m_close_requested.load()) return {{}, execution::Rejection::Closed};\n const auto state = m_state;\n@@ -839,7 +845,7 @@ execution::Admission ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t v\n });\n }\n \n-execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review_id, uint64_t view_revision,\n+execution::SubmitResult ApprovalOwner::request(uint64_t attempt_id, uint64_t review_id, uint64_t view_revision,\n std::shared_ptr<Request> retained_request)\n {\n if (!m_opening || m_close_requested.load() || attempt_id == 0 || !retained_request)\n@@ -959,10 +965,10 @@ execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review\n value.error = ApprovalExecutionError(std::move(error));\n finish(std::move(value));\n };\n- const auto admission = opening->perform(action, [request, output](interfaces::Wallet& wallet) {\n+ const auto started = opening->perform(action, [request, output](interfaces::Wallet& wallet) {\n return ApproveInto(wallet, *request, output);\n }, finish, failed);\n- if (!admission) {\n+ if (!started) {\n Result value;\n value.error = Error::Failed;\n finish(std::move(value));\n@@ -970,7 +976,7 @@ execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review\n });\n }\n \n-execution::Admission ApprovalOwner::close()\n+execution::SubmitResult ApprovalOwner::close()\n {\n if (m_close_requested.exchange(true)) return {{}, execution::Rejection::Invalid};\n if (!m_opening) return {{}, execution::Rejection::Closed};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 817,
"evidence_id": "3c4df831b9e246e4bda2579b677d3e90",
"finding_id": "finding:3",
"kind": "new_source",
"line": 668,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/walletsend.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 12,
"source_job_id": 2936,
"text": " psbtsignatures::CommitsToAllOutputs(document)) {\n result.signature_status = psbtsignatures::VerifyContributions(*approved, document);\n if (result.signature_status == psbtsignatures::Status::Valid) {\n result.document = std::make_shared<const PartiallySignedTransaction>(document);\n result.partial = true;\n } else if (result.signature_status == psbtsignatures::Status::Unknown) {\n result.quarantined_document = std::make_shared<const PartiallySignedTransaction>(document);\n }\n }\n };\n try {\n auto error = wallet.fillPSBT({.sign = false, .bip32_derivs = true}, nullptr, document, complete);\n if (!error && !complete) error = wallet.fillPSBT({.sign = true, .bip32_derivs = true}, nullptr, document, complete);\n if (error) {\n retain_verified_partial();\n result.fill_error = error;\n result.error = *error == common::PSBTError::EXTERNAL_SIGNER_NOT_FOUND ? Error::SignerNotFound\n : *error == common::PSBTError::EXTERNAL_SIGNER_FAILED ? Error::SignerFailed : Error::Fill;\n return result;\n }\n const auto returned = document.GetUnsignedTx();\n if (!returned || !MatchesUnsignedTransaction(unsigned_tx, *returned)) {\n result.document = approved;\n result.error = Error::ChangedTransaction; return result;\n }\n CMutableTransaction signed_tx;\n const bool extracted = FinalizeAndExtractPSBT(document, signed_tx);\n if (!psbtfee::MatchesReview(document, *authenticated, request.approved_fee)) {\n result.document = approved;\n result.error = Error::InvalidFee; return result;\n }\n if (!psbtsignatures::CommitsToAllOutputs(document)) {\n result.document = approved;\n result.error = Error::UncommittedOutputs; return result;\n }\n if (extracted) {\n if (!walletsend::VerifiedSignatures(document)) {\n // Finalization and a signer's completion flag do not prove\n // that the replacement can service the original input keys.\n result.document = approved;\n result.error = Error::InvalidSignature; return result;\n }\n result.signature_status = psbtsignatures::Status::Valid;\n } else {\n result.signature_status = psbtsignatures::VerifyContributions(*approved, document);\n if (result.signature_status != psbtsignatures::Status::Valid) {\n result.document = approved;\n result.error = result.signature_status == psbtsignatures::Status::Invalid\n ? Error::InvalidSignature : Error::UnverifiedSignatures;\n if (result.signature_status == psbtsignatures::Status::Unknown)\n result.quarantined_document = std::make_shared<const PartiallySignedTransaction>(std::move(document));\n return result;\n }\n }\n result.document = std::make_shared<const PartiallySignedTransaction>(std::move(document));\n result.partial = !extracted;\n if (extracted) result.signed_transaction = MakeTransactionRef(std::move(signed_tx));\n } catch (...) {\n result.error = Error::Uncertain;\n try {\n retain_verified_partial();\n } catch (...) {}\n }\n return result;\n}\nResult Approve(interfaces::Wallet& wallet, const Request& request, std::shared_ptr<walletopening::Session> opening)\n{\n // Standalone backend tests may inspect native values entirely on their\n // controlled worker. Production reserves ownership before device execution.\n if (!opening) return ExecuteApproval(wallet, request);\n auto owner = walletopening::RetainValues<Result>(opening, [] { return std::make_unique<Result>(); });\n if (!owner) return Result{.error = Error::Failed};\n return ApproveInto(wallet, request, std::move(owner));\n}\nResult ApproveInto(interfaces::Wallet& wallet, const Request& request, std::shared_ptr<Result> owner)\n{\n if (!owner) return Result{.error = Error::Failed};\n *owner = ExecuteApproval(wallet, request);\n Result result = *owner;\n result.lifetime = owner;\n if (result.document) result.document = std::shared_ptr<const PartiallySignedTransaction>{owner, result.document.get()};\n if (result.quarantined_document) result.quarantined_document = std::shared_ptr<const PartiallySignedTransaction>{owner, result.quarantined_document.get()};\n if (result.signed_transaction) result.signed_transaction = CTransactionRef{owner, result.signed_transaction.get()};\n return result;\n}\n\nstruct ApprovalOwner::State {\n uint64_t sequence{0};\n uint64_t current_review{0}, current_view{0};\n uint64_t attempt_id{0}, attempt_review{0}, attempt_view{0};\n ApprovalPhase phase{ApprovalPhase::Idle};\n Error error{Error::None};\n bool signer_not_found{false}, in_flight{false}, publishable{false}, closed{false};\n std::shared_ptr<Request> request;\n std::shared_ptr<const walletopening::Session::Action> action;\n std::shared_ptr<Result> output;\n std::shared_ptr<const Result> result;\n};\n\nnamespace {\nbool IsStaleApproval(uint64_t attempt_id, uint64_t attempt_review, uint64_t attempt_view,\n uint64_t current_review, uint64_t current_view)\n{\n return attempt_id && (attempt_review != current_review || attempt_view != current_view);\n}\n\nError ApprovalExecutionError(std::exception_ptr error)\n{\n if (!error) return Error::Uncertain;\n try { std::rethrow_exception(error); }\n catch (const execution::NotStarted&) { return Error::Failed; }\n catch (...) { return Error::Uncertain; }\n}\n}\n\nApprovalOwner::ApprovalOwner(std::shared_ptr<walletopening::Session> opening, Notify notify)\n : m_opening(std::move(opening)), m_notify(std::move(notify)), m_state(std::make_shared<State>())\n{\n}\n\nApprovalSnapshot ApprovalOwner::project(const State& state)\n{\n ApprovalSnapshot result;\n result.sequence = state.sequence;\n result.attempt_id = state.attempt_id;\n result.attempt_review = state.attempt_review;\n result.attempt_view = state.attempt_view;\n result.current_review = state.current_review;\n result.current_view = state.current_view;\n result.phase = state.phase;\n result.error = state.error;\n result.signer_not_found = state.signer_not_found;\n result.in_flight = state.in_flight;\n result.publishable = state.publishable && !state.closed && !IsStaleApproval(state.attempt_id,\n state.attempt_review, state.attempt_view, state.current_review, state.current_view);\n result.result = state.result;\n return result;\n}\n\nvoid ApprovalOwner::publish(const std::shared_ptr<State>& state, const Notify& notify)\n{\n if (notify) notify(project(*state));\n}\n\nexecution::SubmitResult ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t view_revision)\n{\n if (!m_opening || m_close_requested.load()) return {{}, execution::Rejection::Closed};\n const auto state = m_state;\n const auto notify = m_notify;\n return m_opening->postDomain([state, notify, review_id, view_revision] {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 555450ae9b22..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Predictable /tmp intent directory lets another user block startupqml/desktopintenttransport.cpp | addressed | AssessmentThe new-head initialization uses QStandardPaths::RuntimeLocation and creates the intent directory beneath it, replacing the predictable shared /tmp location that enabled another account to pre-create the endpoint directory. path_diff: qml/desktopintenttransport.cpp; new_source: qml/desktopintenttransport.cpp [
{
"evidence_id": "a05fb7f5e973430ca4ad1dc5e4119965",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/desktopintenttransport.cpp",
"source_generation": 12,
"source_job_id": 2936,
"text": "diff --git a/qml/desktopintenttransport.cpp b/qml/desktopintenttransport.cpp\nindex 1bd50cb0e9..df095f879a 100644\n--- a/qml/desktopintenttransport.cpp\n+++ b/qml/desktopintenttransport.cpp\n@@ -2,7 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/desktopintenttransport.h>\n-#include <qml/retainedvalue.h>\n+#include <qml/asyncjoin.h>\n #include <util/fs.h>\n \n #include <QCoreApplication>\n@@ -17,6 +17,8 @@\n #include <QLocalSocket>\n #include <QLockFile>\n #include <QMetaObject>\n+#include <QScopeGuard>\n+#include <QStandardPaths>\n #include <QStringList>\n #include <QThread>\n #include <QTimer>\n@@ -196,25 +198,26 @@ struct Discovery {\n struct Service::Flags {\n std::atomic_bool admission_closed{false}, stopping{false}, started{false}, retired{false};\n std::mutex mutex;\n- execution::TaskId retired_task;\n- std::function<void()> completed_stop;\n+ std::vector<std::function<void()>> completed_stops;\n bool probed{false}, probe_pending{false}, probe_terminal{false}; // Protected by mutex.\n };\n struct Service::State {\n struct Native;\n- std::shared_ptr<execution::Scheduler> scope;\n std::shared_ptr<Owner> owner;\n Limits limits;\n- execution::ResourceKey key;\n const std::shared_ptr<Flags> flags{std::make_shared<Flags>()};\n- std::shared_ptr<execution::ResourceLease> native_lifetime;\n- std::mutex mutex;\n+ // The same lock protects admission, pending delivery and the receiver\n+ // used to post work to the transport thread.\n Native* native{nullptr};\n+ size_t pending_deliveries{0};\n+ bool post(std::function<void(Native&)> work);\n+ void finishDelivery();\n+ void retireWhenIdle();\n };\n \n struct Service::State::Native final : QObject {\n struct Query { QJsonArray results; QStringList keys; size_t remaining{0}; bool unknown{false}; };\n- struct Reply { std::optional<desktopintent::Admission> admission; std::optional<Receipt> receipt; };\n+ struct Reply { std::optional<desktopintent::Acceptance> admission; std::optional<Receipt> receipt; };\n struct Cell {\n std::mutex mutex;\n QObject* receiver{nullptr}; std::function<void()> notify;\n@@ -230,7 +233,7 @@ struct Service::State::Native final : QObject {\n };\n struct Pending { uint64_t connection; std::shared_ptr<Cell> cell; std::shared_ptr<Query> query{}; qsizetype index{0}; QStringList keys{}; };\n const std::shared_ptr<State> state;\n- QLocalServer server;\n+ QLocalServer server{this};\n std::unique_ptr<QLockFile> instance_lock;\n struct Client { QLocalSocket* socket; Limits::Time admitted; };\n std::map<uint64_t, Client> clients;\n@@ -306,7 +309,7 @@ struct Service::State::Native final : QObject {\n QStringList keys; for (const auto& input : inputs) keys.push_back(input.producer_key);\n const auto cell = reserve(id, {}, 0, std::move(keys)); if (!cell) { send(id, {{\"status\", \"rejected\"}}); return; }\n const auto admitted = state->owner->admit(std::move(inputs), [cell](auto result) { cell->complete({std::move(result), {}}); });\n- if (!admitted) cell->complete({desktopintent::Admission{Error::Closed, {}}, {}});\n+ if (!admitted) cell->complete({desktopintent::Acceptance{Error::Closed, {}}, {}});\n } else if (command == \"query\") {\n const auto keys = object.value(\"keys\").toArray();\n if (keys.empty() || keys.size() > static_cast<qsizetype>(Queue::MAX_PENDING) || replies.size() + static_cast<size_t>(keys.size()) > MAX_REPLIES) { socket->abort(); return; }\n@@ -351,17 +354,19 @@ struct Service::State::Native final : QObject {\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n- std::shared_ptr<execution::ResourceLease> lifetime;\n- { std::lock_guard lock{state->mutex}; state->native = nullptr; lifetime = std::move(state->native_lifetime); }\n- delete this;\n- lifetime.reset(); // Only now may the original Native event loop drain.\n+ QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n #ifndef Q_OS_WIN\n- private_directory = QDir{QStringLiteral(\"/tmp\")}.filePath(QStringLiteral(\"qml-intent-%1\").arg(getuid()));\n+ // The runtime directory belongs to this user (Qt checks its owner and\n+ // mode). A fixed name in the shared /tmp could be created first by\n+ // another user, which would block delivery for this one.\n+ const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n+ if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n+ private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n@@ -440,37 +445,83 @@ struct Service::State::Native final : QObject {\n }\n };\n \n+bool Service::State::post(std::function<void(Native&)> work)\n+{\n+ std::lock_guard lock{flags->mutex};\n+ return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n+ work(*receiver);\n+ }, Qt::QueuedConnection);\n+}\n+\n+void Service::State::finishDelivery()\n+{\n+ {\n+ std::lock_guard lock{flags->mutex};\n+ --pending_deliveries;\n+ }\n+ retireWhenIdle();\n+}\n+\n+void Service::State::retireWhenIdle()\n+{\n+ std::lock_guard lock{flags->mutex};\n+ if (!flags->stopping || pending_deliveries || !native) return;\n+ auto* receiver = std::exchange(native, nullptr);\n+ if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n+}\n+\n Service::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\n Service::~Service() { stop(); }\n-std::shared_ptr<Service> Service::Create(std::shared_ptr<execution::Scheduler> scheduler, std::shared_ptr<Owner> owner, Limits limits)\n+bool Service::post(std::function<void()> work) const\n+{\n+ const auto state = m_state.load();\n+ return state && state->post([work = std::move(work)](State::Native&) { work(); });\n+}\n+\n+std::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n {\n const auto maximum = std::chrono::seconds{30};\n- if (!scheduler || !owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n+ if (!owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n limits.connect <= std::chrono::milliseconds::zero() || limits.connect > limits.startup ||\n limits.acknowledge <= std::chrono::milliseconds::zero() || limits.acknowledge > limits.startup ||\n limits.query <= std::chrono::milliseconds::zero() || limits.query > limits.startup ||\n limits.client <= std::chrono::milliseconds::zero() || limits.client > maximum ||\n limits.slice <= std::chrono::milliseconds::zero() || limits.slice > std::chrono::milliseconds{100}) return {};\n- auto scope = scheduler->openActionScope(); if (!scope) return {};\n- auto state = execution::RetainValues<State>(scope, [] { return std::make_unique<State>(); }); if (!state) return {};\n- state->scope = scope; state->owner = std::move(owner); state->limits = std::move(limits); state->key = scope->allocateKey();\n- const auto retired = execution::Submit(*scope, [] {}, [state] {\n- std::function<void()> done;\n- { std::lock_guard lock{state->mutex}; state->owner.reset(); }\n- { std::lock_guard lock{state->flags->mutex}; state->flags->retired = true; done = std::move(state->flags->completed_stop); }\n- if (done) done();\n- }, {}, {execution::Lane::Cleanup, state->key}, true);\n- auto borrowed = retired ? scope->borrow(state->key) : execution::BorrowAdmission{{}, retired.rejection};\n- if (!borrowed) { if (retired) scope->activateCleanup(retired.id); return {}; }\n- state->flags->retired_task = retired.id;\n- state->native_lifetime = std::make_shared<execution::ResourceLease>(std::move(*borrowed.lease));\n- return std::shared_ptr<Service>{new Service(std::move(state))};\n+ auto* const app = QCoreApplication::instance();\n+ Q_ASSERT(app && QThread::currentThread() == app->thread());\n+ auto state = std::make_shared<State>();\n+ state->owner = std::move(owner);\n+ state->limits = std::move(limits);\n+ auto thread = std::make_unique<QThread>();\n+ thread->setObjectName(QStringLiteral(\"desktop transport\"));\n+ auto native = std::make_unique<State::Native>(state);\n+ auto service = std::shared_ptr<Service>{new Service(state)};\n+ QObject::connect(thread.get(), &QThread::finished, native.get(), &QObject::deleteLater);\n+ QObject::connect(thread.get(), &QThread::finished, app, [app, state, worker = thread.get()] {\n+ JoinThreadAsync([state, worker] {\n+ if (!worker->wait()) std::terminate();\n+ state->owner.reset();\n+ std::vector<std::function<void()>> completed;\n+ {\n+ std::lock_guard lock{state->flags->mutex};\n+ state->flags->retired = true;\n+ completed = std::move(state->flags->completed_stops);\n+ }\n+ for (const auto& done : completed) {\n+ try { done(); } catch (...) {}\n+ }\n+ }, app, [worker] { delete worker; });\n+ }, Qt::QueuedConnection);\n+ native->moveToThread(thread.get());\n+ state->native = native.release();\n+ thread.release()->start();\n+ return service;\n }\n-execution::Admission Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n+execution::SubmitResult Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n {\n return begin(std::move(directory), std::move(network), std::move(inputs), false, std::move(completed), {});\n }\n-execution::Admission Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n+execution::SubmitResult Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n {\n if (inputs.size() > Queue::MAX_PENDING) return {{}, execution::Rejection::Invalid};\n const auto callback = std::move(completed);\n@@ -487,7 +538,7 @@ execution::Admission Service::probeExisting(QString directory, QString network,\n const auto missing = [callback] { if (callback) callback({ProbeStatus::Missing, {}}); };\n return begin(std::move(directory), std::move(network), inputs, true, transfer, missing);\n }\n-execution::Admission Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n+execution::SubmitResult Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n std::function<void(StartResult)> completed, std::function<void()> missing)\n {\n const auto state = m_state.load();\n@@ -497,80 +548,82 @@ execution::Admission Service::begin(QString directory, QString network, std::vec\n return {{}, execution::Rejection::Closed};\n if (existing_only) { m_flags->probed = true; m_flags->probe_pending = true; }\n else m_flags->started = true;\n+ ++state->pending_deliveries;\n }\n- const auto reject = [flags = m_flags, existing_only](execution::Rejection reason) {\n- if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- return execution::Admission{{}, reason};\n- };\n+ auto release_rejected = qScopeGuard([&] {\n+ if (existing_only) {\n+ std::lock_guard lock{m_flags->mutex};\n+ m_flags->probe_pending = false;\n+ m_flags->probe_terminal = true;\n+ }\n+ state->finishDelivery();\n+ });\n if (directory.size() > 4096 || QString::fromUtf8(directory.toUtf8()) != directory || network.isEmpty() || network.size() > 128 || directory.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\n'}) || inputs.size() > Queue::MAX_PENDING)\n- return reject(execution::Rejection::Invalid);\n+ return {{}, execution::Rejection::Invalid};\n for (const auto& input : inputs) {\n- if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return reject(execution::Rejection::Capacity);\n+ if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return {{}, execution::Rejection::Capacity};\n }\n- auto held = state->scope->borrow(state->key); if (!held) return reject(held.rejection);\n- auto lifetime = std::make_shared<execution::ResourceLease>(std::move(*held.lease));\n- std::shared_ptr<Owner> owner;\n- { std::lock_guard lock{state->mutex}; owner = state->owner; }\n- const auto payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(inputs)); });\n- if (!payload) return reject(execution::Rejection::Closed);\n+ const auto owner = state->owner;\n+ const auto payload = std::make_shared<const std::vector<Input>>(std::move(inputs));\n const auto claimed = std::make_shared<std::atomic_bool>(false);\n- const auto finish = [done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n+ const auto finish = [state, done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n if (claimed->exchange(true)) return;\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- if (done) done(std::move(result));\n+ try { if (done) done(std::move(result)); } catch (...) {}\n };\n- const auto submitted = execution::Submit(*state->scope, [state, directory = std::move(directory), network = std::move(network), payload, lifetime, existing_only] {\n- if (state->flags->admission_closed || (QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))\n- return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start on its background worker.\"))};\n- auto native = std::make_unique<State::Native>(state);\n- auto discovery = native->initialize(directory, network, existing_only);\n- if (discovery.result.status == StartStatus::Primary) {\n- std::lock_guard lock{state->mutex};\n- if (!state->flags->stopping) state->native = native.release();\n- else discovery.result = Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n+ const auto submitted = state->post([state, owner, directory = std::move(directory), network = std::move(network),\n+ payload, finish, claimed, missing = std::move(missing), existing_only](State::Native& native) {\n+ if (state->flags->admission_closed) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n }\n- return discovery;\n- }, [state, owner, payload, finish, lifetime, claimed, missing = std::move(missing)](Discovery discovery) {\n+ auto discovery = [&] {\n+ try { return native.initialize(directory, network, existing_only); }\n+ catch (...) { return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start.\"))}; }\n+ }();\n if (discovery.missing) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n if (!claimed->exchange(true)) {\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n { std::lock_guard lock{state->flags->mutex}; state->flags->probe_pending = false; }\n- if (missing) missing();\n+ try { if (missing) missing(); } catch (...) {}\n }\n return;\n }\n if (!discovery.endpoint.isEmpty()) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n try {\n- const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish, lifetime](ForwardingSnapshot snapshot) {\n+ const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish](ForwardingSnapshot snapshot) {\n if (snapshot.error != Error::None || state->flags->admission_closed) {\n finish(Rejected(QStringLiteral(\"The GUI could not transfer its pending requests.\"))); return;\n }\n- const auto forward_payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(snapshot.inputs)); });\n- if (!forward_payload) { finish(Rejected(QStringLiteral(\"Pending requests could not be kept.\"))); return; }\n- const auto forwarded = execution::Submit(*state->scope, [state, endpoint, forward_payload, lifetime] {\n- if (state->flags->stopping) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n- // Once a frame may have left this process, an exception\n- // is an unknown outcome, never permission to replay.\n- try { return Forward(endpoint, *forward_payload, state->limits, state->flags->stopping); }\n- catch (...) { return Unknown(); }\n- }, [finish, lifetime, forward_payload](StartResult result) {\n- if (result.producer_keys.empty()) result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- }, [finish, lifetime, forward_payload](std::exception_ptr) {\n- auto result = Unknown(); result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- },\n- {execution::Lane::Core, state->key});\n- if (!forwarded) finish(Rejected(QStringLiteral(\"The GUI could not start payment delivery.\")));\n+ try {\n+ const auto forwarded = state->post([state, endpoint, inputs = std::move(snapshot.inputs), finish](State::Native&) {\n+ if (state->flags->stopping) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n+ }\n+ // An exception after sending may have left a frame\n+ // in the other process. Its outcome remains unknown.\n+ auto result = [&] {\n+ try { return Forward(endpoint, inputs, state->limits, state->flags->stopping); }\n+ catch (...) { return Unknown(); }\n+ }();\n+ \n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 483,
"evidence_id": "a6dd6cde99b64b42bd0b967dd35970cc",
"finding_id": "finding:2",
"kind": "new_source",
"line": 334,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "555450ae9b22e42f7585daf4cf5c9748f0ba63a6",
"path": "qml/desktopintenttransport.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 12,
"source_job_id": 2936,
"text": " connect(deadline, &QTimer::timeout, this, [this, id] {\n const auto found = clients.find(id);\n if (found == clients.end()) return;\n try { if (!Remaining(state->limits, found->second.admitted, state->limits.client, 1)) found->second.socket->abort(); }\n catch (...) { found->second.socket->abort(); }\n });\n deadline->start(); ingress(id);\n }\n }\n void ingress(uint64_t id) {\n try { receive(id); }\n catch (...) {\n // Any already admitted queue mutation keeps its original receipt.\n // An unacknowledged caller can query; no exception becomes replay.\n const auto found = clients.find(id); if (found != clients.end()) found->second.socket->abort();\n }\n }\n void retire() {\n server.close();\n while (!replies.empty()) clearReply(replies.begin()->first);\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n#ifndef Q_OS_WIN\n // The runtime directory belongs to this user (Qt checks its owner and\n // mode). A fixed name in the shared /tmp could be created first by\n // another user, which would block delivery for this one.\n const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n if (lstat(encoded.constData(), &info)) {\n if (existing_only && errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n }\n if (!S_ISDIR(info.st_mode) || info.st_uid != getuid() || (info.st_mode & 0077))\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QFileInfo{private_directory}.canonicalFilePath();\n#else\n private_directory = QDir::tempPath();\n#endif\n const QString identity = canonical + QLatin1Char('\\n') + network;\n const auto digest = QCryptographicHash::hash(identity.toUtf8(), QCryptographicHash::Sha256).toHex().first(24);\n#ifndef Q_OS_WIN\n const auto endpoint = QDir{private_directory}.filePath(QString::fromLatin1(digest));\n if (QFile::encodeName(endpoint).size() > 100) return Rejected(QStringLiteral(\"The payment-delivery path is too long.\"));\n#else\n const QString endpoint = QStringLiteral(\"qml-intent-\") + QString::fromLatin1(digest);\n#endif\n if (existing_only) {\n // Discovery grants no listener/lock authority and mutates no local\n // queue. A known absent peer leaves normal final-profile startup\n // available; only a connected same-user peer permits forwarding.\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer)) {\n if (errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The payment-delivery endpoint could not be inspected.\"));\n }\n if (!S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during lookup.\"));\n const auto began = state->limits.now();\n const auto remaining = Remaining(state->limits, began, state->limits.startup, static_cast<int>(state->limits.connect.count()));\n if (!remaining) return Rejected(QStringLiteral(\"The payment-delivery lookup expired.\"));\n QLocalSocket probe; probe.connectToServer(endpoint);\n const bool connected = probe.waitForConnected(remaining);\n if (!connected) {\n if (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError)\n return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The existing payment-delivery endpoint could not be contacted.\"));\n }\n if (state->flags->admission_closed || !Remaining(state->limits, began, state->limits.startup, 1))\n return Rejected(QStringLiteral(\"The payment-delivery lookup expired or is closing.\"));\n if (!SameUser(probe)) return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n return {StartResult{}, endpoint};\n }\n instance_lock = std::make_unique<QLockFile>(QDir{private_directory}.filePath(QString::fromLatin1(digest) + QStringLiteral(\".lock\")));\n instance_lock->setStaleLockTime(0);\n if (instance_lock->tryLock(0)) {\n QLocalSocket probe; probe.connectToServer(endpoint); const bool live = probe.waitForConnected(200);\n bool reclaimable = !live && (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError);\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat socket_info{};\n if (lstat(path.constData(), &socket_info) == 0) {\n reclaimable &= S_ISSOCK(socket_info.st_mode) && socket_info.st_uid == getuid();\n if (reclaimable) reclaimable = QLocalServer::removeServer(endpoint);\n }\n#endif\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n if (reclaimable && !state->flags->admission_closed && server.listen(endpoint)) return StartResult{StartStatus::Primary, {}, {}};\n }\n instance_lock.reset();\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer) || !S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unavailable or unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n return {StartResult{}, endpoint};\n }\n};\n\nbool Service::State::post(std::function<void(Native&)> work)\n{\n std::lock_guard lock{flags->mutex};\n return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n work(*receiver);\n }, Qt::QueuedConnection);\n}\n\nvoid Service::State::finishDelivery()\n{\n {\n std::lock_guard lock{flags->mutex};\n --pending_deliveries;\n }\n retireWhenIdle();\n}\n\nvoid Service::State::retireWhenIdle()\n{\n std::lock_guard lock{flags->mutex};\n if (!flags->stopping || pending_deliveries || !native) return;\n auto* receiver = std::exchange(native, nullptr);\n if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n}\n\nService::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\nService::~Service() { stop(); }\nbool Service::post(std::function<void()> work) const\n{\n const auto state = m_state.load();\n return state && state->post([work = std::move(work)](State::Native&) { work(); });\n}\n\nstd::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n{\n const auto maximum = std::chrono::seconds{30};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 555450ae9b22..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | QR-wait fix commit actually deletes the RequestPayment suitetest/qml/tst_requestpayment.qml | unclear | AssessmentNo captured diff or new-head source is supplied for the deleted test suite, so I cannot verify whether the deletion was moved, the commit message was corrected, or replacement coverage was documented. Source report · 555450ae9b22..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Staged backup installation can replace a loaded wallet's databaseqml/models/backuppolicyio.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · 555450ae9b22..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Helper commits claim fixes before their production wiringqml/models/psbtfee.h | unclear | AssessmentThe supplied excerpts show the helper header unchanged and do not include commit messages, trailers, or commit ordering. They cannot establish whether helper commits were retitled or issue claims moved to wiring commits. old_source: qml/models/psbtfee.h; new_source: qml/models/psbtfee.h [
{
"bounded": true,
"end_line": 34,
"evidence_id": "bb612da4889c4607b5f2c312fcf32243",
"finding_id": "finding:8",
"kind": "old_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/models/psbtfee.h",
"revision": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"source_generation": 11,
"source_job_id": 2921,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_QML_MODELS_PSBTFEE_H\n#define BITCOIN_QML_MODELS_PSBTFEE_H\n\n#include <psbt.h>\n\n#include <map>\n#include <optional>\n#include <vector>\n\nnamespace psbtfee {\nenum class State { Known, Missing, Invalid };\nusing Outputs = std::map<COutPoint, CTxOut>;\nstruct Analysis {\n State state{State::Invalid};\n std::optional<CAmount> amount;\n std::optional<Txid> commitment;\n Outputs verified;\n std::vector<std::optional<CTxOut>> prevouts;\n CAmount output_total{0};\n bool outputs_valid{false};\n bool wallet_prepared{false};\n};\n/** Only full transaction commitments or independently verified outputs prove input amounts. */\nAnalysis Analyze(const PartiallySignedTransaction& psbt, const Outputs& verified = {});\nAnalysis Prepared(const CTransaction& transaction, CAmount fee);\nbool MatchesReview(const PartiallySignedTransaction& psbt, const Analysis& proof, std::optional<CAmount> approved_fee);\nvoid FillMissing(PartiallySignedTransaction& psbt, const Analysis& proof);\n} // namespace psbtfee\n\n#endif // BITCOIN_QML_MODELS_PSBTFEE_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 34,
"evidence_id": "b227d6af6c2b4beeb5f6bf6ee0ad9913",
"finding_id": "finding:8",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/models/psbtfee.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 11,
"source_job_id": 2921,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_QML_MODELS_PSBTFEE_H\n#define BITCOIN_QML_MODELS_PSBTFEE_H\n\n#include <psbt.h>\n\n#include <map>\n#include <optional>\n#include <vector>\n\nnamespace psbtfee {\nenum class State { Known, Missing, Invalid };\nusing Outputs = std::map<COutPoint, CTxOut>;\nstruct Analysis {\n State state{State::Invalid};\n std::optional<CAmount> amount;\n std::optional<Txid> commitment;\n Outputs verified;\n std::vector<std::optional<CTxOut>> prevouts;\n CAmount output_total{0};\n bool outputs_valid{false};\n bool wallet_prepared{false};\n};\n/** Only full transaction commitments or independently verified outputs prove input amounts. */\nAnalysis Analyze(const PartiallySignedTransaction& psbt, const Outputs& verified = {});\nAnalysis Prepared(const CTransaction& transaction, CAmount fee);\nbool MatchesReview(const PartiallySignedTransaction& psbt, const Analysis& proof, std::optional<CAmount> approved_fee);\nvoid FillMissing(PartiallySignedTransaction& psbt, const Analysis& proof);\n} // namespace psbtfee\n\n#endif // BITCOIN_QML_MODELS_PSBTFEE_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Closing a loading address editor silently drops typed notesqml/pages/wallet/AddressDetails.qml | still_present | AssessmentThe new-head excerpt leaves the note field read-only condition unchanged: it remains editable whenever editor.available is true. The supplied change only alters the dialog parent, not the loading-state input or close behavior described in the finding. new_source: qml/pages/wallet/AddressDetails.qml [
{
"bounded": true,
"end_line": 225,
"evidence_id": "0e02f9498feb469e9ee0685b22a0ed6d",
"finding_id": "finding:7",
"kind": "new_source",
"line": 76,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/pages/wallet/AddressDetails.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 11,
"source_job_id": 2921,
"text": " topPadding: 2\n bottomPadding: 2\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsAmountRow\"\n amountValue: true\n hidesAmount: true\n Layout.fillWidth: true\n title: qsTr(\"Amount\")\n value: root.amount\n valueColor: root.hasAmount ? Theme.color.txIncoming : Theme.color.neutral6\n dividerColor: Theme.color.surfaceDivider\n }\n\n TextFieldRow {\n id: noteRow\n objectName: \"addressDetailsNoteRow\"\n visible: root.canEditLabel\n Layout.fillWidth: true\n //: Private address note, also used as the payment request's note to self.\n title: qsTr(\"Note to self\")\n fieldObjectName: \"addressDetailsNoteField\"\n fieldWidth: Math.min(320, Math.max(180, root.width * 0.55))\n text: root.label\n textInput: root.editor ? root.editor.text : null\n //: Placeholder shown when an address has no private note yet.\n placeholderText: qsTr(\"Add note…\")\n enabled: root.canEditLabel\n readOnly: !root.canEditLabel || (root.editor !== null && !root.editor.available)\n errorText: root.editor ? root.editor.error.message : root.noteErrorText\n dividerColor: Theme.color.surfaceDivider\n onEditingFinished: {\n if (!root.editor && text !== root.label) {\n root.editLabelRequested(root.address, text)\n }\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Type\")\n value: root.category === \"change\" ? qsTr(\"Change\") : qsTr(\"Receive\")\n dividerColor: Theme.color.surfaceDivider\n }\n\n ValueRow {\n objectName: \"addressDetailsAddressTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Address type\")\n value: root.scriptType === \"\" ? qsTr(\"Unknown\") : root.scriptType\n showDivider: false\n }\n }\n\n GridLayout {\n columns: 2\n visible: root.editor !== null && (root.editor.dirty || root.editor.conflict)\n Layout.fillWidth: true\n NeutralButton {\n objectName: \"addressDetailsDiscardNoteButton\"\n text: qsTr(\"Discard edits\")\n enabled: root.editor !== null && root.editor.canDiscard\n onClicked: root.editor.discard()\n }\n NeutralButton {\n objectName: \"addressDetailsUseCurrentNoteButton\"\n text: qsTr(\"Use current note\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.UseCurrent)\n }\n NeutralButton {\n objectName: \"addressDetailsKeepEditedNoteButton\"\n text: qsTr(\"Keep my edit\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.KeepEdit)\n }\n PrimaryButton {\n objectName: \"addressDetailsSaveNoteButton\"\n text: qsTr(\"Save note\")\n enabled: root.editor !== null && root.editor.canSave\n onClicked: root.editor.save()\n }\n }\n\n QtObject {\n readonly property Dialog dialog: Dialog {\n id: noteCloseDialog\n objectName: \"addressNoteClosePrompt\"\n // Keeps the overlay when the page leaves the window. A popup whose parent\n // goes null there loses its window while its item is still in the overlay,\n // and a hover event then crashes Qt 6.8.4 and newer.\n Binding on parent {\n when: root.Overlay.overlay !== null\n value: root.Overlay.overlay\n restoreMode: Binding.RestoreNone\n }\n modal: true\n width: Math.min(620, parent ? parent.width - 40 : 620)\n x: parent ? (parent.width - width) / 2 : 0\n y: parent ? (parent.height - height) / 2 : 0\n closePolicy: Popup.NoAutoClose\n visible: root.visible && root.editor !== null && root.editor.available && root.editor.closePrompt !== null\n title: qsTr(\"Save note edits?\")\n contentItem: GridLayout {\n columns: noteCloseDialog.width < 480 ? 1 : 3\n NeutralButton {\n id: keepEditingButton\n objectName: \"addressNoteKeepEditingButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: keepEditingButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Keep editing\")\n onClicked: if (keepEditingButton.pressedPrompt) keepEditingButton.pressedPrompt.answer(TextEditClosePrompt.KeepEditing)\n }\n NeutralButton {\n id: discardAndCloseButton\n objectName: \"addressNoteDiscardAndCloseButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: discardAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Discard\")\n onClicked: if (discardAndCloseButton.pressedPrompt) discardAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Discard)\n }\n PrimaryButton {\n id: saveAndCloseButton\n objectName: \"addressNoteSaveAndCloseButton\"\n Layout.fillWidth: true\n property TextEditClosePrompt pressedPrompt: null\n onPressed: saveAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Save\")\n enabled: root.editor !== null && root.editor.valid && !root.editor.conflict && !root.editor.busy\n onClicked: if (saveAndCloseButton.pressedPrompt) saveAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Save)\n }\n }\n }\n }\n Keys.onEscapePressed: function(event) {\n if (root.editor) root.editor.requestClose()\n else root.closeRequested()\n event.accepted = true\n }\n\n PrimaryButton {\n objectName: \"addressDetailsCreatePaymentRequestButton\"\n Layout.fillWidth: true",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Readiness omits the fee caps enforced by submissionqml/psbtpolicy.cpp | addressed | AssessmentThe new-head code passes a nonzero fee-rate limit to testmempoolaccept and adds an absolute fee-cap check to the policy decision, addressing the identified mismatch with submission caps. path_diff: qml/psbtpolicy.cpp; new_source: qml/psbtpolicy.cpp [
{
"evidence_id": "3a9fea22b1084853950883e488e5257a",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/psbtpolicy.cpp",
"source_generation": 11,
"source_job_id": 2921,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex 97d6c8d9e8..dac47edbc0 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -3,6 +3,7 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/psbtpolicy.h>\n+#include <qml/bitcoinunits.h>\n \n #include <coins.h>\n #include <consensus/consensus.h>\n@@ -31,7 +32,8 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- parameters.push_back(0); // Disable only testmempoolaccept's independent client max-fee-rate cap.\n+ // The same fee-rate cap that submission passes to broadcastTransaction.\n+ parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -46,11 +48,14 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n+ if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n- // An allowed conflict is a replacement. Name what it evicts.\n+ // An allowed conflict is a replacement. Name what it evicts; until the\n+ // lookup completes, the review must not imply that nothing is evicted.\n+ facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n@@ -67,6 +72,7 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n+ facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n@@ -89,6 +95,7 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n+ facts.replaces_unknown = false;\n }\n } // namespace\n \n@@ -97,6 +104,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n+ facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -156,6 +164,7 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n+ if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n@@ -164,6 +173,9 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.replaces.isEmpty()) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n }\n+ if (facts.replaces_unknown) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n+ }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 153,
"evidence_id": "7874cddc831d4d298a587f1d1a9d663f",
"finding_id": "finding:6",
"kind": "new_source",
"line": 4,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/psbtpolicy.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 11,
"source_job_id": 2921,
"text": "\n#include <qml/psbtpolicy.h>\n#include <qml/bitcoinunits.h>\n\n#include <coins.h>\n#include <consensus/consensus.h>\n#include <consensus/tx_verify.h>\n#include <core_io.h>\n#include <interfaces/chain.h>\n#include <interfaces/node.h>\n#include <policy/policy.h>\n#include <univalue.h>\n#include <util/result.h>\n\n#include <QCoreApplication>\n\n#include <algorithm>\n#include <limits>\n#include <map>\n#include <utility>\n\nnamespace {\nQString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n\nvoid ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n{\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n // The same fee-rate cap that submission passes to broadcastTransaction.\n parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n if (!result.isObject() || !result.exists(\"txid\") || !result[\"txid\"].isStr()\n || !result.exists(\"wtxid\") || !result[\"wtxid\"].isStr()\n || result[\"txid\"].get_str() != transaction.GetHash().ToString()\n || result[\"wtxid\"].get_str() != transaction.GetWitnessHash().ToString()\n || !result.exists(\"allowed\") || !result[\"allowed\"].isBool()) return;\n\n const bool allowed = result[\"allowed\"].get_bool();\n QString reason;\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n // An allowed conflict is a replacement. Name what it evicts; until the\n // lookup completes, the review must not imply that nothing is evicted.\n facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n outpoint.pushKV(\"txid\", input.prevout.hash.GetHex());\n outpoint.pushKV(\"vout\", uint64_t{input.prevout.n});\n outpoints.push_back(std::move(outpoint));\n }\n UniValue spending_parameters{UniValue::VARR};\n spending_parameters.push_back(std::move(outpoints));\n const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n if (!spending.isArray()) return;\n for (const auto& item : spending.getValues()) {\n if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n}\n\nvoid ClearChainFacts(psbtpolicy::Facts& facts)\n{\n facts.observed = false;\n facts.missing_inputs = false;\n facts.immature_inputs = false;\n facts.final = true;\n facts.sufficient_fee = true;\n facts.chain_limits = true;\n facts.tip.clear();\n facts.chain_error.clear();\n}\n\nvoid ClearAdmissionFacts(psbtpolicy::Facts& facts)\n{\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n facts.replaces_unknown = false;\n}\n} // namespace\n\npsbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n{\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n int height{-1}; int64_t mtp{0}; bool active{false};\n if (chain->findBlock(tip, interfaces::FoundBlock{}.height(height).mtpTime(mtp).inActiveChain(active))\n && active && height >= 0 && height < std::numeric_limits<int>::max()) {\n std::map<COutPoint, Coin> coins;\n for (const auto& input : transaction->vin) coins.try_emplace(input.prevout);\n chain->findCoins(coins); // Includes available mempool parents.\n for (const auto& [outpoint, coin] : coins) {\n facts.missing_inputs |= coin.IsSpent();\n facts.immature_inputs |= !coin.IsSpent() && coin.IsCoinBase()\n && int64_t(height) + 1 - coin.nHeight < COINBASE_MATURITY;\n }\n facts.final = IsFinalTx(*transaction, height + 1, mtp);\n const auto minimum = std::max(chain->mempoolMinFee(), chain->relayMinFee());\n facts.sufficient_fee = fee >= minimum.GetFee(GetVirtualTransactionSize(*transaction));\n const auto limits = chain->checkChainLimits(transaction);\n facts.chain_limits = bool(limits);\n if (!limits) facts.chain_error = QString::fromStdString(util::ErrorString(limits).translated).left(4096);\n // A reorg during this collection invalidates the whole observation.\n if (node->getBestBlockHash() == tip) {\n facts.tip = QString::fromStdString(tip.ToString());\n facts.observed = true;\n } else {\n ClearChainFacts(facts);\n }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Additive cluster checks block acceptable replacementsqml/psbtpolicy.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · ba4b20f16e79..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Uncertain traps Speed Up after a definite commit rejectionqml/walletbump.cpp | still_present | AssessmentThe new-head code still maps a false commitBumpTransaction result to Error::Commit. The excerpt does not show that this definite rejection is now treated as retryable rather than uncertain. new_source: qml/walletbump.cpp [
{
"bounded": true,
"end_line": 228,
"evidence_id": "26fad3af743c4589b90164739eb89958",
"finding_id": "finding:4",
"kind": "new_source",
"line": 180,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/walletbump.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 11,
"source_job_id": 2921,
"text": " if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n }\n if (const auto scope_error = CheckApprovedScope(wallet, review); scope_error != Error::None) {\n result.error = scope_error; return finishAfterRelock();\n }\n // No further key operation is needed. Restore authorization before\n // commit, and never publish a successful spend with failed restoration.\n restoreWalletLock(); passphrase.reset();\n if (result.relock_failed) return result;\n if (services.admission) {\n const auto exact = MakeTransactionRef(signed_tx);\n const auto decision = psbtpolicy::Evaluate(services.admission(exact, review.new_fee));\n if (decision.state == psbtpolicy::State::Blocked) {\n result.error = Error::Policy;\n result.message = decision.explanation;\n return result;\n }\n }\n std::vector<bilingual_str> errors;\n Txid txid;\n const CTransaction exact{signed_tx};\n result.candidate_txid = exact.GetHash();\n result.candidate_wtxid = exact.GetWitnessHash();\n result.commit_attempted = true;\n if (!wallet.commitBumpTransaction(review.original, std::move(signed_tx), errors, txid)) {\n result.error = Error::Commit; result.message = Message(errors); return result;\n }\n result.txid = txid;\n result.committed = true;\n Observe(wallet, result);\n } catch (const secretinput::Failure&) {\n result.error = Error::Invalid; result.message = QObject::tr(\"The wallet password could not be prepared. No fee bump was submitted.\");\n } catch (...) { result.error = Error::Uncertain; }\n return finishAfterRelock();\n}\nCommit ObserveOutcome(interfaces::Wallet& wallet, const Commit& original)\n{\n auto result = original;\n result.record = Record::Unknown;\n result.submission = Submission::Unknown;\n if (!original.commit_attempted || original.candidate_txid == Txid{}) return result;\n result.txid = original.candidate_txid;\n Observe(wallet, result, true);\n // Observing a record cannot manufacture the original call's missing\n // persistence/replacement-metadata receipt. Keep its uncertainty explicit.\n return result;\n}\n} // namespace walletbump",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Signer checks accept SIGHASH_NONE/SIGHASH_SINGLE as verifiedqml/psbtsignatures.cpp | addressed | AssessmentThe new helper rejects incompatible PSBT sighash metadata and checks partial and finalized ECDSA/Schnorr signatures for commitment to all outputs. The new-head send and approval paths invoke it before accepting signer results, including before retaining partial contributions; the bump path is likewise covered by the new verification logic in the diff. path_diff: qml/psbtsignatures.cpp; new_source: qml/psbtsignatures.cpp [
{
"evidence_id": "95b6afcf2a484042aee7f445cd089009",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/psbtsignatures.cpp",
"source_generation": 11,
"source_job_id": 2921,
"text": "diff --git a/qml/psbtsignatures.cpp b/qml/psbtsignatures.cpp\nindex 3d5dbdb47e..ac97168b46 100644\n--- a/qml/psbtsignatures.cpp\n+++ b/qml/psbtsignatures.cpp\n@@ -62,6 +62,55 @@ std::optional<EcdsaContext> GetEcdsaContext(const PSBTInput& input, const CTxOut\n return result;\n }\n \n+bool EcdsaCommitsToAll(const std::vector<unsigned char>& signature)\n+{\n+ return !signature.empty() && signature.back() == SIGHASH_ALL;\n+}\n+bool SchnorrCommitsToAll(const std::vector<unsigned char>& signature)\n+{\n+ return signature.size() == 64 || (signature.size() == 65 && signature.back() == SIGHASH_ALL);\n+}\n+// Any DER-encoded push in a finalized ECDSA script is a signature.\n+bool EcdsaItemsCommitToAll(const std::vector<std::vector<unsigned char>>& items)\n+{\n+ return std::ranges::all_of(items, [](const auto& item) {\n+ return item.empty() || !CheckSignatureEncoding(item, SCRIPT_VERIFY_DERSIG, nullptr) || EcdsaCommitsToAll(item);\n+ });\n+}\n+std::optional<std::vector<std::vector<unsigned char>>> Pushes(const CScript& script)\n+{\n+ std::vector<std::vector<unsigned char>> pushes;\n+ auto cursor = script.begin();\n+ opcodetype opcode;\n+ std::vector<unsigned char> push;\n+ while (cursor != script.end()) {\n+ if (!script.GetOp(cursor, opcode, push)) return {};\n+ pushes.push_back(push);\n+ }\n+ return pushes;\n+}\n+bool FinalizedCommitsToAll(const PSBTInput& input)\n+{\n+ if (!input.final_script_sig.empty()) {\n+ const auto pushes = Pushes(input.final_script_sig);\n+ if (!pushes || !EcdsaItemsCommitToAll(*pushes)) return false;\n+ }\n+ auto stack = input.final_script_witness.stack;\n+ if (stack.empty()) return true;\n+ CTxOut utxo;\n+ int version;\n+ std::vector<unsigned char> program;\n+ // Without the spent output the witness kind is unknown; refuse it.\n+ if (!input.GetUTXO(utxo)) return false;\n+ if (!utxo.scriptPubKey.IsWitnessProgram(version, program) || version != 1 || program.size() != 32) return EcdsaItemsCommitToAll(stack);\n+ if (stack.size() >= 2 && !stack.back().empty() && stack.back()[0] == ANNEX_TAG) stack.pop_back();\n+ if (stack.size() == 1) return SchnorrCommitsToAll(stack.front());\n+ // Script path: the last two items are the script and the control block.\n+ // Earlier 64- or 65-byte items are the signatures tapscript checks.\n+ stack.resize(stack.size() - 2);\n+ return std::ranges::all_of(stack, [](const auto& item) { return (item.size() != 64 && item.size() != 65) || SchnorrCommitsToAll(item); });\n+}\n+\n bool HasTapleafContext(const PSBTInput& input, const std::vector<unsigned char>& program,\n const XOnlyPubKey& key, const uint256& leaf)\n {\n@@ -187,3 +236,14 @@ bool psbtsignatures::VerifyFinalizedInputs(const PartiallySignedTransaction& doc\n }\n return true;\n }\n+\n+bool psbtsignatures::CommitsToAllOutputs(const PartiallySignedTransaction& document)\n+{\n+ return std::ranges::all_of(document.inputs, [](const PSBTInput& input) {\n+ if (input.sighash_type && *input.sighash_type != SIGHASH_DEFAULT && *input.sighash_type != SIGHASH_ALL) return false;\n+ return std::ranges::all_of(input.partial_sigs, [](const auto& entry) { return EcdsaCommitsToAll(entry.second.second); }) &&\n+ (input.m_tap_key_sig.empty() || SchnorrCommitsToAll(input.m_tap_key_sig)) &&\n+ std::ranges::all_of(input.m_tap_script_sigs, [](const auto& entry) { return SchnorrCommitsToAll(entry.second); }) &&\n+ FinalizedCommitsToAll(input);\n+ });\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 234,
"evidence_id": "367732d68a754f059dfcd0d2fb729c3b",
"finding_id": "finding:3",
"kind": "new_source",
"line": 85,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/psbtsignatures.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 11,
"source_job_id": 2921,
"text": " std::vector<unsigned char> push;\n while (cursor != script.end()) {\n if (!script.GetOp(cursor, opcode, push)) return {};\n pushes.push_back(push);\n }\n return pushes;\n}\nbool FinalizedCommitsToAll(const PSBTInput& input)\n{\n if (!input.final_script_sig.empty()) {\n const auto pushes = Pushes(input.final_script_sig);\n if (!pushes || !EcdsaItemsCommitToAll(*pushes)) return false;\n }\n auto stack = input.final_script_witness.stack;\n if (stack.empty()) return true;\n CTxOut utxo;\n int version;\n std::vector<unsigned char> program;\n // Without the spent output the witness kind is unknown; refuse it.\n if (!input.GetUTXO(utxo)) return false;\n if (!utxo.scriptPubKey.IsWitnessProgram(version, program) || version != 1 || program.size() != 32) return EcdsaItemsCommitToAll(stack);\n if (stack.size() >= 2 && !stack.back().empty() && stack.back()[0] == ANNEX_TAG) stack.pop_back();\n if (stack.size() == 1) return SchnorrCommitsToAll(stack.front());\n // Script path: the last two items are the script and the control block.\n // Earlier 64- or 65-byte items are the signatures tapscript checks.\n stack.resize(stack.size() - 2);\n return std::ranges::all_of(stack, [](const auto& item) { return (item.size() != 64 && item.size() != 65) || SchnorrCommitsToAll(item); });\n}\n\nbool HasTapleafContext(const PSBTInput& input, const std::vector<unsigned char>& program,\n const XOnlyPubKey& key, const uint256& leaf)\n{\n for (const auto& [script_version, controls] : input.m_tap_scripts) {\n const auto& [bytes, version] = script_version;\n if (version != TAPROOT_LEAF_TAPSCRIPT || ComputeTapleafHash(version, bytes) != leaf) continue;\n const CScript script{bytes.begin(), bytes.end()};\n if (HasCodeSeparator(script)) continue;\n // Partial verification does not execute a script. Recognize one\n // unambiguous signing policy and quarantine other script forms.\n auto cursor = script.begin();\n opcodetype opcode;\n std::vector<unsigned char> push;\n if (!script.GetOp(cursor, opcode, push) || push.size() != 32 || !std::equal(push.begin(), push.end(), key.begin()) ||\n !script.GetOp(cursor, opcode) || opcode != OP_CHECKSIG || cursor != script.end()) continue;\n for (const auto& control : controls) {\n if (control.size() < TAPROOT_CONTROL_BASE_SIZE || control.size() > TAPROOT_CONTROL_MAX_SIZE ||\n (control.size() - TAPROOT_CONTROL_BASE_SIZE) % TAPROOT_CONTROL_NODE_SIZE != 0 ||\n (control[0] & TAPROOT_LEAF_MASK) != version) continue;\n const XOnlyPubKey internal{std::span{control}.subspan(1, 32)};\n if (XOnlyPubKey{program}.CheckTapTweak(internal, ComputeTaprootMerkleRoot(control, leaf), control[0] & 1)) return true;\n }\n }\n return false;\n}\n} // namespace\n\npsbtsignatures::Status psbtsignatures::VerifyPartialInputs(const PartiallySignedTransaction& document)\n{\n if (!VerifyFinalizedInputs(document, false)) return Status::Invalid;\n const auto transaction = document.GetUnsignedTx();\n const auto data = PrecomputePSBTData(document);\n if (!transaction || !data || transaction->vin.size() != document.inputs.size()) return Status::Unknown;\n Status result{Status::Valid};\n for (size_t i = 0; i < document.inputs.size(); ++i) {\n const auto& input = document.inputs[i];\n CTxOut utxo;\n if (!input.GetUTXO(utxo)) { result = Status::Unknown; continue; }\n MutableTransactionSignatureChecker checker{&*transaction, static_cast<unsigned int>(i), utxo.nValue, *data, MissingDataBehavior::FAIL};\n const auto context = GetEcdsaContext(input, utxo);\n for (const auto& [id, signature] : input.partial_sigs) {\n const auto& [key, bytes] = signature;\n if (!key.IsFullyValid() || key.GetID() != id ||\n !CheckSignatureEncoding(bytes, SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_STRICTENC | SCRIPT_VERIFY_LOW_S, nullptr) || bytes.empty()) return Status::Invalid;\n if (!context) { result = Status::Unknown; continue; }\n const auto member = ContainsSigningKey(context->script, key);\n if (!member) { result = Status::Unknown; continue; }\n if (!*member) return Status::Invalid;\n if (\n (context->version == SigVersion::WITNESS_V0 && !key.IsCompressed()) ||\n !checker.CheckECDSASignature(bytes, {key.begin(), key.end()}, context->script, context->version)) return Status::Invalid;\n }\n int version;\n std::vector<unsigned char> program;\n const bool taproot = utxo.scriptPubKey.IsWitnessProgram(version, program) && version == 1 && program.size() == 32;\n if ((!input.m_tap_key_sig.empty() || !input.m_tap_script_sigs.empty()) && !data->m_spent_outputs_ready) {\n result = Status::Unknown;\n continue;\n }\n if (!input.m_tap_key_sig.empty()) {\n if (!taproot) return Status::Invalid;\n ScriptExecutionData execution;\n execution.m_annex_init = true;\n execution.m_annex_present = false;\n if (!checker.CheckSchnorrSignature(input.m_tap_key_sig, program, SigVersion::TAPROOT, execution)) return Status::Invalid;\n }\n for (const auto& [key_leaf, signature] : input.m_tap_script_sigs) {\n const auto& [key, leaf] = key_leaf;\n if (!taproot) return Status::Invalid;\n if (!HasTapleafContext(input, program, key, leaf)) { result = Status::Unknown; continue; }\n ScriptExecutionData execution;\n execution.m_annex_init = true;\n execution.m_annex_present = false;\n execution.m_tapleaf_hash_init = true;\n execution.m_tapleaf_hash = leaf;\n execution.m_codeseparator_pos_init = true;\n execution.m_codeseparator_pos = std::numeric_limits<uint32_t>::max();\n if (!checker.CheckSchnorrSignature(signature, key, SigVersion::TAPSCRIPT, execution)) return Status::Invalid;\n }\n // Do not recreate the MuSig2 protocol or an interpreter here.\n if (!input.m_musig2_partial_sigs.empty()) result = Status::Unknown;\n }\n return result;\n}\n\npsbtsignatures::Status psbtsignatures::VerifyContributions(const PartiallySignedTransaction& original,\n const PartiallySignedTransaction& returned)\n{\n if (original.inputs.size() != returned.inputs.size()) return Status::Invalid;\n auto contributions = returned;\n const auto remove_unchanged = [](auto& values, const auto& prior) {\n std::erase_if(values, [&prior](const auto& entry) {\n const auto found = prior.find(entry.first);\n return found != prior.end() && found->second == entry.second;\n });\n };\n for (size_t i = 0; i < contributions.inputs.size(); ++i) {\n auto& input = contributions.inputs[i];\n const auto& prior = original.inputs[i];\n remove_unchanged(input.partial_sigs, prior.partial_sigs);\n remove_unchanged(input.m_tap_script_sigs, prior.m_tap_script_sigs);\n if (input.m_tap_key_sig == prior.m_tap_key_sig) input.m_tap_key_sig.clear();\n for (auto& [group, values] : input.m_musig2_partial_sigs) {\n const auto found = prior.m_musig2_partial_sigs.find(group);\n if (found != prior.m_musig2_partial_sigs.end()) remove_unchanged(values, found->second);\n }\n std::erase_if(input.m_musig2_partial_sigs, [](const auto& group) { return group.second.empty(); });\n }\n return VerifyPartialInputs(contributions);\n}\n\nbool psbtsignatures::VerifyFinalizedInputs(const PartiallySignedTransaction& document, bool require_all)\n{\n if (document.inputs.empty()) return false;\n std::optional<PrecomputedTransactionData> data;\n for (size_t i = 0; i < document.inputs.size(); ++i) {\n if (!PSBTInputSigned(document.inputs[i])) {\n if (require_all) return false;\n continue;\n }\n if (!data) data = PrecomputePSBTData(document);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Squatting /tmp/qml-intent-<uid> prevents GUI startupqml/desktopintenttransport.cpp | addressed | AssessmentThe new-head diff replaces the predictable `/tmp/qml-intent-<uid>` directory with a `QStandardPaths::RuntimeLocation`-based directory and retains checks for directory ownership and permissions. This removes the shared `/tmp` namespace squatting problem described. path_diff: qml/desktopintenttransport.cpp; new_source: qml/desktopintenttransport.cpp [
{
"evidence_id": "9e5d393e51b04d3b8143c12904a4c8d0",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/desktopintenttransport.cpp",
"source_generation": 11,
"source_job_id": 2921,
"text": "diff --git a/qml/desktopintenttransport.cpp b/qml/desktopintenttransport.cpp\nindex 9601409125..df095f879a 100644\n--- a/qml/desktopintenttransport.cpp\n+++ b/qml/desktopintenttransport.cpp\n@@ -2,7 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/desktopintenttransport.h>\n-#include <qml/retainedvalue.h>\n+#include <qml/asyncjoin.h>\n #include <util/fs.h>\n \n #include <QCoreApplication>\n@@ -17,6 +17,8 @@\n #include <QLocalSocket>\n #include <QLockFile>\n #include <QMetaObject>\n+#include <QScopeGuard>\n+#include <QStandardPaths>\n #include <QStringList>\n #include <QThread>\n #include <QTimer>\n@@ -196,25 +198,26 @@ struct Discovery {\n struct Service::Flags {\n std::atomic_bool admission_closed{false}, stopping{false}, started{false}, retired{false};\n std::mutex mutex;\n- execution::TaskId retired_task;\n- std::function<void()> completed_stop;\n+ std::vector<std::function<void()>> completed_stops;\n bool probed{false}, probe_pending{false}, probe_terminal{false}; // Protected by mutex.\n };\n struct Service::State {\n struct Native;\n- std::shared_ptr<execution::Scheduler> scope;\n std::shared_ptr<Owner> owner;\n Limits limits;\n- execution::ResourceKey key;\n const std::shared_ptr<Flags> flags{std::make_shared<Flags>()};\n- std::shared_ptr<execution::ResourceLease> native_lifetime;\n- std::mutex mutex;\n+ // The same lock protects admission, pending delivery and the receiver\n+ // used to post work to the transport thread.\n Native* native{nullptr};\n+ size_t pending_deliveries{0};\n+ bool post(std::function<void(Native&)> work);\n+ void finishDelivery();\n+ void retireWhenIdle();\n };\n \n struct Service::State::Native final : QObject {\n struct Query { QJsonArray results; QStringList keys; size_t remaining{0}; bool unknown{false}; };\n- struct Reply { std::optional<desktopintent::Admission> admission; std::optional<Receipt> receipt; };\n+ struct Reply { std::optional<desktopintent::Acceptance> admission; std::optional<Receipt> receipt; };\n struct Cell {\n std::mutex mutex;\n QObject* receiver{nullptr}; std::function<void()> notify;\n@@ -230,7 +233,7 @@ struct Service::State::Native final : QObject {\n };\n struct Pending { uint64_t connection; std::shared_ptr<Cell> cell; std::shared_ptr<Query> query{}; qsizetype index{0}; QStringList keys{}; };\n const std::shared_ptr<State> state;\n- QLocalServer server;\n+ QLocalServer server{this};\n std::unique_ptr<QLockFile> instance_lock;\n struct Client { QLocalSocket* socket; Limits::Time admitted; };\n std::map<uint64_t, Client> clients;\n@@ -306,7 +309,7 @@ struct Service::State::Native final : QObject {\n QStringList keys; for (const auto& input : inputs) keys.push_back(input.producer_key);\n const auto cell = reserve(id, {}, 0, std::move(keys)); if (!cell) { send(id, {{\"status\", \"rejected\"}}); return; }\n const auto admitted = state->owner->admit(std::move(inputs), [cell](auto result) { cell->complete({std::move(result), {}}); });\n- if (!admitted) cell->complete({desktopintent::Admission{Error::Closed, {}}, {}});\n+ if (!admitted) cell->complete({desktopintent::Acceptance{Error::Closed, {}}, {}});\n } else if (command == \"query\") {\n const auto keys = object.value(\"keys\").toArray();\n if (keys.empty() || keys.size() > static_cast<qsizetype>(Queue::MAX_PENDING) || replies.size() + static_cast<size_t>(keys.size()) > MAX_REPLIES) { socket->abort(); return; }\n@@ -351,17 +354,19 @@ struct Service::State::Native final : QObject {\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n- std::shared_ptr<execution::ResourceLease> lifetime;\n- { std::lock_guard lock{state->mutex}; state->native = nullptr; lifetime = std::move(state->native_lifetime); }\n- delete this;\n- lifetime.reset(); // Only now may the original Native event loop drain.\n+ QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n #ifndef Q_OS_WIN\n- private_directory = QDir{QStringLiteral(\"/tmp\")}.filePath(QStringLiteral(\"qml-intent-%1\").arg(getuid()));\n+ // The runtime directory belongs to this user (Qt checks its owner and\n+ // mode). A fixed name in the shared /tmp could be created first by\n+ // another user, which would block delivery for this one.\n+ const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n+ if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n+ private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n@@ -440,37 +445,83 @@ struct Service::State::Native final : QObject {\n }\n };\n \n+bool Service::State::post(std::function<void(Native&)> work)\n+{\n+ std::lock_guard lock{flags->mutex};\n+ return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n+ work(*receiver);\n+ }, Qt::QueuedConnection);\n+}\n+\n+void Service::State::finishDelivery()\n+{\n+ {\n+ std::lock_guard lock{flags->mutex};\n+ --pending_deliveries;\n+ }\n+ retireWhenIdle();\n+}\n+\n+void Service::State::retireWhenIdle()\n+{\n+ std::lock_guard lock{flags->mutex};\n+ if (!flags->stopping || pending_deliveries || !native) return;\n+ auto* receiver = std::exchange(native, nullptr);\n+ if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n+}\n+\n Service::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\n Service::~Service() { stop(); }\n-std::shared_ptr<Service> Service::Create(std::shared_ptr<execution::Scheduler> scheduler, std::shared_ptr<Owner> owner, Limits limits)\n+bool Service::post(std::function<void()> work) const\n+{\n+ const auto state = m_state.load();\n+ return state && state->post([work = std::move(work)](State::Native&) { work(); });\n+}\n+\n+std::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n {\n const auto maximum = std::chrono::seconds{30};\n- if (!scheduler || !owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n+ if (!owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n limits.connect <= std::chrono::milliseconds::zero() || limits.connect > limits.startup ||\n limits.acknowledge <= std::chrono::milliseconds::zero() || limits.acknowledge > limits.startup ||\n limits.query <= std::chrono::milliseconds::zero() || limits.query > limits.startup ||\n limits.client <= std::chrono::milliseconds::zero() || limits.client > maximum ||\n limits.slice <= std::chrono::milliseconds::zero() || limits.slice > std::chrono::milliseconds{100}) return {};\n- auto scope = scheduler->openActionScope(); if (!scope) return {};\n- auto state = execution::RetainValues<State>(scope, [] { return std::make_unique<State>(); }); if (!state) return {};\n- state->scope = scope; state->owner = std::move(owner); state->limits = std::move(limits); state->key = scope->allocateKey();\n- const auto retired = execution::Submit(*scope, [] {}, [state] {\n- std::function<void()> done;\n- { std::lock_guard lock{state->mutex}; state->owner.reset(); }\n- { std::lock_guard lock{state->flags->mutex}; state->flags->retired = true; done = std::move(state->flags->completed_stop); }\n- if (done) done();\n- }, {}, {execution::Lane::Cleanup, state->key}, true);\n- auto borrowed = retired ? scope->borrow(state->key) : execution::BorrowAdmission{{}, retired.rejection};\n- if (!borrowed) { if (retired) scope->activateCleanup(retired.id); return {}; }\n- state->flags->retired_task = retired.id;\n- state->native_lifetime = std::make_shared<execution::ResourceLease>(std::move(*borrowed.lease));\n- return std::shared_ptr<Service>{new Service(std::move(state))};\n+ auto* const app = QCoreApplication::instance();\n+ Q_ASSERT(app && QThread::currentThread() == app->thread());\n+ auto state = std::make_shared<State>();\n+ state->owner = std::move(owner);\n+ state->limits = std::move(limits);\n+ auto thread = std::make_unique<QThread>();\n+ thread->setObjectName(QStringLiteral(\"desktop transport\"));\n+ auto native = std::make_unique<State::Native>(state);\n+ auto service = std::shared_ptr<Service>{new Service(state)};\n+ QObject::connect(thread.get(), &QThread::finished, native.get(), &QObject::deleteLater);\n+ QObject::connect(thread.get(), &QThread::finished, app, [app, state, worker = thread.get()] {\n+ JoinThreadAsync([state, worker] {\n+ if (!worker->wait()) std::terminate();\n+ state->owner.reset();\n+ std::vector<std::function<void()>> completed;\n+ {\n+ std::lock_guard lock{state->flags->mutex};\n+ state->flags->retired = true;\n+ completed = std::move(state->flags->completed_stops);\n+ }\n+ for (const auto& done : completed) {\n+ try { done(); } catch (...) {}\n+ }\n+ }, app, [worker] { delete worker; });\n+ }, Qt::QueuedConnection);\n+ native->moveToThread(thread.get());\n+ state->native = native.release();\n+ thread.release()->start();\n+ return service;\n }\n-execution::Admission Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n+execution::SubmitResult Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n {\n return begin(std::move(directory), std::move(network), std::move(inputs), false, std::move(completed), {});\n }\n-execution::Admission Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n+execution::SubmitResult Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n {\n if (inputs.size() > Queue::MAX_PENDING) return {{}, execution::Rejection::Invalid};\n const auto callback = std::move(completed);\n@@ -487,7 +538,7 @@ execution::Admission Service::probeExisting(QString directory, QString network,\n const auto missing = [callback] { if (callback) callback({ProbeStatus::Missing, {}}); };\n return begin(std::move(directory), std::move(network), inputs, true, transfer, missing);\n }\n-execution::Admission Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n+execution::SubmitResult Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n std::function<void(StartResult)> completed, std::function<void()> missing)\n {\n const auto state = m_state.load();\n@@ -497,80 +548,82 @@ execution::Admission Service::begin(QString directory, QString network, std::vec\n return {{}, execution::Rejection::Closed};\n if (existing_only) { m_flags->probed = true; m_flags->probe_pending = true; }\n else m_flags->started = true;\n+ ++state->pending_deliveries;\n }\n- const auto reject = [flags = m_flags, existing_only](execution::Rejection reason) {\n- if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- return execution::Admission{{}, reason};\n- };\n+ auto release_rejected = qScopeGuard([&] {\n+ if (existing_only) {\n+ std::lock_guard lock{m_flags->mutex};\n+ m_flags->probe_pending = false;\n+ m_flags->probe_terminal = true;\n+ }\n+ state->finishDelivery();\n+ });\n if (directory.size() > 4096 || QString::fromUtf8(directory.toUtf8()) != directory || network.isEmpty() || network.size() > 128 || directory.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\n'}) || inputs.size() > Queue::MAX_PENDING)\n- return reject(execution::Rejection::Invalid);\n+ return {{}, execution::Rejection::Invalid};\n for (const auto& input : inputs) {\n- if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return reject(execution::Rejection::Capacity);\n+ if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return {{}, execution::Rejection::Capacity};\n }\n- auto held = state->scope->borrow(state->key); if (!held) return reject(held.rejection);\n- auto lifetime = std::make_shared<execution::ResourceLease>(std::move(*held.lease));\n- std::shared_ptr<Owner> owner;\n- { std::lock_guard lock{state->mutex}; owner = state->owner; }\n- const auto payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(inputs)); });\n- if (!payload) return reject(execution::Rejection::Closed);\n+ const auto owner = state->owner;\n+ const auto payload = std::make_shared<const std::vector<Input>>(std::move(inputs));\n const auto claimed = std::make_shared<std::atomic_bool>(false);\n- const auto finish = [done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n+ const auto finish = [state, done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n if (claimed->exchange(true)) return;\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- if (done) done(std::move(result));\n+ try { if (done) done(std::move(result)); } catch (...) {}\n };\n- const auto submitted = execution::Submit(*state->scope, [state, directory = std::move(directory), network = std::move(network), payload, lifetime, existing_only] {\n- if (state->flags->admission_closed || (QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))\n- return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start on its background worker.\"))};\n- auto native = std::make_unique<State::Native>(state);\n- auto discovery = native->initialize(directory, network, existing_only);\n- if (discovery.result.status == StartStatus::Primary) {\n- std::lock_guard lock{state->mutex};\n- if (!state->flags->stopping) state->native = native.release();\n- else discovery.result = Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n+ const auto submitted = state->post([state, owner, directory = std::move(directory), network = std::move(network),\n+ payload, finish, claimed, missing = std::move(missing), existing_only](State::Native& native) {\n+ if (state->flags->admission_closed) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n }\n- return discovery;\n- }, [state, owner, payload, finish, lifetime, claimed, missing = std::move(missing)](Discovery discovery) {\n+ auto discovery = [&] {\n+ try { return native.initialize(directory, network, existing_only); }\n+ catch (...) { return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start.\"))}; }\n+ }();\n if (discovery.missing) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n if (!claimed->exchange(true)) {\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n { std::lock_guard lock{state->flags->mutex}; state->flags->probe_pending = false; }\n- if (missing) missing();\n+ try { if (missing) missing(); } catch (...) {}\n }\n return;\n }\n if (!discovery.endpoint.isEmpty()) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n try {\n- const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish, lifetime](ForwardingSnapshot snapshot) {\n+ const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish](ForwardingSnapshot snapshot) {\n if (snapshot.error != Error::None || state->flags->admission_closed) {\n finish(Rejected(QStringLiteral(\"The GUI could not transfer its pending requests.\"))); return;\n }\n- const auto forward_payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(snapshot.inputs)); });\n- if (!forward_payload) { finish(Rejected(QStringLiteral(\"The GUI could not retain its pending requests.\"))); return; }\n- const auto forwarded = execution::Submit(*state->scope, [state, endpoint, forward_payload, lifetime] {\n- if (state->flags->stopping) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n- // Once a frame may have left this process, an exception\n- // is an unknown outcome, never permission to replay.\n- try { return Forward(endpoint, *forward_payload, state->limits, state->flags->stopping); }\n- catch (...) { return Unknown(); }\n- }, [finish, lifetime, forward_payload](StartResult result) {\n- if (result.producer_keys.empty()) result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- }, [finish, lifetime, forward_payload](std::exception_ptr) {\n- auto result = Unknown(); result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- },\n- {execution::Lane::Core, state->key});\n- if (!forwarded) finish(Rejected(QStringLiteral(\"The GUI could not start payment delivery.\")));\n+ try {\n+ const auto forwarded = state->post([state, endpoint, inputs = std::move(snapshot.inputs), finish](State::Native&) {\n+ if (state->flags->stopping) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n+ }\n+ // An exception after sending may have left a frame\n+ // in the other process. Its outcome remains unknown.\n+ auto result = [&] {\n+ try { return Forward(endpoint, inputs, state->limits, state->flags->stopping); }\n+ catch (...) { return Unknown(); }\n+ }();\n+ \n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 483,
"evidence_id": "3416212c4b5041a7b462bbc21b8c742a",
"finding_id": "finding:2",
"kind": "new_source",
"line": 334,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/desktopintenttransport.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 11,
"source_job_id": 2921,
"text": " connect(deadline, &QTimer::timeout, this, [this, id] {\n const auto found = clients.find(id);\n if (found == clients.end()) return;\n try { if (!Remaining(state->limits, found->second.admitted, state->limits.client, 1)) found->second.socket->abort(); }\n catch (...) { found->second.socket->abort(); }\n });\n deadline->start(); ingress(id);\n }\n }\n void ingress(uint64_t id) {\n try { receive(id); }\n catch (...) {\n // Any already admitted queue mutation keeps its original receipt.\n // An unacknowledged caller can query; no exception becomes replay.\n const auto found = clients.find(id); if (found != clients.end()) found->second.socket->abort();\n }\n }\n void retire() {\n server.close();\n while (!replies.empty()) clearReply(replies.begin()->first);\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n#ifndef Q_OS_WIN\n // The runtime directory belongs to this user (Qt checks its owner and\n // mode). A fixed name in the shared /tmp could be created first by\n // another user, which would block delivery for this one.\n const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n if (lstat(encoded.constData(), &info)) {\n if (existing_only && errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n }\n if (!S_ISDIR(info.st_mode) || info.st_uid != getuid() || (info.st_mode & 0077))\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QFileInfo{private_directory}.canonicalFilePath();\n#else\n private_directory = QDir::tempPath();\n#endif\n const QString identity = canonical + QLatin1Char('\\n') + network;\n const auto digest = QCryptographicHash::hash(identity.toUtf8(), QCryptographicHash::Sha256).toHex().first(24);\n#ifndef Q_OS_WIN\n const auto endpoint = QDir{private_directory}.filePath(QString::fromLatin1(digest));\n if (QFile::encodeName(endpoint).size() > 100) return Rejected(QStringLiteral(\"The payment-delivery path is too long.\"));\n#else\n const QString endpoint = QStringLiteral(\"qml-intent-\") + QString::fromLatin1(digest);\n#endif\n if (existing_only) {\n // Discovery grants no listener/lock authority and mutates no local\n // queue. A known absent peer leaves normal final-profile startup\n // available; only a connected same-user peer permits forwarding.\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer)) {\n if (errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The payment-delivery endpoint could not be inspected.\"));\n }\n if (!S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during lookup.\"));\n const auto began = state->limits.now();\n const auto remaining = Remaining(state->limits, began, state->limits.startup, static_cast<int>(state->limits.connect.count()));\n if (!remaining) return Rejected(QStringLiteral(\"The payment-delivery lookup expired.\"));\n QLocalSocket probe; probe.connectToServer(endpoint);\n const bool connected = probe.waitForConnected(remaining);\n if (!connected) {\n if (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError)\n return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The existing payment-delivery endpoint could not be contacted.\"));\n }\n if (state->flags->admission_closed || !Remaining(state->limits, began, state->limits.startup, 1))\n return Rejected(QStringLiteral(\"The payment-delivery lookup expired or is closing.\"));\n if (!SameUser(probe)) return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n return {StartResult{}, endpoint};\n }\n instance_lock = std::make_unique<QLockFile>(QDir{private_directory}.filePath(QString::fromLatin1(digest) + QStringLiteral(\".lock\")));\n instance_lock->setStaleLockTime(0);\n if (instance_lock->tryLock(0)) {\n QLocalSocket probe; probe.connectToServer(endpoint); const bool live = probe.waitForConnected(200);\n bool reclaimable = !live && (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError);\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat socket_info{};\n if (lstat(path.constData(), &socket_info) == 0) {\n reclaimable &= S_ISSOCK(socket_info.st_mode) && socket_info.st_uid == getuid();\n if (reclaimable) reclaimable = QLocalServer::removeServer(endpoint);\n }\n#endif\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n if (reclaimable && !state->flags->admission_closed && server.listen(endpoint)) return StartResult{StartStatus::Primary, {}, {}};\n }\n instance_lock.reset();\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer) || !S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unavailable or unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n return {StartResult{}, endpoint};\n }\n};\n\nbool Service::State::post(std::function<void(Native&)> work)\n{\n std::lock_guard lock{flags->mutex};\n return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n work(*receiver);\n }, Qt::QueuedConnection);\n}\n\nvoid Service::State::finishDelivery()\n{\n {\n std::lock_guard lock{flags->mutex};\n --pending_deliveries;\n }\n retireWhenIdle();\n}\n\nvoid Service::State::retireWhenIdle()\n{\n std::lock_guard lock{flags->mutex};\n if (!flags->stopping || pending_deliveries || !native) return;\n auto* receiver = std::exchange(native, nullptr);\n if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n}\n\nService::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\nService::~Service() { stop(); }\nbool Service::post(std::function<void()> work) const\n{\n const auto state = m_state.load();\n return state && state->post([work = std::move(work)](State::Native&) { work(); });\n}\n\nstd::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n{\n const auto maximum = std::chrono::seconds{30};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Captured passphrase QString is released without cleansingqml/secretinput.h | still_present | AssessmentThe new-head Input declaration still has a const QString m_text and shows no cleansing destructor. The supplied change alters capture ownership APIs but does not demonstrate cleansing of the retained UTF-16 text. new_source: qml/secretinput.h [
{
"bounded": true,
"end_line": 50,
"evidence_id": "fd4348454dfa4bc095d7c9b679cca8b1",
"finding_id": "finding:11",
"kind": "new_source",
"line": 2,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": "qml/secretinput.h",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 11,
"source_job_id": 2921,
"text": "// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n#ifndef BITCOIN_QML_SECRETINPUT_H\n#define BITCOIN_QML_SECRETINPUT_H\n#include <support/allocators/secure.h>\n#include <QString>\n#include <cstddef>\n#include <exception>\n#include <functional>\n#include <memory>\n#include <utility>\n\nnamespace walletopening { class Session; }\n\nnamespace secretinput {\nenum class Error { None, Unavailable, TransportBudget, Materialization };\nclass Failure final : public std::exception {\npublic:\n explicit Failure(Error error) : m_error(error) {}\n Error error() const noexcept { return m_error; }\n const char* what() const noexcept override { return \"The secret input could not be materialized\"; }\nprivate:\n Error m_error;\n};\n// Immutable Qt-native editor handoff. All UTF8 allocation/conversion, cleansing\n// and retirement run inside the original Native action, never on GUI.\nclass Input final {\npublic:\n Input(QString text, size_t bytes);\n size_t bytes() const { return m_bytes; }\n SecureString materialize() const;\nprivate:\n const QString m_text;\n const size_t m_bytes;\n};\nusing Captured = std::shared_ptr<const Input>;\nstruct CaptureResult {\n Captured input;\n Error error{Error::None};\n size_t bytes{0};\n explicit operator bool() const { return bool(input) && error == Error::None; }\n};\n// O(1) metadata admission. result.bytes is the retained secret's accounted size.\nCaptureResult Capture(const std::function<std::shared_ptr<void>(std::function<void()>)>& hold, const QString& text);\nCaptureResult Capture(const std::shared_ptr<walletopening::Session>& opening, const QString& text);\nsize_t Bytes(const Captured& input);\nSecureString Materialize(const Captured& input);\n}\n#endif // BITCOIN_QML_SECRETINPUT_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | macOS artifact instructions omit the profile-inspector helper.github/workflows/artifacts.yml | unclear | AssessmentThe supplied artifact diff removes the profile-inspector helper from the uploaded artifact, but provides no README or other user-instruction evidence. It does not establish whether the documented permission and signing steps now cover both binaries or whether the helper is otherwise available to users. path_diff: .github/workflows/artifacts.yml; new_source: .github/workflows/artifacts.yml [
{
"evidence_id": "75fa795d746b4832a6c2ce56a47f0bcc",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": ".github/workflows/artifacts.yml",
"source_generation": 11,
"source_job_id": 2921,
"text": "diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml\nindex 354c427df8..0cd946fec9 100644\n--- a/.github/workflows/artifacts.yml\n+++ b/.github/workflows/artifacts.yml\n@@ -75,7 +75,4 @@ jobs:\n - uses: actions/upload-artifact@v7\n with:\n name: unsecure_${{ matrix.os }}_gui\n- path: |\n- build/bin/bitcoin-core-app\n- build/bin/bitcoin-core-profile-inspector\n- if-no-files-found: error\n+ path: build/bin/bitcoin-core-app\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 78,
"evidence_id": "5cfda524ad3f4890a4433eb233639b1e",
"finding_id": "finding:10",
"kind": "new_source",
"line": 50,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "ba4b20f16e79cf460be9ca0c74c1af0676598ce4",
"path": ".github/workflows/artifacts.yml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 11,
"source_job_id": 2921,
"text": " echo \"CCACHE_DIR=${{ runner.temp }}/ccache\" >> \"$GITHUB_ENV\"\n\n - name: Restore Ccache cache\n uses: actions/cache/restore@v6\n id: ccache-cache\n with:\n path: ${{ env.CCACHE_DIR }}\n key: ${{ matrix.os }}-ccache-${{ github.run_id }}\n restore-keys: ${{ matrix.os }}-ccache-\n\n - name: Build\n run: |\n git submodule update --init\n cmake -B build \\\n -DBUILD_APP_TESTS=${{ env.BUILD_APP_TESTS }} \\\n -DENABLE_IPC=OFF\n cmake --build build -j\"$(nproc)\"\n\n - name: Save Ccache cache\n uses: actions/cache/save@v6\n if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'\n with:\n path: ${{ env.CCACHE_DIR }}\n key: ${{ matrix.os }}-ccache-${{ github.run_id }}\n\n - uses: actions/upload-artifact@v7\n with:\n name: unsecure_${{ matrix.os }}_gui\n path: build/bin/bitcoin-core-app",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · ba4b20f16e79..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Backup can rename over a loaded wallet's wallet.datqml/models/backuppolicyio.cpp | unclear | AssessmentThe follow-up assessment was invalid: addressed findings require original comparison evidence. invalid_assessment Source report · ba4b20f16e79..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1123 | The first two commits introduce and replace the same date-locale designqml/util.cpp | unclear | AssessmentThe finding concerns commit sequencing—whether the first two commits were squashed—rather than a defect in the resulting tree. The supplied diff shows final-tree changes but provides no commit history or evidence that the review sequence was consolidated. The old and new bases also differ, so the supplied evidence cannot establish whether any history change was author-addressed. Source report · 08aafcd0c9c9..5fdc4f0d513c 2026-11-24T23:23:36Z · gpt-6-luna |
| gui#1144 | Cleanup tests bypass the wait-and-delete path in DiscardCreatedWalletqml/walletqmlcontroller.cpp | addressed | AssessmentThe new test constructs a wallet backed by a real database and a non-null wallet context, fails the import after creation, then verifies the wallet is removed, its database path is gone, and the same name can be reused. This exercises the wait-and-delete cleanup path the prior tests missed. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "d9f1b827c15549dfbb18d6201aa785a4",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 95ad370336..452a87cf64 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -21,6 +21,7 @@\n #include <util/result.h>\n #include <wallet/context.h>\n #include <wallet/imports.h>\n+#include <wallet/scan.h>\n #include <wallet/walletutil.h>\n #include <wallet/wallet.h>\n #include <util/translation.h>\n@@ -36,10 +37,13 @@\n #include <utility>\n #include <vector>\n \n+#include <QByteArray>\n+#include <QDateTime>\n #include <QDir>\n #include <QDesktopServices>\n #include <QFileInfo>\n #include <QMetaObject>\n+#include <QPointer>\n #include <QRegularExpression>\n #include <QSettings>\n #include <QStringList>\n@@ -87,13 +91,9 @@ bool ErrorContains(const QString& error, const QString& needle)\n }\n \n // The import rescans from the oldest timestamp, which a pruned node may no longer have.\n-bool ScanBlocksPruned(interfaces::Chain& chain, const std::vector<wallet::ImportDescriptorRequest>& requests)\n+bool ScanBlocksPruned(interfaces::Chain& chain, std::optional<int64_t> oldest)\n {\n if (!chain.havePruned()) return false;\n- std::optional<int64_t> oldest;\n- for (const auto& request : requests) {\n- if (request.timestamp) oldest = std::min(oldest.value_or(*request.timestamp), *request.timestamp);\n- }\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n@@ -120,6 +120,52 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n for (const fs::path& path : paths) fs::remove(path, error);\n }\n \n+// A view-only import saves its descriptors before it rescans. The wallet's\n+// best block is already the tip then, so after a crash it would load without\n+// the older transactions. This records where the rescan starts until it ends.\n+QString PendingImportKey(const std::string& wallet_name)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+{\n+ QSettings settings;\n+ if (time) {\n+ settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n+ } else {\n+ settings.remove(PendingImportKey(wallet_name));\n+ }\n+ settings.sync();\n+}\n+\n+std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+{\n+ const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n+ return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+}\n+\n+bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+{\n+ wallet::WalletContext* context{node.walletLoader().context()};\n+ const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n+ if (!wallet) return false;\n+ wallet::WalletRescanReserver reserver{*wallet};\n+ if (!reserver.reserve()) return false;\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ int start_height{0};\n+ uint256 start_block;\n+ bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))};\n+ if (!done) {\n+ // Progress is saved, so a later load continues from where this stopped too.\n+ done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n+ wallet::ScanResult::SUCCESS;\n+ }\n+ control.detach();\n+ return done;\n+}\n+\n QString ImportErrorText(const wallet::ImportError& error)\n {\n const bilingual_str& message{error.wallet_error.message};\n@@ -127,6 +173,33 @@ QString ImportErrorText(const wallet::ImportError& error)\n }\n } // namespace\n \n+bool RescanControl::attach(std::function<void()> abort)\n+{\n+ const std::lock_guard lock{m_mutex};\n+ if (m_cancelled) return false;\n+ m_abort = std::move(abort);\n+ return true;\n+}\n+\n+void RescanControl::detach()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_abort = nullptr;\n+}\n+\n+void RescanControl::cancel()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_cancelled = true;\n+ if (m_abort) m_abort();\n+}\n+\n+bool RescanControl::cancelled() const\n+{\n+ const std::lock_guard lock{m_mutex};\n+ return m_cancelled;\n+}\n+\n WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n@@ -141,6 +214,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n+ return ResumeImport(node, wallet_name, time, control);\n+ })\n {\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n@@ -393,6 +469,8 @@ void WalletQmlController::beginShutdown()\n const auto wallets = m_wallets;\n for (auto* wallet : wallets) removeWalletModel(wallet);\n retireWallet(m_empty_wallet, false);\n+ for (const auto& [name, control] : m_import_rescans) control->cancel();\n+ if (m_import_rescan_executor) m_import_rescan_executor->shutdown();\n m_notification_cleanup_executor = std::make_unique<BackendExecutor>();\n m_notification_cleanup_executor->setObjectName(QStringLiteral(\"wallet-notifications\"));\n connect(m_notification_cleanup_executor.get(), &BackendExecutor::drained, this, [this] {\n@@ -428,7 +506,8 @@ void WalletQmlController::retireWallet(WalletQmlModel* model, bool remove)\n \n void WalletQmlController::checkShutdownFinished()\n {\n- if (m_shutting_down && m_controller_drained && m_notifications_drained && m_retiring_wallets.empty() && !m_shutdown_complete) {\n+ if (m_shutting_down && m_controller_drained && m_notifications_drained && m_import_rescans_drained &&\n+ m_retiring_wallets.empty() && !m_shutdown_complete) {\n m_shutdown_complete = true;\n Q_EMIT walletsDrained();\n }\n@@ -439,6 +518,32 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n connect(wallet_model, &WalletQmlModel::walletUnloaded, this, [this, wallet_model]() {\n removeWalletModel(wallet_model);\n }, Qt::QueuedConnection);\n+ resumeInterruptedImport(wallet_model);\n+}\n+\n+void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n+{\n+ const QString name{wallet_model->name()};\n+ const std::optional<int64_t> time{PendingImport(name.toStdString())};\n+ if (!time) return;\n+ if (!m_import_rescan_executor) {\n+ m_import_rescan_executor = std::make_unique<BackendExecutor>();\n+ m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n+ m_import_rescans_drained = false;\n+ connect(m_import_rescan_executor.get(), &BackendExecutor::drained, this, [this] {\n+ m_import_rescans_drained = true;\n+ checkShutdownFinished();\n+ });\n+ }\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_rescans[name] = control;\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n+ // Stays pending when the rescan stops early, so the next load tries again.\n+ if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n+ }, [this, name, control] {\n+ const auto it{m_import_rescans.find(name)};\n+ if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ });\n }\n \n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n@@ -478,6 +583,7 @@ void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool r\n WalletListModel::LoadState::Closed,\n QString{});\n setWalletLoaded(next_selected_wallet != nullptr);\n+ if (const auto it{m_import_rescans.find(wallet_name)}; it != m_import_rescans.end()) it->second->cancel();\n retireWallet(wallet_model, remove);\n }\n \n@@ -572,6 +678,7 @@ void WalletQmlController::createWalletAsync(const QString& name,\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -711,30 +818,62 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n- const bool date_chosen{!input.undated.empty()};\n+ // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n+ std::optional<int64_t> oldest_dated;\n+ for (size_t i = 0; i < input.requests.size(); ++i) {\n+ const std::optional<int64_t>& time{input.requests[i].timestamp};\n+ if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n+ }\n+ const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n+ // An unset timestamp means now.\n+ int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n+ for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_control = control;\n+ setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests](interfaces::Wallet& wallet) mutable {\n- // Imports the descriptors, then rescans from the oldest timestamp.\n- const std::vector<wallet::ImportResult> results{wallet.importDescriptors(requests)};\n+ [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n+ if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ SetPendingImport(wallet.getWalletName(), rescan_from);\n+ std::vector<wallet::ImportResult> results;\n+ {\n+ const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // Starting a rescan clears an earlier abort.\n+ if (control->cancelled()) wallet.abortRescan();\n+ QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n+ if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ })};\n+ // Imports the descriptors, then rescans from the oldest timestamp.\n+ results = wallet.importDescriptors(requests);\n+ }\n+ control->detach();\n+ if (control->cancelled()) return cancelled;\n // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n+ SetPendingImport(wallet.getWalletName(), std::nullopt);\n return QString{};\n- }, [node = &m_node, requests, date_chosen] {\n+ }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n wallet::WalletContext* context{node->walletLoader().context()};\n- if (!context || !context->chain || !ScanBlocksPruned(*context->chain, requests)) return QString{};\n- if (!date_chosen) {\n+ if (!context || !context->chain) return QString{};\n+ if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n }\n- return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ if (ScanBlocksPruned(*context->chain, chosen_date)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ }\n+ return QString{};\n });\n }\n \n@@ -779,6 +918,18 @@ QVariantMap WalletQmlController::describeViewOnlyImport(const QString& import_te\n return DescribeViewOnlyImport(import_text, address_type);\n }\n \n+void WalletQmlController::cancelViewOnlyImport()\n+{\n+ if (m_import_control) m_import_control->cancel();\n+}\n+\n+void WalletQmlController::setImportProgress(int progress)\n+{\n+ if (m_import_progress == progress) return;\n+ m_import_progress = progress;\n+ Q_EMIT importProgressChanged();\n+}\n+\n void WalletQmlController::requestOpenWalletSettings(WalletQmlModel* wallet)\n {\n if (!wallet) return;\n@@ -1449,3 +1600,8 @@ void WalletQmlController::setOpenLocalPathFnForTesting(OpenLocalPathFn fn)\n {\n m_open_local_path_fn = std::move(fn);\n }\n+\n+void WalletQmlController::setResumeImportFnForTesting(ResumeImportFn fn)\n+{\n+ m_resume_import_fn = std::move(fn);\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Receive-only imports do not explain missing change coverageqml/viewonlyimport.cpp | addressed | AssessmentThe import summary now warns when no active change descriptor exists, including the receive-only case, and the QML form includes the warning in its summary. Tests cover a lone receive descriptor and an inactive change descriptor. path_diff: qml/viewonlyimport.cpp [
{
"evidence_id": "3908654332bf4369801862b08565f9bd",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/viewonlyimport.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex 3d9b9d5216..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -41,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -104,6 +106,10 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n // The wallet derives the first address on import.\n FlatSigningProvider derived;\n std::vector<CScript> scripts;\n@@ -164,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -218,6 +226,14 @@ ViewOnlyImport ParseJson(const std::string& text)\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n \n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n@@ -462,6 +478,16 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n std::vector<bool> active(parsed.requests.size(), false);\n for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n \n // Receive and change of one key share a row.\n QVariantList rows;\n@@ -514,7 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n- result.insert(QStringLiteral(\"warning\"), parsed.warning);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Historical imports lack progress feedback and an in-form cancel actionqml/pages/wallet/CreateWalletForm.qml | addressed | AssessmentThe form now displays rescan progress and a cancel action. The controller installs a progress handler and uses an abort control; cancellation returns an error so the failed creation follows the discard path. The QML test verifies progress and cancellation behavior. path_diff: qml/pages/wallet/CreateWalletForm.qml [
{
"evidence_id": "8ae2afae3a92405c8444b00c62c7d407",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/pages/wallet/CreateWalletForm.qml",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/pages/wallet/CreateWalletForm.qml b/qml/pages/wallet/CreateWalletForm.qml\nindex c121c2c126..a2b36f3b3f 100644\n--- a/qml/pages/wallet/CreateWalletForm.qml\n+++ b/qml/pages/wallet/CreateWalletForm.qml\n@@ -75,7 +75,7 @@ OnboardingView {\n //: %1 is the date the oldest pasted descriptor was created.\n summary += \" \" + qsTr(\"Created %1.\").arg(new Date(importInfo.createdTime * 1000).toLocaleDateString(Qt.locale(), \"d MMM yyyy\"))\n }\n- return summary\n+ return importInfo.warning ? summary + \" \" + importInfo.warning : summary\n }\n \n function submit() {\n@@ -108,6 +108,10 @@ OnboardingView {\n primaryButtonText: creating ? (watchOnly ? qsTr(\"Importing…\") : qsTr(\"Creating…\")) : qsTr(\"Create wallet\")\n primaryButtonObjectName: \"createWalletFormCreateButton\"\n primaryButtonEnabled: canCreate\n+ readonly property bool importRunning: watchOnly && creating && walletController.walletLoadInProgress\n+ secondaryButtonText: importRunning ? qsTr(\"Cancel import\") : \"\"\n+ secondaryButtonObjectName: \"createWalletFormCancelImportButton\"\n+ onSecondaryClicked: walletController.cancelViewOnlyImport()\n onCloseClicked: root.cancel()\n onPrimaryClicked: {\n if (!root.canCreate) return\n@@ -455,15 +459,29 @@ OnboardingView {\n }\n }\n \n- CoreText {\n- objectName: \"watchOnlyScanNote\"\n+ RowLayout {\n visible: root.watchOnly && root.creating\n Layout.fillWidth: true\n- text: qsTr(\"Looking for this wallet's transactions. This can take a while.\")\n- color: Theme.color.neutral7\n- textStyle: Theme.text.caption\n- wrapMode: Text.WordWrap\n- horizontalAlignment: Text.AlignLeft\n+ spacing: 8\n+\n+ SpinningIndicator {\n+ Layout.alignment: Qt.AlignTop\n+ running: parent.visible\n+ color: Theme.color.neutral7\n+ }\n+ CoreText {\n+ objectName: \"watchOnlyScanNote\"\n+ Layout.fillWidth: true\n+ text: walletController.importProgress >= 0\n+ //: %1 is how much of the blockchain has been searched, in percent.\n+ ? qsTr(\"Looking for this wallet's transactions, %1% done. Cancelling deletes the new wallet.\")\n+ .arg(walletController.importProgress)\n+ : qsTr(\"Looking for this wallet's transactions. This can take a while.\")\n+ color: Theme.color.neutral7\n+ textStyle: Theme.text.caption\n+ wrapMode: Text.WordWrap\n+ horizontalAlignment: Text.AlignLeft\n+ }\n }\n \n CoreText {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Receive-type filtering does not refresh after descriptor changesqml/models/walletqmlmodel.cpp | addressed | AssessmentThe available receive types are now a NOTIFY property, and the model connects handleCanGetAddressesChanged through a queued signal before emitting the property notification. The regression test checks that activating a legacy descriptor updates the list. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "829e80c7b5604146bf79b1c01a558eb6",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 2d36dee979..97decc09af 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -170,19 +170,19 @@ void ApplySelectedInputsPolicy(wallet::CCoinControl& coin_control)\n coin_control.m_allow_other_inputs = !coin_control.HasSelected();\n }\n \n-// When no recipient matches a change descriptor, Core picks Taproot, then SegWit,\n-// then the default address type. A wallet that only watches nested SegWit or\n-// legacy addresses has none of those, so use a change type it has.\n-void ApplyChangeTypeFallback(interfaces::Wallet& wallet, wallet::CCoinControl& coin_control)\n+// Core picks a change type from the recipients, then Taproot, SegWit and the\n+// default address type. A wallet that only watches nested SegWit or legacy\n+// addresses may have no change descriptor of that type, so use one it has.\n+void ApplyChangeTypeFallback(interfaces::Wallet& wallet, const std::vector<wallet::CRecipient>& recipients,\n+ wallet::CCoinControl& coin_control)\n {\n const wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (coin_control.m_change_type || !raw_wallet || raw_wallet->m_default_change_type) return;\n+ if (coin_control.m_change_type || !raw_wallet) return;\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ if (raw_wallet->m_default_change_type) return;\n const auto has_change = [&](OutputType type) { return raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true) != nullptr; };\n- const OutputType core_choice{raw_wallet->m_default_address_type == OutputType::LEGACY ? OutputType::LEGACY\n- : has_change(OutputType::BECH32M) ? OutputType::BECH32M\n- : has_change(OutputType::BECH32) ? OutputType::BECH32\n- : raw_wallet->m_default_address_type};\n- if (has_change(core_choice)) return;\n+ if (has_change(raw_wallet->TransactionChangeType(std::nullopt, recipients))) return;\n for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n if (has_change(type)) {\n coin_control.m_change_type = type;\n@@ -701,7 +701,8 @@ void WalletQmlModel::beginShutdown(bool remove_wallet)\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),\n- std::move(m_handler_transaction_changed), std::move(m_handler_unload));\n+ std::move(m_handler_transaction_changed), std::move(m_handler_unload),\n+ std::move(m_handler_can_get_addresses_changed));\n if (m_bump_transaction_model) m_bump_transaction_model->detachWallet();\n if (m_imported_psbt_model) m_imported_psbt_model->detachWallet();\n auto wallet = std::move(m_wallet);\n@@ -1100,32 +1101,29 @@ void WalletQmlModel::clearSettingsError()\n \n QVariantList WalletQmlModel::availableReceiveAddressTypes() const\n {\n- if (!m_wallet || !m_wallet->canGetAddresses()) {\n- return {};\n- }\n-\n- QVariantList types;\n- const std::array ordered_types{\n- OutputType::BECH32M,\n- OutputType::BECH32,\n- OutputType::P2SH_SEGWIT,\n- OutputType::LEGACY,\n- };\n-\n+ if (!m_wallet) return {};\n const wallet::CWallet* raw_wallet{m_wallet->wallet()};\n- for (const OutputType type : ordered_types) {\n- // Only a type with an active receive descriptor can give out addresses.\n- if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n- : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n- continue;\n+ const auto list_types = [&] {\n+ QVariantList types;\n+ if (!m_wallet->canGetAddresses()) return types;\n+ for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n+ // Only a type with an active receive descriptor can give out addresses.\n+ if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n+ : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n+ continue;\n+ }\n+ QVariantMap item;\n+ item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n+ item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n+ item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n+ types.append(item);\n }\n- QVariantMap item;\n- item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n- item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n- item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- types.append(item);\n- }\n- return types;\n+ return types;\n+ };\n+ if (!raw_wallet) return list_types();\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ return list_types();\n }\n \n QString WalletQmlModel::defaultReceiveAddressType() const\n@@ -2172,7 +2170,7 @@ void WalletQmlModel::requestFeeEstimatesNow()\n const int remainder_index = m_send_recipients->recipients().indexOf(m_maximum_recipient);\n const quint64 request_id = ++m_fee_estimate_request_id;\n wallet::CCoinControl base_coin_control{m_coin_control};\n- ApplyChangeTypeFallback(*m_wallet, base_coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *recipients, base_coin_control);\n const OutputType preview_change_type{base_coin_control.m_change_type.value_or(m_wallet->getDefaultAddressType())};\n const bool custom_fee_enabled{m_custom_fee_enabled};\n const std::optional<CAmount> custom_fee_rate_per_kvb{\n@@ -2365,7 +2363,7 @@ bool WalletQmlModel::prepareTransactionInternal(std::optional<SecureString> pass\n \n wallet::CCoinControl coin_control{m_coin_control};\n ApplySelectedInputsPolicy(coin_control);\n- ApplyChangeTypeFallback(*m_wallet, coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *vec_send, coin_control);\n if (m_custom_fee_enabled) {\n const auto custom_fee_rate_per_kvb = ParseCustomFeeRatePerKvB(m_custom_fee_rate, MinimumCustomFeeRatePerKvB(m_wallet.get()));\n if (!custom_fee_rate_per_kvb.has_value()) {\n@@ -3230,6 +3228,11 @@ void WalletQmlModel::subscribeToWalletSignals()\n if (guard && !guard->m_stopping) Q_EMIT guard->addressListChanged();\n }, Qt::QueuedConnection);\n });\n+ m_handler_can_get_addresses_changed = m_wallet->handleCanGetAddressesChanged([guard, bridge] {\n+ QMetaObject::invokeMethod(bridge.get(), [guard] {\n+ if (guard && !guard->m_stopping) Q_EMIT guard->availableReceiveAddressTypesChanged();\n+ }, Qt::QueuedConnection);\n+ });\n m_handler_transaction_changed = handleTransactionChanged([guard, bridge, pending](const uint256& txid, ChangeType change) {\n pending->fetch_add(1);\n QMetaObject::invokeMethod(bridge.get(), [guard, pending, txid, change] {\n@@ -3274,6 +3277,9 @@ void WalletQmlModel::unsubscribeFromWalletSignals()\n if (m_handler_unload) {\n m_handler_unload->disconnect();\n }\n+ if (m_handler_can_get_addresses_changed) {\n+ m_handler_can_get_addresses_changed->disconnect();\n+ }\n }\n \n void WalletQmlModel::refreshSecurityState()\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Mixed JSON timestamps receive ineffective pruning recovery adviceqml/walletqmlcontroller.cpp | addressed | AssessmentThe new code separates the oldest fixed timestamp from the chosen date for undated requests and selects the pruning error message accordingly. A functional test covers mixed dated/undated JSON and confirms it advises using a node that keeps all blocks rather than choosing a later date. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "b8abcf711b9344b3b160cf3a253f0fee",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 95ad370336..452a87cf64 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -21,6 +21,7 @@\n #include <util/result.h>\n #include <wallet/context.h>\n #include <wallet/imports.h>\n+#include <wallet/scan.h>\n #include <wallet/walletutil.h>\n #include <wallet/wallet.h>\n #include <util/translation.h>\n@@ -36,10 +37,13 @@\n #include <utility>\n #include <vector>\n \n+#include <QByteArray>\n+#include <QDateTime>\n #include <QDir>\n #include <QDesktopServices>\n #include <QFileInfo>\n #include <QMetaObject>\n+#include <QPointer>\n #include <QRegularExpression>\n #include <QSettings>\n #include <QStringList>\n@@ -87,13 +91,9 @@ bool ErrorContains(const QString& error, const QString& needle)\n }\n \n // The import rescans from the oldest timestamp, which a pruned node may no longer have.\n-bool ScanBlocksPruned(interfaces::Chain& chain, const std::vector<wallet::ImportDescriptorRequest>& requests)\n+bool ScanBlocksPruned(interfaces::Chain& chain, std::optional<int64_t> oldest)\n {\n if (!chain.havePruned()) return false;\n- std::optional<int64_t> oldest;\n- for (const auto& request : requests) {\n- if (request.timestamp) oldest = std::min(oldest.value_or(*request.timestamp), *request.timestamp);\n- }\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n@@ -120,6 +120,52 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n for (const fs::path& path : paths) fs::remove(path, error);\n }\n \n+// A view-only import saves its descriptors before it rescans. The wallet's\n+// best block is already the tip then, so after a crash it would load without\n+// the older transactions. This records where the rescan starts until it ends.\n+QString PendingImportKey(const std::string& wallet_name)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+{\n+ QSettings settings;\n+ if (time) {\n+ settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n+ } else {\n+ settings.remove(PendingImportKey(wallet_name));\n+ }\n+ settings.sync();\n+}\n+\n+std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+{\n+ const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n+ return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+}\n+\n+bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+{\n+ wallet::WalletContext* context{node.walletLoader().context()};\n+ const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n+ if (!wallet) return false;\n+ wallet::WalletRescanReserver reserver{*wallet};\n+ if (!reserver.reserve()) return false;\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ int start_height{0};\n+ uint256 start_block;\n+ bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))};\n+ if (!done) {\n+ // Progress is saved, so a later load continues from where this stopped too.\n+ done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n+ wallet::ScanResult::SUCCESS;\n+ }\n+ control.detach();\n+ return done;\n+}\n+\n QString ImportErrorText(const wallet::ImportError& error)\n {\n const bilingual_str& message{error.wallet_error.message};\n@@ -127,6 +173,33 @@ QString ImportErrorText(const wallet::ImportError& error)\n }\n } // namespace\n \n+bool RescanControl::attach(std::function<void()> abort)\n+{\n+ const std::lock_guard lock{m_mutex};\n+ if (m_cancelled) return false;\n+ m_abort = std::move(abort);\n+ return true;\n+}\n+\n+void RescanControl::detach()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_abort = nullptr;\n+}\n+\n+void RescanControl::cancel()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_cancelled = true;\n+ if (m_abort) m_abort();\n+}\n+\n+bool RescanControl::cancelled() const\n+{\n+ const std::lock_guard lock{m_mutex};\n+ return m_cancelled;\n+}\n+\n WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n@@ -141,6 +214,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n+ return ResumeImport(node, wallet_name, time, control);\n+ })\n {\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n@@ -393,6 +469,8 @@ void WalletQmlController::beginShutdown()\n const auto wallets = m_wallets;\n for (auto* wallet : wallets) removeWalletModel(wallet);\n retireWallet(m_empty_wallet, false);\n+ for (const auto& [name, control] : m_import_rescans) control->cancel();\n+ if (m_import_rescan_executor) m_import_rescan_executor->shutdown();\n m_notification_cleanup_executor = std::make_unique<BackendExecutor>();\n m_notification_cleanup_executor->setObjectName(QStringLiteral(\"wallet-notifications\"));\n connect(m_notification_cleanup_executor.get(), &BackendExecutor::drained, this, [this] {\n@@ -428,7 +506,8 @@ void WalletQmlController::retireWallet(WalletQmlModel* model, bool remove)\n \n void WalletQmlController::checkShutdownFinished()\n {\n- if (m_shutting_down && m_controller_drained && m_notifications_drained && m_retiring_wallets.empty() && !m_shutdown_complete) {\n+ if (m_shutting_down && m_controller_drained && m_notifications_drained && m_import_rescans_drained &&\n+ m_retiring_wallets.empty() && !m_shutdown_complete) {\n m_shutdown_complete = true;\n Q_EMIT walletsDrained();\n }\n@@ -439,6 +518,32 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n connect(wallet_model, &WalletQmlModel::walletUnloaded, this, [this, wallet_model]() {\n removeWalletModel(wallet_model);\n }, Qt::QueuedConnection);\n+ resumeInterruptedImport(wallet_model);\n+}\n+\n+void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n+{\n+ const QString name{wallet_model->name()};\n+ const std::optional<int64_t> time{PendingImport(name.toStdString())};\n+ if (!time) return;\n+ if (!m_import_rescan_executor) {\n+ m_import_rescan_executor = std::make_unique<BackendExecutor>();\n+ m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n+ m_import_rescans_drained = false;\n+ connect(m_import_rescan_executor.get(), &BackendExecutor::drained, this, [this] {\n+ m_import_rescans_drained = true;\n+ checkShutdownFinished();\n+ });\n+ }\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_rescans[name] = control;\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n+ // Stays pending when the rescan stops early, so the next load tries again.\n+ if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n+ }, [this, name, control] {\n+ const auto it{m_import_rescans.find(name)};\n+ if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ });\n }\n \n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n@@ -478,6 +583,7 @@ void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool r\n WalletListModel::LoadState::Closed,\n QString{});\n setWalletLoaded(next_selected_wallet != nullptr);\n+ if (const auto it{m_import_rescans.find(wallet_name)}; it != m_import_rescans.end()) it->second->cancel();\n retireWallet(wallet_model, remove);\n }\n \n@@ -572,6 +678,7 @@ void WalletQmlController::createWalletAsync(const QString& name,\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -711,30 +818,62 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n- const bool date_chosen{!input.undated.empty()};\n+ // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n+ std::optional<int64_t> oldest_dated;\n+ for (size_t i = 0; i < input.requests.size(); ++i) {\n+ const std::optional<int64_t>& time{input.requests[i].timestamp};\n+ if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n+ }\n+ const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n+ // An unset timestamp means now.\n+ int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n+ for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_control = control;\n+ setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests](interfaces::Wallet& wallet) mutable {\n- // Imports the descriptors, then rescans from the oldest timestamp.\n- const std::vector<wallet::ImportResult> results{wallet.importDescriptors(requests)};\n+ [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n+ if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ SetPendingImport(wallet.getWalletName(), rescan_from);\n+ std::vector<wallet::ImportResult> results;\n+ {\n+ const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // Starting a rescan clears an earlier abort.\n+ if (control->cancelled()) wallet.abortRescan();\n+ QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n+ if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ })};\n+ // Imports the descriptors, then rescans from the oldest timestamp.\n+ results = wallet.importDescriptors(requests);\n+ }\n+ control->detach();\n+ if (control->cancelled()) return cancelled;\n // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n+ SetPendingImport(wallet.getWalletName(), std::nullopt);\n return QString{};\n- }, [node = &m_node, requests, date_chosen] {\n+ }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n wallet::WalletContext* context{node->walletLoader().context()};\n- if (!context || !context->chain || !ScanBlocksPruned(*context->chain, requests)) return QString{};\n- if (!date_chosen) {\n+ if (!context || !context->chain) return QString{};\n+ if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n }\n- return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ if (ScanBlocksPruned(*context->chain, chosen_date)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ }\n+ return QString{};\n });\n }\n \n@@ -779,6 +918,18 @@ QVariantMap WalletQmlController::describeViewOnlyImport(const QString& import_te\n return DescribeViewOnlyImport(import_text, address_type);\n }\n \n+void WalletQmlController::cancelViewOnlyImport()\n+{\n+ if (m_import_control) m_import_control->cancel();\n+}\n+\n+void WalletQmlController::setImportProgress(int progress)\n+{\n+ if (m_import_progress == progress) return;\n+ m_import_progress = progress;\n+ Q_EMIT importProgressChanged();\n+}\n+\n void WalletQmlController::requestOpenWalletSettings(WalletQmlModel* wallet)\n {\n if (!wallet) return;\n@@ -1449,3 +1600,8 @@ void WalletQmlController::setOpenLocalPathFnForTesting(OpenLocalPathFn fn)\n {\n m_open_local_path_fn = std::move(fn);\n }\n+\n+void WalletQmlController::setResumeImportFnForTesting(ResumeImportFn fn)\n+{\n+ m_resume_import_fn = std::move(fn);\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Change fallback overrides Core's recipient-matched legacy changeqml/models/walletqmlmodel.cpp | addressed | AssessmentThe helper now receives recipients and checks Core's TransactionChangeType result before applying a fallback. The regression test verifies that a legacy recipient leaves Core's choice intact when a legacy change manager exists, while unavailable types still fall back. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "6f064699bdd042d6947d9a6d132c284c",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 2d36dee979..97decc09af 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -170,19 +170,19 @@ void ApplySelectedInputsPolicy(wallet::CCoinControl& coin_control)\n coin_control.m_allow_other_inputs = !coin_control.HasSelected();\n }\n \n-// When no recipient matches a change descriptor, Core picks Taproot, then SegWit,\n-// then the default address type. A wallet that only watches nested SegWit or\n-// legacy addresses has none of those, so use a change type it has.\n-void ApplyChangeTypeFallback(interfaces::Wallet& wallet, wallet::CCoinControl& coin_control)\n+// Core picks a change type from the recipients, then Taproot, SegWit and the\n+// default address type. A wallet that only watches nested SegWit or legacy\n+// addresses may have no change descriptor of that type, so use one it has.\n+void ApplyChangeTypeFallback(interfaces::Wallet& wallet, const std::vector<wallet::CRecipient>& recipients,\n+ wallet::CCoinControl& coin_control)\n {\n const wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (coin_control.m_change_type || !raw_wallet || raw_wallet->m_default_change_type) return;\n+ if (coin_control.m_change_type || !raw_wallet) return;\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ if (raw_wallet->m_default_change_type) return;\n const auto has_change = [&](OutputType type) { return raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true) != nullptr; };\n- const OutputType core_choice{raw_wallet->m_default_address_type == OutputType::LEGACY ? OutputType::LEGACY\n- : has_change(OutputType::BECH32M) ? OutputType::BECH32M\n- : has_change(OutputType::BECH32) ? OutputType::BECH32\n- : raw_wallet->m_default_address_type};\n- if (has_change(core_choice)) return;\n+ if (has_change(raw_wallet->TransactionChangeType(std::nullopt, recipients))) return;\n for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n if (has_change(type)) {\n coin_control.m_change_type = type;\n@@ -701,7 +701,8 @@ void WalletQmlModel::beginShutdown(bool remove_wallet)\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),\n- std::move(m_handler_transaction_changed), std::move(m_handler_unload));\n+ std::move(m_handler_transaction_changed), std::move(m_handler_unload),\n+ std::move(m_handler_can_get_addresses_changed));\n if (m_bump_transaction_model) m_bump_transaction_model->detachWallet();\n if (m_imported_psbt_model) m_imported_psbt_model->detachWallet();\n auto wallet = std::move(m_wallet);\n@@ -1100,32 +1101,29 @@ void WalletQmlModel::clearSettingsError()\n \n QVariantList WalletQmlModel::availableReceiveAddressTypes() const\n {\n- if (!m_wallet || !m_wallet->canGetAddresses()) {\n- return {};\n- }\n-\n- QVariantList types;\n- const std::array ordered_types{\n- OutputType::BECH32M,\n- OutputType::BECH32,\n- OutputType::P2SH_SEGWIT,\n- OutputType::LEGACY,\n- };\n-\n+ if (!m_wallet) return {};\n const wallet::CWallet* raw_wallet{m_wallet->wallet()};\n- for (const OutputType type : ordered_types) {\n- // Only a type with an active receive descriptor can give out addresses.\n- if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n- : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n- continue;\n+ const auto list_types = [&] {\n+ QVariantList types;\n+ if (!m_wallet->canGetAddresses()) return types;\n+ for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n+ // Only a type with an active receive descriptor can give out addresses.\n+ if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n+ : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n+ continue;\n+ }\n+ QVariantMap item;\n+ item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n+ item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n+ item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n+ types.append(item);\n }\n- QVariantMap item;\n- item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n- item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n- item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- types.append(item);\n- }\n- return types;\n+ return types;\n+ };\n+ if (!raw_wallet) return list_types();\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ return list_types();\n }\n \n QString WalletQmlModel::defaultReceiveAddressType() const\n@@ -2172,7 +2170,7 @@ void WalletQmlModel::requestFeeEstimatesNow()\n const int remainder_index = m_send_recipients->recipients().indexOf(m_maximum_recipient);\n const quint64 request_id = ++m_fee_estimate_request_id;\n wallet::CCoinControl base_coin_control{m_coin_control};\n- ApplyChangeTypeFallback(*m_wallet, base_coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *recipients, base_coin_control);\n const OutputType preview_change_type{base_coin_control.m_change_type.value_or(m_wallet->getDefaultAddressType())};\n const bool custom_fee_enabled{m_custom_fee_enabled};\n const std::optional<CAmount> custom_fee_rate_per_kvb{\n@@ -2365,7 +2363,7 @@ bool WalletQmlModel::prepareTransactionInternal(std::optional<SecureString> pass\n \n wallet::CCoinControl coin_control{m_coin_control};\n ApplySelectedInputsPolicy(coin_control);\n- ApplyChangeTypeFallback(*m_wallet, coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *vec_send, coin_control);\n if (m_custom_fee_enabled) {\n const auto custom_fee_rate_per_kvb = ParseCustomFeeRatePerKvB(m_custom_fee_rate, MinimumCustomFeeRatePerKvB(m_wallet.get()));\n if (!custom_fee_rate_per_kvb.has_value()) {\n@@ -3230,6 +3228,11 @@ void WalletQmlModel::subscribeToWalletSignals()\n if (guard && !guard->m_stopping) Q_EMIT guard->addressListChanged();\n }, Qt::QueuedConnection);\n });\n+ m_handler_can_get_addresses_changed = m_wallet->handleCanGetAddressesChanged([guard, bridge] {\n+ QMetaObject::invokeMethod(bridge.get(), [guard] {\n+ if (guard && !guard->m_stopping) Q_EMIT guard->availableReceiveAddressTypesChanged();\n+ }, Qt::QueuedConnection);\n+ });\n m_handler_transaction_changed = handleTransactionChanged([guard, bridge, pending](const uint256& txid, ChangeType change) {\n pending->fetch_add(1);\n QMetaObject::invokeMethod(bridge.get(), [guard, pending, txid, change] {\n@@ -3274,6 +3277,9 @@ void WalletQmlModel::unsubscribeFromWalletSignals()\n if (m_handler_unload) {\n m_handler_unload->disconnect();\n }\n+ if (m_handler_can_get_addresses_changed) {\n+ m_handler_can_get_addresses_changed->disconnect();\n+ }\n }\n \n void WalletQmlModel::refreshSecurityState()\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Conflicting duplicate descriptors leave a misleading active previewqml/viewonlyimport.cpp | addressed | AssessmentParseJson now tracks settings by descriptor path and rejects repeated paths with conflicting active/internal settings before adding the request. The new test cases cover active-then-inactive duplicates. path_diff: qml/viewonlyimport.cpp [
{
"evidence_id": "e64ce38efc2e41ff8ba9c5a5c92dd44e",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/viewonlyimport.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex 3d9b9d5216..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -41,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -104,6 +106,10 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n // The wallet derives the first address on import.\n FlatSigningProvider derived;\n std::vector<CScript> scripts;\n@@ -164,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -218,6 +226,14 @@ ViewOnlyImport ParseJson(const std::string& text)\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n \n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n@@ -462,6 +478,16 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n std::vector<bool> active(parsed.requests.size(), false);\n for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n \n // Receive and change of one key share a row.\n QVariantList rows;\n@@ -514,7 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n- result.insert(QStringLiteral(\"warning\"), parsed.warning);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | GUI active-manager lookups race with descriptor importsqml/models/walletqmlmodel.cpp | addressed | AssessmentThe fallback decision now holds raw_wallet->cs_wallet while checking active change managers, and receive-type enumeration holds the same lock across manager lookups. This covers the map reads identified by the finding. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "ee2e5133b35f4a3b91b7c169c35f5106",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 2d36dee979..97decc09af 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -170,19 +170,19 @@ void ApplySelectedInputsPolicy(wallet::CCoinControl& coin_control)\n coin_control.m_allow_other_inputs = !coin_control.HasSelected();\n }\n \n-// When no recipient matches a change descriptor, Core picks Taproot, then SegWit,\n-// then the default address type. A wallet that only watches nested SegWit or\n-// legacy addresses has none of those, so use a change type it has.\n-void ApplyChangeTypeFallback(interfaces::Wallet& wallet, wallet::CCoinControl& coin_control)\n+// Core picks a change type from the recipients, then Taproot, SegWit and the\n+// default address type. A wallet that only watches nested SegWit or legacy\n+// addresses may have no change descriptor of that type, so use one it has.\n+void ApplyChangeTypeFallback(interfaces::Wallet& wallet, const std::vector<wallet::CRecipient>& recipients,\n+ wallet::CCoinControl& coin_control)\n {\n const wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (coin_control.m_change_type || !raw_wallet || raw_wallet->m_default_change_type) return;\n+ if (coin_control.m_change_type || !raw_wallet) return;\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ if (raw_wallet->m_default_change_type) return;\n const auto has_change = [&](OutputType type) { return raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true) != nullptr; };\n- const OutputType core_choice{raw_wallet->m_default_address_type == OutputType::LEGACY ? OutputType::LEGACY\n- : has_change(OutputType::BECH32M) ? OutputType::BECH32M\n- : has_change(OutputType::BECH32) ? OutputType::BECH32\n- : raw_wallet->m_default_address_type};\n- if (has_change(core_choice)) return;\n+ if (has_change(raw_wallet->TransactionChangeType(std::nullopt, recipients))) return;\n for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n if (has_change(type)) {\n coin_control.m_change_type = type;\n@@ -701,7 +701,8 @@ void WalletQmlModel::beginShutdown(bool remove_wallet)\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),\n- std::move(m_handler_transaction_changed), std::move(m_handler_unload));\n+ std::move(m_handler_transaction_changed), std::move(m_handler_unload),\n+ std::move(m_handler_can_get_addresses_changed));\n if (m_bump_transaction_model) m_bump_transaction_model->detachWallet();\n if (m_imported_psbt_model) m_imported_psbt_model->detachWallet();\n auto wallet = std::move(m_wallet);\n@@ -1100,32 +1101,29 @@ void WalletQmlModel::clearSettingsError()\n \n QVariantList WalletQmlModel::availableReceiveAddressTypes() const\n {\n- if (!m_wallet || !m_wallet->canGetAddresses()) {\n- return {};\n- }\n-\n- QVariantList types;\n- const std::array ordered_types{\n- OutputType::BECH32M,\n- OutputType::BECH32,\n- OutputType::P2SH_SEGWIT,\n- OutputType::LEGACY,\n- };\n-\n+ if (!m_wallet) return {};\n const wallet::CWallet* raw_wallet{m_wallet->wallet()};\n- for (const OutputType type : ordered_types) {\n- // Only a type with an active receive descriptor can give out addresses.\n- if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n- : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n- continue;\n+ const auto list_types = [&] {\n+ QVariantList types;\n+ if (!m_wallet->canGetAddresses()) return types;\n+ for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n+ // Only a type with an active receive descriptor can give out addresses.\n+ if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n+ : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n+ continue;\n+ }\n+ QVariantMap item;\n+ item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n+ item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n+ item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n+ types.append(item);\n }\n- QVariantMap item;\n- item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n- item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n- item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- types.append(item);\n- }\n- return types;\n+ return types;\n+ };\n+ if (!raw_wallet) return list_types();\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ return list_types();\n }\n \n QString WalletQmlModel::defaultReceiveAddressType() const\n@@ -2172,7 +2170,7 @@ void WalletQmlModel::requestFeeEstimatesNow()\n const int remainder_index = m_send_recipients->recipients().indexOf(m_maximum_recipient);\n const quint64 request_id = ++m_fee_estimate_request_id;\n wallet::CCoinControl base_coin_control{m_coin_control};\n- ApplyChangeTypeFallback(*m_wallet, base_coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *recipients, base_coin_control);\n const OutputType preview_change_type{base_coin_control.m_change_type.value_or(m_wallet->getDefaultAddressType())};\n const bool custom_fee_enabled{m_custom_fee_enabled};\n const std::optional<CAmount> custom_fee_rate_per_kvb{\n@@ -2365,7 +2363,7 @@ bool WalletQmlModel::prepareTransactionInternal(std::optional<SecureString> pass\n \n wallet::CCoinControl coin_control{m_coin_control};\n ApplySelectedInputsPolicy(coin_control);\n- ApplyChangeTypeFallback(*m_wallet, coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *vec_send, coin_control);\n if (m_custom_fee_enabled) {\n const auto custom_fee_rate_per_kvb = ParseCustomFeeRatePerKvB(m_custom_fee_rate, MinimumCustomFeeRatePerKvB(m_wallet.get()));\n if (!custom_fee_rate_per_kvb.has_value()) {\n@@ -3230,6 +3228,11 @@ void WalletQmlModel::subscribeToWalletSignals()\n if (guard && !guard->m_stopping) Q_EMIT guard->addressListChanged();\n }, Qt::QueuedConnection);\n });\n+ m_handler_can_get_addresses_changed = m_wallet->handleCanGetAddressesChanged([guard, bridge] {\n+ QMetaObject::invokeMethod(bridge.get(), [guard] {\n+ if (guard && !guard->m_stopping) Q_EMIT guard->availableReceiveAddressTypesChanged();\n+ }, Qt::QueuedConnection);\n+ });\n m_handler_transaction_changed = handleTransactionChanged([guard, bridge, pending](const uint256& txid, ChangeType change) {\n pending->fetch_add(1);\n QMetaObject::invokeMethod(bridge.get(), [guard, pending, txid, change] {\n@@ -3274,6 +3277,9 @@ void WalletQmlModel::unsubscribeFromWalletSignals()\n if (m_handler_unload) {\n m_handler_unload->disconnect();\n }\n+ if (m_handler_can_get_addresses_changed) {\n+ m_handler_can_get_addresses_changed->disconnect();\n+ }\n }\n \n void WalletQmlModel::refreshSecurityState()\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Import choices precede the reset that binds them to a keyqml/pages/wallet/CreateWalletForm.qml | unclear | AssessmentThe finding asks for identity/reset plumbing to be folded into an earlier commit. The evidence shows the reset code exists in the final tree, but does not show whether its commit placement was changed. path_diff: qml/pages/wallet/CreateWalletForm.qml [
{
"evidence_id": "5536206e94d64a129ec524fe05c73ab9",
"finding_id": "finding:12",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/pages/wallet/CreateWalletForm.qml",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/pages/wallet/CreateWalletForm.qml b/qml/pages/wallet/CreateWalletForm.qml\nindex c121c2c126..5fb58b3929 100644\n--- a/qml/pages/wallet/CreateWalletForm.qml\n+++ b/qml/pages/wallet/CreateWalletForm.qml\n@@ -75,7 +75,7 @@ OnboardingView {\n //: %1 is the date the oldest pasted descriptor was created.\n summary += \" \" + qsTr(\"Created %1.\").arg(new Date(importInfo.createdTime * 1000).toLocaleDateString(Qt.locale(), \"d MMM yyyy\"))\n }\n- return summary\n+ return importInfo.warning ? summary + \" \" + importInfo.warning : summary\n }\n \n function submit() {\n@@ -108,6 +108,10 @@ OnboardingView {\n primaryButtonText: creating ? (watchOnly ? qsTr(\"Importing…\") : qsTr(\"Creating…\")) : qsTr(\"Create wallet\")\n primaryButtonObjectName: \"createWalletFormCreateButton\"\n primaryButtonEnabled: canCreate\n+ readonly property bool importRunning: watchOnly && creating && walletController.walletLoadInProgress\n+ secondaryButtonText: importRunning ? qsTr(\"Cancel import\") : \"\"\n+ secondaryButtonObjectName: \"createWalletFormCancelImportButton\"\n+ onSecondaryClicked: walletController.cancelViewOnlyImport()\n onCloseClicked: root.cancel()\n onPrimaryClicked: {\n if (!root.canCreate) return\n@@ -156,6 +160,8 @@ OnboardingView {\n LabeledTextField {\n id: nameEntry\n objectName: \"createWalletNameEntry\"\n+ // Editing clears the load status, which would hide Cancel import.\n+ enabled: !root.creating\n Layout.fillWidth: true\n label: qsTr(\"Wallet name\")\n fieldObjectName: \"createWalletNameInput\"\n@@ -247,6 +253,7 @@ OnboardingView {\n id: xpubEntry\n objectName: \"createWalletXpubEntry\"\n visible: root.watchOnly\n+ enabled: !root.creating\n Layout.fillWidth: true\n label: qsTr(\"Descriptors or extended public key\")\n inputObjectName: \"watchOnlyXpubInput\"\n@@ -390,6 +397,7 @@ OnboardingView {\n FormSection {\n objectName: \"watchOnlyAddressType\"\n visible: root.watchOnly && root.needsAddressType\n+ enabled: !root.creating\n Layout.fillWidth: true\n Layout.topMargin: 8\n showBackground: false\n@@ -424,6 +432,7 @@ OnboardingView {\n FormSection {\n objectName: \"watchOnlyBirthDate\"\n visible: root.watchOnly && root.needsBirthDate\n+ enabled: !root.creating\n Layout.fillWidth: true\n Layout.topMargin: 8\n showBackground: false\n@@ -455,15 +464,29 @@ OnboardingView {\n }\n }\n \n- CoreText {\n- objectName: \"watchOnlyScanNote\"\n+ RowLayout {\n visible: root.watchOnly && root.creating\n Layout.fillWidth: true\n- text: qsTr(\"Looking for this wallet's transactions. This can take a while.\")\n- color: Theme.color.neutral7\n- textStyle: Theme.text.caption\n- wrapMode: Text.WordWrap\n- horizontalAlignment: Text.AlignLeft\n+ spacing: 8\n+\n+ SpinningIndicator {\n+ Layout.alignment: Qt.AlignTop\n+ running: parent.visible\n+ color: Theme.color.neutral7\n+ }\n+ CoreText {\n+ objectName: \"watchOnlyScanNote\"\n+ Layout.fillWidth: true\n+ text: walletController.importProgress >= 0\n+ //: %1 is how much of the blockchain has been searched, in percent.\n+ ? qsTr(\"Looking for this wallet's transactions, %1% done. Cancelling deletes the new wallet.\")\n+ .arg(walletController.importProgress)\n+ : qsTr(\"Looking for this wallet's transactions. This can take a while.\")\n+ color: Theme.color.neutral7\n+ textStyle: Theme.text.caption\n+ wrapMode: Text.WordWrap\n+ horizontalAlignment: Text.AlignLeft\n+ }\n }\n \n CoreText {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | Non-default wallet imports precede their receive/change supportqml/models/walletqmlmodel.cpp | unclear | AssessmentThis finding concerns intermediate-commit ordering, not a defect in the final tree. The supplied diff shows final receive/change support changes, but provides no commit-order evidence to determine whether the requested sequencing change was made. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "dbeebec5a0d941908f10878668ef9ad2",
"finding_id": "finding:11",
"kind": "path_diff",
"new_head": "46324d90762c97b30dfdb35e944c7b2b1955ec4b",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 2d36dee979..e74deef1e7 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -170,19 +170,19 @@ void ApplySelectedInputsPolicy(wallet::CCoinControl& coin_control)\n coin_control.m_allow_other_inputs = !coin_control.HasSelected();\n }\n \n-// When no recipient matches a change descriptor, Core picks Taproot, then SegWit,\n-// then the default address type. A wallet that only watches nested SegWit or\n-// legacy addresses has none of those, so use a change type it has.\n-void ApplyChangeTypeFallback(interfaces::Wallet& wallet, wallet::CCoinControl& coin_control)\n+// Core picks a change type from the recipients, then Taproot, SegWit and the\n+// default address type. A wallet that only watches nested SegWit or legacy\n+// addresses may have no change descriptor of that type, so use one it has.\n+void ApplyChangeTypeFallback(interfaces::Wallet& wallet, const std::vector<wallet::CRecipient>& recipients,\n+ wallet::CCoinControl& coin_control)\n {\n const wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (coin_control.m_change_type || !raw_wallet || raw_wallet->m_default_change_type) return;\n+ if (coin_control.m_change_type || !raw_wallet) return;\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ if (raw_wallet->m_default_change_type) return;\n const auto has_change = [&](OutputType type) { return raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true) != nullptr; };\n- const OutputType core_choice{raw_wallet->m_default_address_type == OutputType::LEGACY ? OutputType::LEGACY\n- : has_change(OutputType::BECH32M) ? OutputType::BECH32M\n- : has_change(OutputType::BECH32) ? OutputType::BECH32\n- : raw_wallet->m_default_address_type};\n- if (has_change(core_choice)) return;\n+ if (has_change(raw_wallet->TransactionChangeType(std::nullopt, recipients))) return;\n for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n if (has_change(type)) {\n coin_control.m_change_type = type;\n@@ -701,7 +701,8 @@ void WalletQmlModel::beginShutdown(bool remove_wallet)\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),\n- std::move(m_handler_transaction_changed), std::move(m_handler_unload));\n+ std::move(m_handler_transaction_changed), std::move(m_handler_unload),\n+ std::move(m_handler_can_get_addresses_changed));\n if (m_bump_transaction_model) m_bump_transaction_model->detachWallet();\n if (m_imported_psbt_model) m_imported_psbt_model->detachWallet();\n auto wallet = std::move(m_wallet);\n@@ -1084,6 +1085,11 @@ bool WalletQmlModel::backupWallet(const QString& path)\n setSettingsError(tr(\"Choose a location for the wallet backup.\"));\n return false;\n }\n+ // A backup restored elsewhere loses the state that finishes the import.\n+ if (!m_history_recovery.isEmpty()) {\n+ setSettingsError(tr(\"This wallet's import hasn't finished, so a backup could be missing older transactions. Back it up once the import is done.\"));\n+ return false;\n+ }\n \n if (!m_wallet->backupWallet(path.toStdString())) {\n setSettingsError(tr(\"The wallet could not be backed up.\"));\n@@ -1093,6 +1099,14 @@ bool WalletQmlModel::backupWallet(const QString& path)\n return true;\n }\n \n+void WalletQmlModel::setHistoryRecovery(const QString& state, int progress)\n+{\n+ if (m_history_recovery == state && m_history_recovery_progress == progress) return;\n+ m_history_recovery = state;\n+ m_history_recovery_progress = progress;\n+ Q_EMIT historyRecoveryChanged();\n+}\n+\n void WalletQmlModel::clearSettingsError()\n {\n setSettingsError(QString());\n@@ -1100,32 +1114,29 @@ void WalletQmlModel::clearSettingsError()\n \n QVariantList WalletQmlModel::availableReceiveAddressTypes() const\n {\n- if (!m_wallet || !m_wallet->canGetAddresses()) {\n- return {};\n- }\n-\n- QVariantList types;\n- const std::array ordered_types{\n- OutputType::BECH32M,\n- OutputType::BECH32,\n- OutputType::P2SH_SEGWIT,\n- OutputType::LEGACY,\n- };\n-\n+ if (!m_wallet) return {};\n const wallet::CWallet* raw_wallet{m_wallet->wallet()};\n- for (const OutputType type : ordered_types) {\n- // Only a type with an active receive descriptor can give out addresses.\n- if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n- : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n- continue;\n+ const auto list_types = [&] {\n+ QVariantList types;\n+ if (!m_wallet->canGetAddresses()) return types;\n+ for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n+ // Only a type with an active receive descriptor can give out addresses.\n+ if (raw_wallet ? !raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false)\n+ : type == OutputType::BECH32M && !m_wallet->taprootEnabled()) {\n+ continue;\n+ }\n+ QVariantMap item;\n+ item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n+ item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n+ item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n+ types.append(item);\n }\n- QVariantMap item;\n- item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n- item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n- item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- types.append(item);\n- }\n- return types;\n+ return types;\n+ };\n+ if (!raw_wallet) return list_types();\n+ // An import can change the active descriptors meanwhile.\n+ LOCK(raw_wallet->cs_wallet);\n+ return list_types();\n }\n \n QString WalletQmlModel::defaultReceiveAddressType() const\n@@ -2172,7 +2183,7 @@ void WalletQmlModel::requestFeeEstimatesNow()\n const int remainder_index = m_send_recipients->recipients().indexOf(m_maximum_recipient);\n const quint64 request_id = ++m_fee_estimate_request_id;\n wallet::CCoinControl base_coin_control{m_coin_control};\n- ApplyChangeTypeFallback(*m_wallet, base_coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *recipients, base_coin_control);\n const OutputType preview_change_type{base_coin_control.m_change_type.value_or(m_wallet->getDefaultAddressType())};\n const bool custom_fee_enabled{m_custom_fee_enabled};\n const std::optional<CAmount> custom_fee_rate_per_kvb{\n@@ -2365,7 +2376,7 @@ bool WalletQmlModel::prepareTransactionInternal(std::optional<SecureString> pass\n \n wallet::CCoinControl coin_control{m_coin_control};\n ApplySelectedInputsPolicy(coin_control);\n- ApplyChangeTypeFallback(*m_wallet, coin_control);\n+ ApplyChangeTypeFallback(*m_wallet, *vec_send, coin_control);\n if (m_custom_fee_enabled) {\n const auto custom_fee_rate_per_kvb = ParseCustomFeeRatePerKvB(m_custom_fee_rate, MinimumCustomFeeRatePerKvB(m_wallet.get()));\n if (!custom_fee_rate_per_kvb.has_value()) {\n@@ -3230,6 +3241,11 @@ void WalletQmlModel::subscribeToWalletSignals()\n if (guard && !guard->m_stopping) Q_EMIT guard->addressListChanged();\n }, Qt::QueuedConnection);\n });\n+ m_handler_can_get_addresses_changed = m_wallet->handleCanGetAddressesChanged([guard, bridge] {\n+ QMetaObject::invokeMethod(bridge.get(), [guard] {\n+ if (guard && !guard->m_stopping) Q_EMIT guard->availableReceiveAddressTypesChanged();\n+ }, Qt::QueuedConnection);\n+ });\n m_handler_transaction_changed = handleTransactionChanged([guard, bridge, pending](const uint256& txid, ChangeType change) {\n pending->fetch_add(1);\n QMetaObject::invokeMethod(bridge.get(), [guard, pending, txid, change] {\n@@ -3274,6 +3290,9 @@ void WalletQmlModel::unsubscribeFromWalletSignals()\n if (m_handler_unload) {\n m_handler_unload->disconnect();\n }\n+ if (m_handler_can_get_addresses_changed) {\n+ m_handler_can_get_addresses_changed->disconnect();\n+ }\n }\n \n void WalletQmlModel::refreshSecurityState()\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..46324d90762c 2026-11-25T22:14:12Z · gpt-6-luna |
| gui#1144 | A crash during import can leave a silently incomplete wallet after restartqml/walletqmlcontroller.cpp | addressed | AssessmentThe new head persists a pending import timestamp before descriptor import/rescan, and on wallet registration detects it and schedules a resume scan. The marker is removed only after successful completion; the added functional test also exercises restart recovery. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "4ed3eab4e0134d76919903264533dc31",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "35841cebc6fd02438edb52c63dd430a797201d9e",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 2,
"source_job_id": 2909,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 95ad370336..452a87cf64 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -21,6 +21,7 @@\n #include <util/result.h>\n #include <wallet/context.h>\n #include <wallet/imports.h>\n+#include <wallet/scan.h>\n #include <wallet/walletutil.h>\n #include <wallet/wallet.h>\n #include <util/translation.h>\n@@ -36,10 +37,13 @@\n #include <utility>\n #include <vector>\n \n+#include <QByteArray>\n+#include <QDateTime>\n #include <QDir>\n #include <QDesktopServices>\n #include <QFileInfo>\n #include <QMetaObject>\n+#include <QPointer>\n #include <QRegularExpression>\n #include <QSettings>\n #include <QStringList>\n@@ -87,13 +91,9 @@ bool ErrorContains(const QString& error, const QString& needle)\n }\n \n // The import rescans from the oldest timestamp, which a pruned node may no longer have.\n-bool ScanBlocksPruned(interfaces::Chain& chain, const std::vector<wallet::ImportDescriptorRequest>& requests)\n+bool ScanBlocksPruned(interfaces::Chain& chain, std::optional<int64_t> oldest)\n {\n if (!chain.havePruned()) return false;\n- std::optional<int64_t> oldest;\n- for (const auto& request : requests) {\n- if (request.timestamp) oldest = std::min(oldest.value_or(*request.timestamp), *request.timestamp);\n- }\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n@@ -120,6 +120,52 @@ void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<inte\n for (const fs::path& path : paths) fs::remove(path, error);\n }\n \n+// A view-only import saves its descriptors before it rescans. The wallet's\n+// best block is already the tip then, so after a crash it would load without\n+// the older transactions. This records where the rescan starts until it ends.\n+QString PendingImportKey(const std::string& wallet_name)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+{\n+ QSettings settings;\n+ if (time) {\n+ settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n+ } else {\n+ settings.remove(PendingImportKey(wallet_name));\n+ }\n+ settings.sync();\n+}\n+\n+std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+{\n+ const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n+ return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+}\n+\n+bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+{\n+ wallet::WalletContext* context{node.walletLoader().context()};\n+ const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n+ if (!wallet) return false;\n+ wallet::WalletRescanReserver reserver{*wallet};\n+ if (!reserver.reserve()) return false;\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ int start_height{0};\n+ uint256 start_block;\n+ bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))};\n+ if (!done) {\n+ // Progress is saved, so a later load continues from where this stopped too.\n+ done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n+ wallet::ScanResult::SUCCESS;\n+ }\n+ control.detach();\n+ return done;\n+}\n+\n QString ImportErrorText(const wallet::ImportError& error)\n {\n const bilingual_str& message{error.wallet_error.message};\n@@ -127,6 +173,33 @@ QString ImportErrorText(const wallet::ImportError& error)\n }\n } // namespace\n \n+bool RescanControl::attach(std::function<void()> abort)\n+{\n+ const std::lock_guard lock{m_mutex};\n+ if (m_cancelled) return false;\n+ m_abort = std::move(abort);\n+ return true;\n+}\n+\n+void RescanControl::detach()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_abort = nullptr;\n+}\n+\n+void RescanControl::cancel()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_cancelled = true;\n+ if (m_abort) m_abort();\n+}\n+\n+bool RescanControl::cancelled() const\n+{\n+ const std::lock_guard lock{m_mutex};\n+ return m_cancelled;\n+}\n+\n WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n@@ -141,6 +214,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n+ return ResumeImport(node, wallet_name, time, control);\n+ })\n {\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n@@ -393,6 +469,8 @@ void WalletQmlController::beginShutdown()\n const auto wallets = m_wallets;\n for (auto* wallet : wallets) removeWalletModel(wallet);\n retireWallet(m_empty_wallet, false);\n+ for (const auto& [name, control] : m_import_rescans) control->cancel();\n+ if (m_import_rescan_executor) m_import_rescan_executor->shutdown();\n m_notification_cleanup_executor = std::make_unique<BackendExecutor>();\n m_notification_cleanup_executor->setObjectName(QStringLiteral(\"wallet-notifications\"));\n connect(m_notification_cleanup_executor.get(), &BackendExecutor::drained, this, [this] {\n@@ -428,7 +506,8 @@ void WalletQmlController::retireWallet(WalletQmlModel* model, bool remove)\n \n void WalletQmlController::checkShutdownFinished()\n {\n- if (m_shutting_down && m_controller_drained && m_notifications_drained && m_retiring_wallets.empty() && !m_shutdown_complete) {\n+ if (m_shutting_down && m_controller_drained && m_notifications_drained && m_import_rescans_drained &&\n+ m_retiring_wallets.empty() && !m_shutdown_complete) {\n m_shutdown_complete = true;\n Q_EMIT walletsDrained();\n }\n@@ -439,6 +518,32 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n connect(wallet_model, &WalletQmlModel::walletUnloaded, this, [this, wallet_model]() {\n removeWalletModel(wallet_model);\n }, Qt::QueuedConnection);\n+ resumeInterruptedImport(wallet_model);\n+}\n+\n+void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n+{\n+ const QString name{wallet_model->name()};\n+ const std::optional<int64_t> time{PendingImport(name.toStdString())};\n+ if (!time) return;\n+ if (!m_import_rescan_executor) {\n+ m_import_rescan_executor = std::make_unique<BackendExecutor>();\n+ m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n+ m_import_rescans_drained = false;\n+ connect(m_import_rescan_executor.get(), &BackendExecutor::drained, this, [this] {\n+ m_import_rescans_drained = true;\n+ checkShutdownFinished();\n+ });\n+ }\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_rescans[name] = control;\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n+ // Stays pending when the rescan stops early, so the next load tries again.\n+ if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n+ }, [this, name, control] {\n+ const auto it{m_import_rescans.find(name)};\n+ if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ });\n }\n \n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n@@ -478,6 +583,7 @@ void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool r\n WalletListModel::LoadState::Closed,\n QString{});\n setWalletLoaded(next_selected_wallet != nullptr);\n+ if (const auto it{m_import_rescans.find(wallet_name)}; it != m_import_rescans.end()) it->second->cancel();\n retireWallet(wallet_model, remove);\n }\n \n@@ -572,6 +678,7 @@ void WalletQmlController::createWalletAsync(const QString& name,\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -711,30 +818,62 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n- const bool date_chosen{!input.undated.empty()};\n+ // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n+ std::optional<int64_t> oldest_dated;\n+ for (size_t i = 0; i < input.requests.size(); ++i) {\n+ const std::optional<int64_t>& time{input.requests[i].timestamp};\n+ if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n+ }\n+ const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n+ // An unset timestamp means now.\n+ int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n+ for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_control = control;\n+ setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [node = &m_node, requests](interfaces::Wallet& wallet) mutable {\n- // Imports the descriptors, then rescans from the oldest timestamp.\n- const std::vector<wallet::ImportResult> results{wallet.importDescriptors(requests)};\n+ [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n+ if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ SetPendingImport(wallet.getWalletName(), rescan_from);\n+ std::vector<wallet::ImportResult> results;\n+ {\n+ const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // Starting a rescan clears an earlier abort.\n+ if (control->cancelled()) wallet.abortRescan();\n+ QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n+ if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ })};\n+ // Imports the descriptors, then rescans from the oldest timestamp.\n+ results = wallet.importDescriptors(requests);\n+ }\n+ control->detach();\n+ if (control->cancelled()) return cancelled;\n // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n+ SetPendingImport(wallet.getWalletName(), std::nullopt);\n return QString{};\n- }, [node = &m_node, requests, date_chosen] {\n+ }, [node = &m_node, oldest_dated, chosen_date] {\n // Checked before the wallet file exists, so another date can be tried with the same name.\n wallet::WalletContext* context{node->walletLoader().context()};\n- if (!context || !context->chain || !ScanBlocksPruned(*context->chain, requests)) return QString{};\n- if (!date_chosen) {\n+ if (!context || !context->chain) return QString{};\n+ if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n }\n- return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ if (ScanBlocksPruned(*context->chain, chosen_date)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ }\n+ return QString{};\n });\n }\n \n@@ -779,6 +918,18 @@ QVariantMap WalletQmlController::describeViewOnlyImport(const QString& import_te\n return DescribeViewOnlyImport(import_text, address_type);\n }\n \n+void WalletQmlController::cancelViewOnlyImport()\n+{\n+ if (m_import_control) m_import_control->cancel();\n+}\n+\n+void WalletQmlController::setImportProgress(int progress)\n+{\n+ if (m_import_progress == progress) return;\n+ m_import_progress = progress;\n+ Q_EMIT importProgressChanged();\n+}\n+\n void WalletQmlController::requestOpenWalletSettings(WalletQmlModel* wallet)\n {\n if (!wallet) return;\n@@ -1449,3 +1600,8 @@ void WalletQmlController::setOpenLocalPathFnForTesting(OpenLocalPathFn fn)\n {\n m_open_local_path_fn = std::move(fn);\n }\n+\n+void WalletQmlController::setResumeImportFnForTesting(ResumeImportFn fn)\n+{\n+ m_resume_import_fn = std::move(fn);\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 35841cebc6fd..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1057 | The per-type descriptor note omits previous-key exclusionsqml/pages/wallet/WalletDescriptorDetail.qml | addressed | AssessmentThe detail page detects inactive exports of the selected address type and adds a note that previous keys are excluded, directing users to Copy all or a watch-only wallet copy. The diff also adds a test for the matching-type note and its absence for a type without previous keys. path_diff: qml/pages/wallet/WalletDescriptorDetail.qml; new_source: qml/pages/wallet/WalletDescriptorDetail.qml [
{
"evidence_id": "51f4eb032b064d5ebfffbb1a251a8542",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/pages/wallet/WalletDescriptorDetail.qml",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/pages/wallet/WalletDescriptorDetail.qml b/qml/pages/wallet/WalletDescriptorDetail.qml\nindex c46265f471..37be305349 100644\n--- a/qml/pages/wallet/WalletDescriptorDetail.qml\n+++ b/qml/pages/wallet/WalletDescriptorDetail.qml\n@@ -19,6 +19,8 @@ SettingsPage {\n property var clipboard: Clipboard\n property var exportItem: null\n property bool extendedKeyFormat: false\n+ // Previous keys of this type are separate descriptors.\n+ property bool hasPreviousKeys: false\n readonly property bool extendedKeyAvailable: !!exportItem && exportItem.extendedKey !== \"\"\n readonly property string payload: !exportItem ? \"\"\n : extendedKeyFormat ? exportItem.extendedKey : exportItem.descriptor\n@@ -31,6 +33,7 @@ SettingsPage {\n function refresh() {\n const exports = wallet ? wallet.descriptorExports() : []\n exportItem = exports.find(item => item.id === addressType) || null\n+ hasPreviousKeys = !!wallet && wallet.inactiveDescriptorExports().some(item => item.id === addressType)\n if (!extendedKeyAvailable) extendedKeyFormat = false\n }\n \n@@ -67,6 +70,16 @@ SettingsPage {\n onSelected: index => root.setExtendedKeyFormat(index === 1)\n }\n \n+ // A bare key has no script type, so an importer can guess another one.\n+ ToastBanner {\n+ objectName: \"descriptorsTaprootWarning\"\n+ Layout.fillWidth: true\n+ shown: root.extendedKeyFormat && !!root.exportItem && root.exportItem.id === \"bech32m\"\n+ tone: ToastBanner.Warning\n+ textObjectName: \"descriptorsTaprootWarningText\"\n+ text: qsTr(\"This key doesn't record that it is for Taproot. A wallet that imports it as another address type will give out addresses this wallet doesn't watch, and payments to them won't show here. Use the descriptor unless the other wallet asks for a Taproot key.\")\n+ }\n+\n Rectangle {\n readonly property real side: Math.min(parent.width, 240)\n Layout.preferredWidth: side\n@@ -147,8 +160,9 @@ SettingsPage {\n if (!root.exportItem) return \"\"\n //: \"Back up or export wallet\" is the wallet settings action that saves a watch-only copy of the whole wallet.\n let note = qsTr(\"Only includes funds on %1 addresses. For a copy of the whole wallet, use Back up or export wallet.\").arg(root.exportItem.label)\n- if (root.extendedKeyFormat && root.exportItem.id === \"bech32m\") {\n- note += \" \" + qsTr(\"Most wallets need the descriptor format to import Taproot keys.\")\n+ if (root.hasPreviousKeys) {\n+ //: %1 is an address type. \"Copy all for Bitcoin Core\" is a button on the Descriptors page.\n+ note += \" \" + qsTr(\"Funds on previous %1 keys are not included. To include them, use Copy all for Bitcoin Core on Descriptors, or save a watch-only copy.\").arg(root.exportItem.label)\n }\n return note\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 184,
"evidence_id": "7792421dc4ea4299b778c4c7dbd83d19",
"finding_id": "finding:9",
"kind": "new_source",
"line": 119,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/pages/wallet/WalletDescriptorDetail.qml",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 5,
"source_job_id": 2908,
"text": "\n FormSection {\n Layout.fillWidth: true\n\n ValueRow {\n objectName: \"descriptorsFingerprint\"\n visible: !!root.exportItem && root.exportItem.fingerprint !== \"\"\n Layout.fillWidth: true\n //: BIP32 fingerprint of the wallet's master key.\n title: qsTr(\"Master fingerprint\")\n value: root.exportItem ? root.exportItem.fingerprint : \"\"\n valueTextStyle: Theme.text.monoDescription\n }\n\n ValueRow {\n objectName: \"descriptorsDerivationPath\"\n visible: !!root.exportItem && root.exportItem.derivationPath !== \"\"\n Layout.fillWidth: true\n title: qsTr(\"Derivation path\")\n value: root.exportItem ? root.exportItem.derivationPath : \"\"\n valueTextStyle: Theme.text.monoDescription\n showDivider: !root.extendedKeyFormat\n }\n\n ValueRow {\n objectName: \"descriptorsChains\"\n visible: !root.extendedKeyFormat && !!root.exportItem\n Layout.fillWidth: true\n //: Derivation branches the descriptor covers: receiving addresses and change addresses.\n title: qsTr(\"Chains\")\n value: !root.exportItem ? \"\"\n : root.exportItem.changeChain === \"\" ? qsTr(\"Receive %1\").arg(root.exportItem.receiveChain)\n : qsTr(\"Receive %1, change %2\").arg(root.exportItem.receiveChain).arg(root.exportItem.changeChain)\n showDivider: false\n }\n }\n\n CoreText {\n objectName: \"descriptorsNote\"\n Layout.fillWidth: true\n text: {\n if (!root.exportItem) return \"\"\n //: \"Back up or export wallet\" is the wallet settings action that saves a watch-only copy of the whole wallet.\n let note = qsTr(\"Only includes funds on %1 addresses. For a copy of the whole wallet, use Back up or export wallet.\").arg(root.exportItem.label)\n if (root.hasPreviousKeys) {\n //: %1 is an address type. \"Copy all for Bitcoin Core\" is a button on the Descriptors page.\n note += \" \" + qsTr(\"Funds on previous %1 keys are not included. To include them, use Copy all for Bitcoin Core on Descriptors, or save a watch-only copy.\").arg(root.exportItem.label)\n }\n return note\n }\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignLeft\n }\n\n NeutralButton {\n objectName: \"descriptorsCopyButton\"\n buttonSize: NeutralButton.Large\n Layout.fillWidth: true\n enabled: root.payload !== \"\"\n text: copiedTimer.running ? qsTr(\"Copied\")\n : root.extendedKeyFormat ? qsTr(\"Copy extended key\")\n : qsTr(\"Copy descriptor\")\n onClicked: root.copy()\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Backups without private keys show a spending-authority warningqml/components/BackupWalletPopup.qml | addressed | AssessmentThe popup receives a separate `privateKeys` capability and selects the privacy warning when the wallet has no private keys, independently of the selected backup type. The old-to-new diff shows the caller supplying that capability, and the new UI test asserts the warning text for a wallet without private keys. path_diff: qml/components/BackupWalletPopup.qml; new_source: qml/components/BackupWalletPopup.qml [
{
"evidence_id": "a80727031b48482e849a6cded6f4befd",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/components/BackupWalletPopup.qml",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/components/BackupWalletPopup.qml b/qml/components/BackupWalletPopup.qml\nindex b30c78d761..94f356b001 100644\n--- a/qml/components/BackupWalletPopup.qml\n+++ b/qml/components/BackupWalletPopup.qml\n@@ -18,6 +18,7 @@ DialogPopup {\n property bool encrypted: false\n property string destinationPath: \"\"\n property bool pending: false\n+ property bool privateKeys: true\n property string errorText: \"\"\n \n signal locationChangeRequested()\n@@ -25,6 +26,8 @@ DialogPopup {\n \n title: canChooseType ? qsTr(\"Back up or export wallet\") : qsTr(\"Back up wallet\")\n implicitWidth: 520\n+ // The export holds the wallet lock, so other wallet actions would wait on it.\n+ busy: pending\n \n contentItem: ColumnLayout {\n spacing: Theme.space.xl\n@@ -33,6 +36,7 @@ DialogPopup {\n Layout.fillWidth: true\n title: root.title\n closeButtonObjectName: \"backupWalletClose\"\n+ closeEnabled: !root.pending\n onCloseRequested: root.close()\n }\n \n@@ -86,7 +90,7 @@ DialogPopup {\n CoreText {\n objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n- text: root.watchOnly\n+ text: root.watchOnly || !root.privateKeys\n ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n : root.encrypted\n ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n@@ -116,6 +120,7 @@ DialogPopup {\n objectName: \"backupDestinationPath\"\n Layout.fillWidth: true\n text: root.destinationPath\n+ textFormat: Text.PlainText\n textStyle: Theme.text.monoCaption\n color: Theme.color.neutral9\n horizontalAlignment: Text.AlignLeft\n@@ -138,6 +143,7 @@ DialogPopup {\n visible: root.errorText.length > 0\n Layout.fillWidth: true\n text: root.errorText\n+ textFormat: Text.PlainText\n textStyle: Theme.text.caption\n color: Theme.color.dangerText\n horizontalAlignment: Text.AlignLeft\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 173,
"evidence_id": "446022dc4295474facfc42beeb61e356",
"finding_id": "finding:8",
"kind": "new_source",
"line": 63,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/components/BackupWalletPopup.qml",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 5,
"source_job_id": 2908,
"text": " Layout.fillWidth: true\n spacing: Theme.space.m\n\n OptionButton {\n objectName: \"backupTypeFull\"\n Layout.fillWidth: true\n selected: !root.watchOnly\n enabled: !root.pending\n surfaceSelectionStyle: true\n text: qsTr(\"Full backup\")\n description: qsTr(\"Includes private keys. Restores a wallet that can spend.\")\n onClicked: root.watchOnly = false\n }\n\n OptionButton {\n objectName: \"backupTypeWatchOnly\"\n Layout.fillWidth: true\n selected: root.watchOnly\n enabled: !root.pending\n surfaceSelectionStyle: true\n text: qsTr(\"Watch-only copy\")\n //: Describes a watch-only wallet file for restoring on another Bitcoin Core node.\n description: qsTr(\"No private keys. Shows balance and history, but cannot spend.\")\n onClicked: root.watchOnly = true\n }\n }\n\n CoreText {\n objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n text: root.watchOnly || !root.privateKeys\n ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n : root.encrypted\n ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n : qsTr(\"Anyone with this file can spend your bitcoin. Keep it somewhere safe.\")\n textStyle: Theme.text.description\n color: Theme.color.neutral8\n horizontalAlignment: Text.AlignLeft\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: Theme.space.ml\n\n ColumnLayout {\n Layout.fillWidth: true\n spacing: Theme.space.xxs\n\n CoreText {\n Layout.fillWidth: true\n text: qsTr(\"Save to\")\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignLeft\n }\n\n CoreText {\n objectName: \"backupDestinationPath\"\n Layout.fillWidth: true\n text: root.destinationPath\n textFormat: Text.PlainText\n textStyle: Theme.text.monoCaption\n color: Theme.color.neutral9\n horizontalAlignment: Text.AlignLeft\n // A cut path could hide the part that tells two folders apart.\n wrapMode: Text.WrapAnywhere\n }\n }\n\n NeutralButton {\n objectName: \"backupChangeLocation\"\n Layout.alignment: Qt.AlignVCenter\n enabled: !root.pending\n text: qsTr(\"Change…\")\n onClicked: root.locationChangeRequested()\n }\n }\n\n CoreText {\n objectName: \"backupWalletErrorText\"\n visible: root.errorText.length > 0\n Layout.fillWidth: true\n text: root.errorText\n textFormat: Text.PlainText\n textStyle: Theme.text.caption\n color: Theme.color.dangerText\n horizontalAlignment: Text.AlignLeft\n }\n }\n }\n\n PrimaryButton {\n objectName: \"backupSaveButton\"\n Layout.fillWidth: true\n enabled: !root.pending && root.destinationPath.length > 0\n busy: root.pending\n text: root.pending ? qsTr(\"Saving…\")\n : root.watchOnly ? qsTr(\"Save watch-only copy\")\n : qsTr(\"Save backup\")\n onClicked: root.saveRequested()\n }\n\n CoreText {\n Layout.fillWidth: true\n text: root.canChooseType ? qsTr(\"Restore either file with Import wallet.\") : qsTr(\"Restore it with Import wallet.\")\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignHCenter\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Backup and replacement paths can be interpreted as rich textqml/components/BackupWalletPopup.qml | addressed | AssessmentThe backup destination and error fields now use `Text.PlainText`; the old-to-new diff also sets `Text.PlainText` on all three replacement-alert path/name fields. The new QML test exercises markup-looking paths and checks the relevant text formats. path_diff: qml/components/BackupWalletPopup.qml; new_source: qml/components/BackupWalletPopup.qml [
{
"evidence_id": "fecb9e2102694bd682e2cca4a2110076",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/components/BackupWalletPopup.qml",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/components/BackupWalletPopup.qml b/qml/components/BackupWalletPopup.qml\nindex b30c78d761..94f356b001 100644\n--- a/qml/components/BackupWalletPopup.qml\n+++ b/qml/components/BackupWalletPopup.qml\n@@ -18,6 +18,7 @@ DialogPopup {\n property bool encrypted: false\n property string destinationPath: \"\"\n property bool pending: false\n+ property bool privateKeys: true\n property string errorText: \"\"\n \n signal locationChangeRequested()\n@@ -25,6 +26,8 @@ DialogPopup {\n \n title: canChooseType ? qsTr(\"Back up or export wallet\") : qsTr(\"Back up wallet\")\n implicitWidth: 520\n+ // The export holds the wallet lock, so other wallet actions would wait on it.\n+ busy: pending\n \n contentItem: ColumnLayout {\n spacing: Theme.space.xl\n@@ -33,6 +36,7 @@ DialogPopup {\n Layout.fillWidth: true\n title: root.title\n closeButtonObjectName: \"backupWalletClose\"\n+ closeEnabled: !root.pending\n onCloseRequested: root.close()\n }\n \n@@ -86,7 +90,7 @@ DialogPopup {\n CoreText {\n objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n- text: root.watchOnly\n+ text: root.watchOnly || !root.privateKeys\n ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n : root.encrypted\n ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n@@ -116,6 +120,7 @@ DialogPopup {\n objectName: \"backupDestinationPath\"\n Layout.fillWidth: true\n text: root.destinationPath\n+ textFormat: Text.PlainText\n textStyle: Theme.text.monoCaption\n color: Theme.color.neutral9\n horizontalAlignment: Text.AlignLeft\n@@ -138,6 +143,7 @@ DialogPopup {\n visible: root.errorText.length > 0\n Layout.fillWidth: true\n text: root.errorText\n+ textFormat: Text.PlainText\n textStyle: Theme.text.caption\n color: Theme.color.dangerText\n horizontalAlignment: Text.AlignLeft\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 173,
"evidence_id": "0ce40207747a49989976f7c7784ef830",
"finding_id": "finding:7",
"kind": "new_source",
"line": 88,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/components/BackupWalletPopup.qml",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 5,
"source_job_id": 2908,
"text": " }\n\n CoreText {\n objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n text: root.watchOnly || !root.privateKeys\n ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n : root.encrypted\n ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n : qsTr(\"Anyone with this file can spend your bitcoin. Keep it somewhere safe.\")\n textStyle: Theme.text.description\n color: Theme.color.neutral8\n horizontalAlignment: Text.AlignLeft\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: Theme.space.ml\n\n ColumnLayout {\n Layout.fillWidth: true\n spacing: Theme.space.xxs\n\n CoreText {\n Layout.fillWidth: true\n text: qsTr(\"Save to\")\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignLeft\n }\n\n CoreText {\n objectName: \"backupDestinationPath\"\n Layout.fillWidth: true\n text: root.destinationPath\n textFormat: Text.PlainText\n textStyle: Theme.text.monoCaption\n color: Theme.color.neutral9\n horizontalAlignment: Text.AlignLeft\n // A cut path could hide the part that tells two folders apart.\n wrapMode: Text.WrapAnywhere\n }\n }\n\n NeutralButton {\n objectName: \"backupChangeLocation\"\n Layout.alignment: Qt.AlignVCenter\n enabled: !root.pending\n text: qsTr(\"Change…\")\n onClicked: root.locationChangeRequested()\n }\n }\n\n CoreText {\n objectName: \"backupWalletErrorText\"\n visible: root.errorText.length > 0\n Layout.fillWidth: true\n text: root.errorText\n textFormat: Text.PlainText\n textStyle: Theme.text.caption\n color: Theme.color.dangerText\n horizontalAlignment: Text.AlignLeft\n }\n }\n }\n\n PrimaryButton {\n objectName: \"backupSaveButton\"\n Layout.fillWidth: true\n enabled: !root.pending && root.destinationPath.length > 0\n busy: root.pending\n text: root.pending ? qsTr(\"Saving…\")\n : root.watchOnly ? qsTr(\"Save watch-only copy\")\n : qsTr(\"Save backup\")\n onClicked: root.saveRequested()\n }\n\n CoreText {\n Layout.fillWidth: true\n text: root.canChooseType ? qsTr(\"Restore either file with Import wallet.\") : qsTr(\"Restore it with Import wallet.\")\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignHCenter\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Receiving on an unused inactive descriptor leaves its export availability staleqml/models/walletqmlmodel.cpp | addressed | AssessmentThe transaction-update callback now emits `descriptorExportsChanged()`. A new model test verifies that receiving on a previous descriptor triggers the notification and makes that descriptor available to display. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "863e6fa0fca14ff2bca9c598da618f44",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex ea50382fb5..371d57b2f6 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1366,7 +1366,7 @@ QVariantList WalletQmlModel::descriptorExports() const\n if (change_unreadable) {\n std::string change_text;\n const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n- if (change_desc_man) change_desc_man->GetDescriptorString(change_text, /*priv=*/false);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n descriptor = {.text = change_text.empty() ? receive->descriptor\n : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n .parts = {}};\n@@ -1379,7 +1379,7 @@ QVariantList WalletQmlModel::descriptorExports() const\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -3622,6 +3622,8 @@ void WalletQmlModel::subscribeToWalletSignals()\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n+ // A payment to a previous key can make it count as used.\n+ Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 3739,
"evidence_id": "296688cd7895423c879c585d911e163f",
"finding_id": "finding:6",
"kind": "new_source",
"line": 3602,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 5,
"source_job_id": 2908,
"text": " Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n }, Qt::QueuedConnection);\n });\n m_handler_address_list_changed = m_wallet->handleAddressBookChanged([guard, bridge](const CTxDestination&, const std::string&, bool, wallet::AddressPurpose, ChangeType) {\n QMetaObject::invokeMethod(bridge.get(), [guard] {\n if (guard && !guard->m_stopping) Q_EMIT guard->addressListChanged();\n }, Qt::QueuedConnection);\n });\n m_handler_transaction_changed = handleTransactionChanged([guard, bridge, pending](const uint256& txid, ChangeType change) {\n pending->fetch_add(1);\n QMetaObject::invokeMethod(bridge.get(), [guard, pending, txid, change] {\n if (guard && !guard->m_stopping) {\n const Txid id = Txid::FromUint256(txid);\n if (guard->m_receive_reconciliation_pending) guard->m_receive_reconciliation_updates[id] = change == CT_DELETED;\n guard->removeReceiveRequestPayment(id);\n if (change != CT_DELETED) {\n guard->recordReceiveRequestPayment(guard->getWalletTx(txid));\n guard->recheckReceiveRequestPayments(id);\n }\n guard->updateReceivedPaymentRequestAmounts();\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n // A payment to a previous key can make it count as used.\n Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n });\n // Core signals this when the active descriptors change.\n m_handler_can_get_addresses_changed = m_wallet->handleCanGetAddressesChanged([guard, bridge] {\n QMetaObject::invokeMethod(bridge.get(), [guard] {\n if (guard && !guard->m_stopping) Q_EMIT guard->descriptorExportsChanged();\n }, Qt::QueuedConnection);\n });\n m_handler_unload = handleUnload([guard, bridge, unload_requested = m_unload_requested] {\n unload_requested->store(true);\n QMetaObject::invokeMethod(bridge.get(), [guard] {\n if (guard && !guard->m_stopping) {\n Q_EMIT guard->availableChanged();\n Q_EMIT guard->walletUnloaded();\n }\n }, Qt::QueuedConnection);\n });\n}\n\nvoid WalletQmlModel::unsubscribeFromWalletSignals()\n{\n if (m_handler_status_changed) {\n m_handler_status_changed->disconnect();\n }\n if (m_handler_address_list_changed) {\n m_handler_address_list_changed->disconnect();\n }\n if (m_handler_transaction_changed) {\n m_handler_transaction_changed->disconnect();\n }\n if (m_handler_unload) {\n m_handler_unload->disconnect();\n }\n if (m_handler_can_get_addresses_changed) {\n m_handler_can_get_addresses_changed->disconnect();\n }\n}\n\nvoid WalletQmlModel::refreshSecurityState()\n{\n const bool encrypted = m_wallet ? m_wallet->isCrypted() : false;\n const bool locked = m_wallet ? m_wallet->isLocked() : false;\n if (m_is_encrypted != encrypted || m_is_locked != locked) {\n m_is_encrypted = encrypted;\n m_is_locked = locked;\n Q_EMIT securityStateChanged();\n }\n}\n\nbool WalletQmlModel::unlockForAction(std::optional<SecureString>& passphrase, bool& relock)\n{\n relock = false;\n if (!m_wallet) {\n if (passphrase.has_value()) {\n QmlUtil::ClearSecureString(*passphrase);\n passphrase.reset();\n }\n return true;\n }\n if (!passphrase.has_value()) {\n // Either the wallet is unlocked already (action proceeds), or it isn't\n // and the caller asked for an unlock-less attempt — let the action fail\n // downstream rather than blocking here.\n return true;\n }\n\n const auto result{TryUnlockWithPassphrase(*m_wallet, *passphrase)};\n passphrase.reset();\n switch (result) {\n case WalletUnlockResult::IncorrectPassphrase:\n setTransactionStatus(tr(\"The wallet password you entered was incorrect.\"));\n return false;\n case WalletUnlockResult::AlreadyUnlocked:\n return true;\n case WalletUnlockResult::UnlockedNowRelockRequired:\n relock = true;\n refreshSecurityState();\n return true;\n }\n return false;\n}\n\nvoid WalletQmlModel::clearTransactionStatus()\n{\n setTransactionStatus(QString());\n}\n\nvoid WalletQmlModel::setTransactionStatus(const QString& error, bool needs_unlock)\n{\n if (m_transaction_error != error) {\n m_transaction_error = error;\n Q_EMIT transactionErrorChanged();\n }\n if (m_transaction_needs_unlock != needs_unlock) {\n m_transaction_needs_unlock = needs_unlock;\n Q_EMIT transactionNeedsUnlockChanged();\n }\n}\n\nvoid WalletQmlModel::setSettingsError(const QString& error)\n{\n if (m_settings_error != error) {\n m_settings_error = error;\n Q_EMIT settingsErrorChanged();\n }\n}\n\nQString WalletQmlModel::persistedReceiveAddressTypeKey() const\n{\n return QStringLiteral(\"receiveAddressTypes/%1\").arg(name());\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Dismissing a pending export exposes wallet actions that block the GUIqml/components/BackupWalletPopup.qml | addressed | AssessmentThe popup binds `busy` to `pending`, which keeps the dialog from auto-closing, and disables the header close control while pending. The added UI test checks the busy state, close policy, disabled close control, and Escape dismissal behavior during export. path_diff: qml/components/BackupWalletPopup.qml; new_source: qml/components/BackupWalletPopup.qml [
{
"evidence_id": "6fc449ca5a24413ca4e829965bda5477",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/components/BackupWalletPopup.qml",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/components/BackupWalletPopup.qml b/qml/components/BackupWalletPopup.qml\nindex b30c78d761..94f356b001 100644\n--- a/qml/components/BackupWalletPopup.qml\n+++ b/qml/components/BackupWalletPopup.qml\n@@ -18,6 +18,7 @@ DialogPopup {\n property bool encrypted: false\n property string destinationPath: \"\"\n property bool pending: false\n+ property bool privateKeys: true\n property string errorText: \"\"\n \n signal locationChangeRequested()\n@@ -25,6 +26,8 @@ DialogPopup {\n \n title: canChooseType ? qsTr(\"Back up or export wallet\") : qsTr(\"Back up wallet\")\n implicitWidth: 520\n+ // The export holds the wallet lock, so other wallet actions would wait on it.\n+ busy: pending\n \n contentItem: ColumnLayout {\n spacing: Theme.space.xl\n@@ -33,6 +36,7 @@ DialogPopup {\n Layout.fillWidth: true\n title: root.title\n closeButtonObjectName: \"backupWalletClose\"\n+ closeEnabled: !root.pending\n onCloseRequested: root.close()\n }\n \n@@ -86,7 +90,7 @@ DialogPopup {\n CoreText {\n objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n- text: root.watchOnly\n+ text: root.watchOnly || !root.privateKeys\n ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n : root.encrypted\n ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n@@ -116,6 +120,7 @@ DialogPopup {\n objectName: \"backupDestinationPath\"\n Layout.fillWidth: true\n text: root.destinationPath\n+ textFormat: Text.PlainText\n textStyle: Theme.text.monoCaption\n color: Theme.color.neutral9\n horizontalAlignment: Text.AlignLeft\n@@ -138,6 +143,7 @@ DialogPopup {\n visible: root.errorText.length > 0\n Layout.fillWidth: true\n text: root.errorText\n+ textFormat: Text.PlainText\n textStyle: Theme.text.caption\n color: Theme.color.dangerText\n horizontalAlignment: Text.AlignLeft\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 150,
"evidence_id": "3d4f8a85e35b44ec9e4d394026d449f4",
"finding_id": "finding:4",
"kind": "new_source",
"line": 1,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/components/BackupWalletPopup.qml",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 5,
"source_job_id": 2908,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\nimport org.bitcoincore.qt 1.0\n\nimport \"../controls\"\n\nDialogPopup {\n id: root\n objectName: \"backupWalletPopup\"\n\n property bool canChooseType: true\n property bool watchOnly: false\n property bool encrypted: false\n property string destinationPath: \"\"\n property bool pending: false\n property bool privateKeys: true\n property string errorText: \"\"\n\n signal locationChangeRequested()\n signal saveRequested()\n\n title: canChooseType ? qsTr(\"Back up or export wallet\") : qsTr(\"Back up wallet\")\n implicitWidth: 520\n // The export holds the wallet lock, so other wallet actions would wait on it.\n busy: pending\n\n contentItem: ColumnLayout {\n spacing: Theme.space.xl\n\n DialogHeader {\n Layout.fillWidth: true\n title: root.title\n closeButtonObjectName: \"backupWalletClose\"\n closeEnabled: !root.pending\n onCloseRequested: root.close()\n }\n\n // Long paths, errors or translations scroll here, so Save stays in reach.\n ScrollView {\n id: bodyScroll\n objectName: \"backupWalletBody\"\n Layout.fillWidth: true\n Layout.fillHeight: true\n Layout.minimumHeight: Theme.size.controlLarge * 2\n Layout.preferredHeight: body.implicitHeight\n contentWidth: availableWidth\n contentHeight: body.implicitHeight\n clip: true\n ScrollBar.horizontal.policy: ScrollBar.AlwaysOff\n\n ColumnLayout {\n id: body\n width: bodyScroll.availableWidth\n spacing: Theme.space.l\n\n ColumnLayout {\n visible: root.canChooseType\n Layout.fillWidth: true\n spacing: Theme.space.m\n\n OptionButton {\n objectName: \"backupTypeFull\"\n Layout.fillWidth: true\n selected: !root.watchOnly\n enabled: !root.pending\n surfaceSelectionStyle: true\n text: qsTr(\"Full backup\")\n description: qsTr(\"Includes private keys. Restores a wallet that can spend.\")\n onClicked: root.watchOnly = false\n }\n\n OptionButton {\n objectName: \"backupTypeWatchOnly\"\n Layout.fillWidth: true\n selected: root.watchOnly\n enabled: !root.pending\n surfaceSelectionStyle: true\n text: qsTr(\"Watch-only copy\")\n //: Describes a watch-only wallet file for restoring on another Bitcoin Core node.\n description: qsTr(\"No private keys. Shows balance and history, but cannot spend.\")\n onClicked: root.watchOnly = true\n }\n }\n\n CoreText {\n objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n text: root.watchOnly || !root.privateKeys\n ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n : root.encrypted\n ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n : qsTr(\"Anyone with this file can spend your bitcoin. Keep it somewhere safe.\")\n textStyle: Theme.text.description\n color: Theme.color.neutral8\n horizontalAlignment: Text.AlignLeft\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: Theme.space.ml\n\n ColumnLayout {\n Layout.fillWidth: true\n spacing: Theme.space.xxs\n\n CoreText {\n Layout.fillWidth: true\n text: qsTr(\"Save to\")\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignLeft\n }\n\n CoreText {\n objectName: \"backupDestinationPath\"\n Layout.fillWidth: true\n text: root.destinationPath\n textFormat: Text.PlainText\n textStyle: Theme.text.monoCaption\n color: Theme.color.neutral9\n horizontalAlignment: Text.AlignLeft\n // A cut path could hide the part that tells two folders apart.\n wrapMode: Text.WrapAnywhere\n }\n }\n\n NeutralButton {\n objectName: \"backupChangeLocation\"\n Layout.alignment: Qt.AlignVCenter\n enabled: !root.pending\n text: qsTr(\"Change…\")\n onClicked: root.locationChangeRequested()\n }\n }\n\n CoreText {\n objectName: \"backupWalletErrorText\"\n visible: root.errorText.length > 0\n Layout.fillWidth: true\n text: root.errorText\n textFormat: Text.PlainText\n textStyle: Theme.text.caption\n color: Theme.color.dangerText\n horizontalAlignment: Text.AlignLeft\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Receive-only wallets offer an extended key for an untracked change branchqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new `key_covers_both` condition requires a parsed change descriptor with a `/1` branch and nonempty descriptor parts, so a receive-only export no longer offers an extended key. The test now expects an empty extended key when no change descriptor exists while retaining the descriptor export. path_diff: qml/models/walletqmlmodel.cpp; old_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "9aff0cc55c3347b2a55980649f11ed57",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex ea50382fb5..371d57b2f6 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1366,7 +1366,7 @@ QVariantList WalletQmlModel::descriptorExports() const\n if (change_unreadable) {\n std::string change_text;\n const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n- if (change_desc_man) change_desc_man->GetDescriptorString(change_text, /*priv=*/false);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n descriptor = {.text = change_text.empty() ? receive->descriptor\n : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n .parts = {}};\n@@ -1379,7 +1379,7 @@ QVariantList WalletQmlModel::descriptorExports() const\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -3622,6 +3622,8 @@ void WalletQmlModel::subscribeToWalletSignals()\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n+ // A payment to a previous key can make it count as used.\n+ Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1501,
"evidence_id": "5550a17e6d844ecfa82d21ba5b8989bd",
"finding_id": "finding:3",
"kind": "old_source",
"line": 1352,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"source_generation": 5,
"source_job_id": 2908,
"text": " QVariantList exports;\n LOCK(raw_wallet->cs_wallet);\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n const auto change = ParseSingleKeyDescriptor(change_man);\n // A change chain in another form is listed as it is, and no single key covers it.\n const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n if (change_unreadable) {\n std::string change_text;\n const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n if (change_desc_man) change_desc_man->GetDescriptorString(change_text, /*priv=*/false);\n descriptor = {.text = change_text.empty() ? receive->descriptor\n : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n .parts = {}};\n }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n exports.append(item);\n }\n return exports;\n}\n\nQVariantList WalletQmlModel::inactiveDescriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n struct Inactive {\n SingleKeyDescriptor descriptor;\n OutputType type;\n bool used;\n };\n std::vector<Inactive> found;\n LOCK(raw_wallet->cs_wallet);\n for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n if (raw_wallet->IsActiveScriptPubKeyMan(*spk_man)) continue;\n const auto descriptor = ParseSingleKeyDescriptor(spk_man);\n const auto type = descriptor ? SingleKeyOutputType(descriptor->script) : std::nullopt;\n if (!type) continue;\n const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n LOCK(desc_man.cs_desc_man);\n found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n }\n std::ranges::sort(found, {}, [](const Inactive& item) {\n return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n\n QVariantList exports;\n const auto append = [&](const Inactive& receive, const std::optional<SingleKeyDescriptor>& change) {\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(receive.type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n };\n for (auto it = found.begin(); it != found.end();) {\n const auto end = std::find_if(it, found.end(), [&](const Inactive& item) {\n return item.type != it->type || item.descriptor.origin != it->descriptor.origin ||\n item.descriptor.xpub != it->descriptor.xpub;\n });\n // next_index only moves once an address is handed out or seen in a transaction.\n if (std::any_of(it, end, [](const Inactive& item) { return item.used; })) {\n if (end - it == 2) {\n append(*it, std::next(it)->descriptor);\n } else {\n std::for_each(it, end, [&](const Inactive& item) { append(item, std::nullopt); });\n }\n }\n it = end;\n }\n return exports;\n}\n\nnamespace {\n\n// Hardened derivation after the key, as in a migrated wallet's old HD chain,\n// needs the private key, so importdescriptors rejects the public form.\nbool ExpandsFromPublicKeys(const std::string& descriptor)\n{\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) return false;\n return std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n });\n}\n\nstd::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n{\n omitted = 0;\n LOCK(wallet.cs_wallet);\n auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n if (!exported) return {};\n std::vector<wallet::WalletDescInfo> importable;\n for (wallet::WalletDescInfo& info : *exported) {\n if (ExpandsFromPublicKeys(info.descriptor)) {\n importable.push_back(std::move(info));\n } else {\n ++omitted;\n }\n }\n std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n return importable;\n}\n\n} // namespace\n\nint WalletQmlModel::descriptorImportOmittedCount() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return 0;\n size_t omitted{0};\n ImportableDescriptors(*raw_wallet, omitted);\n return int(omitted);\n}\n\n// Every descriptor in the same form as listdescriptors, ready for importdescriptors.\nQString WalletQmlModel::descriptorImportJson() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n size_t omitted{0};\n const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n if (exported.empty()) return {};\n",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Taproot extended-key export carries no script-type informationqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new UI explicitly warns that a bare Taproot key does not identify its script type and that importing it as another type can produce receive addresses this wallet does not watch. It directs users to use the descriptor unless the other wallet specifically requests a Taproot key. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "1cc47e3cd38f4734bdf339faf39a57bf",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex ea50382fb5..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1341,7 +1341,34 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n \n bool WalletQmlModel::canShowDescriptors() const\n {\n- return !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n QVariantList WalletQmlModel::descriptorExports() const\n@@ -1366,7 +1393,7 @@ QVariantList WalletQmlModel::descriptorExports() const\n if (change_unreadable) {\n std::string change_text;\n const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n- if (change_desc_man) change_desc_man->GetDescriptorString(change_text, /*priv=*/false);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n descriptor = {.text = change_text.empty() ? receive->descriptor\n : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n .parts = {}};\n@@ -1376,10 +1403,11 @@ QVariantList WalletQmlModel::descriptorExports() const\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -1421,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1445,19 +1474,27 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n \n namespace {\n \n-// Hardened derivation after the key, as in a migrated wallet's old HD chain,\n-// needs the private key, so importdescriptors rejects the public form.\n-bool ExpandsFromPublicKeys(const std::string& descriptor)\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n {\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n- if (parsed.empty()) return false;\n- return std::ranges::all_of(parsed, [&](const auto& desc) {\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n- });\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n }\n \n std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n@@ -1468,10 +1505,15 @@ std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet&\n if (!exported) return {};\n std::vector<wallet::WalletDescInfo> importable;\n for (wallet::WalletDescInfo& info : *exported) {\n- if (ExpandsFromPublicKeys(info.descriptor)) {\n+ switch (ClassifyPublicImport(info.descriptor)) {\n+ case PublicImport::Importable:\n importable.push_back(std::move(info));\n- } else {\n+ break;\n+ case PublicImport::NeedsPrivateKeys:\n ++omitted;\n+ break;\n+ case PublicImport::NoScripts:\n+ break;\n }\n }\n std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n@@ -1510,7 +1552,8 @@ QString WalletQmlModel::descriptorImportJson() const\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n- range.push_back(info.range->second - 1);\n+ // A used-up range ends before next_index, which importdescriptors rejects.\n+ range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n@@ -3622,6 +3665,8 @@ void WalletQmlModel::subscribeToWalletSignals()\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n+ // A payment to a previous key can make it count as used.\n+ Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | The series builds and repairs a modal that it later deletesqml/components/WatchOnlyExportModal.qml | unclear | AssessmentThe concern is about commit-by-commit review history and PR description, not the final tree. The supplied evidence includes no commit-series comparison or updated PR description sufficient to determine whether that feedback was addressed. Source report · efa47d341725..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Replace precedes protection of other loaded wallets in the seriesqml/walletqmlcontroller.cpp | addressed | AssessmentThis was an intermediate-series review-flow concern, not a defect at the previous head. The supplied old-to-new diff shows the final head protecting paths for all loaded wallets and retaining retiring-wallet protection; the concern about landing on an unsafe intermediate commit does not apply to the new head. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "357b18e5b4d749749f45fa8f8567ba98",
"finding_id": "finding:11",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 15f446e8da..3cf3c9a5cb 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -210,13 +210,17 @@ QString WalletQmlController::defaultWalletFilePath(WalletQmlModel* wallet, bool\n \n QVariantMap WalletQmlController::walletFileDestination(WalletQmlModel* wallet, const QString& path, bool watch_only) const\n {\n+ // The exact name: a trimmed one can name a different folder.\n+ const auto location = [this](const WalletQmlModel* model) {\n+ return model && model != m_empty_wallet ? walletLocationPath(model->name()) : QString{};\n+ };\n QStringList protected_paths{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n // A wallet loaded by path can live outside the wallets folder. Replacing\n // any loaded wallet's file would bypass its database lock.\n- protected_paths.append(walletLocationPath(wallet));\n+ protected_paths.append(location(wallet));\n {\n QMutexLocker locker(&m_wallets_mutex);\n- for (const WalletQmlModel* loaded : m_wallets) protected_paths.append(walletLocationPath(loaded));\n+ for (const WalletQmlModel* loaded : m_wallets) protected_paths.append(location(loaded));\n }\n // A closing wallet keeps its database open until it finishes.\n for (const QString& retiring : m_retiring_wallet_names) protected_paths.append(walletLocationPath(retiring));\n@@ -229,20 +233,19 @@ QString WalletQmlController::walletLocationPath(const WalletQmlModel* wallet) co\n if (!wallet || wallet == m_empty_wallet) {\n return {};\n }\n- return walletLocationPath(wallet->name());\n+ return walletLocationPath(wallet->name().trimmed());\n }\n \n QString WalletQmlController::walletLocationPath(const QString& name) const\n {\n- const QString wallet_name{name.trimmed()};\n- if (wallet_name.isEmpty()) {\n+ if (name.isEmpty()) {\n return {};\n }\n \n- QFileInfo wallet_path{wallet_name};\n+ QFileInfo wallet_path{name};\n if (!wallet_path.isAbsolute()) {\n const QDir wallet_dir{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n- wallet_path = QFileInfo{wallet_dir.filePath(wallet_name)};\n+ wallet_path = QFileInfo{wallet_dir.filePath(name)};\n }\n \n return wallet_path.absoluteFilePath();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Trailing whitespace bypasses loaded-wallet overwrite protectionqml/walletqmlcontroller.cpp | addressed | AssessmentThe protection path for loaded wallets now passes each model's exact backend name to `walletLocationPath()` instead of trimming it first. The new POSIX regression test checks that a wallet directory ending in a space is protected while the similarly named directory without that space remains available. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "316989307546497c91130ebc139ee6c7",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 5,
"source_job_id": 2908,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 15f446e8da..3cf3c9a5cb 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -210,13 +210,17 @@ QString WalletQmlController::defaultWalletFilePath(WalletQmlModel* wallet, bool\n \n QVariantMap WalletQmlController::walletFileDestination(WalletQmlModel* wallet, const QString& path, bool watch_only) const\n {\n+ // The exact name: a trimmed one can name a different folder.\n+ const auto location = [this](const WalletQmlModel* model) {\n+ return model && model != m_empty_wallet ? walletLocationPath(model->name()) : QString{};\n+ };\n QStringList protected_paths{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n // A wallet loaded by path can live outside the wallets folder. Replacing\n // any loaded wallet's file would bypass its database lock.\n- protected_paths.append(walletLocationPath(wallet));\n+ protected_paths.append(location(wallet));\n {\n QMutexLocker locker(&m_wallets_mutex);\n- for (const WalletQmlModel* loaded : m_wallets) protected_paths.append(walletLocationPath(loaded));\n+ for (const WalletQmlModel* loaded : m_wallets) protected_paths.append(location(loaded));\n }\n // A closing wallet keeps its database open until it finishes.\n for (const QString& retiring : m_retiring_wallet_names) protected_paths.append(walletLocationPath(retiring));\n@@ -229,20 +233,19 @@ QString WalletQmlController::walletLocationPath(const WalletQmlModel* wallet) co\n if (!wallet || wallet == m_empty_wallet) {\n return {};\n }\n- return walletLocationPath(wallet->name());\n+ return walletLocationPath(wallet->name().trimmed());\n }\n \n QString WalletQmlController::walletLocationPath(const QString& name) const\n {\n- const QString wallet_name{name.trimmed()};\n- if (wallet_name.isEmpty()) {\n+ if (name.isEmpty()) {\n return {};\n }\n \n- QFileInfo wallet_path{wallet_name};\n+ QFileInfo wallet_path{name};\n if (!wallet_path.isAbsolute()) {\n const QDir wallet_dir{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n- wallet_path = QFileInfo{wallet_dir.filePath(wallet_name)};\n+ wallet_path = QFileInfo{wallet_dir.filePath(name)};\n }\n \n return wallet_path.absoluteFilePath();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 356,
"evidence_id": "68b3db4e20404509be13d2c2c00e86e8",
"finding_id": "finding:1",
"kind": "new_source",
"line": 207,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "efa47d34172588c3f773c0b96b26734d45e74ed1",
"path": "qml/walletqmlcontroller.cpp",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 5,
"source_job_id": 2908,
"text": " const QDir dir{folder.isEmpty() ? QDir::homePath() : normalizeWalletPath(folder)};\n return QDir::toNativeSeparators(dir.filePath(DefaultWalletFileName(name, watch_only, QDate::currentDate())));\n}\n\nQVariantMap WalletQmlController::walletFileDestination(WalletQmlModel* wallet, const QString& path, bool watch_only) const\n{\n // The exact name: a trimmed one can name a different folder.\n const auto location = [this](const WalletQmlModel* model) {\n return model && model != m_empty_wallet ? walletLocationPath(model->name()) : QString{};\n };\n QStringList protected_paths{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n // A wallet loaded by path can live outside the wallets folder. Replacing\n // any loaded wallet's file would bypass its database lock.\n protected_paths.append(location(wallet));\n {\n QMutexLocker locker(&m_wallets_mutex);\n for (const WalletQmlModel* loaded : m_wallets) protected_paths.append(location(loaded));\n }\n // A closing wallet keeps its database open until it finishes.\n for (const QString& retiring : m_retiring_wallet_names) protected_paths.append(walletLocationPath(retiring));\n const QString name{wallet && wallet != m_empty_wallet ? wallet->name() : QString{}};\n return DescribeWalletFileDestination(path, watch_only, name, protected_paths, QDateTime::currentDateTime());\n}\n\nQString WalletQmlController::walletLocationPath(const WalletQmlModel* wallet) const\n{\n if (!wallet || wallet == m_empty_wallet) {\n return {};\n }\n return walletLocationPath(wallet->name().trimmed());\n}\n\nQString WalletQmlController::walletLocationPath(const QString& name) const\n{\n if (name.isEmpty()) {\n return {};\n }\n\n QFileInfo wallet_path{name};\n if (!wallet_path.isAbsolute()) {\n const QDir wallet_dir{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n wallet_path = QFileInfo{wallet_dir.filePath(name)};\n }\n\n return wallet_path.absoluteFilePath();\n}\n\nbool WalletQmlController::openWalletLocation(WalletQmlModel* wallet)\n{\n clearWalletLocationOpenError();\n\n const QString wallet_path{walletLocationPath(wallet)};\n if (wallet_path.isEmpty()) {\n setWalletLocationOpenError(tr(\"No wallet file is available to view.\"));\n return false;\n }\n\n const QFileInfo wallet_location{wallet_path};\n if (!wallet_location.exists()) {\n setWalletLocationOpenError(tr(\"Wallet file not found: %1\").arg(wallet_path));\n return false;\n }\n\n const QString open_path = wallet_location.isDir()\n ? wallet_location.absoluteFilePath()\n : wallet_location.absolutePath();\n if (!m_open_local_path_fn(open_path)) {\n setWalletLocationOpenError(tr(\"Could not open wallet file location.\"));\n return false;\n }\n\n return true;\n}\n\nvoid WalletQmlController::clearWalletLocationOpenError()\n{\n setWalletLocationOpenError({});\n}\n\nvoid WalletQmlController::closeWallet(const QString& path)\n{\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n if (path.trimmed().isEmpty()) {\n return;\n }\n\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n\n WalletQmlModel* wallet_to_close{nullptr};\n\n {\n QMutexLocker locker(&m_wallets_mutex);\n const auto wallet_it = std::find_if(m_wallets.begin(), m_wallets.end(), [&](WalletQmlModel* wallet) {\n return wallet->name() == path;\n });\n if (wallet_it == m_wallets.end()) {\n return;\n }\n\n wallet_to_close = *wallet_it;\n }\n\n removeWalletModel(wallet_to_close, true);\n}\n\nQString WalletQmlController::walletDisplayName(const QString& path) const\n{\n const QString trimmed_path = path.trimmed();\n if (trimmed_path.isEmpty()) {\n return {};\n }\n\n QSettings settings;\n const QString display_name = settings.value(walletDisplayNameKey(trimmed_path)).toString().trimmed();\n return display_name.isEmpty() ? trimmed_path : display_name;\n}\n\nbool WalletQmlController::setWalletDisplayName(const QString& path, const QString& display_name)\n{\n const QString trimmed_path = path.trimmed();\n if (trimmed_path.isEmpty()) {\n return false;\n }\n\n const QString trimmed_name = display_name.trimmed();\n QSettings settings;\n if (trimmed_name.isEmpty() || trimmed_name == trimmed_path) {\n settings.remove(walletDisplayNameKey(trimmed_path));\n } else {\n settings.setValue(walletDisplayNameKey(trimmed_path), trimmed_name);\n }\n settings.sync();\n\n {\n QMutexLocker locker(&m_wallets_mutex);\n for (WalletQmlModel* wallet : m_wallets) {\n if (wallet->name() == trimmed_path) {\n applyWalletDisplayName(wallet);\n }\n }\n }\n\n Q_EMIT walletDisplayNamesChanged();\n return true;\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · efa47d341725..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#994 | Per-network settings initialization is separated from its new readerqml/bitcoin.cpp | unclear | AssessmentThe finding is about an incorrect intermediate commit ordering and asks that the settings initialization move be folded into the commit introducing the reader. The supplied evidence shows the final settings setup before NodeModel construction, but does not provide commit-level history to assess whether the requested series-level change was made. path_diff: qml/bitcoin.cpp; new_source: qml/bitcoin.cpp [
{
"evidence_id": "c88030ed270348d0bd97457405176986",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/bitcoin.cpp",
"source_generation": 5,
"source_job_id": 2907,
"text": "diff --git a/qml/bitcoin.cpp b/qml/bitcoin.cpp\nindex af88f2e930..8b374cf033 100644\n--- a/qml/bitcoin.cpp\n+++ b/qml/bitcoin.cpp\n@@ -684,7 +684,7 @@ int BitcoinQmlApplication::run(int argc, char* argv[])\n if (!node->baseInitialize()) return false;\n \n // Use Qt's effective settings identity with the resolved network, before\n- // any window-behavior model reads it. This also works on the onboarding worker.\n+ // any model reads it. This also works on the onboarding worker.\n if (gArgs.IsArgSet(\"-resetguisettings\")) {\n const QSettings defaults;\n QSettings settings{defaults.format(), defaults.scope(), defaults.organizationName(),\n@@ -692,6 +692,7 @@ int BitcoinQmlApplication::run(int argc, char* argv[])\n settings.remove(QStringLiteral(\"fHideTrayIcon\"));\n settings.remove(QStringLiteral(\"fMinimizeToTray\"));\n settings.remove(QStringLiteral(\"fMinimizeOnClose\"));\n+ settings.remove(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS));\n settings.sync();\n if (settings.status() != QSettings::NoError) InitWarning(Untranslated(QObject::tr(\"Unable to save window settings after reset.\").toStdString()));\n }\n@@ -801,6 +802,8 @@ int BitcoinQmlApplication::run(int argc, char* argv[])\n \n ChainModel chain_model{QString::fromStdString(gArgs.GetChainTypeString())};\n BlockClockModel block_clock_model{block_clock_history};\n+ block_clock_model.setTipTime(node_model.blockTipTime());\n+ QObject::connect(&node_model, &NodeModel::blockTipTimeChanged, &block_clock_model, &BlockClockModel::setTipTime);\n \n \n \n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 852,
"evidence_id": "81258773cef042868fd32b820d1ff7e4",
"finding_id": "finding:9",
"kind": "new_source",
"line": 703,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/bitcoin.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 5,
"source_job_id": 2907,
"text": " if (pre_init_onboarding_status == PreInitOnboardingStatus::COMPLETED) {\n // The onboarding window stays visible until MainWindow is ready.\n // Its model owns the settings write, node preparation and worker cleanup.\n auto& context = pre_init_onboarding_context;\n startup_error_window = context.window;\n QEventLoop preparation_loop;\n bool preparation_finished{false};\n QObject::connect(context.window, &QWindow::visibleChanged, &preparation_loop,\n [&](bool visible) { if (!visible) startup_canceled = true; });\n QObject::connect(context.onboarding_options_model.get(), &OnboardingOptionsModel::nodePrepared,\n &preparation_loop, [&](bool success, const QString& error) {\n if (!error.isEmpty()) InitError(Untranslated(error.toStdString()));\n prepared = success;\n preparation_finished = true;\n preparation_loop.quit();\n });\n context.onboarding_options_model->prepareNode(gArgs, prepare_node);\n while (!preparation_finished) preparation_loop.exec();\n startup_error_window.clear();\n if (startup_canceled || quit_handler.isQuitRequested()) return EXIT_SUCCESS;\n } else {\n // No window is visible, so retain the original synchronous startup path.\n prepared = prepare_node();\n }\n if (!prepared) return EXIT_FAILURE;\n gui_startup_message_handler.disconnect();\n\n const bool wallet_enabled = WalletEnabledFromArgs();\n app_mode.setWalletEnabled(wallet_enabled);\n\n // The config file may select the network, and NodeModel reads per-network settings.\n setupChainQSettings(&app, QString::fromStdString(gArgs.GetChainTypeString()).toUpper());\n\n constexpr bool backend_ready{false};\n NodeModel node_model{*node, backend_ready};\n node_model.addStartupWarnings(startup_warnings);\n auto block_clock_history{std::make_shared<BlockClockHistory>()};\n QmlInitExecutor init_executor{*node, [history = block_clock_history, node = node.get(), chain = chain.get()] {\n return SubscribeBlockClockHistory(*node, *chain, history);\n }};\n QmlShutdownCoordinator shutdown_coordinator{init_executor};\n QPointer<QQuickWindow> main_window;\n bool shutdown_requested{false};\n bool shutdown_finished{false};\n QObject::connect(&shutdown_coordinator, &QmlShutdownCoordinator::finished, &app, [&] { shutdown_finished = true; });\n // Read the file the node actually writes, so -debuglogfile=<file> and\n // -nodebuglogfile are honoured rather than assuming <datadir>/debug.log.\n DebugLogModel debug_log_model{LogInstance().m_file_path, LogInstance().m_print_to_file};\n#ifdef ENABLE_WALLET\n std::unique_ptr<WalletQmlController> wallet_controller;\n if (wallet_enabled) {\n wallet_controller = std::make_unique<WalletQmlController>(*node);\n QObject::connect(\n &init_executor, &QmlInitExecutor::initializeResult, wallet_controller.get(),\n [wallet_controller = wallet_controller.get(), &shutdown_requested](bool success, interfaces::BlockAndHeaderTipInfo, bool, bool backend_shutdown_requested) {\n if (success && !shutdown_requested && !backend_shutdown_requested) {\n wallet_controller->initialize();\n }\n });\n }\n#endif\n QObject::connect(&node_model, &NodeModel::requestedInitialize, &init_executor, &QmlInitExecutor::initialize);\n QObject::connect(&node_model, &NodeModel::requestedShutdown,\n &shutdown_coordinator, &QmlShutdownCoordinator::requestShutdown);\n QObject::connect(&shutdown_coordinator, &QmlShutdownCoordinator::shutdownStarted, &node_model, [&] {\n shutdown_requested = true;\n for (auto* window : QGuiApplication::allWindows()) {\n if (auto* quick_window = qobject_cast<QQuickWindow*>(window)) quick_window->contentItem()->setEnabled(false);\n }\n node_model.requestShutdown();\n });\n shutdown_coordinator.addParticipant(&node_model, &NodeModel::workDrained, [&] { node_model.beginShutdown(); });\n shutdown_coordinator.addParticipant(&debug_log_model, &DebugLogModel::drained, [&] { debug_log_model.stop(); });\n#ifdef ENABLE_WALLET\n if (wallet_controller) {\n shutdown_coordinator.addParticipant(wallet_controller.get(), &WalletQmlController::walletsDrained,\n [&] { wallet_controller->beginShutdown(); });\n }\n#endif\n QObject::connect(&init_executor, &QmlInitExecutor::initializeResult, &node_model, &NodeModel::initializeResult);\n QObject::connect(&init_executor, &QmlInitExecutor::runawayException, &node_model, [&](const QString& message) {\n if (main_window) main_window->contentItem()->setEnabled(true);\n node_model.handleRunawayException(message);\n if (!main_window) {\n InitErrorMessageBox(Untranslated(node_model.startupError().toStdString()), quit_handler,\n [this](QQmlApplicationEngine& engine) { qmlEngineCreated(engine); });\n node_model.requestShutdown();\n }\n });\n\n NetworkTrafficTower network_traffic_tower{*node};\n QObject::connect(&node_model, &NodeModel::chainStateReady,\n &network_traffic_tower, &NetworkTrafficTower::startSampling);\n shutdown_coordinator.addParticipant(&network_traffic_tower, &NetworkTrafficTower::drained,\n [&] { network_traffic_tower.beginShutdown(); });\n NetworkStatusModel network_status_model;\n#ifdef __ANDROID__\n AndroidNotifier android_notifier{node_model};\n#endif\n\n ChainModel chain_model{QString::fromStdString(gArgs.GetChainTypeString())};\n BlockClockModel block_clock_model{block_clock_history};\n block_clock_model.setTipTime(node_model.blockTipTime());\n QObject::connect(&node_model, &NodeModel::blockTipTimeChanged, &block_clock_model, &BlockClockModel::setTipTime);\n\n\n\n DesktopWindowBehaviorModel desktop_window_behavior_model;\n DesktopTrayIconController desktop_tray_icon_controller;\n\n qGuiApp->setQuitOnLastWindowClosed(false);\n QObject::connect(qGuiApp, &QGuiApplication::lastWindowClosed, &desktop_tray_icon_controller, [&] {\n // When the tray icon is visible the node keeps running in the background.\n if (desktop_tray_icon_controller.visible()) return;\n node_model.requestShutdown();\n });\n\n PeerListModel peer_model{*node, nullptr, backend_ready};\n QObject::connect(&node_model, &NodeModel::chainStateReady,\n &peer_model, &PeerListModel::backendInitialized);\n PeerListSortProxy peer_model_sort_proxy{nullptr};\n peer_model_sort_proxy.setSourceModel(&peer_model);\n\n BanListModel ban_list_model{*node, nullptr, backend_ready};\n QObject::connect(&node_model, &NodeModel::bannedListChanged,\n &ban_list_model, &BanListModel::refresh);\n QObject::connect(&node_model, &NodeModel::chainStateReady,\n &ban_list_model, &BanListModel::backendInitialized);\n\n QObject::connect(&shutdown_coordinator, &QmlShutdownCoordinator::shutdownStarted, &peer_model, [&] {\n peer_model.beginShutdown();\n ban_list_model.beginShutdown();\n block_clock_model.stop();\n QObject::disconnect(&node_model, nullptr, &ban_list_model, nullptr);\n QObject::disconnect(&node_model, nullptr, &block_clock_model, nullptr);\n });\n\n QScopedPointer<const NetworkStyle> network_style{NetworkStyle::instantiate(Params().GetChainType())};\n assert(!network_style.isNull());\n auto engine = CreateMainEngine(network_style.data());\n qmlEngineCreated(*engine);\n\n engine->rootContext()->setContextProperty(\"networkTrafficTower\", &network_traffic_tower);\n engine->rootContext()->setContextProperty(\"networkStatusModel\", &network_status_model);\n engine->rootContext()->setContextProperty(\"nodeModel\", &node_model);\n engine->rootContext()->setContextProperty(\"chainModel\", &chain_model);\n engine->rootContext()->setContextProperty(\"blockClockModel\", &block_clock_model);\n engine->rootContext()->setContextProperty(\"peerTableModel\", &peer_model);\n engine->rootContext()->setContextProperty(\"peerListModelProxy\", &peer_model_sort_proxy);\n engine->rootContext()->setContextProperty(\"banListModel\", &ban_list_model);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c693949d1a33..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | NodeBanner close semantics are split across three commitsqml/components/NodeBanner.qml | unclear | AssessmentThe supplied new-head evidence shows the final session-only dismissal behavior, but the finding concerns how that behavior and its tests are distributed across commits. The available evidence is a path diff and file excerpts, not commit-level history sufficient to determine whether the fixups and assertions were folded into the introduction. path_diff: qml/components/NodeBanner.qml; new_source: qml/components/NodeBanner.qml [
{
"evidence_id": "9173df6c05b84dd2b0a864a6a49e1789",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/components/NodeBanner.qml",
"source_generation": 5,
"source_job_id": 2907,
"text": "diff --git a/qml/components/NodeBanner.qml b/qml/components/NodeBanner.qml\nindex f873a8bfdd..ae45f1ce79 100644\n--- a/qml/components/NodeBanner.qml\n+++ b/qml/components/NodeBanner.qml\n@@ -30,7 +30,11 @@ Rectangle {\n }\n \n visible: shown\n- implicitHeight: shown ? content.implicitHeight + 2 * Theme.space.ml : 0\n+ // Qt 6.2 reports a binding loop when this reads the RowLayout's implicitHeight.\n+ implicitHeight: shown\n+ ? Math.max(dot.implicitHeight + dot.Layout.topMargin, bannerText.implicitHeight, closeButton.implicitHeight)\n+ + 2 * Theme.space.ml\n+ : 0\n color: Theme.color.tint(status.bannerColor)\n \n Rectangle {\n@@ -51,6 +55,7 @@ Rectangle {\n spacing: Theme.space.ml\n \n Rectangle {\n+ id: dot\n Layout.alignment: Qt.AlignTop\n Layout.topMargin: Theme.space.s\n implicitWidth: Theme.space.m\n@@ -59,6 +64,7 @@ Rectangle {\n color: root.status.bannerColor\n }\n CoreText {\n+ id: bannerText\n objectName: \"nodeBannerText\"\n Layout.fillWidth: true\n textFormat: Text.StyledText\n@@ -68,6 +74,7 @@ Rectangle {\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n+ id: closeButton\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n backgroundColor: \"transparent\"\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 87,
"evidence_id": "d964fef5e5c441a991477fd9fd2d1a64",
"finding_id": "finding:8",
"kind": "new_source",
"line": 1,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/components/NodeBanner.qml",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 5,
"source_job_id": 2907,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\n\nimport \"../controls\"\n\n// Closing hides the current notice for this session; it returns when it\n// changes or recurs. Saved warning dismissals belong to the Warnings dialog.\nRectangle {\n id: root\n objectName: \"nodeBanner\"\n\n property NodeStatus status: NodeStatus {}\n readonly property string message: status.bannerKind.length > 0\n ? status.bannerKind + \"\\n\" + status.bannerText : \"\"\n property string dismissedMessage: \"\"\n readonly property bool shown: message.length > 0 && message !== dismissedMessage\n onMessageChanged: if (message !== dismissedMessage) dismissedMessage = \"\"\n\n function dismiss() {\n root.dismissedMessage = root.message\n }\n\n function escaped(text) {\n return text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\")\n }\n\n visible: shown\n // Qt 6.2 reports a binding loop when this reads the RowLayout's implicitHeight.\n implicitHeight: shown\n ? Math.max(dot.implicitHeight + dot.Layout.topMargin, bannerText.implicitHeight, closeButton.implicitHeight)\n + 2 * Theme.space.ml\n : 0\n color: Theme.color.tint(status.bannerColor)\n\n Rectangle {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.bottom: parent.bottom\n height: 1\n color: root.status.bannerColor\n }\n\n RowLayout {\n id: content\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n anchors.leftMargin: Theme.space.xl\n anchors.rightMargin: Theme.space.ml\n spacing: Theme.space.ml\n\n Rectangle {\n id: dot\n Layout.alignment: Qt.AlignTop\n Layout.topMargin: Theme.space.s\n implicitWidth: Theme.space.m\n implicitHeight: Theme.space.m\n radius: height / 2\n color: root.status.bannerColor\n }\n CoreText {\n id: bannerText\n objectName: \"nodeBannerText\"\n Layout.fillWidth: true\n textFormat: Text.StyledText\n text: \"<b>\" + root.escaped(root.status.bannerTitle) + \"</b> \" + root.escaped(root.status.bannerText)\n textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n id: closeButton\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n backgroundColor: \"transparent\"\n backgroundHoverColor: Theme.color.surfaceHover\n backgroundPressedColor: Theme.color.surfacePressed\n Accessible.name: qsTr(\"Close notice\")\n onClicked: root.dismiss()\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c693949d1a33..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | -resetguisettings leaves dismissals saved for a config-selected networkqml/models/settings_keys.h | unclear | AssessmentThe follow-up assessment was invalid: follow-up evidence belongs to another finding or comparison. invalid_assessment Source report · c693949d1a33..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Last-block age uses retained history rather than the active tipqml/models/blockclockmodel.cpp | unclear | AssessmentThe follow-up assessment was invalid: follow-up evidence belongs to another finding or comparison. invalid_assessment Source report · c693949d1a33..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Short timestamp intervals disappear from the layered dialqml/components/blockclockdial.cpp | partially_addressed | AssessmentThe fixed 1.2° gap is now reduced for short intervals, and the added test checks visibility of a 120-second interval. However, equal or zero-length timestamps still produce a zero-length arc: the computed gap becomes zero, so start equals end and the interval is skipped. The supplied test does not cover equal timestamps or establish coalescing while preserving counts. path_diff: qml/components/blockclockdial.cpp; new_source: qml/components/blockclockdial.cpp [
{
"evidence_id": "0b9ef494e1ed420cbda83c3e30804fe0",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/components/blockclockdial.cpp",
"source_generation": 5,
"source_job_id": 2907,
"text": "diff --git a/qml/components/blockclockdial.cpp b/qml/components/blockclockdial.cpp\nindex 86526fd6f5..5cab667e1b 100644\n--- a/qml/components/blockclockdial.cpp\n+++ b/qml/components/blockclockdial.cpp\n@@ -721,17 +721,21 @@ void BlockClockDial::paintLayeredBlocks(QPainter* painter, qreal unit)\n const qreal current{m_current_time_fraction};\n const bool reveal{connected() && !paused() && m_animate_dial};\n const qreal visible_end{reveal ? current - 1.0 + qBound<qreal>(0.0, m_animating_max_angle / 360.0, 1.0) : current};\n- // Leave a gap at both ends so neighbouring blocks stay distinct.\n- constexpr qreal half_gap{0.6 / 360.0};\n+ // Leave a gap at both ends so neighbouring blocks stay distinct. Short\n+ // intervals get a smaller gap so they still show.\n+ constexpr qreal max_half_gap{0.6 / 360.0};\n const QRectF bounds{circleBounds(88 * unit)};\n \n QPen pen;\n pen.setWidthF(6 * unit);\n pen.setCapStyle(Qt::FlatCap);\n for (qsizetype i{1}; i < blocks.size(); ++i) {\n- const qreal start{qMax(blocks.at(i - 1), current - 1.0) + half_gap};\n- const qreal end{qMin(blocks.at(i), visible_end) - half_gap};\n if (blocks.at(i - 1) >= visible_end) break;\n+ const qreal interval_start{qMax(blocks.at(i - 1), current - 1.0)};\n+ const qreal interval_end{qMin(blocks.at(i), visible_end)};\n+ const qreal half_gap{qMin(max_half_gap, (interval_end - interval_start) / 4)};\n+ const qreal start{interval_start + half_gap};\n+ const qreal end{interval_end - half_gap};\n if (end <= start) continue;\n \n const qsizetype age{blocks.size() - 1 - i};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 854,
"evidence_id": "8817bad22cea489fa8bfdc849acd985d",
"finding_id": "finding:2",
"kind": "new_source",
"line": 705,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/components/blockclockdial.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 5,
"source_job_id": 2907,
"text": " QPainterPath path;\n path.arcMoveTo(bounds, angle);\n path.arcTo(bounds, angle, degreesPerPixel());\n painter->drawPath(path);\n }\n}\n\nQRectF BlockClockDial::circleBounds(qreal radius) const\n{\n const QPointF center{boundingRect().center()};\n return {center.x() - radius, center.y() - radius, radius * 2, radius * 2};\n}\n\nvoid BlockClockDial::paintLayeredBlocks(QPainter* painter, qreal unit)\n{\n const QList<qreal>& blocks{m_block_time_fractions};\n const qreal current{m_current_time_fraction};\n const bool reveal{connected() && !paused() && m_animate_dial};\n const qreal visible_end{reveal ? current - 1.0 + qBound<qreal>(0.0, m_animating_max_angle / 360.0, 1.0) : current};\n // Leave a gap at both ends so neighbouring blocks stay distinct. Short\n // intervals get a smaller gap so they still show.\n constexpr qreal max_half_gap{0.6 / 360.0};\n const QRectF bounds{circleBounds(88 * unit)};\n\n QPen pen;\n pen.setWidthF(6 * unit);\n pen.setCapStyle(Qt::FlatCap);\n for (qsizetype i{1}; i < blocks.size(); ++i) {\n if (blocks.at(i - 1) >= visible_end) break;\n const qreal interval_start{qMax(blocks.at(i - 1), current - 1.0)};\n const qreal interval_end{qMin(blocks.at(i), visible_end)};\n const qreal half_gap{qMin(max_half_gap, (interval_end - interval_start) / 4)};\n const qreal start{interval_start + half_gap};\n const qreal end{interval_end - half_gap};\n if (end <= start) continue;\n\n const qsizetype age{blocks.size() - 1 - i};\n if (m_dimmed) {\n pen.setColor(m_dimmed_color);\n } else if (age < m_confirmation_colors.size()) {\n pen.setColor(m_confirmation_colors.at(age));\n } else {\n pen.setColor(m_progress_color);\n }\n painter->setPen(pen);\n painter->drawArc(bounds, qRound((90 - 360 * start) * 16), qRound(-360 * (end - start) * 16));\n }\n\n QPen hand_pen{m_dimmed ? m_time_tick_color : m_hand_color};\n hand_pen.setWidthF(1.5 * unit);\n hand_pen.setCapStyle(Qt::RoundCap);\n painter->setPen(hand_pen);\n const qreal angle{qDegreesToRadians(current * 360)};\n const QPointF center{boundingRect().center()};\n const QPointF direction{qSin(angle), -qCos(angle)};\n painter->drawLine(center + direction * 80 * unit, center + direction * 96 * unit);\n}\n\nvoid BlockClockDial::paintLayeredProgress(QPainter* painter, qreal unit)\n{\n const bool reveal{connected() && !paused() && m_animate_dial};\n const auto span{[&](double progress) {\n return reveal ? qMin(progress * 360, m_animating_max_angle) : progress * 360;\n }};\n\n QPen header_pen{m_background_color};\n header_pen.setWidthF(2.5 * unit);\n header_pen.setCapStyle(Qt::RoundCap);\n const QRectF header_bounds{circleBounds(81 * unit)};\n painter->setPen(header_pen);\n painter->drawEllipse(header_bounds);\n if (m_header_progress > 0) {\n header_pen.setColor(m_dimmed ? m_dimmed_color : m_header_progress_color);\n painter->setPen(header_pen);\n painter->drawArc(header_bounds, 90 * 16, qRound(-span(m_header_progress) * 16));\n }\n\n if (m_block_progress > 0) {\n QPen block_pen{m_dimmed ? m_time_tick_color : m_progress_color};\n block_pen.setWidthF(6 * unit);\n block_pen.setCapStyle(Qt::RoundCap);\n painter->setPen(block_pen);\n painter->drawArc(circleBounds(88 * unit), 90 * 16, qRound(-span(m_block_progress) * 16));\n }\n}\n\nvoid BlockClockDial::paintLayered(QPainter* painter)\n{\n // Units of the 200-unit design canvas.\n const qreal unit{qMin(width(), height()) / 200.0};\n const QPointF center{boundingRect().center()};\n\n QPen track_pen{m_background_color};\n track_pen.setWidthF(6 * unit);\n painter->setPen(track_pen);\n painter->setBrush(Qt::NoBrush);\n painter->drawEllipse(circleBounds(88 * unit));\n\n if (showTimeTicks()) {\n painter->setPen(Qt::NoPen);\n painter->setBrush(m_time_tick_color);\n for (int hour{0}; hour < 12; ++hour) {\n const qreal angle{qDegreesToRadians(hour * 30.0)};\n const qreal radius{(hour % 3 == 0 ? 2.0 : 1.2) * unit};\n const QPointF dot{center + QPointF{qSin(angle), -qCos(angle)} * 74 * unit};\n painter->drawEllipse(dot, radius, radius);\n }\n painter->setBrush(Qt::NoBrush);\n }\n\n if (m_faulted) return;\n\n if (synced()) {\n paintLayeredBlocks(painter, unit);\n } else if (m_header_progress > 0 || m_block_progress > 0) {\n paintLayeredProgress(painter, unit);\n }\n\n if (!connected() && !paused() && m_animation_timer.isActive()) {\n QPen spinner_pen{m_hand_color};\n spinner_pen.setWidthF(6 * unit);\n spinner_pen.setCapStyle(Qt::RoundCap);\n painter->setPen(spinner_pen);\n painter->drawArc(circleBounds(88 * unit), qRound((m_connecting_start_angle + 18) * 16), -36 * 16);\n }\n}\n\nvoid BlockClockDial::paint(QPainter * painter)\n{\n if (width() <= 0 || height() <= 0) {\n return;\n }\n painter->setRenderHint(QPainter::Antialiasing);\n\n if (m_layered_rings) {\n paintLayered(painter);\n return;\n }\n\n paintBackground(painter);\n if (showTimeTicks()) {\n paintTimeTicks(painter);\n }\n\n if (paused()) return;\n\n if (connected() && synced()) {\n if (showBlockSegments()) {\n paintBlocks(painter);\n } else if (useGradientArcWhenSynced()) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c693949d1a33..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Saved dismissals suppress later occurrences of operational warningsqml/models/nodemodel.cpp | addressed | AssessmentsetWarnings now removes saved dismissals for warnings present in the prior warning list but absent from the new list, persisting the updated list. The supplied test diff also exercises clearing warnings and confirms the stored dismissal list is empty before a later recurrence. path_diff: qml/models/nodemodel.cpp; new_source: qml/models/nodemodel.cpp [
{
"evidence_id": "b3a5fa3761784163a199ca8f1aa64fe0",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/models/nodemodel.cpp",
"source_generation": 5,
"source_job_id": 2907,
"text": "diff --git a/qml/models/nodemodel.cpp b/qml/models/nodemodel.cpp\nindex 52db06a151..45ec8e60a1 100644\n--- a/qml/models/nodemodel.cpp\n+++ b/qml/models/nodemodel.cpp\n@@ -679,6 +679,12 @@ void NodeModel::setWarnings(const QString& warnings)\n if (m_warnings == warnings && m_warning_list == warning_list) {\n return;\n }\n+ // A dismissed warning that clears shows again if it recurs.\n+ bool dismissals_changed{false};\n+ for (const QString& warning : m_warning_list) {\n+ if (!warning_list.contains(warning) && m_dismissed_warnings.removeAll(warning) > 0) dismissals_changed = true;\n+ }\n+ if (dismissals_changed) QSettings{}.setValue(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS), m_dismissed_warnings);\n m_warnings = warnings;\n m_warning_list = warning_list;\n Q_EMIT warningsChanged();\n@@ -821,6 +827,7 @@ void NodeModel::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo\n setBlockTipHeight(tip_info.block_height);\n setVerificationProgress(tip_info.verification_progress);\n setBlockSyncActive(initial_block_download);\n+ Q_EMIT blockTipTimeChanged(m_block_tip_time);\n }\n // LoadChainTip emits an INIT_DOWNLOAD notification even on a caught-up\n // restart. Core's IBD flag only latches false: preserve a newer POST_INIT\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 835,
"evidence_id": "212a1720fa3f44c9b8f43694898a0d22",
"finding_id": "finding:1",
"kind": "new_source",
"line": 686,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"path": "qml/models/nodemodel.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 5,
"source_job_id": 2907,
"text": " }\n if (dismissals_changed) QSettings{}.setValue(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS), m_dismissed_warnings);\n m_warnings = warnings;\n m_warning_list = warning_list;\n Q_EMIT warningsChanged();\n}\n\nQStringList NodeModel::activeWarningList() const\n{\n QStringList active;\n for (const QString& warning : m_warning_list) {\n if (!m_dismissed_warnings.contains(warning)) active.push_back(warning);\n }\n return active;\n}\n\nQStringList NodeModel::dismissedWarningList() const\n{\n QStringList dismissed;\n for (const QString& warning : m_warning_list) {\n if (m_dismissed_warnings.contains(warning)) dismissed.push_back(warning);\n }\n return dismissed;\n}\n\nvoid NodeModel::dismissWarnings(const QStringList& warnings)\n{\n bool changed{false};\n for (const QString& warning : warnings) {\n if (warning.isEmpty() || m_dismissed_warnings.contains(warning)) continue;\n m_dismissed_warnings.push_back(warning);\n changed = true;\n }\n if (!changed) return;\n constexpr qsizetype MAX_DISMISSED_WARNINGS{50};\n while (m_dismissed_warnings.size() > MAX_DISMISSED_WARNINGS) m_dismissed_warnings.removeFirst();\n QSettings{}.setValue(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS), m_dismissed_warnings);\n Q_EMIT warningsChanged();\n}\n\nvoid NodeModel::restoreDismissedWarnings()\n{\n if (m_dismissed_warnings.isEmpty()) return;\n m_dismissed_warnings.clear();\n QSettings{}.remove(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS));\n Q_EMIT warningsChanged();\n}\n\nvoid NodeModel::showStartupWarnings()\n{\n if (m_startup_warning_messages.isEmpty()) {\n return;\n }\n\n const QString warnings{m_startup_warning_messages.join(QStringLiteral(\"\\n\\n\"))};\n m_startup_warning_messages.clear();\n // MSG_WARNING is modal; startup notices should be shown once without blocking initialization.\n showRuntimeDialogOnGuiThread(warnings, CClientUIInterface::ICON_WARNING, /*question=*/false);\n}\n\nvoid NodeModel::recordStartupErrorMessage(const QString& message)\n{\n const QString error{message.trimmed()};\n if (error.isEmpty() || m_startup_error_messages.contains(error)) {\n return;\n }\n m_startup_error_messages.push_back(error);\n}\n\nvoid NodeModel::recordStartupWarningMessage(const QString& message)\n{\n const QString warning{message.trimmed()};\n if (warning.isEmpty() || m_startup_warning_messages.contains(warning)) {\n return;\n }\n m_startup_warning_messages.push_back(warning);\n}\n\nvoid NodeModel::startNodeInitializionThread()\n{\n if (m_initialization_requested) {\n return;\n }\n m_initialization_requested = true;\n Q_EMIT requestedInitialize();\n}\n\nvoid NodeModel::requestShutdown()\n{\n if (m_fatal_exception) {\n std::_Exit(EXIT_FAILURE);\n }\n if (m_shutdown_requested) {\n return;\n }\n m_shutdown_requested = true;\n Q_EMIT networkActionReadyChanged();\n while (m_runtime_dialog_active) answerRuntimeDialog(CClientUIInterface::BTN_CANCEL);\n stopShutdownPolling();\n Q_EMIT requestedShutdown();\n}\n\nvoid NodeModel::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info, bool initial_block_download, bool shutdown_requested)\n{\n if (m_workers_stopping || m_fatal_exception) return;\n if (success && (m_shutdown_requested || shutdown_requested)) {\n requestShutdown();\n return;\n }\n\n if (!success) {\n if (m_startup_failure_dialog_shown) {\n requestShutdown();\n Q_EMIT nodeInitialized();\n return;\n }\n setErrorState(true);\n refreshStatus();\n QString startup_error{m_startup_error_messages.isEmpty() ? tr(\"Node initialization failed.\") : m_startup_error_messages.join(QStringLiteral(\"\\n\\n\"))};\n if (!m_startup_warning_messages.isEmpty()) {\n startup_error = tr(\"Startup warnings:\") + QStringLiteral(\"\\n\") + m_startup_warning_messages.join(QStringLiteral(\"\\n\\n\")) + QStringLiteral(\"\\n\\n\") + startup_error;\n }\n m_startup_warning_messages.clear();\n setStartupError(startup_error);\n if (shutdown_requested) {\n requestShutdown();\n }\n } else {\n m_backend_queries_ready = true;\n Q_EMIT networkActionReadyChanged();\n if (m_mempool_info_polling_active) {\n QMetaObject::invokeMethod(m_mempool_info_timer, [timer = m_mempool_info_timer] { timer->start(); }, Qt::QueuedConnection);\n }\n m_startup_error_messages.clear();\n m_runtime_dialogs_enabled = true;\n showStartupWarnings();\n {\n const QScopedValueRollback applying{m_applying_sync_snapshot, true};\n publishNotifications();\n if (!m_seen_block_tip) {\n m_block_tip_time = tip_info.block_time;\n setBlockTipHeight(tip_info.block_height);\n setVerificationProgress(tip_info.verification_progress);\n setBlockSyncActive(initial_block_download);\n Q_EMIT blockTipTimeChanged(m_block_tip_time);\n }\n // LoadChainTip emits an INIT_DOWNLOAD notification even on a caught-up\n // restart. Core's IBD flag only latches false: preserve a newer POST_INIT\n // notification, but let this final startup result clear the init flag.\n if (!initial_block_download) setBlockSyncActive(false);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c693949d1a33..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#1142 | Payment and PSBT import errors bypass translationqml/paymentimport.cpp | still_present | AssessmentThe new-head ReadSource excerpt still constructs malformed-PSBT and unsupported-source errors with QStringLiteral. The reported errors therefore remain literal rather than translated through the operation. new_source: qml/paymentimport.cpp [
{
"bounded": true,
"end_line": 219,
"evidence_id": "3ff0db4e199346f597ccc4228a3720d8",
"finding_id": "finding:4",
"kind": "new_source",
"line": 70,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "346fbd99d01f51c571f699985e2a636e5afab78e",
"path": "qml/paymentimport.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 10,
"source_job_id": 2900,
"text": " bytes = value.toUtf8();\n }\n Inspection result;\n result.field = input.field;\n result.source_identity = QString::fromLatin1(QCryptographicHash::hash(bytes, QCryptographicHash::Sha256).toHex()) + QLatin1Char(':') +\n QString::fromLatin1(QCryptographicHash::hash(identity_path.toUtf8(), QCryptographicHash::Sha256).toHex());\n const auto text = QString::fromUtf8(bytes).trimmed();\n if (text.startsWith(QStringLiteral(\"bitcoin:\"), Qt::CaseInsensitive)) {\n const auto payment = BitcoinUri::Parse(text);\n if (!payment.success) return Invalid(payment.error);\n if (payment.address.size() > 1024 || payment.label.size() > senddraft::Limits::note ||\n payment.message.size() > senddraft::Limits::message) return Invalid(QStringLiteral(\"The payment request metadata is too large.\"));\n result.kind = Kind::Payment;\n result.payment.address = payment.address;\n result.payment.label = payment.label;\n result.payment.message = payment.message;\n if (payment.has_amount) result.payment.amount = payment.amount_sats;\n result.payment_identity = PaymentIdentity(result.payment);\n // Public URI fields never manufacture a user-authored private note.\n return result;\n }\n const auto raw = DecodeRawPSBT(std::as_bytes(std::span{bytes.constData(), static_cast<size_t>(bytes.size())}));\n auto document = raw ? std::optional<PartiallySignedTransaction>{*raw} : std::nullopt;\n if (!document) {\n const auto decoded = DecodeBase64PSBT(text.toStdString());\n if (decoded) document = *decoded;\n }\n if (!document) return Invalid(QStringLiteral(\"The source is not a supported payment request or PSBT.\"));\n const auto transaction = document->GetUnsignedTx();\n if (!transaction || transaction->vin.empty() || transaction->vout.empty() ||\n document->inputs.size() != transaction->vin.size() || document->outputs.size() != transaction->vout.size())\n return Invalid(QStringLiteral(\"The PSBT is malformed.\"));\n auto parsed = std::make_shared<psbtwork::Snapshot>();\n parsed->document = std::make_shared<const PartiallySignedTransaction>(std::move(*document));\n result.kind = Kind::Psbt;\n result.psbt = std::move(parsed);\n return result;\n}\n\nInspection AnalyzeSource(const Inspection& source, const psbtfee::Lookup& lookup)\n{\n if (source.kind != Kind::Psbt || !source.psbt || !source.psbt->document) return Invalid(QStringLiteral(\"No PSBT is available for inspection.\"));\n psbtwork::Request request;\n request.kind = psbtwork::Kind::Inspect;\n request.document = source.psbt->document;\n psbtwork::Context context; context.lookup = lookup;\n const auto analyzed = psbtwork::Execute(nullptr, std::move(request), context);\n if (!analyzed.snapshot) return Invalid(analyzed.error.isEmpty() ? QStringLiteral(\"The PSBT could not be inspected.\") : analyzed.error);\n auto result = source;\n result.psbt = analyzed.snapshot;\n return result;\n}\n\nstruct Owner::Reply {\n std::optional<Target> target;\n std::optional<ChildReply> child;\n std::exception_ptr error;\n};\nstruct Owner::Delivery {\n struct Cell {\n std::mutex mutex;\n bool ready{false};\n Reply reply;\n };\n std::shared_ptr<Cell> cell;\n std::shared_ptr<void> outcome;\n ReplyKind kind;\n std::optional<Child> child;\n uint64_t identity{0}, source{0}, target{0};\n void complete(Reply value)\n {\n std::shared_ptr<void> release;\n {\n std::lock_guard lock{cell->mutex};\n if (!cell->ready) {\n cell->reply = std::move(value);\n cell->ready = true;\n release = std::move(outcome);\n }\n }\n release.reset();\n }\n};\nstruct Owner::State {\n Flow flow;\n std::shared_ptr<const Input> input;\n std::shared_ptr<const Inspection> inspection;\n std::shared_ptr<const TargetPort> target;\n std::shared_ptr<const ChildReply> result;\n std::map<uint64_t, std::shared_ptr<Delivery>> deliveries;\n uint64_t sequence{0}, target_sequence{0}, delivery_sequence{0}, query_delivery{0};\n size_t native_jobs{0};\n QString error;\n bool closing{false}, retired{false}, wake_pending{false}, use_requested{false};\n std::chrono::steady_clock::time_point retry_at{};\n};\nOwner::Owner(uint64_t identity, Services services, Notify notify, Retired retired, std::shared_ptr<State> state)\n : m_identity(identity), m_services(std::move(services)),\n m_outcomes(std::make_shared<execution::ValueCleanupQueue>(m_services.outcomes)), m_notify(std::move(notify)),\n m_retired(std::move(retired)), m_state(std::move(state)) {}\n\nstd::shared_ptr<Owner> Owner::Create(uint64_t identity, Services services, Notify notify, Retired retired)\n{\n if (!identity || !services.reads || !services.outcomes) return {};\n if (!services.read) services.read = ReadSource;\n if (!services.analyze) services.analyze = [](const Inspection& source) { return AnalyzeSource(source); };\n if (!services.now) services.now = std::chrono::steady_clock::now;\n auto owner = std::shared_ptr<Owner>{new Owner(identity, std::move(services), std::move(notify),\n std::move(retired), std::make_shared<State>())};\n auto closing = std::make_shared<std::shared_ptr<Owner>>();\n auto reservation = owner->m_outcomes->hold([closing] {\n if (*closing) (*closing)->closeOnQueue();\n });\n if (!reservation) return owner;\n owner->m_post_close = [closing, reservation = std::move(reservation)](auto self) mutable {\n *closing = std::move(self);\n reservation.reset();\n };\n return owner;\n}\n\nexecution::SubmitResult Owner::submit(std::function<void()> decision)\n{\n auto run = [self = shared_from_this(), decision = std::move(decision)] {\n decision(); self->publish();\n };\n const bool accepted = m_services.outcomes->post(std::move(run));\n return {{}, accepted ? execution::Rejection::None : execution::Rejection::Transport};\n}\n\nvoid Owner::publish()\n{\n auto& state = *m_state;\n Snapshot snapshot;\n snapshot.sequence = ++state.sequence; snapshot.owner = m_identity; snapshot.source = state.flow.source();\n snapshot.phase = state.flow.phase(); snapshot.kind = state.flow.kind(); snapshot.error_code = state.flow.error();\n snapshot.error = state.error; snapshot.target = state.flow.target(); snapshot.prompt = state.flow.prompt();\n snapshot.result = state.flow.result(); snapshot.inspection = state.inspection; snapshot.child_result = state.result;\n snapshot.pending = state.flow.pending() || state.native_jobs || !state.deliveries.empty();\n if (snapshot.phase == Phase::Closed && snapshot.pending) snapshot.phase = Phase::Closing;\n snapshot.can_apply = state.flow.canApply(); snapshot.can_review = state.flow.canReview();\n snapshot.can_export = state.flow.canExport(); snapshot.can_reconcile = state.flow.canReconcile();\n try { if (m_notify) m_notify(std::move(snapshot)); } catch (...) {}\n if (state.flow.phase() == Phase::Closed && !state.native_jobs && state.deliveries.empty() && !state.retired) {\n state.retired = true;\n state.target.reset();\n state.result.reset();\n state.input.reset();\n state.inspection.reset();\n if (m_retired) m_retired(m_identity);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 346fbd99d01f..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Late repairs leave already-fixed regressions in the area commitsqml/bitcoin.cpp | unclear | AssessmentThe supplied bitcoin.cpp evidence shows source changes but does not establish whether the startup and dialog repairs were folded into the commits where those behaviors first appeared. The concern is about series history and review flow, which these excerpts do not show. path_diff: qml/bitcoin.cpp; new_source: qml/bitcoin.cpp [
{
"evidence_id": "994e488a7daa4479a22f9fc9fb18e725",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "346fbd99d01f51c571f699985e2a636e5afab78e",
"path": "qml/bitcoin.cpp",
"source_generation": 10,
"source_job_id": 2900,
"text": "diff --git a/qml/bitcoin.cpp b/qml/bitcoin.cpp\nindex c14cacac63..a1e12b7721 100644\n--- a/qml/bitcoin.cpp\n+++ b/qml/bitcoin.cpp\n@@ -7,7 +7,7 @@\n #include <qml/atomicsharedptr.h>\n #include <bitcoin-build-config.h> // IWYU pragma: keep\n \n-#include <qml/models/backuppolicyoperation.h>\n+#include <qml/models/filesaveoperation.h>\n #include <qml/bitcoin.h>\n #include <qml/bitcoinqmlapplication.h>\n \n@@ -25,8 +25,7 @@\n #include <noui.h>\n #include <qml/appmode.h>\n #include <qml/applicationmodels.h>\n-#include <qml/backendexecutor.h>\n-#include <qml/models/imageexportoperation.h>\n+#include <qml/executor.h>\n #include <qml/components/ownedqrimage.h>\n #include <qml/buttonkeyactivation.h>\n #include <qml/quithandler.h>\n@@ -61,6 +60,20 @@\n #include <qml/models/banlistmodel.h>\n #include <qml/models/bitcoinaddress.h>\n #include <qml/models/bitcoinurimodel.h>\n+#include <qml/models/sendimportmodel.h>\n+#include <qml/models/preparationoperation.h>\n+#include <qml/models/psbtoperation.h>\n+#include <qml/models/paymentrequestdeletecontroller.h>\n+#include <qml/models/paymentrequestviewcontroller.h>\n+#include <qml/models/senddraftcontroller.h>\n+#include <qml/models/feebumpcontroller.h>\n+#include <qml/models/walletbackupcontroller.h>\n+#include <qml/models/walletpasswordcontroller.h>\n+#include <qml/models/settingsnavigationcontroller.h>\n+#include <qml/models/senddraftinterface.h>\n+#include <qml/models/sendoperation.h>\n+#include <qml/models/transactionreviewcontroller.h>\n+#include <qml/models/transactionreviewinterface.h>\n #include <qml/models/blockclockmodel.h>\n #include <qml/models/blockclockhistory.h>\n #include <qml/models/chainmodel.h>\n@@ -74,13 +87,14 @@\n #include <qml/models/desktoptrayiconcontroller.h>\n #include <qml/models/desktopwindowbehaviormodel.h>\n #include <qml/models/onboardingoptionsmodel.h>\n-#include <qml/models/options_model.h>\n+#include <qml/models/settingsmodel.h>\n #include <qml/models/uipreferences.h>\n #include <qml/models/peerdetailsmodel.h>\n #include <qml/models/peercommandmodel.h>\n+#include <qml/models/peercommandcontroller.h>\n #include <qml/models/peercommandoperation.h>\n #include <qml/models/peerselectionmodel.h>\n-#include <qml/models/peerlistsortproxy.h>\n+#include <qml/models/peerlistproxymodel.h>\n #include <qml/models/peerlistmodel.h>\n #include <qml/models/rpcconsolemodel.h>\n #include <qml/models/settings_keys.h>\n@@ -106,26 +120,31 @@\n #include <qml/models/activityexportoperation.h>\n #include <qml/models/addresslistmodel.h>\n #include <qml/models/bumptransactionmodel.h>\n-#include <qml/models/paymentrequest.h>\n #include <qml/models/sendrecipient.h>\n #include <qml/models/walletlistmodel.h>\n #include <qml/models/walletselectionmodel.h>\n #include <qml/models/walletcreationmodel.h>\n #include <qml/models/walletoperationpresentationmodel.h>\n-#include <qml/models/walletqmlmodel.h>\n-#include <qml/models/walletqmlmodeltransaction.h>\n+#include <qml/models/coinslistmodel.h>\n+#include <qml/models/sendrecipientslistmodel.h>\n+#include <qml/models/walletmodel.h>\n+#include <qml/models/walletimporttarget.h>\n+#include <qml/models/transactionreviewmodel.h>\n #include <qml/models/fileexportoperation.h>\n-#include <qml/walletqmlcontroller.h>\n+#include <qml/walletcontroller.h>\n #endif\n \n #include <algorithm>\n+#include <array>\n #include <cassert>\n #include <cstdio>\n #include <atomic>\n #include <exception>\n #include <functional>\n #include <memory>\n+#include <mutex>\n #include <optional>\n+#include <utility>\n #include <vector>\n \n #include <QApplication>\n@@ -271,13 +290,14 @@ bool StartupErrorInWindow(QQuickWindow& window, const QString& summary, QmlQuitH\n }\n \n bool InitErrorMessageBox(\n- const QString& summary, const execution::SnapshotServices& services,\n+ const QString& summary, presentation::Post post,\n+ execution::Executor& executor, execution::Lane preferences_lane,\n std::shared_ptr<const startupdiagnostics::Collection> full_message,\n QmlQuitHandler& quit_handler,\n const std::function<void(QQmlApplicationEngine&)>& engine_created,\n- StartupDiagnosticsModel* existing_details = nullptr,\n+ PresentationServices& diagnostics, StartupDiagnosticsModel* existing_details = nullptr,\n std::shared_ptr<std::atomic_bool> diagnostic_loss = {},bool wallet_enabled=false,\n- PresentationServices* presentation_services = nullptr)\n+ PresentationServices* presentation_services = nullptr, const QString& automation_socket = {})\n {\n static AppMode error_app_mode = SetupAppMode(wallet_enabled);\n error_app_mode.setWalletEnabled(wallet_enabled);\n@@ -291,8 +311,9 @@ bool InitErrorMessageBox(\n startup::ErrorDetails details_owner;\n const auto engine = CreateInitErrorEngine();\n engine_created(*engine);\n- startup::InstallPreferences(*engine, services, UiPreferencesNamespace::Capture(), startup::PreferencesPhase::ErrorHandoff);\n- details_owner = startup::PrepareErrorDetails(services, summary, std::move(full_message), existing_details, diagnostic_loss);\n+ startup::InstallPreferences(*engine, executor, preferences_lane, post,\n+ UiPreferencesNamespace::Capture(), startup::PreferencesPhase::ErrorHandoff);\n+ details_owner = startup::PrepareErrorDetails(std::move(post), summary, std::move(full_message), existing_details, diagnostic_loss, diagnostics);\n auto* details = details_owner.model;\n if (details_owner.replacement_message) engine->rootContext()->setContextProperty(\"message\", *details_owner.replacement_message);\n if (engine->rootContext()->contextProperty(\"message\").isNull()) engine->rootContext()->setContextProperty(\"message\", summary);\n@@ -307,6 +328,13 @@ bool InitErrorMessageBox(\n return EXIT_FAILURE;\n }\n auto* window = qobject_cast<QQuickWindow*>(engine->rootObjects().first());\n+#ifdef ENABLE_TEST_AUTOMATION\n+ // Functional tests read and close a startup error shown before any other window.\n+ std::unique_ptr<TestBridge> test_bridge;\n+ if (!automation_socket.isEmpty()) test_bridge = std::make_unique<TestBridge>(engine.get(), automation_socket);\n+#else\n+ Q_UNUSED(automation_socket);\n+#endif\n if (window) ExecStartupDialog(*engine, *window, quit_handler);\n return false;\n }\n@@ -419,11 +447,7 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n QQmlEngine::setObjectOwnership(bitcoin_uri_model_instance, QQmlEngine::CppOwnership);\n return bitcoin_uri_model_instance;\n });\n- qmlRegisterUncreatableType<ImageExportOperation>(\"org.bitcoincore.qt\", 1, 0, \"ImageExportOperation\", \"Owned by an image export request\");\n- qmlRegisterUncreatableType<BackupFileOperation>(\"org.bitcoincore.qt\", 1, 0, \"BackupFileOperation\", \"Owned by a backup request\");\n-#ifdef ENABLE_WALLET\n- qmlRegisterUncreatableType<FileExportOperationModel>(\"org.bitcoincore.qt\", 1, 0, \"FileExportOperationModel\", \"Owned by a file export request\");\n-#endif\n+ qmlRegisterUncreatableType<FileSaveOperation>(\"org.bitcoincore.qt\", 1, 0, \"FileSaveOperation\", \"Started by a save request\");\n qmlRegisterSingletonType<GlobalSettings>(\"org.bitcoincore.qt\", 1, 0, \"GlobalSettings\", [](QQmlEngine*, QJSEngine*) -> QObject* {\n return new GlobalSettings(QStringLiteral(QAPP_APP_NAME_DEFAULT));\n });\n@@ -440,6 +464,8 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qmlRegisterUncreatableType<PeerDetailsModel>(\"org.bitcoincore.qt\", 1, 0, \"PeerDetailsModel\", \"\");\n qmlRegisterUncreatableType<PeerCommandModel>(\"org.bitcoincore.qt\", 1, 0, \"PeerCommandModel\", \"Application peer commands\");\n qmlRegisterUncreatableType<PeerCommandOperation>(\"org.bitcoincore.qt\", 1, 0, \"PeerCommandOperation\", \"Captured peer command\");\n+ qmlRegisterUncreatableType<PeerActionsInterface>(\"org.bitcoincore.qt\", 1, 0, \"PeerActionsInterface\", \"A peer\");\n+ qmlRegisterType<PeerCommandController>(\"org.bitcoincore.qt\", 1, 0, \"PeerCommandController\");\n qmlRegisterType<PeerSelectionModel>(\"org.bitcoincore.qt\", 1, 0, \"PeerSelectionModel\");\n qRegisterMetaType<PeerCommandResult>();\n qmlRegisterUncreatableMetaObject(PeerCommandResult::staticMetaObject, \"org.bitcoincore.qt\", 1, 0, \"PeerCommandResult\", \"Retained peer result\");\n@@ -452,20 +478,34 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qmlRegisterUncreatableMetaObject(SettingsSaveResult::staticMetaObject,\"org.bitcoincore.qt\",1,0,\"SettingsSaveResult\",\"Retained settings outcome\");\n qRegisterMetaType<SettingsSaveResult>();\n qmlRegisterUncreatableType<SettingsEditorModel>(\"org.bitcoincore.qt\",1,0,\"SettingsEditorModel\",\"Owned by the settings form\");\n+ qmlRegisterUncreatableType<SettingsEditorFactoryInterface>(\"org.bitcoincore.qt\",1,0,\"SettingsEditorFactoryInterface\",\"The options\");\n+ qmlRegisterType<SettingsNavigationController>(\"org.bitcoincore.qt\",1,0,\"SettingsNavigationController\");\n qmlRegisterUncreatableType<SettingsEntryModel>(\"org.bitcoincore.qt\",1,0,\"SettingsEntryModel\",\"Owned by a settings editor\");\n qmlRegisterUncreatableType<CoreSettingsModel>(\"org.bitcoincore.qt\",1,0,\"CoreSettingsModel\",\"Owned by settings\");\n- qmlRegisterUncreatableType<CoreProxyDraft>(\"org.bitcoincore.qt\",1,0,\"CoreProxyDraft\",\"Owned by a settings form\");\n- qmlRegisterUncreatableType<OptionsTransactionLinks>(\"org.bitcoincore.qt\", 1, 0, \"OptionsTransactionLinks\", \"Owned by options\");\n+ qmlRegisterType<CoreProxyDraft>(\"org.bitcoincore.qt\",1,0,\"CoreProxyDraft\");\n+ qmlRegisterType<OptionsTransactionLinks>(\"org.bitcoincore.qt\", 1, 0, \"OptionsTransactionLinks\");\n qmlRegisterUncreatableType<FlowDetailsModel>(\"org.bitcoincore.qt\", 1, 0, \"FlowDetailsModel\", \"Owned by a transaction review\");\n qmlRegisterUncreatableType<DebugLogModel>(\"org.bitcoincore.qt\", 1, 0, \"DebugLogModel\", \"\");\n qmlRegisterUncreatableType<RpcConsoleModel>(\"org.bitcoincore.qt\", 1, 0, \"RpcConsoleModel\", \"\");\n qmlRegisterType<MonospaceOutputModel>(\"org.bitcoincore.qt\", 1, 0, \"MonospaceOutputModel\");\n qmlRegisterType<BitcoinAmount>(\"org.bitcoincore.qt\", 1, 0, \"BitcoinAmount\");\n qmlRegisterType<BitcoinAddress>(\"org.bitcoincore.qt\", 1, 0, \"BitcoinAddress\");\n+ qmlRegisterUncreatableType<ImportOperation>(\"org.bitcoincore.qt\", 1, 0, \"ImportOperation\", \"An import owned by its source\");\n+ qmlRegisterUncreatableType<ImportTarget>(\"org.bitcoincore.qt\", 1, 0, \"ImportTarget\", \"A send draft\");\n+ qmlRegisterType<SendImportModel>(\"org.bitcoincore.qt\", 1, 0, \"SendImportModel\");\n+ qmlRegisterUncreatableType<SendOperation>(\"org.bitcoincore.qt\", 1, 0, \"SendOperation\", \"Started by a wallet\");\n+ qmlRegisterUncreatableType<PsbtOperation>(\"org.bitcoincore.qt\", 1, 0, \"PsbtOperation\", \"Started by a wallet\");\n+ qmlRegisterUncreatableType<PreparationOperation>(\"org.bitcoincore.qt\", 1, 0, \"PreparationOperation\", \"Started by a wallet\");\n+ qmlRegisterUncreatableType<SendDraftInterface>(\"org.bitcoincore.qt\", 1, 0, \"SendDraftInterface\", \"A wallet\");\n+ qmlRegisterType<SendDraftController>(\"org.bitcoincore.qt\", 1, 0, \"SendDraftController\");\n+ qmlRegisterUncreatableType<TransactionReviewInterface>(\"org.bitcoincore.qt\", 1, 0, \"TransactionReviewInterface\", \"A wallet\");\n+ qmlRegisterType<TransactionReviewController>(\"org.bitcoincore.qt\", 1, 0, \"TransactionReviewController\");\n #ifdef ENABLE_WALLET\n qmlRegisterUncreatableType<PaymentImportOperation>(\"org.bitcoincore.qt\", 1, 0, \"PaymentImportOperation\", \"Owned by an import request\");\n+ qmlRegisterType<WalletImportTarget>(\"org.bitcoincore.qt\", 1, 0, \"WalletImportTarget\");\n #else\n qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"PaymentImportOperation\", \"Wallet support is not compiled\");\n+ qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"WalletImportTarget\", \"Wallet support is not compiled\");\n #endif\n qmlRegisterType<ExactTextDocument>(\"org.bitcoincore.qt\", 1, 0, \"ExactTextDocument\");\n qmlRegisterUncreatableType<TextEditSessionModel>(\"org.bitcoincore.qt\", 1, 0, \"TextEditSessionModel\", \"Owned by an editor factory\");\n@@ -473,11 +513,12 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qmlRegisterUncreatableType<TextEditClosePrompt>(\"org.bitcoincore.qt\", 1, 0, \"TextEditClosePrompt\", \"Owned by an editor\");\n qRegisterMetaType<TextEditError>(); qRegisterMetaType<TextEditSaveResult>(); qRegisterMetaType<TextEditConflict>(); qRegisterMetaType<QList<TextEditConflict>>();\n #ifdef ENABLE_WALLET\n- qRegisterMetaType<ActivityExportResult>();\n- qmlRegisterUncreatableType<ActivityExportOperation>(\"org.bitcoincore.qt\", 1, 0, \"ActivityExportOperation\", \"Owned by the original export action\");\n+ qmlRegisterType<PaymentRequestDeleteController>(\"org.bitcoincore.qt\", 1, 0, \"PaymentRequestDeleteController\");\n+ qmlRegisterType<PaymentRequestViewController>(\"org.bitcoincore.qt\", 1, 0, \"PaymentRequestViewController\");\n qmlRegisterType<ActivityFilterProxyModel>(\"org.bitcoincore.qt\", 1, 0, \"ActivityFilterProxyModel\");\n- qmlRegisterUncreatableType<TransactionActivityModel>(\"org.bitcoincore.qt\", 1, 0, \"TransactionActivityModel\", \"Owned by WalletQmlModel\");\n+ qmlRegisterUncreatableType<TransactionActivityModel>(\"org.bitcoincore.qt\", 1, 0, \"TransactionActivityModel\", \"Owned by WalletModel\");\n qmlRegisterUncreatableType<ActivityDetailModel>(\"org.bitcoincore.qt\", 1, 0, \"ActivityDetailModel\", \"Owned by an Activity view\");\n+ qmlRegisterType<ActivityDetailController>(\"org.bitcoincore.qt\", 1, 0, \"ActivityDetailController\");\n qRegisterMetaType<MessageSigningError>(); qRegisterMetaType<MessageVerificationSnapshot>();\n qmlRegisterUncreatableType<SignVerifyMessageModel>(\"org.bitcoincore.qt\", 1, 0, \"SignVerifyMessageModel\", \"Owned by a wallet\");\n qmlRegisterUncreatableType<MessageSigningPrompt>(\"org.bitcoincore.qt\", 1, 0, \"MessageSigningPrompt\", \"Owned by a signing attempt\");\n@@ -485,7 +526,7 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qmlRegisterUncreatableType<SignerDiscoveryModel>(\"org.bitcoincore.qt\", 1, 0, \"SignerDiscoveryModel\", \"Owned by application signer discovery\");\n qmlRegisterUncreatableMetaObject(SignerDiscoveryError::staticMetaObject, \"org.bitcoincore.qt\", 1, 0, \"SignerDiscoveryError\", \"Error value\");\n qRegisterMetaType<SignerDiscoveryError>();\n- qmlRegisterUncreatableType<WalletCreationModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationModel\", \"Owned by a creation form\");\n+ qmlRegisterType<WalletCreationModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationModel\");\n qmlRegisterUncreatableType<WalletCreationText>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationText\", \"Owned by a creation form\");\n qmlRegisterUncreatableType<WalletOperationModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletOperationModel\", \"Owned by an immutable wallet operation\");\n qmlRegisterUncreatableType<WalletOperationPrompt>(\"org.bitcoincore.qt\", 1, 0, \"WalletOperationPrompt\", \"Owned by an immutable wallet operation\");\n@@ -493,48 +534,70 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qRegisterMetaType<WalletOperationError>(); qRegisterMetaType<WalletOperationResult>(); qRegisterMetaType<WalletCreationReceipt>();\n qmlRegisterUncreatableType<WalletProvisioningCheck>(\"org.bitcoincore.qt\", 1, 0, \"WalletProvisioningCheck\", \"Owned by the wallet controller\");\n qmlRegisterUncreatableType<WalletSelectionModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletSelectionModel\", \"Owned by a window\");\n- qmlRegisterType<PaymentRequest>(\"org.bitcoincore.qt\", 1, 0, \"PaymentRequest\");\n+ qmlRegisterUncreatableType<WalletNamesController>(\"org.bitcoincore.qt\", 1, 0, \"WalletNamesController\", \"Owned by the wallet controller\");\n+ qmlRegisterUncreatableType<WalletCreationController>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationController\", \"Owned by the wallet controller\");\n RegisterReceiveTypes();\n qmlRegisterUncreatableType<ReceiveRequestOperation>(\"org.bitcoincore.qt\", 1, 0, \"ReceiveRequestOperation\", \"Owned by a receive request command\");\n qmlRegisterUncreatableType<Transaction>(\"org.bitcoincore.qt\", 1, 0, \"Transaction\", \"\");\n qmlRegisterUncreatableType<FeeSelectionModel>(\"org.bitcoincore.qt\", 1, 0, \"FeeSelectionModel\", \"\");\n qmlRegisterUncreatableType<FeeRateEntry>(\"org.bitcoincore.qt\", 1, 0, \"FeeRateEntry\", \"\");\n qmlRegisterUncreatableType<SendRecipient>(\"org.bitcoincore.qt\", 1, 0, \"SendRecipient\", \"\");\n+ qmlRegisterUncreatableType<SendRecipientsListModel>(\"org.bitcoincore.qt\", 1, 0, \"SendRecipientsListModel\", \"Owned by a wallet\");\n+ qmlRegisterUncreatableType<CoinsListModel>(\"org.bitcoincore.qt\", 1, 0, \"CoinsListModel\", \"Owned by a wallet\");\n \n qmlRegisterUncreatableType<BumpTransactionModel>(\"org.bitcoincore.qt\", 1, 0, \"BumpTransactionModel\",\n \"BumpTransactionModel cannot be instantiated from QML\");\n+ qmlRegisterUncreatableType<WalletSecurityInterface>(\"org.bitcoincore.qt\", 1, 0, \"WalletSecurityInterface\", \"A wallet\");\n+ qmlRegisterUncreatableType<SecurityOperation>(\"org.bitcoincore.qt\", 1, 0, \"SecurityOperation\", \"Started by a wallet\");\n+ qmlRegisterType<WalletPasswordController>(\"org.bitcoincore.qt\", 1, 0, \"WalletPasswordController\");\n+ qmlRegisterUncreatableType<WalletBackupInterface>(\"org.bitcoincore.qt\", 1, 0, \"WalletBackupInterface\", \"A wallet\");\n+ qmlRegisterType<WalletBackupController>(\"org.bitcoincore.qt\", 1, 0, \"WalletBackupController\");\n+ qmlRegisterUncreatableType<FeeBumpOperation>(\"org.bitcoincore.qt\", 1, 0, \"FeeBumpOperation\", \"Opened by a FeeBumpController\");\n+ qmlRegisterUncreatableType<FeeBumpInterface>(\"org.bitcoincore.qt\", 1, 0, \"FeeBumpInterface\", \"A wallet\");\n+ qmlRegisterType<FeeBumpController>(\"org.bitcoincore.qt\", 1, 0, \"FeeBumpController\");\n qmlRegisterUncreatableType<WalletSecurityModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletSecurityModel\", \"Owned by a wallet opening\");\n qmlRegisterUncreatableType<SecurityOperationModel>(\"org.bitcoincore.qt\", 1, 0, \"SecurityOperationModel\", \"Owned by a security command\");\n- qmlRegisterUncreatableType<WalletQmlModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletQmlModel\",\n- \"WalletQmlModel cannot be instantiated from QML\");\n- qmlRegisterUncreatableType<WalletQmlModelTransaction>(\"org.bitcoincore.qt\", 1, 0, \"WalletQmlModelTransaction\",\n- \"WalletQmlModelTransaction cannot be instantiated from QML\");\n+ qmlRegisterUncreatableType<WalletModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletModel\",\n+ \"WalletModel cannot be instantiated from QML\");\n+ qmlRegisterUncreatableType<WalletCloseQuestion>(\"org.bitcoincore.qt\", 1, 0, \"WalletCloseQuestion\", \"Owned by a wallet\");\n+ qmlRegisterUncreatableType<TransactionReviewModel>(\"org.bitcoincore.qt\", 1, 0, \"TransactionReviewModel\",\n+ \"TransactionReviewModel cannot be instantiated from QML\");\n qmlRegisterUncreatableType<WalletListModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletListModel\",\n \"WalletListModel cannot be instantiated from QML\");\n #else\n- qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"ActivityExportOperation\", \"Wallet support is not compiled\");\n qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"ActivityFilterProxyModel\", \"Wallet support is not compiled\");\n qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"TransactionActivityModel\", \"Wallet support is not compiled\");\n qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"ActivityDetailModel\", \"Wallet support is not compiled\");\n+ qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"ActivityDetailController\", \"Wallet support is not compiled\");\n qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"SignVerifyMessageModel\", \"Wallet support is not compiled\");\n qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1,\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 952,
"evidence_id": "2e2523153df94ef9ad8c3e697dbdabf7",
"finding_id": "finding:3",
"kind": "new_source",
"line": 803,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "346fbd99d01f51c571f699985e2a636e5afab78e",
"path": "qml/bitcoin.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 10,
"source_job_id": 2900,
"text": "}\n#endif\n}\n\nint BitcoinQmlApplication::run(int argc, char* argv[])\n{\n // The process sink outlives QApplication, including destructor diagnostics.\n // Its only synchronous join occurs after GUI lifetime has ended.\n qtlog::NativeSink qt_log_sink{WriteQtLog};\n const auto diagnostic_loss = std::make_shared<std::atomic_bool>(false);\n g_qt_log_queue.store(qt_log_sink.queue());\n g_qt_fatal_policy.store(qtlog::CaptureFatalPolicy());\n const auto previous_log_handler = qInstallMessageHandler(StartupDebugMessageHandler);\n bool logging_finished{false};\n const auto finish_qt_logging = [&] {\n if (std::exchange(logging_finished, true)) return;\n qInstallMessageHandler(previous_log_handler);\n g_qt_log_queue.store({});\n g_qt_fatal_policy.store({});\n qt_log_sink.finishAfterGui();\n };\n const auto finish_logging_on_exception = qScopeGuard(finish_qt_logging);\n const auto startup_failed=std::make_shared<std::atomic_bool>(false);\n const auto setup_record_failed=std::make_shared<std::atomic_bool>(false);\n const auto core_exit_status=std::make_shared<std::atomic_int>(EXIT_SUCCESS);\n const auto lifecycle_failed=std::make_shared<std::atomic_bool>(false);\n const auto run_gui = [&]() -> int {\n Q_INIT_RESOURCE(bitcoin_qml);\n Q_INIT_RESOURCE(bitcoin_compat);\n qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>(\"interfaces::BlockAndHeaderTipInfo\");\n QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusAllControls);\n // Qt gets a synthetic argument list so it never parses the process command line:\n // a bitcoin: URI from a desktop handler can smuggle options that Qt would consume\n // before Bitcoin Core rejects them. See https://achow101.com/2021/02/0.18-uri-vuln.\n int qt_argc = 1;\n char qt_application_name[]{\"bitcoin-core-app\"};\n char* qt_argv[]{qt_application_name, nullptr};\n QApplication app(qt_argc, qt_argv);\n#ifdef Q_OS_MACOS\n // QMacStyle draws widgets through Cocoa views. With another platform\n // plugin (the test suites use `minimal`) a widget file dialog crashes\n // in QMacStylePrivate::drawNSViewInRect, so use Fusion there.\n if (QGuiApplication::platformName() != QLatin1String(\"cocoa\")) QApplication::setStyle(QStringLiteral(\"Fusion\"));\n#endif\n QmlQuitHandler quit_handler;\n ButtonKeyActivation button_key_activation;\n app.setQuitOnLastWindowClosed(false);\n const auto native_interfaces = std::make_shared<NativeApplicationInterfaces>();\n execution::Executor executor{execution::Executor::Config{}};\n const auto drain_workers_before_application_destruction = qScopeGuard([native_interfaces, &executor] {\n startup::DrainThenRetire([native_interfaces] { native_interfaces->retire(); },\n [&executor] { executor.stopAndJoin(); });\n });\n QQuickStyle::setStyle(QStringLiteral(\"Basic\"));\n\n auto startup_core = executor.makeQueue(execution::Lane::Core);\n auto startup_outcomes = executor.makeQueue(execution::Lane::Utility);\n const auto run_startup = [&](auto work) {\n return startup::Run(&startup_core, &startup_outcomes, std::move(work));\n };\n const auto startup_post = presentation::QueuedPost();\n // A startup error can hold Core until the dialog closes.\n const auto diagnostic_retirement = std::make_shared<execution::SerialQueue>(executor.makeQueue(execution::Lane::Utility));\n PresentationServices startup_diagnostics{{startup_post,\n [diagnostic_retirement](auto work) { return diagnostic_retirement->post(std::move(work)); }, {},\n std::make_shared<execution::SerialQueue>(executor.makeQueue(execution::Lane::Utility))}};\n const auto retire_diagnostic_value = startup_diagnostics.valueRetirement();\n // FileOpen can arrive in the very first startup::Run event loop.\n // Capture owned values now; factory/readiness follow actual Core init.\n DesktopIntentModel desktop_intent_model{executor, startup_post, false};\n desktop_intent_model.installFileOpenHandler();\n std::shared_ptr<desktopintent::transport::Service> desktop_service;\n std::shared_ptr<startup::preparation::Coordinator> startup_preparation;\n std::shared_ptr<execution::OwnedCommand<StartupPreparationSummary>> preparation_summary;\n const auto retire_startup_runtime=[&](std::function<void()> done){\n startup_diagnostics.close();\n desktop_intent_model.close();\n auto service = std::exchange(desktop_service, {});\n if (service) service->close();\n if(startup_preparation)startup_preparation->close();\n if (service) service->stop();\n preparation_summary.reset();\n auto finish = [&app, &startup_diagnostics, service = std::move(service), done = std::move(done)]() mutable {\n QMetaObject::invokeMethod(&app, [&app, &startup_diagnostics, service = std::move(service), done = std::move(done)]() mutable {\n startup_diagnostics.whenRetired(&app, [&app, service = std::move(service), done = std::move(done)]() mutable {\n if (!service || service->retired()) {\n done();\n return;\n }\n const auto acknowledge = [app = &app, done] {\n QMetaObject::invokeMethod(app, done, Qt::QueuedConnection);\n };\n if (service->stop(acknowledge)) return;\n done();\n });\n }, Qt::QueuedConnection);\n };\n auto drain = [&desktop_intent_model, finish = std::move(finish)]() mutable {\n desktop_intent_model.whenDrained(std::move(finish));\n };\n if (startup_preparation) {\n startup_preparation->whenDrained(std::move(drain));\n startup_preparation.reset();\n } else {\n drain();\n }\n };\n const auto retire_startup_before_exit=qScopeGuard([&]{\n QEventLoop retirement;bool drained{false};\n retire_startup_runtime([&]{drained=true;retirement.quit();});\n while(!drained)retirement.exec();\n });\n run_startup([]{noui_connect();SetupEnvironment();return true;});\n auto startup_warnings = startupdiagnostics::Create(retire_diagnostic_value);\n if (!startup_warnings) { qCritical(\"Startup diagnostic retention is unavailable\"); return EXIT_FAILURE; }\n const auto startup_error_reported=std::make_shared<std::atomic_bool>(false);\n const auto wallet_presentation=std::make_shared<std::atomic_bool>(AppMode::walletCompiled());\n bool startup_canceled{false};\n // Set while the onboarding window is open, so startup errors show inside it.\n QPointer<QQuickWindow> startup_error_window;\n // The automation socket, once known, for an error shown in its own window.\n QString startup_error_automation_socket;\n btcsignals::scoped_connection gui_startup_message_handler{::uiInterface.ThreadSafeMessageBox.connect(\n [&](const bilingual_str& message, unsigned int style) {\n const auto origin = QThread::currentThread() == app.thread()\n ? startup::DiagnosticOrigin::Gui : startup::DiagnosticOrigin::Native;\n if (style & CClientUIInterface::ICON_WARNING) {\n startup::RecordWarning(startup_warnings, message, origin, diagnostic_loss); return false;\n }\n startup_error_reported->store(true);\n const auto error = startup::PrepareError(message, origin, {\n [&] { return startupdiagnostics::Create(retire_diagnostic_value); },\n [](const QString& text) { qCritical().noquote() << text; }}, diagnostic_loss);\n bool result{false};\n const auto handle_message = [&] {\n result = startup::DeliverError(startup_canceled, quit_handler.isQuitRequested(), [&] {\n if (startup_error_window) return StartupErrorInWindow(*startup_error_window, error.summary, quit_handler);\n return InitErrorMessageBox(error.summary, startup_post,\n executor, execution::Lane::Utility, error.details, quit_handler,\n [this](QQmlApplicationEngine& engine) { qmlEngineCreated(engine); }, startup_diagnostics, nullptr, diagnostic_loss, wallet_presentation->load(),\n nullptr, startup_error_automation_socket);\n });\n };\n if (origin == startup::DiagnosticOrigin::Gui) handle_message();\n else QMetaObject::invokeMethod(&app, handle_message, Qt::BlockingQueuedConnection);\n return result;\n })};\n\n util::ThreadSetInternalName(\"main\");\n",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 346fbd99d01f..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The review guide omits 19 post-rename commitsqml/psbtwork.cpp | unclear | AssessmentThe supplied diff and file excerpts concern PSBT behavior, not the review guide’s commit hashes, range count, or commit and issue lists. They do not establish whether the guide was updated. path_diff: qml/psbtwork.cpp; new_source: qml/psbtwork.cpp [
{
"evidence_id": "be71eb9b06ad43c78173e151fcb832c2",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "346fbd99d01f51c571f699985e2a636e5afab78e",
"path": "qml/psbtwork.cpp",
"source_generation": 10,
"source_job_id": 2900,
"text": "diff --git a/qml/psbtwork.cpp b/qml/psbtwork.cpp\nindex fedb916eec..03f91e8c65 100644\n--- a/qml/psbtwork.cpp\n+++ b/qml/psbtwork.cpp\n@@ -9,6 +9,7 @@\n #include <qml/models/transactionflow.h>\n #include <qml/flowpresentation.h>\n #include <qml/bitcoinunits.h>\n+#include <qml/psbtpolicy.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <key_io.h>\n@@ -22,7 +23,6 @@\n #include <QCoreApplication>\n #include <QFile>\n #include <QIODevice>\n-#include <QSaveFile>\n #include <QUrl>\n #include <algorithm>\n #include <limits>\n@@ -99,21 +99,6 @@ private:\n QFile& m_file;\n };\n \n-class QtFileWriter final : public psbtwork::FileWriter\n-{\n-public:\n- explicit QtFileWriter(QSaveFile& file) : m_file{file} {}\n-\n- bool open() override { return m_file.open(QIODevice::WriteOnly); }\n- qint64 write(const QByteArray& bytes) override { return m_file.write(bytes); }\n- void cancel() override { m_file.cancelWriting(); }\n- bool commit() override { return m_file.commit(); }\n- QString errorString() override { return m_file.errorString(); }\n-\n-private:\n- QSaveFile& m_file;\n-};\n-\n } // namespace\n \n QString psbtwork::LocalFilePath(const QString& path)\n@@ -167,30 +152,6 @@ QString psbtwork::ErrorText(common::PSBTError error)\n return QString::fromStdString(common::PSBTErrorString(error).translated);\n }\n \n-QString psbtwork::WriteFile(psbtwork::FileWriter& writer, const PartiallySignedTransaction& psbt)\n-{\n- if (!writer.open()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n-\n- const QByteArray raw{SerializeRaw(psbt)};\n- if (writer.write(raw) != raw.size()) {\n- writer.cancel();\n- return Tr(\"Could not write the complete PSBT file.\");\n- }\n- if (!writer.commit()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n- return {};\n-}\n-\n-QString psbtwork::SaveFile(const PartiallySignedTransaction& psbt, const QString& path)\n-{\n- QSaveFile file{LocalFilePath(path)};\n- QtFileWriter writer{file};\n- return psbtwork::WriteFile(writer, psbt);\n-}\n-\n std::optional<std::pair<int, int>> psbtwork::Multisig(const PartiallySignedTransaction& psbt, std::size_t index)\n {\n if (index >= psbt.inputs.size()) return std::nullopt;\n@@ -380,7 +341,7 @@ Broadcast NodeBroadcast(interfaces::Node* node)\n if (!node) return {};\n return [node](CTransactionRef transaction) {\n std::string detail;\n- const auto code = node->broadcastTransaction(transaction, node::DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK(), node::DEFAULT_MAX_RAW_TX_FEE_RATE, detail);\n+ const auto code = node->broadcastTransaction(transaction, psbtpolicy::MaxFee(), psbtpolicy::MAX_FEE_RATE, detail);\n QString error;\n if (code != node::TransactionError::OK) {\n error = TransactionErrorText(code);\n@@ -425,12 +386,6 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code = Error::Fee; result.error = Tr(\"The transaction fee is missing or invalid.\"); return finishAfterRelock();\n }\n }\n- if (request.kind == Kind::Save) {\n- result.error = context.save(*request.document, request.path);\n- result.saved = result.error.isEmpty();\n- result.code = result.saved ? Error::None : Error::Core;\n- return finishAfterRelock();\n- }\n if (request.kind == Kind::Clipboard) {\n result.clipboard = SerializePsbtBase64(*request.document);\n return finishAfterRelock();\n@@ -477,7 +432,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n : signer_threw ? Error::Uncertain : Error::UnverifiedSignatures;\n result.error = result.signature_status == psbtsignatures::Status::Invalid\n ? Tr(\"The signer returned invalid signatures for the reviewed transaction.\")\n- : Tr(\"The returned PSBT needs more verification information. The original document is unchanged; export the unverified result to reconcile it.\");\n+ : Tr(\"The signer returned a PSBT that cannot be verified yet. The original PSBT is unchanged; export the result to check it elsewhere.\");\n if (result.signature_status == psbtsignatures::Status::Unknown)\n result.quarantined_document = std::make_shared<const PartiallySignedTransaction>(std::move(candidate));\n return finishAfterRelock();\n@@ -492,7 +447,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n retained->complete = complete;\n result.snapshot = std::move(retained);\n if (sign_error) { result.code = Error::Core; result.error = Tr(\"Could not sign PSBT: %1\").arg(ErrorText(*sign_error)); }\n- if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"The signer ended without a confirmed outcome. The retained PSBT must be reconciled before retrying.\"); }\n+ if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"It is not known what the signer did. Check the PSBT before trying again.\"); }\n request.status = complete ? Tr(\"PSBT signed. Transaction is ready for broadcast.\")\n : signed_inputs ? Tr(\"Signed %n input(s). More signatures are still required.\", nullptr, signed_inputs)\n : Tr(\"This wallet could not add any signatures to the PSBT.\");\n@@ -541,8 +496,8 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code=Error::Core;\n result.error=Tr(\"The signing password could not be prepared. Signing did not begin.\");\n } catch (...) {\n- result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign || request.kind == Kind::Save ? Error::Uncertain : Error::Core;\n- result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action ended without a confirmed outcome. Reconcile before retrying.\") : Tr(\"The PSBT could not be processed.\");\n+ result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign ? Error::Uncertain : Error::Core;\n+ result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action may not have finished. Check its status before trying again.\") : Tr(\"The PSBT could not be processed.\");\n }\n return finishAfterRelock();\n }\n@@ -680,13 +635,19 @@ ImportResult PrepareReview(interfaces::Wallet& wallet, std::shared_ptr<const Par\n if (wallet.getTx(finalized.GetHash())) { result.disposition = ImportResult::Disposition::Known; return result; }\n }\n const bool owned_inputs = std::all_of(tx->vin.begin(), tx->vin.end(), [&](const CTxIn& input) { return wallet.txinIsMine(input); });\n+ // Inputs another party has already signed need no key from this\n+ // wallet; every input still unsigned must be one this wallet owns.\n+ bool owned_unsigned_inputs{true};\n+ for (size_t i = 0; i < tx->vin.size(); ++i) {\n+ if (!PSBTInputSigned(assessment->inputs[i]) && !wallet.txinIsMine(tx->vin[i])) { owned_unsigned_inputs = false; break; }\n+ }\n std::optional<std::pair<int, int>> multisig;\n if (!snapshot->complete) for (size_t i = 0; i < assessment->inputs.size(); ++i) if ((multisig = Multisig(*assessment, i))) break;\n const bool signer = !wallet.privateKeysDisabled() || wallet.hasExternalSigner();\n- result.key_can_send = !multisig && owned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n+ result.key_can_send = !multisig && owned_unsigned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n result.can_commit_complete = !multisig && owned_inputs;\n result.key_can_broadcast = snapshot->can_broadcast;\n- const bool may_send = result.can_commit_complete && (snapshot->complete || result.key_can_send);\n+ const bool may_send = (result.can_commit_complete && snapshot->complete) || result.key_can_send;\n auto review = std::make_shared<walletreview::Snapshot>();\n review->transaction = snapshot->signature_state == SignatureState::Verified ? MakeTransactionRef(finalized) : MakeTransactionRef(*tx);\n review->assessment = assessment;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 683,
"evidence_id": "6af936dcf33c407791a3fa6245891f39",
"finding_id": "finding:2",
"kind": "new_source",
"line": 534,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "346fbd99d01f51c571f699985e2a636e5afab78e",
"path": "qml/psbtwork.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 10,
"source_job_id": 2900,
"text": "QVariantMap CollectReviewFlow(interfaces::Wallet& wallet, CTransactionRef transaction,\n std::shared_ptr<const PartiallySignedTransaction> document,\n std::shared_ptr<const psbtfee::Analysis> proof, const QSet<QString>& recipients, int display_unit,\n const QMap<QString, QString>& reviewed_notes)\n{\n if (!transaction) return {};\n std::vector<CScript> recipient_scripts;\n recipient_scripts.reserve(static_cast<size_t>(recipients.size()));\n for (const auto& address : recipients) {\n const auto destination = DecodeDestination(address.toStdString());\n if (IsValidDestination(destination)) recipient_scripts.push_back(GetScriptForDestination(destination));\n }\n interfaces::WalletTx preview{}; preview.tx = transaction;\n std::vector<std::optional<CTxOut>> prevouts;\n prevouts.reserve(transaction->vin.size());\n for (size_t i = 0; i < transaction->vin.size(); ++i) {\n const auto& input = transaction->vin[i];\n preview.txin_is_mine.push_back(wallet.txinIsMine(input));\n if (document && proof) {\n prevouts.push_back(i < proof->prevouts.size() ? proof->prevouts[i] : std::nullopt);\n } else {\n preview.debit += wallet.getDebit(input);\n const auto parent = wallet.getTx(input.prevout.hash);\n if (parent && input.prevout.n < parent->vout.size()) prevouts.emplace_back(parent->vout[input.prevout.n]);\n else if (document && i < document->inputs.size() && !document->inputs[i].witness_utxo.IsNull()) prevouts.emplace_back(document->inputs[i].witness_utxo);\n else if (document && i < document->inputs.size() && document->inputs[i].non_witness_utxo &&\n input.prevout.n < document->inputs[i].non_witness_utxo->vout.size()) prevouts.emplace_back(document->inputs[i].non_witness_utxo->vout[input.prevout.n]);\n else prevouts.emplace_back(std::nullopt);\n }\n }\n for (const auto& output : transaction->vout) {\n const bool owned = wallet.txoutIsMine(output);\n preview.txout_is_mine.push_back(owned);\n const bool recipient_output = std::find(recipient_scripts.begin(), recipient_scripts.end(), output.scriptPubKey) != recipient_scripts.end();\n preview.txout_is_change.push_back(owned && !recipient_output);\n }\n auto flow = BuildTransactionFlow(preview, prevouts);\n if (flow.isEmpty()) return flow;\n if (document) {\n const bool known = proof && proof->amount.has_value();\n flow.insert(QStringLiteral(\"feeKnown\"), known);\n flow.insert(QStringLiteral(\"feeSat\"), known ? QVariant{qint64(*proof->amount)} : QVariant{});\n }\n const auto unit = QmlBitcoinUnits::fromDisplayUnit(display_unit);\n const auto format = [unit](CAmount amount) -> QString { return QmlBitcoinUnits::formatForDisplay(unit, amount) + QLatin1Char(' ') + QmlBitcoinUnits::label(unit, amount); };\n for (const auto& side : {QStringLiteral(\"inputs\"), QStringLiteral(\"outputs\")}) {\n auto rows = flow.value(side).toList();\n for (auto& value : rows) {\n auto row = value.toMap();\n if (row.value(QStringLiteral(\"amountKnown\")).toBool()) row.insert(QStringLiteral(\"amount\"), format(row.value(QStringLiteral(\"amountSat\")).toLongLong()));\n if (side == QStringLiteral(\"inputs\") && row.value(QStringLiteral(\"ownership\")).toString() == QStringLiteral(\"wallet\")) {\n const auto destination = DecodeDestination(row.value(QStringLiteral(\"address\")).toString().toStdString());\n std::string label;\n if (IsValidDestination(destination) && wallet.getAddress(destination, &label, nullptr) && !label.empty()) row.insert(QStringLiteral(\"label\"), QString::fromStdString(label));\n }\n if (side == QStringLiteral(\"outputs\")) {\n const auto label = reviewed_notes.value(row.value(QStringLiteral(\"address\")).toString());\n if (!label.isEmpty()) row.insert(QStringLiteral(\"label\"), label);\n }\n value = row;\n }\n flow.insert(side, rows);\n }\n if (flow.value(QStringLiteral(\"feeKnown\")).toBool()) flow.insert(QStringLiteral(\"feeAmount\"), format(flow.value(QStringLiteral(\"feeSat\")).toLongLong()));\n flow.insert(QStringLiteral(\"presentation\"), PrepareTransactionFlowPresentation(flow));\n return flow;\n}\n\nImportResult PrepareReview(interfaces::Wallet& wallet, std::shared_ptr<const PartiallySignedTransaction> document,\n const Context& context, int display_unit)\n{\n ImportResult result;\n try {\n if (!document) { result.message = Tr(\"No PSBT is loaded.\"); return result; }\n const auto original = document->GetUnsignedTx();\n if (!original || original->vin.empty() || original->vout.empty() || document->inputs.size() != original->vin.size() || document->outputs.size() != original->vout.size()) {\n result.message = Tr(\"The PSBT is malformed.\"); return result;\n }\n // Legacy scriptSig data changes the final transaction identity. Inspect\n // a copy so the known-status query cannot finalize the imported value.\n auto identity_document = *document;\n CMutableTransaction finalized;\n const auto identity = FinalizeAndExtractPSBT(identity_document, finalized)\n ? finalized.GetHash() : original->GetHash();\n result.txid = QString::fromStdString(identity.ToString());\n if (wallet.getTx(identity)) { result.disposition = ImportResult::Disposition::Known; return result; }\n std::shared_ptr<const PartiallySignedTransaction> assessment;\n const auto snapshot = Inspect(&wallet, document, {}, context, {}, &assessment);\n if (!snapshot->document || !assessment || !snapshot->proof || !snapshot->proof->outputs_valid) {\n result.message = Tr(\"The transaction fee is missing or invalid.\"); return result;\n }\n // A failed metadata fill is not signing authority. Preserve the exact\n // imported document for a later explicit retry rather than adopting it.\n if (snapshot->metadata_failed) { result.message = snapshot->error; return result; }\n const auto tx = assessment->GetUnsignedTx();\n if (!tx || !MatchesUnsignedTransaction(*original, *tx)) { result.message = Tr(\"The wallet changed the reviewed transaction.\"); return result; }\n auto completed_assessment = *assessment;\n const bool extracted = FinalizeAndExtractPSBT(completed_assessment, finalized);\n if (snapshot->signature_state == SignatureState::Verified && !extracted) { result.message = Tr(\"The analyzed transaction could not be extracted.\"); return result; }\n if (extracted && finalized.GetHash() != identity) {\n result.txid = QString::fromStdString(finalized.GetHash().ToString());\n if (wallet.getTx(finalized.GetHash())) { result.disposition = ImportResult::Disposition::Known; return result; }\n }\n const bool owned_inputs = std::all_of(tx->vin.begin(), tx->vin.end(), [&](const CTxIn& input) { return wallet.txinIsMine(input); });\n // Inputs another party has already signed need no key from this\n // wallet; every input still unsigned must be one this wallet owns.\n bool owned_unsigned_inputs{true};\n for (size_t i = 0; i < tx->vin.size(); ++i) {\n if (!PSBTInputSigned(assessment->inputs[i]) && !wallet.txinIsMine(tx->vin[i])) { owned_unsigned_inputs = false; break; }\n }\n std::optional<std::pair<int, int>> multisig;\n if (!snapshot->complete) for (size_t i = 0; i < assessment->inputs.size(); ++i) if ((multisig = Multisig(*assessment, i))) break;\n const bool signer = !wallet.privateKeysDisabled() || wallet.hasExternalSigner();\n result.key_can_send = !multisig && owned_unsigned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n result.can_commit_complete = !multisig && owned_inputs;\n result.key_can_broadcast = snapshot->can_broadcast;\n const bool may_send = (result.can_commit_complete && snapshot->complete) || result.key_can_send;\n auto review = std::make_shared<walletreview::Snapshot>();\n review->transaction = snapshot->signature_state == SignatureState::Verified ? MakeTransactionRef(finalized) : MakeTransactionRef(*tx);\n review->assessment = assessment;\n review->node_policy_blocked = snapshot->node_state == psbtpolicy::State::Blocked;\n if (snapshot->signature_state == SignatureState::Verified) review->node_policy_status = psbtpolicy::Evaluate(snapshot->node_facts).explanation;\n review->proof = snapshot->proof;\n review->fee = snapshot->proof->amount.value_or(0);\n review->display_unit = display_unit;\n review->can_send = snapshot->proof->amount.has_value() && may_send\n && psbtpolicy::Evaluate(snapshot->node_facts).state != psbtpolicy::State::Blocked;\n for (const auto& output : tx->vout) {\n CTxDestination destination;\n if (!ExtractDestination(output.scriptPubKey, destination)) {\n if (output.nValue == 0 && output.scriptPubKey.IsUnspendable()) continue;\n result.message = Tr(\"Only PSBTs with standard address outputs are supported right now.\"); return result;\n }\n // Imported documents do not provide authoritative change intent.\n // Ownership alone cannot distinguish a self-transfer recipient\n // from change, and signing capability must not alter the review.\n const auto address = QString::fromStdString(EncodeDestination(destination));\n std::string label;\n wallet.getAddress(destination, &label, nullptr);\n if (!MoneyRange(output.nValue) || output.nValue > MAX_MONEY - review->amount) { result.message = Tr(\"The PSBT contains invalid amounts.\"); return result; }\n review->amount += output.nValue;\n review->recipients.append({address, QString::fromStdString(label), output.nValue, false});\n review->destinations.insert(address);\n review->notes.insert(address, QString::fromStdString(label));\n }\n if (review->recipients.empty()) { result.message = Tr(\"The PSBT does not have any recipient outputs to review.\"); return result; }\n if (review->recipients.size() > 25) { result.message = Tr(\"The PSBT has more recipients than this send flow supports.\"); return result; }\n if (review->amount <= 0) { result.message = Tr(\"The PSBT does not send a positive amount.\"); return result; }\n review->presentation = walletreview::FormatRecipients(review->recipients, display_unit);\n review->flow = CollectReviewFlow(wallet, review->transaction, assessment, snapshot->proof, review->destinations, display_unit, review->notes);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 346fbd99d01f..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | New-password normalization disagrees with unlock inputqml/controls/PasswordTextField.qml | still_present | AssessmentThe new-head PasswordTextField still silently removes CR/LF when dropsLineEndings is enabled; the reported mismatch between new-password entry and exact unlock input therefore remains. new_source: qml/controls/PasswordTextField.qml [
{
"bounded": true,
"end_line": 58,
"evidence_id": "37630406a668446d8bd72d56c386fb5e",
"finding_id": "finding:1",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "346fbd99d01f51c571f699985e2a636e5afab78e",
"path": "qml/controls/PasswordTextField.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 10,
"source_job_id": 2900,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\n\nLabeledTextField {\n id: root\n\n property bool passwordVisible: false\n property string visibilityToggleObjectName: root.objectName.length > 0\n ? root.objectName + \"VisibilityToggle\"\n : \"\"\n\n // For a new passphrase only. A line ending cannot be typed into this\n // field, so one that arrives by paste is dropped instead of becoming a\n // character the user cannot see or type again. Fields that unlock an\n // existing wallet leave this off: a wallet encrypted with a pasted line\n // ending must still open with exactly that text.\n property bool dropsLineEndings: false\n\n function dropLineEndings() {\n const text = root.field.text\n if (!root.dropsLineEndings || !/[\\r\\n]/.test(text)) return\n const caret = text.slice(0, root.field.cursorPosition).replace(/[\\r\\n]/g, \"\").length\n root.field.text = text.replace(/[\\r\\n]/g, \"\")\n root.field.cursorPosition = caret\n }\n\n Connections {\n target: root.field\n function onTextChanged() { root.dropLineEndings() }\n }\n onDropsLineEndingsChanged: dropLineEndings()\n\n echoMode: passwordVisible ? TextInput.Normal : TextInput.Password\n // Qt never exposes a name for a password field, so the label also goes\n // into the description, which VoiceOver still reads.\n accessibleDescription: [label, errorText.length > 0 ? errorText : supportingText]\n .filter(function(part) { return part.length > 0 }).join(\". \")\n inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText\n\n trailingItem: IconButton {\n id: visibilityToggle\n objectName: root.visibilityToggleObjectName\n size: 30\n iconSize: 22\n iconSource: root.passwordVisible ? \"qrc:/icons/hidden\" : \"qrc:/icons/visible\"\n iconColor: Theme.color.neutral7\n activeColor: Theme.color.neutral9\n enabled: root.enabled\n // Clicking keeps focus in the field; Tab still reaches the toggle.\n focusPolicy: Qt.TabFocus\n accessibleName: root.passwordVisible ? qsTr(\"Hide password\") : qsTr(\"Show password\")\n background: null\n onClicked: root.passwordVisible = !root.passwordVisible\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 346fbd99d01f..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Closing a loading address editor discards newly typed notesqml/pages/wallet/AddressDetails.qml | still_present | AssessmentThe changed AddressDetails.qml excerpt only changes the close dialog's parent binding. The note field remains read-only only when the editor is unavailable, with no evidenced guard for the Loading phase or initialization, so the reported close-before-read issue is not shown as fixed. path_diff: qml/pages/wallet/AddressDetails.qml; new_source: qml/pages/wallet/AddressDetails.qml [
{
"evidence_id": "baec06788f654b40a32f0690eb02baa1",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/pages/wallet/AddressDetails.qml",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/pages/wallet/AddressDetails.qml b/qml/pages/wallet/AddressDetails.qml\nindex 07013ea9d8..b45555f650 100644\n--- a/qml/pages/wallet/AddressDetails.qml\n+++ b/qml/pages/wallet/AddressDetails.qml\n@@ -164,7 +164,14 @@ ColumnLayout {\n readonly property Dialog dialog: Dialog {\n id: noteCloseDialog\n objectName: \"addressNoteClosePrompt\"\n- parent: root.Overlay.overlay\n+ // Keeps the overlay when the page leaves the window. A popup whose parent\n+ // goes null there loses its window while its item is still in the overlay,\n+ // and a hover event then crashes Qt 6.8.4 and newer.\n+ Binding on parent {\n+ when: root.Overlay.overlay !== null\n+ value: root.Overlay.overlay\n+ restoreMode: Binding.RestoreNone\n+ }\n modal: true\n width: Math.min(620, parent ? parent.width - 40 : 620)\n x: parent ? (parent.width - width) / 2 : 0\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 225,
"evidence_id": "b929e0b5bdcc47c8ac6c1a5cc5573c0a",
"finding_id": "finding:9",
"kind": "new_source",
"line": 76,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/pages/wallet/AddressDetails.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 8,
"source_job_id": 2830,
"text": " topPadding: 2\n bottomPadding: 2\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsAmountRow\"\n amountValue: true\n hidesAmount: true\n Layout.fillWidth: true\n title: qsTr(\"Amount\")\n value: root.amount\n valueColor: root.hasAmount ? Theme.color.txIncoming : Theme.color.neutral6\n dividerColor: Theme.color.surfaceDivider\n }\n\n TextFieldRow {\n id: noteRow\n objectName: \"addressDetailsNoteRow\"\n visible: root.canEditLabel\n Layout.fillWidth: true\n //: Private address note, also used as the payment request's note to self.\n title: qsTr(\"Note to self\")\n fieldObjectName: \"addressDetailsNoteField\"\n fieldWidth: Math.min(320, Math.max(180, root.width * 0.55))\n text: root.label\n textInput: root.editor ? root.editor.text : null\n //: Placeholder shown when an address has no private note yet.\n placeholderText: qsTr(\"Add note…\")\n enabled: root.canEditLabel\n readOnly: !root.canEditLabel || (root.editor !== null && !root.editor.available)\n errorText: root.editor ? root.editor.error.message : root.noteErrorText\n dividerColor: Theme.color.surfaceDivider\n onEditingFinished: {\n if (!root.editor && text !== root.label) {\n root.editLabelRequested(root.address, text)\n }\n }\n }\n\n ValueRow {\n objectName: \"addressDetailsTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Type\")\n value: root.category === \"change\" ? qsTr(\"Change\") : qsTr(\"Receive\")\n dividerColor: Theme.color.surfaceDivider\n }\n\n ValueRow {\n objectName: \"addressDetailsAddressTypeRow\"\n Layout.fillWidth: true\n title: qsTr(\"Address type\")\n value: root.scriptType === \"\" ? qsTr(\"Unknown\") : root.scriptType\n showDivider: false\n }\n }\n\n GridLayout {\n columns: 2\n visible: root.editor !== null && (root.editor.dirty || root.editor.conflict)\n Layout.fillWidth: true\n NeutralButton {\n objectName: \"addressDetailsDiscardNoteButton\"\n text: qsTr(\"Discard edits\")\n enabled: root.editor !== null && root.editor.canDiscard\n onClicked: root.editor.discard()\n }\n NeutralButton {\n objectName: \"addressDetailsUseCurrentNoteButton\"\n text: qsTr(\"Use current note\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.UseCurrent)\n }\n NeutralButton {\n objectName: \"addressDetailsKeepEditedNoteButton\"\n text: qsTr(\"Keep my edit\")\n visible: root.editor !== null && root.editor.conflict\n onClicked: root.editor.resolveConflict(\"text\", TextEditSessionModel.KeepEdit)\n }\n PrimaryButton {\n objectName: \"addressDetailsSaveNoteButton\"\n text: qsTr(\"Save note\")\n enabled: root.editor !== null && root.editor.canSave\n onClicked: root.editor.save()\n }\n }\n\n QtObject {\n readonly property Dialog dialog: Dialog {\n id: noteCloseDialog\n objectName: \"addressNoteClosePrompt\"\n // Keeps the overlay when the page leaves the window. A popup whose parent\n // goes null there loses its window while its item is still in the overlay,\n // and a hover event then crashes Qt 6.8.4 and newer.\n Binding on parent {\n when: root.Overlay.overlay !== null\n value: root.Overlay.overlay\n restoreMode: Binding.RestoreNone\n }\n modal: true\n width: Math.min(620, parent ? parent.width - 40 : 620)\n x: parent ? (parent.width - width) / 2 : 0\n y: parent ? (parent.height - height) / 2 : 0\n closePolicy: Popup.NoAutoClose\n visible: root.visible && root.editor !== null && root.editor.available && root.editor.closePrompt !== null\n title: qsTr(\"Save note edits?\")\n contentItem: GridLayout {\n columns: noteCloseDialog.width < 480 ? 1 : 3\n NeutralButton {\n id: keepEditingButton\n objectName: \"addressNoteKeepEditingButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: keepEditingButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Keep editing\")\n onClicked: if (keepEditingButton.pressedPrompt) keepEditingButton.pressedPrompt.answer(TextEditClosePrompt.KeepEditing)\n }\n NeutralButton {\n id: discardAndCloseButton\n objectName: \"addressNoteDiscardAndCloseButton\"\n Layout.fillWidth: true\n enabled: root.editor !== null && !root.editor.busy\n property TextEditClosePrompt pressedPrompt: null\n onPressed: discardAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Discard\")\n onClicked: if (discardAndCloseButton.pressedPrompt) discardAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Discard)\n }\n PrimaryButton {\n id: saveAndCloseButton\n objectName: \"addressNoteSaveAndCloseButton\"\n Layout.fillWidth: true\n property TextEditClosePrompt pressedPrompt: null\n onPressed: saveAndCloseButton.pressedPrompt = root.editor ? root.editor.closePrompt : null\n text: qsTr(\"Save\")\n enabled: root.editor !== null && root.editor.valid && !root.editor.conflict && !root.editor.busy\n onClicked: if (saveAndCloseButton.pressedPrompt) saveAndCloseButton.pressedPrompt.answer(TextEditClosePrompt.Save)\n }\n }\n }\n }\n Keys.onEscapePressed: function(event) {\n if (root.editor) root.editor.requestClose()\n else root.closeRequested()\n event.accepted = true\n }\n\n PrimaryButton {\n objectName: \"addressDetailsCreatePaymentRequestButton\"\n Layout.fillWidth: true",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Sign only inherits Send's all-inputs-owned restrictionqml/psbtwork.cpp | addressed | AssessmentPrepareReview now derives signing eligibility from owned_unsigned_inputs, allowing already-signed foreign inputs, while retaining the separate all-input ownership check for complete-transaction commit eligibility. The updated may_send expression allows the Sign-only path when key_can_send is true. path_diff: qml/psbtwork.cpp [
{
"evidence_id": "f34b41d673be4ede82b527bfcfbe17f6",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/psbtwork.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/psbtwork.cpp b/qml/psbtwork.cpp\nindex dc83755db1..03f91e8c65 100644\n--- a/qml/psbtwork.cpp\n+++ b/qml/psbtwork.cpp\n@@ -9,6 +9,7 @@\n #include <qml/models/transactionflow.h>\n #include <qml/flowpresentation.h>\n #include <qml/bitcoinunits.h>\n+#include <qml/psbtpolicy.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <key_io.h>\n@@ -22,7 +23,6 @@\n #include <QCoreApplication>\n #include <QFile>\n #include <QIODevice>\n-#include <QSaveFile>\n #include <QUrl>\n #include <algorithm>\n #include <limits>\n@@ -99,21 +99,6 @@ private:\n QFile& m_file;\n };\n \n-class QtFileWriter final : public psbtwork::FileWriter\n-{\n-public:\n- explicit QtFileWriter(QSaveFile& file) : m_file{file} {}\n-\n- bool open() override { return m_file.open(QIODevice::WriteOnly); }\n- qint64 write(const QByteArray& bytes) override { return m_file.write(bytes); }\n- void cancel() override { m_file.cancelWriting(); }\n- bool commit() override { return m_file.commit(); }\n- QString errorString() override { return m_file.errorString(); }\n-\n-private:\n- QSaveFile& m_file;\n-};\n-\n } // namespace\n \n QString psbtwork::LocalFilePath(const QString& path)\n@@ -167,30 +152,6 @@ QString psbtwork::ErrorText(common::PSBTError error)\n return QString::fromStdString(common::PSBTErrorString(error).translated);\n }\n \n-QString psbtwork::WriteFile(psbtwork::FileWriter& writer, const PartiallySignedTransaction& psbt)\n-{\n- if (!writer.open()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n-\n- const QByteArray raw{SerializeRaw(psbt)};\n- if (writer.write(raw) != raw.size()) {\n- writer.cancel();\n- return Tr(\"Could not write the complete PSBT file.\");\n- }\n- if (!writer.commit()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n- return {};\n-}\n-\n-QString psbtwork::SaveFile(const PartiallySignedTransaction& psbt, const QString& path)\n-{\n- QSaveFile file{LocalFilePath(path)};\n- QtFileWriter writer{file};\n- return psbtwork::WriteFile(writer, psbt);\n-}\n-\n std::optional<std::pair<int, int>> psbtwork::Multisig(const PartiallySignedTransaction& psbt, std::size_t index)\n {\n if (index >= psbt.inputs.size()) return std::nullopt;\n@@ -380,7 +341,7 @@ Broadcast NodeBroadcast(interfaces::Node* node)\n if (!node) return {};\n return [node](CTransactionRef transaction) {\n std::string detail;\n- const auto code = node->broadcastTransaction(transaction, node::DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK(), node::DEFAULT_MAX_RAW_TX_FEE_RATE, detail);\n+ const auto code = node->broadcastTransaction(transaction, psbtpolicy::MaxFee(), psbtpolicy::MAX_FEE_RATE, detail);\n QString error;\n if (code != node::TransactionError::OK) {\n error = TransactionErrorText(code);\n@@ -425,12 +386,6 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code = Error::Fee; result.error = Tr(\"The transaction fee is missing or invalid.\"); return finishAfterRelock();\n }\n }\n- if (request.kind == Kind::Save) {\n- result.error = context.save(*request.document, request.path);\n- result.saved = result.error.isEmpty();\n- result.code = result.saved ? Error::None : Error::Core;\n- return finishAfterRelock();\n- }\n if (request.kind == Kind::Clipboard) {\n result.clipboard = SerializePsbtBase64(*request.document);\n return finishAfterRelock();\n@@ -477,7 +432,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n : signer_threw ? Error::Uncertain : Error::UnverifiedSignatures;\n result.error = result.signature_status == psbtsignatures::Status::Invalid\n ? Tr(\"The signer returned invalid signatures for the reviewed transaction.\")\n- : Tr(\"The returned PSBT needs more verification information. The original document is unchanged; export the unverified result to reconcile it.\");\n+ : Tr(\"The signer returned a PSBT that cannot be verified yet. The original PSBT is unchanged; export the result to check it elsewhere.\");\n if (result.signature_status == psbtsignatures::Status::Unknown)\n result.quarantined_document = std::make_shared<const PartiallySignedTransaction>(std::move(candidate));\n return finishAfterRelock();\n@@ -492,7 +447,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n retained->complete = complete;\n result.snapshot = std::move(retained);\n if (sign_error) { result.code = Error::Core; result.error = Tr(\"Could not sign PSBT: %1\").arg(ErrorText(*sign_error)); }\n- if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"The signer ended without a confirmed outcome. The retained PSBT must be reconciled before retrying.\"); }\n+ if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"It is not known what the signer did. Check the PSBT before trying again.\"); }\n request.status = complete ? Tr(\"PSBT signed. Transaction is ready for broadcast.\")\n : signed_inputs ? Tr(\"Signed %n input(s). More signatures are still required.\", nullptr, signed_inputs)\n : Tr(\"This wallet could not add any signatures to the PSBT.\");\n@@ -541,8 +496,8 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code=Error::Core;\n result.error=Tr(\"The signing password could not be prepared. Signing did not begin.\");\n } catch (...) {\n- result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign || request.kind == Kind::Save ? Error::Uncertain : Error::Core;\n- result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action ended without a confirmed outcome. Reconcile before retrying.\") : Tr(\"The PSBT could not be processed.\");\n+ result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign ? Error::Uncertain : Error::Core;\n+ result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action may not have finished. Check its status before trying again.\") : Tr(\"The PSBT could not be processed.\");\n }\n return finishAfterRelock();\n }\n@@ -558,7 +513,10 @@ DocumentResult ExportReview(interfaces::Wallet& wallet, std::shared_ptr<const Pa\n tx = CMutableTransaction{*reviewed};\n for (auto& input : tx.vin) { input.scriptSig.clear(); input.scriptWitness.SetNull(); }\n }\n- PartiallySignedTransaction document = source ? *source : PartiallySignedTransaction{tx, 2};\n+ // A file this app creates is version 0, as Bitcoin-Qt writes since\n+ // bitcoin/bitcoin#36539: Core before v32 cannot read version 2 (#1112).\n+ // An imported PSBT is saved back in the version it arrived with.\n+ PartiallySignedTransaction document = source ? *source : PartiallySignedTransaction{tx, /*version=*/0};\n const auto approved = document.GetUnsignedTx();\n if (!approved || (reviewed && !MatchesUnsignedTransaction(tx, *approved))) return {{}, Tr(\"The reviewed transaction changed.\")};\n if (proof && approved_fee && !psbtfee::MatchesReview(document, *proof, approved_fee)) return {{}, Tr(\"The transaction fee changed after review.\")};\n@@ -677,13 +635,19 @@ ImportResult PrepareReview(interfaces::Wallet& wallet, std::shared_ptr<const Par\n if (wallet.getTx(finalized.GetHash())) { result.disposition = ImportResult::Disposition::Known; return result; }\n }\n const bool owned_inputs = std::all_of(tx->vin.begin(), tx->vin.end(), [&](const CTxIn& input) { return wallet.txinIsMine(input); });\n+ // Inputs another party has already signed need no key from this\n+ // wallet; every input still unsigned must be one this wallet owns.\n+ bool owned_unsigned_inputs{true};\n+ for (size_t i = 0; i < tx->vin.size(); ++i) {\n+ if (!PSBTInputSigned(assessment->inputs[i]) && !wallet.txinIsMine(tx->vin[i])) { owned_unsigned_inputs = false; break; }\n+ }\n std::optional<std::pair<int, int>> multisig;\n if (!snapshot->complete) for (size_t i = 0; i < assessment->inputs.size(); ++i) if ((multisig = Multisig(*assessment, i))) break;\n const bool signer = !wallet.privateKeysDisabled() || wallet.hasExternalSigner();\n- result.key_can_send = !multisig && owned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n+ result.key_can_send = !multisig && owned_unsigned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n result.can_commit_complete = !multisig && owned_inputs;\n result.key_can_broadcast = snapshot->can_broadcast;\n- const bool may_send = result.can_commit_complete && (snapshot->complete || result.key_can_send);\n+ const bool may_send = (result.can_commit_complete && snapshot->complete) || result.key_can_send;\n auto review = std::make_shared<walletreview::Snapshot>();\n review->transaction = snapshot->signature_state == SignatureState::Verified ? MakeTransactionRef(finalized) : MakeTransactionRef(*tx);\n review->assessment = assessment;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | The additive cluster check overrides accepted replacement admissionqml/psbtpolicy.cpp | addressed | AssessmentThe new Evaluate condition blocks on failed chain_limits only when admission is not Allowed. An exact accepted replacement therefore is no longer vetoed by the additive cluster check. path_diff: qml/psbtpolicy.cpp; new_source: qml/psbtpolicy.cpp [
{
"evidence_id": "1398375410224b74aec82d4b35be4e68",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/psbtpolicy.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex 97d6c8d9e8..3cd08b0509 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -3,6 +3,7 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/psbtpolicy.h>\n+#include <qml/bitcoinunits.h>\n \n #include <coins.h>\n #include <consensus/consensus.h>\n@@ -24,14 +25,16 @@\n namespace {\n QString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n \n-void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n+void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts, bool enforce_raw_fee_cap)\n {\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- parameters.push_back(0); // Disable only testmempoolaccept's independent client max-fee-rate cap.\n+ // Raw PSBT broadcasts pass MAX_FEE_RATE to broadcastTransaction; wallet\n+ // sends and fee bumps already checked the wallet's own -maxtxfee limit.\n+ parameters.push_back(enforce_raw_fee_cap ? ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()) : UniValue{0});\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -46,11 +49,14 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n+ if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n- // An allowed conflict is a replacement. Name what it evicts.\n+ // An allowed conflict is a replacement. Name what it evicts; until the\n+ // lookup completes, the review must not imply that nothing is evicted.\n+ facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n@@ -67,6 +73,7 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n+ facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n@@ -89,14 +96,16 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n+ facts.replaces_unknown = false;\n }\n } // namespace\n \n-psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n+psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain, bool enforce_raw_fee_cap)\n {\n- return [node, chain](CTransactionRef transaction, CAmount fee) {\n+ return [node, chain, enforce_raw_fee_cap](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n+ facts.within_fee_cap = !enforce_raw_fee_cap || !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -134,7 +143,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n- ReadAdmission(*node, *transaction, facts);\n+ ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n@@ -154,8 +163,12 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (facts.immature_inputs) return {State::Blocked, Tr(\"An input spends an immature coinbase output. Refresh the review after more blocks.\")};\n if (!facts.final) return {State::Blocked, Tr(\"The transaction lock time is not final at the observed chain tip.\")};\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n- if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n+ // checkChainLimits does not account for conflicting transactions a\n+ // replacement would evict; when testmempoolaccept already allowed this\n+ // exact transaction, do not override it with the non-RBF chain check.\n+ if (!facts.chain_limits && facts.admission != Admission::Allowed) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n+ if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n@@ -164,6 +177,9 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.replaces.isEmpty()) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n }\n+ if (facts.replaces_unknown) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n+ }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 187,
"evidence_id": "da130a65ad754f58a7a4960070403c04",
"finding_id": "finding:7",
"kind": "new_source",
"line": 87,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/psbtpolicy.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 8,
"source_job_id": 2830,
"text": " facts.final = true;\n facts.sufficient_fee = true;\n facts.chain_limits = true;\n facts.tip.clear();\n facts.chain_error.clear();\n}\n\nvoid ClearAdmissionFacts(psbtpolicy::Facts& facts)\n{\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n facts.replaces_unknown = false;\n}\n} // namespace\n\npsbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain, bool enforce_raw_fee_cap)\n{\n return [node, chain, enforce_raw_fee_cap](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n facts.within_fee_cap = !enforce_raw_fee_cap || !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n int height{-1}; int64_t mtp{0}; bool active{false};\n if (chain->findBlock(tip, interfaces::FoundBlock{}.height(height).mtpTime(mtp).inActiveChain(active))\n && active && height >= 0 && height < std::numeric_limits<int>::max()) {\n std::map<COutPoint, Coin> coins;\n for (const auto& input : transaction->vin) coins.try_emplace(input.prevout);\n chain->findCoins(coins); // Includes available mempool parents.\n for (const auto& [outpoint, coin] : coins) {\n facts.missing_inputs |= coin.IsSpent();\n facts.immature_inputs |= !coin.IsSpent() && coin.IsCoinBase()\n && int64_t(height) + 1 - coin.nHeight < COINBASE_MATURITY;\n }\n facts.final = IsFinalTx(*transaction, height + 1, mtp);\n const auto minimum = std::max(chain->mempoolMinFee(), chain->relayMinFee());\n facts.sufficient_fee = fee >= minimum.GetFee(GetVirtualTransactionSize(*transaction));\n const auto limits = chain->checkChainLimits(transaction);\n facts.chain_limits = bool(limits);\n if (!limits) facts.chain_error = QString::fromStdString(util::ErrorString(limits).translated).left(4096);\n // A reorg during this collection invalidates the whole observation.\n if (node->getBestBlockHash() == tip) {\n facts.tip = QString::fromStdString(tip.ToString());\n facts.observed = true;\n } else {\n ClearChainFacts(facts);\n }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);\n }\n return facts;\n };\n}\n\npsbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n{\n if (facts.observed) {\n if (facts.missing_inputs) return {State::Blocked, Tr(\"An input is missing or already spent at the observed chain tip. Refresh the review before submitting.\")};\n if (facts.immature_inputs) return {State::Blocked, Tr(\"An input spends an immature coinbase output. Refresh the review after more blocks.\")};\n if (!facts.final) return {State::Blocked, Tr(\"The transaction lock time is not final at the observed chain tip.\")};\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n // checkChainLimits does not account for conflicting transactions a\n // replacement would evict; when testmempoolaccept already allowed this\n // exact transaction, do not override it with the non-RBF chain check.\n if (!facts.chain_limits && facts.admission != Admission::Allowed) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n }\n if (facts.admission == Admission::Allowed) {\n if (!facts.replaces.isEmpty()) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n }\n if (facts.replaces_unknown) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n return {State::Unknown, Tr(\"Fully signed. Current node policy will be checked when you submit.\")};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | PSBT readiness omits submission's maximum-fee checksqml/psbtpolicy.cpp | addressed | AssessmentReadAdmission now passes MAX_FEE_RATE.GetFeePerK() as testmempoolaccept's maxfeerate, and ReadNode/Evaluate block fees above MaxFee(). These checks align admission readiness with the stated submission caps. path_diff: qml/psbtpolicy.cpp; new_source: qml/psbtpolicy.cpp [
{
"evidence_id": "4d2243c4935e490bbd586625094a88ab",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/psbtpolicy.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex 97d6c8d9e8..dac47edbc0 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -3,6 +3,7 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/psbtpolicy.h>\n+#include <qml/bitcoinunits.h>\n \n #include <coins.h>\n #include <consensus/consensus.h>\n@@ -31,7 +32,8 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- parameters.push_back(0); // Disable only testmempoolaccept's independent client max-fee-rate cap.\n+ // The same fee-rate cap that submission passes to broadcastTransaction.\n+ parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -46,11 +48,14 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n+ if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n- // An allowed conflict is a replacement. Name what it evicts.\n+ // An allowed conflict is a replacement. Name what it evicts; until the\n+ // lookup completes, the review must not imply that nothing is evicted.\n+ facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n@@ -67,6 +72,7 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n+ facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n@@ -89,6 +95,7 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n+ facts.replaces_unknown = false;\n }\n } // namespace\n \n@@ -97,6 +104,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n+ facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -156,6 +164,7 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n+ if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n@@ -164,6 +173,9 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.replaces.isEmpty()) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n }\n+ if (facts.replaces_unknown) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n+ }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 153,
"evidence_id": "914ae0927d2948628c640340e929e45a",
"finding_id": "finding:6",
"kind": "new_source",
"line": 4,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/psbtpolicy.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 8,
"source_job_id": 2830,
"text": "\n#include <qml/psbtpolicy.h>\n#include <qml/bitcoinunits.h>\n\n#include <coins.h>\n#include <consensus/consensus.h>\n#include <consensus/tx_verify.h>\n#include <core_io.h>\n#include <interfaces/chain.h>\n#include <interfaces/node.h>\n#include <policy/policy.h>\n#include <univalue.h>\n#include <util/result.h>\n\n#include <QCoreApplication>\n\n#include <algorithm>\n#include <limits>\n#include <map>\n#include <utility>\n\nnamespace {\nQString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n\nvoid ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n{\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n // The same fee-rate cap that submission passes to broadcastTransaction.\n parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n if (!result.isObject() || !result.exists(\"txid\") || !result[\"txid\"].isStr()\n || !result.exists(\"wtxid\") || !result[\"wtxid\"].isStr()\n || result[\"txid\"].get_str() != transaction.GetHash().ToString()\n || result[\"wtxid\"].get_str() != transaction.GetWitnessHash().ToString()\n || !result.exists(\"allowed\") || !result[\"allowed\"].isBool()) return;\n\n const bool allowed = result[\"allowed\"].get_bool();\n QString reason;\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n // An allowed conflict is a replacement. Name what it evicts; until the\n // lookup completes, the review must not imply that nothing is evicted.\n facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n outpoint.pushKV(\"txid\", input.prevout.hash.GetHex());\n outpoint.pushKV(\"vout\", uint64_t{input.prevout.n});\n outpoints.push_back(std::move(outpoint));\n }\n UniValue spending_parameters{UniValue::VARR};\n spending_parameters.push_back(std::move(outpoints));\n const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n if (!spending.isArray()) return;\n for (const auto& item : spending.getValues()) {\n if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n}\n\nvoid ClearChainFacts(psbtpolicy::Facts& facts)\n{\n facts.observed = false;\n facts.missing_inputs = false;\n facts.immature_inputs = false;\n facts.final = true;\n facts.sufficient_fee = true;\n facts.chain_limits = true;\n facts.tip.clear();\n facts.chain_error.clear();\n}\n\nvoid ClearAdmissionFacts(psbtpolicy::Facts& facts)\n{\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n facts.replaces_unknown = false;\n}\n} // namespace\n\npsbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n{\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n int height{-1}; int64_t mtp{0}; bool active{false};\n if (chain->findBlock(tip, interfaces::FoundBlock{}.height(height).mtpTime(mtp).inActiveChain(active))\n && active && height >= 0 && height < std::numeric_limits<int>::max()) {\n std::map<COutPoint, Coin> coins;\n for (const auto& input : transaction->vin) coins.try_emplace(input.prevout);\n chain->findCoins(coins); // Includes available mempool parents.\n for (const auto& [outpoint, coin] : coins) {\n facts.missing_inputs |= coin.IsSpent();\n facts.immature_inputs |= !coin.IsSpent() && coin.IsCoinBase()\n && int64_t(height) + 1 - coin.nHeight < COINBASE_MATURITY;\n }\n facts.final = IsFinalTx(*transaction, height + 1, mtp);\n const auto minimum = std::max(chain->mempoolMinFee(), chain->relayMinFee());\n facts.sufficient_fee = fee >= minimum.GetFee(GetVirtualTransactionSize(*transaction));\n const auto limits = chain->checkChainLimits(transaction);\n facts.chain_limits = bool(limits);\n if (!limits) facts.chain_error = QString::fromStdString(util::ErrorString(limits).translated).left(4096);\n // A reorg during this collection invalidates the whole observation.\n if (node->getBestBlockHash() == tip) {\n facts.tip = QString::fromStdString(tip.ToString());\n facts.observed = true;\n } else {\n ClearChainFacts(facts);\n }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | A definite fee-bump refusal leaves Speed Up stuck in Uncertainqml/walletbump.cpp | still_present | AssessmentThe new-head walletbump excerpt still sets Error::Commit when commitBumpTransaction returns false. The supplied model evidence for the same code path maps Error::Commit to Uncertain, so the reported definite-refusal state remains. path_diff: qml/walletbump.cpp; new_source: qml/walletbump.cpp [
{
"evidence_id": "3e5b7eb5635a43b6acbcab204b3d1e40",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/walletbump.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/walletbump.cpp b/qml/walletbump.cpp\nindex bf7cd5152b..def2576023 100644\n--- a/qml/walletbump.cpp\n+++ b/qml/walletbump.cpp\n@@ -3,7 +3,6 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/walletbump.h>\n-#include <qml/walletopening.h>\n #include <qml/walletsend.h>\n #include <qml/models/signertransaction.h>\n #include <wallet/coincontrol.h>\n@@ -11,7 +10,9 @@\n #include <QObject>\n #include <algorithm>\n #include <set>\n+#include <string>\n #include <utility>\n+#include <vector>\n \n namespace walletbump {\n namespace {\n@@ -39,7 +40,12 @@ Error CheckApprovedScope(interfaces::Wallet& wallet, const Prepared& review)\n if (!wallet.transactionCanBeBumped(review.original)) return Error::Ineligible;\n interfaces::WalletTxStatus status{};\n int blocks{0}; int64_t block_time{0};\n- if (!wallet.tryGetTxStatus(review.original, status, blocks, block_time)) return Error::Unavailable;\n+ // A busy wallet is not a missing transaction. Waiting is safe on Core.\n+ if (!wallet.tryGetTxStatus(review.original, status, blocks, block_time)) {\n+ std::vector<std::string> messages, payment_requests;\n+ bool in_mempool{false};\n+ if (!wallet.getWalletTxDetails(review.original, status, messages, payment_requests, in_mempool, blocks).tx) return Error::Unavailable;\n+ }\n if (status.is_abandoned || status.depth_in_main_chain != 0) return Error::Ineligible;\n const auto original = wallet.getTx(review.original);\n if (!original || original->GetHash() != review.original\n@@ -80,7 +86,7 @@ void Observe(interfaces::Wallet& wallet, Commit& result, bool exact_witness = fa\n } // namespace\n \n Preparation Prepare(interfaces::Wallet& wallet, const QString& txid, unsigned int target,\n- const std::shared_ptr<walletopening::Session>& opening)\n+ std::shared_ptr<Prepared> review)\n {\n Preparation result;\n try {\n@@ -89,17 +95,7 @@ Preparation Prepare(interfaces::Wallet& wallet, const QString& txid, unsigned in\n if (target < 1 || target > 1008) { result.error = Error::Invalid; return result; }\n const auto original = Txid::FromUint256(*parsed);\n if (!wallet.transactionCanBeBumped(original)) { result.error = Error::Ineligible; return result; }\n- // A transaction review is backend data, potentially much larger than\n- // its GUI fee strings. Reserve cleanup before constructing it so the\n- // last facade/command release never tears transaction vectors down on GUI.\n- struct ReviewStorage { std::unique_ptr<Prepared> value; };\n- const auto review_storage = std::make_shared<ReviewStorage>();\n- auto cleanup_borrower = opening->holdValues([review_storage] { review_storage->value.reset(); });\n- if (!cleanup_borrower) { result.error = Error::Uncertain; return result; }\n- const auto review_lifetime = std::make_shared<execution::ResourceLease>(std::move(*cleanup_borrower.lease));\n- review_storage->value = std::make_unique<Prepared>();\n- // The review alias pins the borrower until reserved cleanup can run.\n- auto review = std::shared_ptr<Prepared>{review_lifetime, review_storage->value.get()};\n+ if (!review) { result.error = Error::Uncertain; return result; }\n review->original = original;\n review->target_blocks = target;\n const auto original_transaction = wallet.getTx(original);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 228,
"evidence_id": "834f2c3060f8472c908b91c6f0ec7692",
"finding_id": "finding:5",
"kind": "new_source",
"line": 180,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/walletbump.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 8,
"source_job_id": 2830,
"text": " if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n }\n if (const auto scope_error = CheckApprovedScope(wallet, review); scope_error != Error::None) {\n result.error = scope_error; return finishAfterRelock();\n }\n // No further key operation is needed. Restore authorization before\n // commit, and never publish a successful spend with failed restoration.\n restoreWalletLock(); passphrase.reset();\n if (result.relock_failed) return result;\n if (services.admission) {\n const auto exact = MakeTransactionRef(signed_tx);\n const auto decision = psbtpolicy::Evaluate(services.admission(exact, review.new_fee));\n if (decision.state == psbtpolicy::State::Blocked) {\n result.error = Error::Policy;\n result.message = decision.explanation;\n return result;\n }\n }\n std::vector<bilingual_str> errors;\n Txid txid;\n const CTransaction exact{signed_tx};\n result.candidate_txid = exact.GetHash();\n result.candidate_wtxid = exact.GetWitnessHash();\n result.commit_attempted = true;\n if (!wallet.commitBumpTransaction(review.original, std::move(signed_tx), errors, txid)) {\n result.error = Error::Commit; result.message = Message(errors); return result;\n }\n result.txid = txid;\n result.committed = true;\n Observe(wallet, result);\n } catch (const secretinput::Failure&) {\n result.error = Error::Invalid; result.message = QObject::tr(\"The wallet password could not be prepared. No fee bump was submitted.\");\n } catch (...) { result.error = Error::Uncertain; }\n return finishAfterRelock();\n}\nCommit ObserveOutcome(interfaces::Wallet& wallet, const Commit& original)\n{\n auto result = original;\n result.record = Record::Unknown;\n result.submission = Submission::Unknown;\n if (!original.commit_attempted || original.candidate_txid == Txid{}) return result;\n result.txid = original.candidate_txid;\n Observe(wallet, result, true);\n // Observing a record cannot manufacture the original call's missing\n // persistence/replacement-metadata receipt. Keep its uncertainty explicit.\n return result;\n}\n} // namespace walletbump",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A refused receive type stays hidden after descriptor importqml/walletopening.cpp | still_present | AssessmentThe supplied new-head walletopening excerpt retains the unavailable receive-type cache and does not show invalidation or re-probing when address-generation capabilities change. path_diff: qml/walletopening.cpp; new_source: qml/walletopening.cpp [
{
"evidence_id": "90610ec2586e4b7985a96906c4c23223",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/walletopening.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/walletopening.cpp b/qml/walletopening.cpp\nindex 5e818aea45..3d26d7a3c1 100644\n--- a/qml/walletopening.cpp\n+++ b/qml/walletopening.cpp\n@@ -3,81 +3,137 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/walletopening.h>\n+#include <qml/executor.h>\n+#include <qml/retainedvalue.h>\n \n+#include <common/args.h>\n #include <interfaces/chain.h>\n #include <addresstype.h>\n #include <outputtype.h>\n #include <univalue.h>\n \n #include <algorithm>\n+#include <cassert>\n+#include <exception>\n #include <stdexcept>\n #include <utility>\n \n namespace walletopening {\n struct Session::Resources {\n- std::shared_ptr<interfaces::Wallet> wallet;\n+ std::unique_ptr<interfaces::Wallet> wallet;\n+ std::shared_ptr<interfaces::Wallet> shared_wallet;\n+ std::unique_ptr<interfaces::Handler> unload_handler;\n std::vector<std::unique_ptr<interfaces::Handler>> handlers;\n+ bool acquired{false};\n+\n+ interfaces::Wallet* get() const { return wallet ? wallet.get() : shared_wallet.get(); }\n };\n+\n namespace {\n-struct Borrower {\n- execution::ResourceLease lease;\n- std::shared_ptr<interfaces::Wallet> wallet;\n-};\n Metadata ReadMetadata(interfaces::Wallet& wallet, const Session::Preferences& preferences, std::vector<std::string> unavailable_receive_types)\n {\n auto name = wallet.getWalletName();\n- if (name.size() > 32'768) throw std::length_error(\"Wallet name exceeds metadata transport budget\");\n+ if (name.size() > 32'768) throw std::length_error(\"Wallet name is too long\");\n auto saved = preferences.read ? preferences.read(name) : std::string{};\n // IDs are a closed vocabulary; never copy arbitrary persistent input into\n // the bounded metadata transport. Invalid values use the supported default.\n if (saved != \"bech32m\" && saved != \"bech32\" && saved != \"p2sh-segwit\" && saved != \"legacy\") saved.clear();\n+ // Core resolves -addresstype into the wallet's default type; only an\n+ // explicit setting overrides the app's own Taproot default.\n+ std::string configured{gArgs.IsArgSet(\"-addresstype\") ? FormatOutputType(wallet.getDefaultAddressType()) : std::string{}};\n return {std::move(name), wallet.privateKeysDisabled(), wallet.hasExternalSigner(), wallet.isCrypted(), wallet.isLocked(),\n- wallet.canGetAddresses(), wallet.taprootEnabled(), std::move(saved), std::move(unavailable_receive_types)};\n+ wallet.canGetAddresses(), wallet.taprootEnabled(), std::move(saved), std::move(configured), std::move(unavailable_receive_types)};\n+}\n+\n+execution::SubmitResult PostUtility(execution::SerialQueue& queue, std::function<void()> work)\n+{\n+ const bool accepted = queue.post([work = std::move(work)] {\n+ // These turns have no outcome callback. A failed turn must still\n+ // leave the worker available for the next one.\n+ try {\n+ work();\n+ } catch (...) {}\n+ });\n+ return {{}, accepted ? execution::Rejection::None : execution::Rejection::Transport};\n }\n }\n \n-Session::Session(std::shared_ptr<execution::Scheduler> commands,\n- std::shared_ptr<execution::Scheduler> retirement,\n- std::shared_ptr<std::atomic_bool> closed, Notify notify, Preferences preferences, Clock clock, std::shared_ptr<std::atomic_bool> shutdown_gate, NativeEvents native_events)\n- : m_commands(std::move(commands)), m_retirement(std::move(retirement)),\n- m_command_key(m_commands->allocateKey()), m_retirement_key(m_retirement->allocateKey()),\n- m_closed(std::move(closed)), m_shutdown_gate(std::move(shutdown_gate)), m_notify(std::move(notify)), m_preferences(std::move(preferences)), m_clock(std::move(clock)), m_native_events(std::move(native_events)), m_resources(std::make_shared<Resources>())\n+Session::Session(std::shared_ptr<std::atomic_bool> closed, Notify notify, Preferences preferences, Clock clock,\n+ std::shared_ptr<std::atomic_bool> shutdown_gate, NativeEvents native_events, Queues queues)\n+ : m_closed(std::move(closed)), m_shutdown_gate(std::move(shutdown_gate)), m_notify(std::move(notify)), m_preferences(std::move(preferences)), m_clock(std::move(clock)), m_native_events(std::move(native_events)),\n+ m_cleanup_queue(std::move(queues.cleanup)), m_core_queue(std::move(queues.core)), m_outcomes(std::move(queues.outcomes)),\n+ m_value_cleanup(std::make_shared<execution::ValueCleanupQueue>(m_cleanup_queue)),\n+ m_native_cleanup(std::make_shared<execution::ValueCleanupQueue>(queues.native_cleanup ? queues.native_cleanup : m_cleanup_queue)),\n+ m_outcome_delivery(std::make_shared<execution::ValueCleanupQueue>(m_outcomes)),\n+ m_stop_work(std::move(queues.stop_work))\n {\n+ assert(m_cleanup_queue && m_core_queue && m_outcomes && m_stop_work);\n }\n \n Session::Start Session::start(const std::shared_ptr<interfaces::Wallet>& wallet)\n {\n- {\n- std::lock_guard lock{m_mutex};\n- if (std::exchange(m_started, true)) return {{{}, execution::Rejection::Invalid}, {}};\n- }\n+ return startWith([&](Resources& resources) { resources.shared_wallet = wallet; });\n+}\n+\n+Session::Start Session::start(std::unique_ptr<interfaces::Wallet>& wallet, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ return startWith([&](Resources& resources) {\n+ resources.wallet = std::move(wallet);\n+ resources.unload_handler = std::move(unload_handler);\n+ });\n+}\n+\n+Session::Start Session::start(Source& source, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ if (auto* wallet = std::get_if<std::unique_ptr<interfaces::Wallet>>(&source)) return start(*wallet, unload_handler);\n+ auto& wallet = std::get<std::shared_ptr<interfaces::Wallet>>(source);\n+ return startWith([&](Resources& resources) {\n+ resources.shared_wallet = std::move(wallet);\n+ resources.unload_handler = std::move(unload_handler);\n+ });\n+}\n+\n+void Session::retireUnclaimed(Source& source, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ struct UnclaimedWallet {\n+ Source source;\n+ std::unique_ptr<interfaces::Handler> handler;\n+\n+ ~UnclaimedWallet()\n+ {\n+ try {\n+ if (handler) handler->disconnect();\n+ } catch (...) {\n+ // Release both handles even when disconnection fails.\n+ }\n+ }\n+ };\n+ const auto make = [] { return std::make_unique<UnclaimedWallet>(); };\n+ const auto unused = walletopening::RetainValues<UnclaimedWallet>(shared_from_this(), make);\n+ if (!unused) std::terminate();\n+ unused->source = std::move(source);\n+ unused->handler = std::move(unload_handler);\n+}\n+\n+Session::Start Session::startWith(const std::function<void(Resources&)>& acquire)\n+{\n const auto self = shared_from_this();\n- const auto cleanup = execution::Submit(*m_retirement, [self] { return self->cleanup(); }, [self](bool failed) {\n- self->m_drained = true;\n- Update update; update.phase = Phase::Closed; update.failed = failed;\n- self->publish(std::move(update));\n- }, {}, {execution::Lane::Cleanup, sizeof(void*) * 8, m_retirement_key}, true);\n- if (!cleanup) {\n- m_closed->store(true);\n- m_drained = true;\n- Update failed; failed.phase = Phase::Closed; failed.failed = true; publish(std::move(failed));\n- return {cleanup, {}};\n- }\n+ std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{m_mutex};\n- m_cleanup = cleanup.id;\n- }\n- // Pin initialization before acquiring a native resource. A concurrent\n- // retirement-root shutdown may activate its reservation immediately.\n- auto initialization = m_retirement->borrow(m_retirement_key);\n- if (!initialization) {\n- retire();\n- return {{{}, initialization.rejection}, {}};\n- }\n- {\n- std::lock_guard lock{m_mutex};\n- m_resources->wallet = wallet;\n+ if (m_started) return {{{}, execution::Rejection::Invalid}, {}};\n+ if (m_drained || m_closed->load()) return {{{}, execution::Rejection::Closed}, {}};\n+ auto native = std::make_shared<Resources>();\n+ auto hold = m_native_cleanup->hold([self, native] {\n+ if (native->acquired) self->completeStop(self->cleanup(*native));\n+ });\n+ if (!hold) return {{{}, execution::Rejection::Closed}, {}};\n+ resources = std::shared_ptr<Resources>{std::move(hold), native.get()};\n+ acquire(*resources);\n+ resources->acquired = true;\n+ m_resources = resources;\n m_refresh_pending = true;\n+ m_started = true;\n }\n auto client = borrow();\n const auto admitted = read([self](interfaces::Wallet& value) {\n@@ -111,17 +167,14 @@ Session::Start Session::start(const std::shared_ptr<interfaces::Wallet>& wallet)\n std::shared_ptr<interfaces::Wallet> Session::borrow() const\n {\n std::lock_guard lock{m_mutex};\n- if (!observationOpen() || !m_resources->wallet) return {};\n- auto borrowed = m_retirement->borrow(m_retirement_key);\n- if (!borrowed) return {};\n- auto owner = std::make_shared<Borrower>(Borrower{std::move(*borrowed.lease), m_resources->wallet});\n- return {std::move(owner), m_resources->wallet.get()};\n+ if (!observationOpen() || !m_resources || !m_resources->get()) return {};\n+ return {m_resources, m_resources->get()};\n }\n \n void Session::close()\n {\n std::lock_guard lock{m_mutex};\n- m_admission_closed.store(true);\n+ m_actions_closed.store(true);\n m_source_epoch->closed.store(true);\n }\n \n@@ -135,34 +188,58 @@ bool Session::admitAction()\n \n bool Session::control(std::function<void()> effect)\n {\n- return bool(execution::Submit(*m_commands, [] {}, std::move(effect), {},\n- {execution::Lane::Control, sizeof(void*) * 8, m_command_key}));\n+ return bool(PostUtility(*m_outcomes, std::move(effect)));\n }\n \n-execution::Admission Session::postDomain(std::function<void()> work, size_t payload_bytes, execution::WorkClass kind)\n+execution::SubmitResult Session::postDomain(std::function<void()> work, execution::WorkClass kind)\n {\n if (kind == execution::WorkClass::Action ? !admitAction() : !available()) return {{}, execution::Rejection::Closed};\n const auto self = shared_from_this();\n- return execution::Submit(*m_commands, [self, work = std::move(work), kind] {\n+ auto run = [self, work = std::move(work), kind] {\n // Accepted command planning must consume its outcome even after close.\n if (kind == execution::WorkClass::Action || self->available()) work();\n- }, [] {}, {}, {execution::Lane::Domain, payload_bytes, m_command_key, kind});\n+ };\n+ return PostUtility(*m_outcomes, std::move(run));\n }\n \n-execution::Admission Session::retireValues(std::function<void()> work)\n+execution::SubmitResult Session::postDomainTask(std::shared_ptr<execution::Task> packet, execution::WorkClass)\n {\n- return execution::Submit(*m_commands, std::move(work), [] {}, {},\n- {execution::Lane::Cleanup, 256, {}, execution::WorkClass::Action});\n+ if (!observationOpen()) return {{}, execution::Rejection::Closed};\n+ return PostUtility(*m_outcomes, [packet = std::move(packet)] {\n+ packet->execute();\n+ packet->deliver();\n+ });\n }\n \n-execution::BorrowAdmission Session::holdValues(std::function<void()> cleanup)\n+std::function<execution::SubmitResult(std::shared_ptr<execution::Task>)> Session::observationPost(\n+ execution::Lane lane)\n {\n- const auto key = m_commands->allocateKey();\n- const auto reserved = execution::Submit(*m_commands, std::move(cleanup), [] {}, {},\n- {execution::Lane::Cleanup, 256, key, execution::WorkClass::Action}, true);\n- if (!reserved) return {{}, reserved.rejection};\n- auto held = m_commands->borrow(key);\n- m_commands->activateCleanup(reserved.id);\n+ assert(lane == execution::Lane::Core || lane == execution::Lane::Domain);\n+ return [self = shared_from_this(), lane](std::shared_ptr<execution::Task> packet) {\n+ if (lane == execution::Lane::Domain) return self->postDomainTask(std::move(packet), execution::WorkClass::Observation);\n+ if (!self->observationOpen()) return execution::SubmitResult{{}, execution::Rejection::Closed};\n+ return self->postCore(std::move(packet));\n+ };\n+}\n+\n+execution::SubmitResult Session::retireValues(std::function<void()> work)\n+{\n+ return PostUtility(*m_outcomes, std::move(work));\n+}\n+\n+std::shared_ptr<void> Session::holdValues(std::function<void()> cleanup)\n+{\n+ // A rejected callback can release an action and reenter releaseWork().\n+ // Keep its captures alive until the admission lock has been released.\n+ auto retire = std::make_shared<Notify>(std::move(cleanup));\n+ std::lock_guard lock{m_mutex};\n+ if (m_stop_requested) return {};\n+ auto held = m_value_cleanup->hold([self = shared_from_this(), retire] {\n+ try { (*retire)(); } catch (...) {}\n+ *retire = {};\n+ self->releaseWork();\n+ });\n+ if (held) ++m_work_references;\n return held;\n }\n \n@@ -181,46 +258,54 @@ std::function<bool()> Session::observationGuard() const\n };\n }\n \n+Session::Action::~Action()\n+{\n+ if (m_owner) m_owner->releaseWork();\n+}\n+\n std::shared_ptr<const Session::Action> Session::startAction()\n {\n- auto scope = m_commands->openActionScope(sizeof(Action) + 128);\n- if (!scope) return {};\n- execution::ResourceKey work_key;\n- try { work_key = m_commands->allocateKey(); } catch (...) { return {}; }\n- if (!admitAction()) return {};\n- auto wallet = borrow();\n- if (!wallet) return {};\n- return std::shared_ptr<const Action>{new Action{m_identity, std::move(scope), work_key, std::move(wallet)}};\n+ auto action = std::shared_ptr<Action>{new Action{m_identity}};\n+ std::lock_guard lock{m_mutex};\n+ if (!available() || !m_resources || !m_resources->get()) return {};\n+ action->m_owner = shared_from_this();\n+ ++m_work_references;\n+ ++m_consequences;\n+ return action;\n }\n \n-execution::Admission Session::submitActionWork(const std::shared_ptr<const Action>& action,\n- std::function<void()> work, size_t payload_bytes)\n+void Session::releaseWork()\n {\n- if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Core, payload_bytes, action->m_work_key, execution::WorkClass::Action});\n+ std::function<void(Notify)> stop_work;\n+ {\n+ std::lock_guard lock{m_mutex};\n+ assert(m_work_references > 0);\n+ if (--m_work_references == 0 && m_stop_requested) stop_work = std::exchange(m_stop_work, {});\n+ }\n+ if (stop_work) drainWork(std::move(stop_work));\n }\n \n-execution::Admission Session::reserveActionCleanup(const std::shared_ptr<const Action>& action,\n- std::function<void()> work)\n+interfaces::Wallet& Session::nativeWallet() const\n {\n- if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Cleanup, 256, action->m_work_key, execution::WorkClass::Action}, true);\n+ std::lock_guard lock{m_mutex};\n+ auto* wallet = m_resources ? m_resources->get() : nullptr;\n+ if (!wallet) throw std::logic_error{\"The wallet opening has no native wallet\"};\n+ return *wallet;\n }\n \n-bool Session::activateActionCleanup(const std::shared_ptr<const Action>& action, execution::TaskId id)\n+execution::SubmitResult Session::postCore(std::shared_ptr<execution::Task> packet)\n {\n- if (!action || action->m_identity != m_identity) return false;\n- return action->m_scope->activateCleanup(id);\n+ // Reserve Utility delivery before admitting Core work. A rejected Core\n+ // submission releases the reservation with no completed packet.\n+ return m_outcome_delivery->postWithOutcome(*m_core_queue, std::move(packet));\n }\n \n-execution::Admission Session::planAction(const std::shared_ptr<const Action>& action,\n- std::function<void()> work, size_t payload_bytes)\n+execution::SubmitResult Session::planAction(const std::shared_ptr<const Action>& action,\n+ std::function<void()> work)\n {\n if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Domain, payload_bytes, m_command_key, execution::WorkClass::Action});\n+ auto run = [action, work = std::move(work)] { work(); };\n+ return PostUtility(*m_outcomes, std::move(run));\n }\n \n void Session::onTransactions(Transactions consumer)\n@@ -236,7 +321,7 @@ void Session::onTransactions(Transactions consumer)\n // including a Domain publication that had already copied the old consumer.\n if (consumer && seed.transaction_revision && !postDomain([consumer = std::move(consumer), seed] {\n consumer(seed.transaction_revision, seed.transactions, true);\n- }, 256 + seed.transactions.size() * 128)) {\n+ })) {\n {\n std::lock_guard lock{m_mutex};\n m_pending.rescan = true;\n@@ -274,29 +359,79 @@ void Session::answerClose(Question question, bool accept)\n \n void Session::retire(bool remove_wallet)\n {\n- std::optional<execution::TaskId> cleanup;\n+ // Native ingress can report an unload while the facade still needs to\n+ // stop its producers. The facade calls stop() after that handoff.\n+ std::lock_guard lock{m_mutex};\n+ m_closed->store(true);\n+ m_remove |= remove_wallet;\n+ m_pending = {};\n+}\n+\n+void Session::stop(bool remove_wallet, Notify done)\n+{\n+ std::function<void(Notify)> stop_work;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_remove |= remove_wallet;\n- cleanup = m_cleanup;\n m_pending = {};\n+ if (!m_drained) {\n+ if (done) m_stop_callbacks.push_back(std::exchange(done, {}));\n+ m_stop_requested = true;\n+ // Accepted actions can still schedule follow-ups, and retained\n+ // values can still post their final cleanup on Utility.\n+ if (m_work_references == 0) stop_work = std::exchange(m_stop_work, {});\n+ }\n }\n- if (cleanup) m_retirement->activateCleanup(*cleanup);\n+ if (stop_work) drainWork(std::move(stop_work));\n+ if (done) done();\n }\n \n-bool Session::cleanup()\n+void Session::drainWork(std::function<void(Notify)> stop_work)\n+{\n+ stop_work([self = shared_from_this()] {\n+ std::shared_ptr<Resources> resources;\n+ {\n+ std::lock_guard lock{self->m_mutex};\n+ resources = std::move(self->m_resources);\n+ }\n+ if (!resources) self->completeStop(false);\n+ // The last borrower releases the wallet on its cleanup worker.\n+ });\n+}\n+\n+void Session::completeStop(bool failed)\n+{\n+ std::vector<Notify> callbacks;\n+ {\n+ std::lock_guard lock{m_mutex};\n+ m_closed->store(true);\n+ m_drained = true;\n+ callbacks.swap(m_stop_callbacks);\n+ }\n+ Update update;\n+ update.phase = Phase::Closed;\n+ update.failed = failed;\n+ publish(std::move(update));\n+ for (const auto& callback : callbacks) callback();\n+}\n+\n+bool Session::cleanup(Resources& resources)\n {\n m_closed->store(true);\n bool failed{false};\n- for (auto& handler : m_resources->handlers) {\n+ for (auto& handler : resources.handlers) {\n try { if (handler) handler->disconnect(); } catch (...) { failed = true; }\n }\n- m_resources->handlers.clear();\n+ resources.handlers.clear();\n bool remove;\n { std::lock_guard lock{m_mutex}; remove = m_remove; }\n- try { if (m_resources->wall\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 517,
"evidence_id": "6b634843490e49a8a97dc60e6e2e352b",
"finding_id": "finding:4",
"kind": "new_source",
"line": 368,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/walletopening.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 8,
"source_job_id": 2830,
"text": "}\n\nvoid Session::stop(bool remove_wallet, Notify done)\n{\n std::function<void(Notify)> stop_work;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_remove |= remove_wallet;\n m_pending = {};\n if (!m_drained) {\n if (done) m_stop_callbacks.push_back(std::exchange(done, {}));\n m_stop_requested = true;\n // Accepted actions can still schedule follow-ups, and retained\n // values can still post their final cleanup on Utility.\n if (m_work_references == 0) stop_work = std::exchange(m_stop_work, {});\n }\n }\n if (stop_work) drainWork(std::move(stop_work));\n if (done) done();\n}\n\nvoid Session::drainWork(std::function<void(Notify)> stop_work)\n{\n stop_work([self = shared_from_this()] {\n std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{self->m_mutex};\n resources = std::move(self->m_resources);\n }\n if (!resources) self->completeStop(false);\n // The last borrower releases the wallet on its cleanup worker.\n });\n}\n\nvoid Session::completeStop(bool failed)\n{\n std::vector<Notify> callbacks;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_drained = true;\n callbacks.swap(m_stop_callbacks);\n }\n Update update;\n update.phase = Phase::Closed;\n update.failed = failed;\n publish(std::move(update));\n for (const auto& callback : callbacks) callback();\n}\n\nbool Session::cleanup(Resources& resources)\n{\n m_closed->store(true);\n bool failed{false};\n for (auto& handler : resources.handlers) {\n try { if (handler) handler->disconnect(); } catch (...) { failed = true; }\n }\n resources.handlers.clear();\n bool remove;\n { std::lock_guard lock{m_mutex}; remove = m_remove; }\n try { if (auto* wallet = resources.get(); wallet && remove) wallet->remove(); } catch (...) { failed = true; }\n // The original load observation records the removal before disconnecting.\n try { if (resources.unload_handler) resources.unload_handler->disconnect(); } catch (...) { failed = true; }\n resources.unload_handler.reset();\n resources.wallet.reset();\n resources.shared_wallet.reset();\n return failed;\n}\n\nvoid Session::ingress(int kind, const Txid& txid, ChangeType change)\n{\n m_source_epoch->advance();\n if (kind == 3) m_native_events.observeUnload();\n std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{m_mutex};\n resources = m_resources;\n }\n if (kind == 3) {\n retire();\n Update closing; closing.unloaded = true; closing.phase = Phase::Closing;\n publish(std::move(closing));\n const auto self = shared_from_this();\n control([self] {\n self->m_state.retire();\n Update update; update.unloaded = true;\n update.phase = self->m_state.phase();\n self->publish(std::move(update));\n });\n return;\n }\n if (!resources) {\n if (available()) { retire(); Update failed; failed.failed = true; publish(std::move(failed)); }\n return;\n }\n {\n std::lock_guard lock{m_mutex};\n if (!observationOpen()) return;\n if (kind == 4) m_metadata_dirty = true;\n else if (kind == 0) m_pending.status = true;\n else if (kind == 1) m_pending.addresses = true;\n else {\n m_transactions_pending = true;\n m_pending.transaction_revision = ++m_transaction_revision;\n if (m_pending.transactions.size() < 256 || m_pending.transactions.contains(txid)) m_pending.transactions[txid] = change;\n else m_pending.rescan = true;\n }\n }\n scheduleRefresh();\n}\n\nvoid Session::scheduleRefresh()\n{\n Update events;\n {\n std::lock_guard lock{m_mutex};\n if (!observationOpen() || m_refresh_pending || m_clock() < m_retry_after) return;\n if (!m_metadata_dirty && !m_pending.status && !m_pending.addresses && !m_pending.rescan && m_pending.transactions.empty()) return;\n m_refresh_pending = true;\n events = std::exchange(m_pending, {});\n m_metadata_dirty = false;\n }\n const auto self = shared_from_this();\n const bool transactions = events.rescan || !events.transactions.empty();\n const auto admitted = read([self](interfaces::Wallet& wallet) { return ReadMetadata(wallet, self->m_preferences, self->unavailableReceiveTypes()); },\n [self, events = std::move(events)](Metadata metadata) mutable { self->refreshed(std::move(metadata), std::move(events)); },\n [self, transactions](std::exception_ptr) { self->refreshFailed(transactions); }, execution::WorkClass::Observation);\n if (!admitted) refreshFailed(transactions);\n}\n\nvoid Session::refreshFailed(bool transactions)\n{\n {\n std::lock_guard lock{m_mutex};\n m_refresh_pending = false;\n if (!observationOpen()) return;\n // Reconcile a failed/undelivered notice instead of dropping its\n // consequences. Retry only after the bounded backoff, on a new notice\n // or an explicit clock tick; never spin on admission failure.\n m_pending.status = m_pending.addresses = true;\n m_pending.rescan |= transactions;\n if (transactions) m_pending.transaction_revision = m_transaction_revision;\n m_retry_after = m_clock() + std::chrono::seconds{std::min(30U, 1U << m_refresh_failures)};\n m_refresh_failures = std::min(5U, m_refresh_failures + 1);\n }\n Update update; update.failed = true; publish(std::move(update));\n}\n\nOutputType Session::preferredReceiveType(interfaces::Wallet& wallet) const",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Signer verification accepts signatures that do not protect all reviewed outputsqml/walletsend.cpp | addressed | AssessmentThe new send paths call CommitsToAllOutputs after signature verification for imported PSBT execution, returned signer contributions, and external transactions. The supplied diff shows the additional output-commitment enforcement across these paths. path_diff: qml/walletsend.cpp [
{
"evidence_id": "9bb15430f22046a286beedd692316875",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/walletsend.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/walletsend.cpp b/qml/walletsend.cpp\nindex 2e51f39355..5ba1a6231e 100644\n--- a/qml/walletsend.cpp\n+++ b/qml/walletsend.cpp\n@@ -95,7 +95,7 @@ bool VerifiedExternalTransaction(interfaces::Wallet& wallet, const CTransaction&\n document.inputs[i].final_script_sig = transaction.vin[i].scriptSig;\n document.inputs[i].final_script_witness = transaction.vin[i].scriptWitness;\n }\n- return VerifiedSignatures(document);\n+ return VerifiedSignatures(document) && psbtsignatures::CommitsToAllOutputs(document);\n } catch (...) { return false; }\n }\n struct Observation {\n@@ -178,6 +178,7 @@ Result Execute(interfaces::Wallet& wallet, Request request)\n if (request.assessed_complete && request.reviewed->GetWitnessHash() != MakeTransactionRef(extracted)->GetWitnessHash()) { result.error = Error::ChangedTransaction; return result; }\n if (!psbtfee::MatchesReview(psbt, *authenticated, request.approved_fee)) { result.error = Error::InvalidFee; return result; }\n if (!VerifiedSignatures(psbt)) { result.error = Error::InvalidSignature; return result; }\n+ if (!psbtsignatures::CommitsToAllOutputs(psbt)) { result.error = Error::UncommittedOutputs; return result; }\n transaction = MakeTransactionRef(std::move(extracted));\n } else if (wallet.privateKeysDisabled()) {\n if (!wallet.hasExternalSigner()) { result.error = Error::CannotSign; return result; }\n@@ -332,7 +333,7 @@ bool VerifyExternalTransaction(interfaces::Wallet& wallet, const CTransaction& t\n return VerifiedExternalTransaction(wallet, transaction);\n }\n \n-execution::Admission Operation::start(Request request, std::shared_ptr<const walletopening::Session::Action> action)\n+execution::SubmitResult SendTask::start(Request request, std::shared_ptr<const walletopening::Session::Action> action)\n {\n {\n std::lock_guard lock{m_mutex};\n@@ -342,13 +343,13 @@ execution::Admission Operation::start(Request request, std::shared_ptr<const wal\n if (!action) action = m_opening->startAction();\n if (!action) { complete(FailureResult(Error::Rejected)); return {{}, execution::Rejection::Closed}; }\n auto native_result = walletopening::RetainValues<CTransactionRef>(m_opening, [] { return std::make_unique<CTransactionRef>(); });\n- if (!native_result) { complete(FailureResult(Error::Rejected)); return {{}, execution::Rejection::Capacity}; }\n+ if (!native_result) { complete(FailureResult(Error::Rejected)); return {{}, execution::Rejection::Closed}; }\n std::shared_ptr<PartiallySignedTransaction> native_document_result;\n if (request.intent == Intent::SignOnly) {\n native_document_result = walletopening::RetainValues<PartiallySignedTransaction>(m_opening, [] {\n return std::make_unique<PartiallySignedTransaction>(CMutableTransaction{}, 2);\n });\n- if (!native_document_result) { complete(FailureResult(Error::Rejected)); return {{}, execution::Rejection::Capacity}; }\n+ if (!native_document_result) { complete(FailureResult(Error::Rejected)); return {{}, execution::Rejection::Closed}; }\n }\n {\n std::lock_guard lock{m_mutex};\n@@ -360,18 +361,18 @@ execution::Admission Operation::start(Request request, std::shared_ptr<const wal\n m_native_document_result = std::move(native_document_result);\n }\n const auto self = shared_from_this();\n- return plan([self] { self->beginOnDomain(); }, sizeof(Request));\n+ return plan([self] { self->beginOnDomain(); });\n }\n \n-execution::Admission Operation::plan(std::function<void()> work, size_t bytes)\n+execution::SubmitResult SendTask::plan(std::function<void()> work)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n { std::lock_guard lock{m_mutex}; action = m_action; }\n if (!action) return {{}, execution::Rejection::Closed};\n- return m_opening->planAction(action, std::move(work), bytes);\n+ return m_opening->planAction(action, std::move(work));\n }\n \n-void Operation::beginOnDomain()\n+void SendTask::beginOnDomain()\n {\n Notice notice{Notice::SweepConsentRequired};\n bool wait_for_sweep{false}, cancelled{false};\n@@ -398,7 +399,7 @@ void Operation::beginOnDomain()\n dispatchNative();\n }\n \n-void Operation::dispatchNative(secretinput::Captured passphrase)\n+void SendTask::dispatchNative(secretinput::Captured passphrase)\n {\n Request request;\n std::shared_ptr<const walletopening::Session::Action> action;\n@@ -430,8 +431,6 @@ void Operation::dispatchNative(secretinput::Captured passphrase)\n native_document_result = m_native_document_result;\n }\n const auto self = shared_from_this();\n- const size_t bytes = sizeof(Request) + (request.passphrase ? request.passphrase->capacity() : 0)\n- + secretinput::Bytes(request.captured_passphrase) + request.notes.size() * 128;\n const auto admitted = m_opening->perform(action,\n [request = std::move(request), native_result, native_document_result](interfaces::Wallet& wallet) mutable {\n auto result = request.intent == Intent::SignOnly\n@@ -450,11 +449,11 @@ void Operation::dispatchNative(secretinput::Captured passphrase)\n try { std::rethrow_exception(error); }\n catch (const execution::NotStarted&) { self->nativeCompleted(FailureResult(Error::Rejected)); }\n catch (...) { self->nativeCompleted(FailureResult(Error::Uncertain)); }\n- }, bytes);\n+ });\n if (!admitted) nativeCompleted(FailureResult(Error::Rejected));\n }\n \n-void Operation::nativeCompleted(Result result)\n+void SendTask::nativeCompleted(Result result)\n {\n if (!result.candidate) {\n std::lock_guard lock{m_mutex};\n@@ -490,7 +489,7 @@ void Operation::nativeCompleted(Result result)\n } else if (m_notes) {\n try {\n auto accepted = m_notes->submitSentLabels(action, result.committed->GetHash(), notes,\n- [notify = m_notify, weak = std::weak_ptr<Operation>{shared_from_this()}] {\n+ [notify = m_notify, weak = std::weak_ptr<SendTask>{shared_from_this()}] {\n try { notify(Notice::Notes); }\n catch (...) { if (const auto owner = weak.lock()) owner->publicationFailed(); }\n });\n@@ -501,7 +500,7 @@ void Operation::nativeCompleted(Result result)\n complete(std::move(result));\n }\n \n-execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t review_id)\n+execution::SubmitResult SendTask::confirmSweep(uint64_t attempt_id, uint64_t review_id)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -512,7 +511,7 @@ execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t revie\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id] {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id] {\n bool accepted{false}, cancelled{false};\n {\n std::lock_guard lock{self->m_mutex};\n@@ -528,12 +527,12 @@ execution::Admission Operation::confirmSweep(uint64_t attempt_id, uint64_t revie\n }\n if (cancelled) self->complete(FailureResult(Error::Cancelled));\n else if (accepted) self->dispatchNative();\n- }, 256);\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ });\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t review_id, secretinput::Captured passphrase)\n+execution::SubmitResult SendTask::providePassphrase(uint64_t attempt_id, uint64_t review_id, secretinput::Captured passphrase)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -544,8 +543,7 @@ execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto bytes = secretinput::Bytes(passphrase) + 128;\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id, passphrase = std::move(passphrase)]() mutable {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id, passphrase = std::move(passphrase)]() mutable {\n bool accepted{false}, cancelled{false};\n {\n std::lock_guard lock{self->m_mutex};\n@@ -561,12 +559,12 @@ execution::Admission Operation::providePassphrase(uint64_t attempt_id, uint64_t\n }\n if (cancelled) self->complete(FailureResult(Error::Cancelled));\n else if (accepted) self->dispatchNative(std::move(passphrase));\n- }, bytes);\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ });\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t review_id)\n+execution::SubmitResult SendTask::cancelPrompt(uint64_t attempt_id, uint64_t review_id)\n {\n std::shared_ptr<const walletopening::Session::Action> action;\n {\n@@ -578,7 +576,7 @@ execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t revie\n action = m_action;\n }\n const auto self = shared_from_this();\n- const auto admission = m_opening->planAction(action, [self, attempt_id, review_id] {\n+ const auto started = m_opening->planAction(action, [self, attempt_id, review_id] {\n {\n std::lock_guard lock{self->m_mutex};\n if (self->m_result || self->m_attempt_id != attempt_id || self->m_review_id != review_id ||\n@@ -588,19 +586,19 @@ execution::Admission Operation::cancelPrompt(uint64_t attempt_id, uint64_t revie\n self->m_stage = Stage::Finished;\n }\n self->complete(FailureResult(Error::Cancelled));\n- }, 256);\n- if (!admission) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n- return admission;\n+ });\n+ if (!started) { std::lock_guard lock{m_mutex}; m_continuation_pending = false; }\n+ return started;\n }\n \n-Stage Operation::stage() const { std::lock_guard lock{m_mutex}; return m_stage; }\n-Error Operation::promptError() const { std::lock_guard lock{m_mutex}; return m_prompt_error; }\n+Stage SendTask::stage() const { std::lock_guard lock{m_mutex}; return m_stage; }\n+Error SendTask::promptError() const { std::lock_guard lock{m_mutex}; return m_prompt_error; }\n \n-std::optional<Result> Operation::result() const\n+std::optional<Result> SendTask::result() const\n {\n std::lock_guard lock{m_mutex}; return m_result;\n }\n-void Operation::complete(Result result)\n+void SendTask::complete(Result result)\n {\n Request discarded;\n std::shared_ptr<const walletopening::Session::Action> retired_action;\n@@ -629,7 +627,7 @@ void Operation::complete(Result result)\n try { m_notify(Notice::Finished); }\n catch (...) { publicationFailed(); }\n }\n-void Operation::publicationFailed()\n+void SendTask::publicationFailed()\n {\n std::lock_guard lock{m_mutex}; m_publication_failed = true;\n if (m_result) m_result->publication_failed = true;\n@@ -666,7 +664,8 @@ static Result ExecuteApproval(interfaces::Wallet& wallet, const Request& request\n const auto returned = document.GetUnsignedTx();\n if (returned && MatchesUnsignedTransaction(unsigned_tx, *returned) &&\n psbtfee::MatchesReview(document, *authenticated, request.approved_fee) &&\n- psbtsignatures::VerifyFinalizedInputs(document, /*require_all=*/false)) {\n+ psbtsignatures::VerifyFinalizedInputs(document, /*require_all=*/false) &&\n+ psbtsignatures::CommitsToAllOutputs(document)) {\n result.signature_status = psbtsignatures::VerifyContributions(*approved, document);\n if (result.signature_status == psbtsignatures::Status::Valid) {\n result.document = std::make_shared<const PartiallySignedTransaction>(document);\n@@ -697,6 +696,10 @@ static Result ExecuteApproval(interfaces::Wallet& wallet, const Request& request\n result.document = approved;\n result.error = Error::InvalidFee; return result;\n }\n+ if (!psbtsignatures::CommitsToAllOutputs(document)) {\n+ result.document = approved;\n+ result.error = Error::UncommittedOutputs; return result;\n+ }\n if (extracted) {\n if (!walletsend::VerifiedSignatures(document)) {\n // Finalization and a signer's completion flag do not prove\n@@ -806,7 +809,7 @@ void ApprovalOwner::publish(const std::shared_ptr<State>& state, const Notify& n\n if (notify) notify(project(*state));\n }\n \n-execution::Admission ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t view_revision)\n+execution::SubmitResult ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t view_revision)\n {\n if (!m_opening || m_close_requested.load()) return {{}, execution::Rejection::Closed};\n const auto state = m_state;\n@@ -839,10 +842,10 @@ execution::Admission ApprovalOwner::reviewChanged(uint64_t review_id, uint64_t v\n }\n ++state->sequence;\n publish(state, notify);\n- }, 512);\n+ });\n }\n \n-execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review_id, uint64_t view_revision,\n+execution::SubmitResult ApprovalOwner::request(uint64_t attempt_id, uint64_t review_id, uint64_t view_revision,\n std::shared_ptr<Request> retained_request)\n {\n if (!m_opening || m_close_requested.load() || attempt_id == 0 || !retained_request)\n@@ -962,18 +965,18 @@ execution::Admission ApprovalOwner::request(uint64_t attempt_id, uint64_t review\n value.error = ApprovalExecutionError(std::move(error));\n finish(std::move(value));\n };\n- const auto admission = opening->perform(action, [request, output](interfaces::Wallet& wallet) {\n+ const auto started = opening->perform(action, [request, output](interfaces::Wallet& wallet) {\n return ApproveInto(wallet, *request, output);\n }, finish, failed);\n- if (!admission) {\n+ if (!started) {\n Result value;\n value.error = Error::Failed;\n finish(std::move(value));\n }\n- }, 1024);\n+ });\n }\n \n-execution::Admission ApprovalOwner::close()\n+execution::SubmitResult ApprovalOwner::close()\n {\n if (m_close_requested.exchange(true)) return {{}, execution::Rejection::Invalid};\n if (!m_opening) return {{}, execution::Rejection::Closed};\n@@ -993,6 +996,6 @@ execution::Admission ApprovalOwner::close()\n }\n ++state->sequence;\n publish(state, notify);\n- }, 256);\n+ });\n }\n } // namespace walletsigning\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | A pre-created /tmp/qml-intent-<uid> blocks GUI startupqml/desktopintenttransport.cpp | addressed | AssessmentThe Unix transport now selects QStandardPaths::RuntimeLocation and uses a qml-intent subdirectory there instead of the predictable shared /tmp path, with owner, directory-type, and permission checks. path_diff: qml/desktopintenttransport.cpp; new_source: qml/desktopintenttransport.cpp [
{
"evidence_id": "81dd87ef3d684a9483b6491045daf4b7",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/desktopintenttransport.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/desktopintenttransport.cpp b/qml/desktopintenttransport.cpp\nindex 841d066889..df095f879a 100644\n--- a/qml/desktopintenttransport.cpp\n+++ b/qml/desktopintenttransport.cpp\n@@ -2,7 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/desktopintenttransport.h>\n-#include <qml/retainedvalue.h>\n+#include <qml/asyncjoin.h>\n #include <util/fs.h>\n \n #include <QCoreApplication>\n@@ -17,6 +17,8 @@\n #include <QLocalSocket>\n #include <QLockFile>\n #include <QMetaObject>\n+#include <QScopeGuard>\n+#include <QStandardPaths>\n #include <QStringList>\n #include <QThread>\n #include <QTimer>\n@@ -196,25 +198,26 @@ struct Discovery {\n struct Service::Flags {\n std::atomic_bool admission_closed{false}, stopping{false}, started{false}, retired{false};\n std::mutex mutex;\n- execution::TaskId retired_task;\n- std::function<void()> completed_stop;\n+ std::vector<std::function<void()>> completed_stops;\n bool probed{false}, probe_pending{false}, probe_terminal{false}; // Protected by mutex.\n };\n struct Service::State {\n struct Native;\n- std::shared_ptr<execution::Scheduler> scope;\n std::shared_ptr<Owner> owner;\n Limits limits;\n- execution::ResourceKey key;\n const std::shared_ptr<Flags> flags{std::make_shared<Flags>()};\n- std::shared_ptr<execution::ResourceLease> native_lifetime;\n- std::mutex mutex;\n+ // The same lock protects admission, pending delivery and the receiver\n+ // used to post work to the transport thread.\n Native* native{nullptr};\n+ size_t pending_deliveries{0};\n+ bool post(std::function<void(Native&)> work);\n+ void finishDelivery();\n+ void retireWhenIdle();\n };\n \n struct Service::State::Native final : QObject {\n struct Query { QJsonArray results; QStringList keys; size_t remaining{0}; bool unknown{false}; };\n- struct Reply { std::optional<desktopintent::Admission> admission; std::optional<Receipt> receipt; };\n+ struct Reply { std::optional<desktopintent::Acceptance> admission; std::optional<Receipt> receipt; };\n struct Cell {\n std::mutex mutex;\n QObject* receiver{nullptr}; std::function<void()> notify;\n@@ -230,7 +233,7 @@ struct Service::State::Native final : QObject {\n };\n struct Pending { uint64_t connection; std::shared_ptr<Cell> cell; std::shared_ptr<Query> query{}; qsizetype index{0}; QStringList keys{}; };\n const std::shared_ptr<State> state;\n- QLocalServer server;\n+ QLocalServer server{this};\n std::unique_ptr<QLockFile> instance_lock;\n struct Client { QLocalSocket* socket; Limits::Time admitted; };\n std::map<uint64_t, Client> clients;\n@@ -306,7 +309,7 @@ struct Service::State::Native final : QObject {\n QStringList keys; for (const auto& input : inputs) keys.push_back(input.producer_key);\n const auto cell = reserve(id, {}, 0, std::move(keys)); if (!cell) { send(id, {{\"status\", \"rejected\"}}); return; }\n const auto admitted = state->owner->admit(std::move(inputs), [cell](auto result) { cell->complete({std::move(result), {}}); });\n- if (!admitted) cell->complete({desktopintent::Admission{Error::Closed, {}}, {}});\n+ if (!admitted) cell->complete({desktopintent::Acceptance{Error::Closed, {}}, {}});\n } else if (command == \"query\") {\n const auto keys = object.value(\"keys\").toArray();\n if (keys.empty() || keys.size() > static_cast<qsizetype>(Queue::MAX_PENDING) || replies.size() + static_cast<size_t>(keys.size()) > MAX_REPLIES) { socket->abort(); return; }\n@@ -351,17 +354,19 @@ struct Service::State::Native final : QObject {\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n- std::shared_ptr<execution::ResourceLease> lifetime;\n- { std::lock_guard lock{state->mutex}; state->native = nullptr; lifetime = std::move(state->native_lifetime); }\n- delete this;\n- lifetime.reset(); // Only now may the original Native event loop drain.\n+ QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n #ifndef Q_OS_WIN\n- private_directory = QDir{QStringLiteral(\"/tmp\")}.filePath(QStringLiteral(\"qml-intent-%1\").arg(getuid()));\n+ // The runtime directory belongs to this user (Qt checks its owner and\n+ // mode). A fixed name in the shared /tmp could be created first by\n+ // another user, which would block delivery for this one.\n+ const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n+ if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n+ private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n@@ -440,37 +445,83 @@ struct Service::State::Native final : QObject {\n }\n };\n \n+bool Service::State::post(std::function<void(Native&)> work)\n+{\n+ std::lock_guard lock{flags->mutex};\n+ return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n+ work(*receiver);\n+ }, Qt::QueuedConnection);\n+}\n+\n+void Service::State::finishDelivery()\n+{\n+ {\n+ std::lock_guard lock{flags->mutex};\n+ --pending_deliveries;\n+ }\n+ retireWhenIdle();\n+}\n+\n+void Service::State::retireWhenIdle()\n+{\n+ std::lock_guard lock{flags->mutex};\n+ if (!flags->stopping || pending_deliveries || !native) return;\n+ auto* receiver = std::exchange(native, nullptr);\n+ if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n+}\n+\n Service::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\n Service::~Service() { stop(); }\n-std::shared_ptr<Service> Service::Create(std::shared_ptr<execution::Scheduler> scheduler, std::shared_ptr<Owner> owner, Limits limits)\n+bool Service::post(std::function<void()> work) const\n+{\n+ const auto state = m_state.load();\n+ return state && state->post([work = std::move(work)](State::Native&) { work(); });\n+}\n+\n+std::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n {\n const auto maximum = std::chrono::seconds{30};\n- if (!scheduler || !owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n+ if (!owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n limits.connect <= std::chrono::milliseconds::zero() || limits.connect > limits.startup ||\n limits.acknowledge <= std::chrono::milliseconds::zero() || limits.acknowledge > limits.startup ||\n limits.query <= std::chrono::milliseconds::zero() || limits.query > limits.startup ||\n limits.client <= std::chrono::milliseconds::zero() || limits.client > maximum ||\n limits.slice <= std::chrono::milliseconds::zero() || limits.slice > std::chrono::milliseconds{100}) return {};\n- auto scope = scheduler->openActionScope(1024); if (!scope) return {};\n- auto state = execution::RetainValues<State>(scope, [] { return std::make_unique<State>(); }); if (!state) return {};\n- state->scope = scope; state->owner = std::move(owner); state->limits = std::move(limits); state->key = scope->allocateKey();\n- const auto retired = execution::Submit(*scope, [] {}, [state] {\n- std::function<void()> done;\n- { std::lock_guard lock{state->mutex}; state->owner.reset(); }\n- { std::lock_guard lock{state->flags->mutex}; state->flags->retired = true; done = std::move(state->flags->completed_stop); }\n- if (done) done();\n- }, {}, {execution::Lane::Cleanup, 1024, state->key}, true);\n- auto borrowed = retired ? scope->borrow(state->key) : execution::BorrowAdmission{{}, retired.rejection};\n- if (!borrowed) { if (retired) scope->activateCleanup(retired.id); return {}; }\n- state->flags->retired_task = retired.id;\n- state->native_lifetime = std::make_shared<execution::ResourceLease>(std::move(*borrowed.lease));\n- return std::shared_ptr<Service>{new Service(std::move(state))};\n+ auto* const app = QCoreApplication::instance();\n+ Q_ASSERT(app && QThread::currentThread() == app->thread());\n+ auto state = std::make_shared<State>();\n+ state->owner = std::move(owner);\n+ state->limits = std::move(limits);\n+ auto thread = std::make_unique<QThread>();\n+ thread->setObjectName(QStringLiteral(\"desktop transport\"));\n+ auto native = std::make_unique<State::Native>(state);\n+ auto service = std::shared_ptr<Service>{new Service(state)};\n+ QObject::connect(thread.get(), &QThread::finished, native.get(), &QObject::deleteLater);\n+ QObject::connect(thread.get(), &QThread::finished, app, [app, state, worker = thread.get()] {\n+ JoinThreadAsync([state, worker] {\n+ if (!worker->wait()) std::terminate();\n+ state->owner.reset();\n+ std::vector<std::function<void()>> completed;\n+ {\n+ std::lock_guard lock{state->flags->mutex};\n+ state->flags->retired = true;\n+ completed = std::move(state->flags->completed_stops);\n+ }\n+ for (const auto& done : completed) {\n+ try { done(); } catch (...) {}\n+ }\n+ }, app, [worker] { delete worker; });\n+ }, Qt::QueuedConnection);\n+ native->moveToThread(thread.get());\n+ state->native = native.release();\n+ thread.release()->start();\n+ return service;\n }\n-execution::Admission Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n+execution::SubmitResult Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n {\n return begin(std::move(directory), std::move(network), std::move(inputs), false, std::move(completed), {});\n }\n-execution::Admission Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n+execution::SubmitResult Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n {\n if (inputs.size() > Queue::MAX_PENDING) return {{}, execution::Rejection::Invalid};\n const auto callback = std::move(completed);\n@@ -487,7 +538,7 @@ execution::Admission Service::probeExisting(QString directory, QString network,\n const auto missing = [callback] { if (callback) callback({ProbeStatus::Missing, {}}); };\n return begin(std::move(directory), std::move(network), inputs, true, transfer, missing);\n }\n-execution::Admission Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n+execution::SubmitResult Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n std::function<void(StartResult)> completed, std::function<void()> missing)\n {\n const auto state = m_state.load();\n@@ -497,82 +548,82 @@ execution::Admission Service::begin(QString directory, QString network, std::vec\n return {{}, execution::Rejection::Closed};\n if (existing_only) { m_flags->probed = true; m_flags->probe_pending = true; }\n else m_flags->started = true;\n+ ++state->pending_deliveries;\n }\n- const auto reject = [flags = m_flags, existing_only](execution::Rejection reason) {\n- if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- return execution::Admission{{}, reason};\n- };\n+ auto release_rejected = qScopeGuard([&] {\n+ if (existing_only) {\n+ std::lock_guard lock{m_flags->mutex};\n+ m_flags->probe_pending = false;\n+ m_flags->probe_terminal = true;\n+ }\n+ state->finishDelivery();\n+ });\n if (directory.size() > 4096 || QString::fromUtf8(directory.toUtf8()) != directory || network.isEmpty() || network.size() > 128 || directory.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\n'}) || inputs.size() > Queue::MAX_PENDING)\n- return reject(execution::Rejection::Invalid);\n- size_t bytes{1024};\n+ return {{}, execution::Rejection::Invalid};\n for (const auto& input : inputs) {\n- if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return reject(execution::Rejection::Capacity);\n- bytes += static_cast<size_t>(input.producer_key.size() + input.value.size()) * sizeof(QChar);\n+ if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return {{}, execution::Rejection::Capacity};\n }\n- auto held = state->scope->borrow(state->key); if (!held) return reject(held.rejection);\n- auto lifetime = std::make_shared<execution::ResourceLease>(std::move(*held.lease));\n- std::shared_ptr<Owner> owner;\n- { std::lock_guard lock{state->mutex}; owner = state->owner; }\n- const auto payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(inputs)); });\n- if (!payload) return reject(execution::Rejection::Capacity);\n+ const auto owner = state->owner;\n+ const auto payload = std::make_shared<const std::vector<Input>>(std::move(inputs));\n const auto claimed = std::make_shared<std::atomic_bool>(false);\n- const auto finish = [done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n+ const auto finish = [state, done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n if (claimed->exchange(true)) return;\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- if (done) done(std::move(result));\n+ try { if (done) done(std::move(result)); } catch (...) {}\n };\n- const auto submitted = execution::Submit(*state->scope, [state, directory = std::move(directory), network = std::move(network), payload, lifetime, existing_only] {\n- if (state->flags->admission_closed || (QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))\n- return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start on its background worker.\"))};\n- auto native = std::make_unique<State::Native>(state);\n- auto discovery = native->initialize(directory, network, existing_only);\n- if (discovery.result.status == StartStatus::Primary) {\n- std::lock_guard lock{state->mutex};\n- if (!state->flags->stopping) state->native = native.release();\n- else discovery.result = Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n+ const auto submitted = state->post([state, owner, directory = std::move(directory), network = std::move(network),\n+ payload, finish, claimed, missing = std::move(missing), existing_only](State::Native& native) {\n+ if (state->flags->admission_closed) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n }\n- return discovery;\n- }, [state, owner, payload, finish, lifetime, claimed, missing = std::move(missing)](Discovery discovery) {\n+ auto discovery = [&] {\n+ try { return native.initialize(directory, network, existing_only); }\n+ catch (...) { return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start.\"))}; }\n+ }();\n if (discovery.missing) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n if (!claimed->exchange(true)) {\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n { std::lock_guard lock{state->flags->mutex}; state->flags->probe_pending = false; }\n- if (missing) missing();\n+ try { if (missing) missing(); } catch (...) {}\n }\n return;\n }\n if (!discovery.endpoint.isEmpty()) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n try {\n- const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish, lifetime](ForwardingSnapshot snapshot) {\n+ const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish](ForwardingSnapshot snapshot) {\n if (snapshot.error != Error::None || state->flags->admission_closed) {\n finish(Rejected(QStringLiteral(\"The GUI could not transfer its pending requests.\"))); return;\n }\n- const auto forward_payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(snapshot.inputs)); });\n- if (!forward_payload) { finish(Rejected(QStringLiteral(\"The GUI could not retain its pending requests.\"))); return; }\n- const auto forwarded = execution::Submit(*state->scope, [state, endpoint, forward_payload, lifetime] {\n- if (state->flags->stopping) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n- // Once a frame may have left this process, an exception\n- // is an unknown outcome, never permission to replay.\n- try { return Forward(endpoint, *forward_payload, state->limits, state->flags->stopping); }\n- catch (...) { return Unknown(); }\n- }, [finish, lifetime, forward_payload](StartResult result) {\n- if (result.producer_keys.empty()) result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- }, [finish, lifetime, forward_payload](std::exception_ptr) {\n- auto result = Unknown(); result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- },\n- {execution::Lane::Core, 1024 + Queue::MAX_PENDING_BYTES, state->key});\n- if (!forwarded) finish(Rejected(QStringLiteral(\"The GUI could not start payment delivery.\")));\n+ try {\n+ const auto forwarded = state->post([state, endpoint, inputs = std::move(snapshot.inputs), finish](State::Native&) {\n+ if (state->flags->stopping) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n+ }\n+ // An exception after sending may have left a frame\n+ // in the other process. Its outcome remains unknown.\n+ auto result = [&] {\n+ try { return Fo\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 483,
"evidence_id": "e01b5a38d55c4524bf6f75871954d431",
"finding_id": "finding:2",
"kind": "new_source",
"line": 334,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/desktopintenttransport.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 8,
"source_job_id": 2830,
"text": " connect(deadline, &QTimer::timeout, this, [this, id] {\n const auto found = clients.find(id);\n if (found == clients.end()) return;\n try { if (!Remaining(state->limits, found->second.admitted, state->limits.client, 1)) found->second.socket->abort(); }\n catch (...) { found->second.socket->abort(); }\n });\n deadline->start(); ingress(id);\n }\n }\n void ingress(uint64_t id) {\n try { receive(id); }\n catch (...) {\n // Any already admitted queue mutation keeps its original receipt.\n // An unacknowledged caller can query; no exception becomes replay.\n const auto found = clients.find(id); if (found != clients.end()) found->second.socket->abort();\n }\n }\n void retire() {\n server.close();\n while (!replies.empty()) clearReply(replies.begin()->first);\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n#ifndef Q_OS_WIN\n // The runtime directory belongs to this user (Qt checks its owner and\n // mode). A fixed name in the shared /tmp could be created first by\n // another user, which would block delivery for this one.\n const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n if (lstat(encoded.constData(), &info)) {\n if (existing_only && errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n }\n if (!S_ISDIR(info.st_mode) || info.st_uid != getuid() || (info.st_mode & 0077))\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QFileInfo{private_directory}.canonicalFilePath();\n#else\n private_directory = QDir::tempPath();\n#endif\n const QString identity = canonical + QLatin1Char('\\n') + network;\n const auto digest = QCryptographicHash::hash(identity.toUtf8(), QCryptographicHash::Sha256).toHex().first(24);\n#ifndef Q_OS_WIN\n const auto endpoint = QDir{private_directory}.filePath(QString::fromLatin1(digest));\n if (QFile::encodeName(endpoint).size() > 100) return Rejected(QStringLiteral(\"The payment-delivery path is too long.\"));\n#else\n const QString endpoint = QStringLiteral(\"qml-intent-\") + QString::fromLatin1(digest);\n#endif\n if (existing_only) {\n // Discovery grants no listener/lock authority and mutates no local\n // queue. A known absent peer leaves normal final-profile startup\n // available; only a connected same-user peer permits forwarding.\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer)) {\n if (errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The payment-delivery endpoint could not be inspected.\"));\n }\n if (!S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during lookup.\"));\n const auto began = state->limits.now();\n const auto remaining = Remaining(state->limits, began, state->limits.startup, static_cast<int>(state->limits.connect.count()));\n if (!remaining) return Rejected(QStringLiteral(\"The payment-delivery lookup expired.\"));\n QLocalSocket probe; probe.connectToServer(endpoint);\n const bool connected = probe.waitForConnected(remaining);\n if (!connected) {\n if (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError)\n return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The existing payment-delivery endpoint could not be contacted.\"));\n }\n if (state->flags->admission_closed || !Remaining(state->limits, began, state->limits.startup, 1))\n return Rejected(QStringLiteral(\"The payment-delivery lookup expired or is closing.\"));\n if (!SameUser(probe)) return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n return {StartResult{}, endpoint};\n }\n instance_lock = std::make_unique<QLockFile>(QDir{private_directory}.filePath(QString::fromLatin1(digest) + QStringLiteral(\".lock\")));\n instance_lock->setStaleLockTime(0);\n if (instance_lock->tryLock(0)) {\n QLocalSocket probe; probe.connectToServer(endpoint); const bool live = probe.waitForConnected(200);\n bool reclaimable = !live && (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError);\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat socket_info{};\n if (lstat(path.constData(), &socket_info) == 0) {\n reclaimable &= S_ISSOCK(socket_info.st_mode) && socket_info.st_uid == getuid();\n if (reclaimable) reclaimable = QLocalServer::removeServer(endpoint);\n }\n#endif\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n if (reclaimable && !state->flags->admission_closed && server.listen(endpoint)) return StartResult{StartStatus::Primary, {}, {}};\n }\n instance_lock.reset();\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer) || !S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unavailable or unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n return {StartResult{}, endpoint};\n }\n};\n\nbool Service::State::post(std::function<void(Native&)> work)\n{\n std::lock_guard lock{flags->mutex};\n return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n work(*receiver);\n }, Qt::QueuedConnection);\n}\n\nvoid Service::State::finishDelivery()\n{\n {\n std::lock_guard lock{flags->mutex};\n --pending_deliveries;\n }\n retireWhenIdle();\n}\n\nvoid Service::State::retireWhenIdle()\n{\n std::lock_guard lock{flags->mutex};\n if (!flags->stopping || pending_deliveries || !native) return;\n auto* receiver = std::exchange(native, nullptr);\n if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n}\n\nService::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\nService::~Service() { stop(); }\nbool Service::post(std::function<void()> work) const\n{\n const auto state = m_state.load();\n return state && state->post([work = std::move(work)](State::Native&) { work(); });\n}\n\nstd::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n{\n const auto maximum = std::chrono::seconds{30};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | Private descriptor imports remain outside console redactionqml/models/rpccommandexecutor.cpp | still_present | AssessmentThe new-head HISTORY_FILTER excerpt still lacks importdescriptors, so descriptor private-key arguments remain outside the evidenced redaction policy. new_source: qml/models/rpccommandexecutor.cpp; old_source: qml/models/rpccommandexecutor.cpp [
{
"bounded": true,
"end_line": 150,
"evidence_id": "056396d7bbbe4a89a505a96ed39e2b7d",
"finding_id": "finding:11",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/models/rpccommandexecutor.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 8,
"source_job_id": 2830,
"text": "// Copyright (c) 2011-2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n//\n// Portions of this file are ported from src/qt/rpcconsole.cpp.\n\n#include <qml/models/rpccommandexecutor.h>\n\n#include <interfaces/node.h>\n#include <rpc/client.h>\n#include <univalue.h>\n#include <util/strencodings.h>\n\n#include <cassert>\n#include <stdexcept>\n#include <string>\n#include <utility>\n#include <vector>\n#include <optional>\n\n#include <QStringList>\n#include <QUrl>\n#include <QCoreApplication>\n\nnamespace {\n\n// Redact arguments before storing either request output or recall history.\n// Keep the pinned Qt Widgets historyFilter policy, plus addhdkey's private key.\n// The parity regression requires an explicit review when Core's policy changes.\nconst QStringList HISTORY_FILTER = QStringList()\n << \"addhdkey\"\n << \"createwallet\"\n << \"createwalletdescriptor\"\n << \"migratewallet\"\n << \"signmessagewithprivkey\"\n << \"signrawtransactionwithkey\"\n << \"walletpassphrase\"\n << \"walletpassphrasechange\"\n << \"encryptwallet\";\n\n} // namespace\n\nstruct RpcCommandExecutor::Plan {\n struct Argument {\n std::string literal;\n std::optional<size_t> result;\n std::vector<std::string> queries;\n };\n std::vector<std::vector<Argument>> calls;\n Argument result;\n std::string filtered;\n};\n\nconst std::string& RpcCommandExecutor::Prepared::filtered() const { return m_plan->filtered; }\n\nstd::optional<RpcCommandExecutor::Prepared> RpcCommandExecutor::Prepare(const std::string& strCommand)\n{\n auto plan = std::make_shared<Plan>();\n std::vector<std::vector<Plan::Argument>> stack;\n stack.emplace_back();\n\n enum CmdParseState {\n STATE_EATING_SPACES,\n STATE_EATING_SPACES_IN_ARG,\n STATE_EATING_SPACES_IN_BRACKETS,\n STATE_ARGUMENT,\n STATE_SINGLEQUOTED,\n STATE_DOUBLEQUOTED,\n STATE_ESCAPE_OUTER,\n STATE_ESCAPE_DOUBLEQUOTED,\n STATE_COMMAND_EXECUTED,\n STATE_COMMAND_EXECUTED_INNER\n } state = STATE_EATING_SPACES;\n\n std::string curarg;\n Plan::Argument last_result;\n unsigned nDepthInsideSensitive = 0;\n size_t filter_begin_pos = 0, chpos;\n std::vector<std::pair<size_t, size_t>> filter_ranges;\n\n auto add_to_current_stack = [&](const std::string& strArg) {\n if (stack.empty()) throw std::runtime_error(\"Invalid Syntax\");\n if (stack.back().empty() && (!nDepthInsideSensitive) &&\n HISTORY_FILTER.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) {\n nDepthInsideSensitive = 1;\n filter_begin_pos = chpos;\n }\n stack.back().push_back({strArg, {}, {}});\n };\n\n auto close_out_params = [&]() {\n if (nDepthInsideSensitive) {\n if (!--nDepthInsideSensitive) {\n // filter_begin_pos is set to chpos at the delimiter *after* the\n // sensitive command name, which is always > 0 (at minimum the\n // opening paren or space character follows the name).\n assert(filter_begin_pos);\n filter_ranges.emplace_back(filter_begin_pos, chpos);\n filter_begin_pos = 0;\n }\n }\n stack.pop_back();\n };\n\n std::string strCommandTerminated = strCommand;\n if (strCommandTerminated.empty() || strCommandTerminated.back() != '\\n')\n strCommandTerminated += '\\n';\n\n for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos) {\n char ch = strCommandTerminated[chpos];\n switch (state) {\n case STATE_COMMAND_EXECUTED_INNER:\n case STATE_COMMAND_EXECUTED: {\n bool breakParsing = true;\n switch (ch) {\n case '[':\n curarg.clear();\n state = STATE_COMMAND_EXECUTED_INNER;\n break;\n default:\n if (state == STATE_COMMAND_EXECUTED_INNER) {\n if (ch != ']') {\n curarg += ch;\n break;\n }\n if (!curarg.empty()) last_result.queries.push_back(curarg);\n state = STATE_COMMAND_EXECUTED;\n break;\n }\n breakParsing = false;\n\n close_out_params();\n\n if (!stack.empty()) stack.back().push_back(last_result);\n else plan->result = last_result;\n curarg.clear();\n state = STATE_EATING_SPACES;\n }\n if (breakParsing)\n break;\n [[fallthrough]];\n }\n case STATE_ARGUMENT:\n case STATE_EATING_SPACES_IN_ARG:\n case STATE_EATING_SPACES_IN_BRACKETS:\n case STATE_EATING_SPACES:\n switch (ch) {\n case '\"':\n state = STATE_DOUBLEQUOTED;\n break;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 150,
"evidence_id": "bceae881380745478f04ff36046c7cfa",
"finding_id": "finding:11",
"kind": "old_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/models/rpccommandexecutor.cpp",
"revision": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"source_generation": 8,
"source_job_id": 2830,
"text": "// Copyright (c) 2011-2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n//\n// Portions of this file are ported from src/qt/rpcconsole.cpp.\n\n#include <qml/models/rpccommandexecutor.h>\n\n#include <interfaces/node.h>\n#include <rpc/client.h>\n#include <univalue.h>\n#include <util/strencodings.h>\n\n#include <cassert>\n#include <stdexcept>\n#include <string>\n#include <utility>\n#include <vector>\n#include <optional>\n\n#include <QStringList>\n#include <QUrl>\n#include <QCoreApplication>\n\nnamespace {\n\n// Redact arguments before storing either request output or recall history.\n// Keep the pinned Qt Widgets historyFilter policy, plus addhdkey's private key.\n// The parity regression requires an explicit review when Core's policy changes.\nconst QStringList HISTORY_FILTER = QStringList()\n << \"addhdkey\"\n << \"createwallet\"\n << \"createwalletdescriptor\"\n << \"migratewallet\"\n << \"signmessagewithprivkey\"\n << \"signrawtransactionwithkey\"\n << \"walletpassphrase\"\n << \"walletpassphrasechange\"\n << \"encryptwallet\";\n\n} // namespace\n\nstruct RpcCommandExecutor::Plan {\n struct Argument {\n std::string literal;\n std::optional<size_t> result;\n std::vector<std::string> queries;\n };\n std::vector<std::vector<Argument>> calls;\n Argument result;\n std::string filtered;\n};\n\nconst std::string& RpcCommandExecutor::Prepared::filtered() const { return m_plan->filtered; }\n\nstd::optional<RpcCommandExecutor::Prepared> RpcCommandExecutor::Prepare(const std::string& strCommand)\n{\n auto plan = std::make_shared<Plan>();\n std::vector<std::vector<Plan::Argument>> stack;\n stack.emplace_back();\n\n enum CmdParseState {\n STATE_EATING_SPACES,\n STATE_EATING_SPACES_IN_ARG,\n STATE_EATING_SPACES_IN_BRACKETS,\n STATE_ARGUMENT,\n STATE_SINGLEQUOTED,\n STATE_DOUBLEQUOTED,\n STATE_ESCAPE_OUTER,\n STATE_ESCAPE_DOUBLEQUOTED,\n STATE_COMMAND_EXECUTED,\n STATE_COMMAND_EXECUTED_INNER\n } state = STATE_EATING_SPACES;\n\n std::string curarg;\n Plan::Argument last_result;\n unsigned nDepthInsideSensitive = 0;\n size_t filter_begin_pos = 0, chpos;\n std::vector<std::pair<size_t, size_t>> filter_ranges;\n\n auto add_to_current_stack = [&](const std::string& strArg) {\n if (stack.empty()) throw std::runtime_error(\"Invalid Syntax\");\n if (stack.back().empty() && (!nDepthInsideSensitive) &&\n HISTORY_FILTER.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) {\n nDepthInsideSensitive = 1;\n filter_begin_pos = chpos;\n }\n stack.back().push_back({strArg, {}, {}});\n };\n\n auto close_out_params = [&]() {\n if (nDepthInsideSensitive) {\n if (!--nDepthInsideSensitive) {\n // filter_begin_pos is set to chpos at the delimiter *after* the\n // sensitive command name, which is always > 0 (at minimum the\n // opening paren or space character follows the name).\n assert(filter_begin_pos);\n filter_ranges.emplace_back(filter_begin_pos, chpos);\n filter_begin_pos = 0;\n }\n }\n stack.pop_back();\n };\n\n std::string strCommandTerminated = strCommand;\n if (strCommandTerminated.empty() || strCommandTerminated.back() != '\\n')\n strCommandTerminated += '\\n';\n\n for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos) {\n char ch = strCommandTerminated[chpos];\n switch (state) {\n case STATE_COMMAND_EXECUTED_INNER:\n case STATE_COMMAND_EXECUTED: {\n bool breakParsing = true;\n switch (ch) {\n case '[':\n curarg.clear();\n state = STATE_COMMAND_EXECUTED_INNER;\n break;\n default:\n if (state == STATE_COMMAND_EXECUTED_INNER) {\n if (ch != ']') {\n curarg += ch;\n break;\n }\n if (!curarg.empty()) last_result.queries.push_back(curarg);\n state = STATE_COMMAND_EXECUTED;\n break;\n }\n breakParsing = false;\n\n close_out_params();\n\n if (!stack.empty()) stack.back().push_back(last_result);\n else plan->result = last_result;\n curarg.clear();\n state = STATE_EATING_SPACES;\n }\n if (breakParsing)\n break;\n [[fallthrough]];\n }\n case STATE_ARGUMENT:\n case STATE_EATING_SPACES_IN_ARG:\n case STATE_EATING_SPACES_IN_BRACKETS:\n case STATE_EATING_SPACES:\n switch (ch) {\n case '\"':\n state = STATE_DOUBLEQUOTED;\n break;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Backup destination confirmation has no height cap or scrollingqml/components/WalletBackupConfirmation.qml | unclear | AssessmentThe old confirmation component is deleted, but no new confirmation UI source is supplied; the evidence records that the new source is unavailable at the finding location. The deletion does not establish that the replacement UI bounds and scrolls the path while keeping actions visible. path_diff: qml/components/WalletBackupConfirmation.qml; old_source: qml/components/WalletBackupConfirmation.qml [
{
"evidence_id": "fbe1d85d3b444e689783d3417bc35307",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/components/WalletBackupConfirmation.qml",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/components/WalletBackupConfirmation.qml b/qml/components/WalletBackupConfirmation.qml\ndeleted file mode 100644\nindex f2e1c72f62..0000000000\n--- a/qml/components/WalletBackupConfirmation.qml\n+++ /dev/null\n@@ -1,78 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"walletBackupOverwritePopup\"\n- required property BackupFileOperation operation\n- readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n- parent: Overlay.overlay\n- width: parent ? Math.min(600, parent.width - 40) : 600\n- implicitHeight: content.implicitHeight + topPadding + bottomPadding\n- x: parent ? Math.round((parent.width - width) / 2) : 0\n- y: parent ? Math.round((parent.height - height) / 2) : 0\n- padding: 24\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.NoAutoClose\n- onOpened: content.forceActiveFocus()\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 10\n- border.color: Theme.color.neutral2\n- }\n- contentItem: ColumnLayout {\n- id: content\n- focus: true\n- spacing: 16\n- Keys.priority: Keys.BeforeItem\n- Keys.onEscapePressed: function(event) {\n- root.operation.refuse()\n- event.accepted = true\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.title\n- font: Theme.text.subtitle.font\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.replacing\n- ? qsTr(\"An existing file will be replaced at this final destination:\")\n- : qsTr(\"Save the backup at this final destination:\")\n- wrap: true\n- }\n- CoreText {\n- objectName: \"walletBackupFinalPathText\"\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.finalPath\n- wrapMode: Text.WrapAnywhere\n- }\n- RowLayout {\n- spacing: 12\n- NeutralButton {\n- objectName: \"walletBackupOverwriteRejectButton\"\n- text: qsTr(\"Cancel\")\n- onClicked: root.operation.refuse()\n- }\n- NeutralButton {\n- objectName: \"walletBackupOverwriteApproveButton\"\n- text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n- onClicked: root.operation.approve()\n- }\n- }\n- }\n-}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 78,
"evidence_id": "44ed857ad34442858c369b56d084befc",
"finding_id": "finding:10",
"kind": "old_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/components/WalletBackupConfirmation.qml",
"revision": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"source_generation": 8,
"source_job_id": 2830,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\nimport org.bitcoincore.qt 1.0\n\nimport \"../controls\"\n\nPopup {\n id: root\n objectName: \"walletBackupOverwritePopup\"\n required property BackupFileOperation operation\n readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n parent: Overlay.overlay\n width: parent ? Math.min(600, parent.width - 40) : 600\n implicitHeight: content.implicitHeight + topPadding + bottomPadding\n x: parent ? Math.round((parent.width - width) / 2) : 0\n y: parent ? Math.round((parent.height - height) / 2) : 0\n padding: 24\n modal: true\n dim: true\n focus: true\n closePolicy: Popup.NoAutoClose\n onOpened: content.forceActiveFocus()\n\n background: Rectangle {\n color: Theme.color.neutral1\n radius: 10\n border.color: Theme.color.neutral2\n }\n contentItem: ColumnLayout {\n id: content\n focus: true\n spacing: 16\n Keys.priority: Keys.BeforeItem\n Keys.onEscapePressed: function(event) {\n root.operation.refuse()\n event.accepted = true\n }\n CoreText {\n Layout.fillWidth: true\n textFormat: Text.PlainText\n text: root.title\n font: Theme.text.subtitle.font\n }\n CoreText {\n Layout.fillWidth: true\n textFormat: Text.PlainText\n text: root.operation.replacing\n ? qsTr(\"An existing file will be replaced at this final destination:\")\n : qsTr(\"Save the backup at this final destination:\")\n wrap: true\n }\n CoreText {\n objectName: \"walletBackupFinalPathText\"\n Layout.fillWidth: true\n textFormat: Text.PlainText\n text: root.operation.finalPath\n wrapMode: Text.WrapAnywhere\n }\n RowLayout {\n spacing: 12\n NeutralButton {\n objectName: \"walletBackupOverwriteRejectButton\"\n text: qsTr(\"Cancel\")\n onClicked: root.operation.refuse()\n }\n NeutralButton {\n objectName: \"walletBackupOverwriteApproveButton\"\n text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n onClicked: root.operation.approve()\n }\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Backup can replace another loaded wallet's live wallet.datqml/models/backuppolicyio.cpp | addressed | AssessmentThe new code screens an approved existing destination against loaded wallet files and repeats that screening under the installation coordinator lock immediately before installation. This addresses the reported live-wallet database overwrite path, including canonical/file-equivalence checks. path_diff: qml/models/backuppolicyio.cpp; new_source: qml/models/backuppolicyio.cpp [
{
"evidence_id": "b8904d4d47374ee19aec44e603ab6bc7",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/models/backuppolicyio.cpp",
"source_generation": 8,
"source_job_id": 2830,
"text": "diff --git a/qml/models/backuppolicyio.cpp b/qml/models/backuppolicyio.cpp\nindex 7f2a43eccc..8ce3d25dd0 100644\n--- a/qml/models/backuppolicyio.cpp\n+++ b/qml/models/backuppolicyio.cpp\n@@ -15,6 +15,7 @@\n #include <QUrl>\n \n #include <algorithm>\n+#include <system_error>\n #include <utility>\n \n namespace {\n@@ -123,8 +124,33 @@ backup::Proposal backup::InspectPng(const std::string& raw)\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n }\n \n+namespace {\n+bool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n+{\n+ if (!coordinator.wallet_files) return false;\n+ const fs::path destination{fs::PathFromString(path)};\n+ std::error_code error;\n+ for (const auto& file : coordinator.wallet_files()) {\n+ const fs::path database{fs::PathFromString(file)};\n+ // SQLite keeps a journal next to the database while it writes.\n+ for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n+ if (fs::equivalent(destination, candidate, error)) return true;\n+ }\n+ }\n+ return false;\n+}\n+} // namespace\n+\n+backup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n+{\n+ if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n+ proposal.error = Error::WalletFile;\n+ }\n+ return proposal;\n+}\n+\n backup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n- InstallCoordinator& coordinator, std::function<bool()> admission)\n+ InstallCoordinator& coordinator, std::function<bool()> submitted)\n {\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n@@ -138,12 +164,12 @@ backup::WriteResult backup::Write(const Proposal& approved, bool destination_app\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n- const auto current = ReadTarget(final_path);\n+ const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n- if (admission && !admission()) return {Error::Changed};\n+ if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 184,
"evidence_id": "1f74b60cc4f747fab7fb04b733a11a4b",
"finding_id": "finding:1",
"kind": "new_source",
"line": 119,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"path": "qml/models/backuppolicyio.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 8,
"source_job_id": 2830,
"text": " if (!url.isValid() || !url.isLocalFile() || !QDir::isAbsolutePath(url.toLocalFile())) return {{}, {}, false, false, Error::InvalidPath};\n QString path = QDir::cleanPath(url.toLocalFile());\n if (path.contains(QChar{0}) || QFileInfo{path}.isDir()) return {{}, {}, false, false, Error::InvalidPath};\n const QString selected = path;\n if (!path.endsWith(QStringLiteral(\".png\"), Qt::CaseInsensitive)) path += QStringLiteral(\".png\");\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n}\n\nnamespace {\nbool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n{\n if (!coordinator.wallet_files) return false;\n const fs::path destination{fs::PathFromString(path)};\n std::error_code error;\n for (const auto& file : coordinator.wallet_files()) {\n const fs::path database{fs::PathFromString(file)};\n // SQLite keeps a journal next to the database while it writes.\n for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n if (fs::equivalent(destination, candidate, error)) return true;\n }\n }\n return false;\n}\n} // namespace\n\nbackup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n{\n if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n proposal.error = Error::WalletFile;\n }\n return proposal;\n}\n\nbackup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n InstallCoordinator& coordinator, std::function<bool()> submitted)\n{\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n const QString parent = QFileInfo{final_path}.absolutePath();\n QTemporaryDir staging{QDir{parent}.filePath(QStringLiteral(\".bitcoin-backup-XXXXXX\"))};\n if (!staging.isValid()) return {Error::Staging};\n const QString staged_path = staging.filePath(QStringLiteral(\"wallet.backup\"));\n if (!producer(Utf8(staged_path))) return {Error::CoreBackup};\n const QFileInfo staged_info{staged_path};\n if (!staged_info.isFile() || staged_info.isSymLink()) return {Error::CoreBackup};\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n } else {\n // QFile's non-replacing rename also protects against a destination\n // created after inspection; never use an overwriting rename here.\n installed = QFile::rename(staged_path, final_path);\n }\n if (!installed) return {Error::Install};\n DirectoryCommit(fs::PathFromString(Utf8(parent)));\n return {};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 50767aca7e16..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The backup confirmation can outgrow the window without scrollingqml/components/WalletBackupConfirmation.qml | unclear | AssessmentThe old confirmation component is deleted, but the evidence does not identify or provide the new confirmation UI. The inspection gap says new source is unavailable at the finding location, so it is not possible to tell whether the unbounded-content problem remains elsewhere. path_diff: qml/components/WalletBackupConfirmation.qml; old_source: qml/components/WalletBackupConfirmation.qml [
{
"evidence_id": "d4149c68a26a4565afa48d20dc5c5a9b",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/components/WalletBackupConfirmation.qml",
"source_generation": 7,
"source_job_id": 2828,
"text": "diff --git a/qml/components/WalletBackupConfirmation.qml b/qml/components/WalletBackupConfirmation.qml\ndeleted file mode 100644\nindex f2e1c72f62..0000000000\n--- a/qml/components/WalletBackupConfirmation.qml\n+++ /dev/null\n@@ -1,78 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"walletBackupOverwritePopup\"\n- required property BackupFileOperation operation\n- readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n- parent: Overlay.overlay\n- width: parent ? Math.min(600, parent.width - 40) : 600\n- implicitHeight: content.implicitHeight + topPadding + bottomPadding\n- x: parent ? Math.round((parent.width - width) / 2) : 0\n- y: parent ? Math.round((parent.height - height) / 2) : 0\n- padding: 24\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.NoAutoClose\n- onOpened: content.forceActiveFocus()\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 10\n- border.color: Theme.color.neutral2\n- }\n- contentItem: ColumnLayout {\n- id: content\n- focus: true\n- spacing: 16\n- Keys.priority: Keys.BeforeItem\n- Keys.onEscapePressed: function(event) {\n- root.operation.refuse()\n- event.accepted = true\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.title\n- font: Theme.text.subtitle.font\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.replacing\n- ? qsTr(\"An existing file will be replaced at this final destination:\")\n- : qsTr(\"Save the backup at this final destination:\")\n- wrap: true\n- }\n- CoreText {\n- objectName: \"walletBackupFinalPathText\"\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.finalPath\n- wrapMode: Text.WrapAnywhere\n- }\n- RowLayout {\n- spacing: 12\n- NeutralButton {\n- objectName: \"walletBackupOverwriteRejectButton\"\n- text: qsTr(\"Cancel\")\n- onClicked: root.operation.refuse()\n- }\n- NeutralButton {\n- objectName: \"walletBackupOverwriteApproveButton\"\n- text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n- onClicked: root.operation.approve()\n- }\n- }\n- }\n-}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 78,
"evidence_id": "180e0dd8e1c6404e9f5cc42578ad3f05",
"finding_id": "finding:6",
"kind": "old_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/components/WalletBackupConfirmation.qml",
"revision": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"source_generation": 7,
"source_job_id": 2828,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\nimport org.bitcoincore.qt 1.0\n\nimport \"../controls\"\n\nPopup {\n id: root\n objectName: \"walletBackupOverwritePopup\"\n required property BackupFileOperation operation\n readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n parent: Overlay.overlay\n width: parent ? Math.min(600, parent.width - 40) : 600\n implicitHeight: content.implicitHeight + topPadding + bottomPadding\n x: parent ? Math.round((parent.width - width) / 2) : 0\n y: parent ? Math.round((parent.height - height) / 2) : 0\n padding: 24\n modal: true\n dim: true\n focus: true\n closePolicy: Popup.NoAutoClose\n onOpened: content.forceActiveFocus()\n\n background: Rectangle {\n color: Theme.color.neutral1\n radius: 10\n border.color: Theme.color.neutral2\n }\n contentItem: ColumnLayout {\n id: content\n focus: true\n spacing: 16\n Keys.priority: Keys.BeforeItem\n Keys.onEscapePressed: function(event) {\n root.operation.refuse()\n event.accepted = true\n }\n CoreText {\n Layout.fillWidth: true\n textFormat: Text.PlainText\n text: root.title\n font: Theme.text.subtitle.font\n }\n CoreText {\n Layout.fillWidth: true\n textFormat: Text.PlainText\n text: root.operation.replacing\n ? qsTr(\"An existing file will be replaced at this final destination:\")\n : qsTr(\"Save the backup at this final destination:\")\n wrap: true\n }\n CoreText {\n objectName: \"walletBackupFinalPathText\"\n Layout.fillWidth: true\n textFormat: Text.PlainText\n text: root.operation.finalPath\n wrapMode: Text.WrapAnywhere\n }\n RowLayout {\n spacing: 12\n NeutralButton {\n objectName: \"walletBackupOverwriteRejectButton\"\n text: qsTr(\"Cancel\")\n onClicked: root.operation.refuse()\n }\n NeutralButton {\n objectName: \"walletBackupOverwriteApproveButton\"\n text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n onClicked: root.operation.approve()\n }\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f95b6a8f7cc5..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Receive keeps supported types hidden after descriptor importsqml/walletopening.cpp | still_present | AssessmentThe supplied new-head excerpt shows markReceiveTypeUnavailable still only inserts into the negative cache, and preferredReceiveType continues to skip cached types. No invalidation or re-probe on capability changes is evidenced. path_diff: qml/walletopening.cpp; new_source: qml/walletopening.cpp [
{
"evidence_id": "6de421375f5d4b33949e1a9764276ae0",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/walletopening.cpp",
"source_generation": 7,
"source_job_id": 2828,
"text": "diff --git a/qml/walletopening.cpp b/qml/walletopening.cpp\nindex 5e818aea45..3d26d7a3c1 100644\n--- a/qml/walletopening.cpp\n+++ b/qml/walletopening.cpp\n@@ -3,81 +3,137 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/walletopening.h>\n+#include <qml/executor.h>\n+#include <qml/retainedvalue.h>\n \n+#include <common/args.h>\n #include <interfaces/chain.h>\n #include <addresstype.h>\n #include <outputtype.h>\n #include <univalue.h>\n \n #include <algorithm>\n+#include <cassert>\n+#include <exception>\n #include <stdexcept>\n #include <utility>\n \n namespace walletopening {\n struct Session::Resources {\n- std::shared_ptr<interfaces::Wallet> wallet;\n+ std::unique_ptr<interfaces::Wallet> wallet;\n+ std::shared_ptr<interfaces::Wallet> shared_wallet;\n+ std::unique_ptr<interfaces::Handler> unload_handler;\n std::vector<std::unique_ptr<interfaces::Handler>> handlers;\n+ bool acquired{false};\n+\n+ interfaces::Wallet* get() const { return wallet ? wallet.get() : shared_wallet.get(); }\n };\n+\n namespace {\n-struct Borrower {\n- execution::ResourceLease lease;\n- std::shared_ptr<interfaces::Wallet> wallet;\n-};\n Metadata ReadMetadata(interfaces::Wallet& wallet, const Session::Preferences& preferences, std::vector<std::string> unavailable_receive_types)\n {\n auto name = wallet.getWalletName();\n- if (name.size() > 32'768) throw std::length_error(\"Wallet name exceeds metadata transport budget\");\n+ if (name.size() > 32'768) throw std::length_error(\"Wallet name is too long\");\n auto saved = preferences.read ? preferences.read(name) : std::string{};\n // IDs are a closed vocabulary; never copy arbitrary persistent input into\n // the bounded metadata transport. Invalid values use the supported default.\n if (saved != \"bech32m\" && saved != \"bech32\" && saved != \"p2sh-segwit\" && saved != \"legacy\") saved.clear();\n+ // Core resolves -addresstype into the wallet's default type; only an\n+ // explicit setting overrides the app's own Taproot default.\n+ std::string configured{gArgs.IsArgSet(\"-addresstype\") ? FormatOutputType(wallet.getDefaultAddressType()) : std::string{}};\n return {std::move(name), wallet.privateKeysDisabled(), wallet.hasExternalSigner(), wallet.isCrypted(), wallet.isLocked(),\n- wallet.canGetAddresses(), wallet.taprootEnabled(), std::move(saved), std::move(unavailable_receive_types)};\n+ wallet.canGetAddresses(), wallet.taprootEnabled(), std::move(saved), std::move(configured), std::move(unavailable_receive_types)};\n+}\n+\n+execution::SubmitResult PostUtility(execution::SerialQueue& queue, std::function<void()> work)\n+{\n+ const bool accepted = queue.post([work = std::move(work)] {\n+ // These turns have no outcome callback. A failed turn must still\n+ // leave the worker available for the next one.\n+ try {\n+ work();\n+ } catch (...) {}\n+ });\n+ return {{}, accepted ? execution::Rejection::None : execution::Rejection::Transport};\n }\n }\n \n-Session::Session(std::shared_ptr<execution::Scheduler> commands,\n- std::shared_ptr<execution::Scheduler> retirement,\n- std::shared_ptr<std::atomic_bool> closed, Notify notify, Preferences preferences, Clock clock, std::shared_ptr<std::atomic_bool> shutdown_gate, NativeEvents native_events)\n- : m_commands(std::move(commands)), m_retirement(std::move(retirement)),\n- m_command_key(m_commands->allocateKey()), m_retirement_key(m_retirement->allocateKey()),\n- m_closed(std::move(closed)), m_shutdown_gate(std::move(shutdown_gate)), m_notify(std::move(notify)), m_preferences(std::move(preferences)), m_clock(std::move(clock)), m_native_events(std::move(native_events)), m_resources(std::make_shared<Resources>())\n+Session::Session(std::shared_ptr<std::atomic_bool> closed, Notify notify, Preferences preferences, Clock clock,\n+ std::shared_ptr<std::atomic_bool> shutdown_gate, NativeEvents native_events, Queues queues)\n+ : m_closed(std::move(closed)), m_shutdown_gate(std::move(shutdown_gate)), m_notify(std::move(notify)), m_preferences(std::move(preferences)), m_clock(std::move(clock)), m_native_events(std::move(native_events)),\n+ m_cleanup_queue(std::move(queues.cleanup)), m_core_queue(std::move(queues.core)), m_outcomes(std::move(queues.outcomes)),\n+ m_value_cleanup(std::make_shared<execution::ValueCleanupQueue>(m_cleanup_queue)),\n+ m_native_cleanup(std::make_shared<execution::ValueCleanupQueue>(queues.native_cleanup ? queues.native_cleanup : m_cleanup_queue)),\n+ m_outcome_delivery(std::make_shared<execution::ValueCleanupQueue>(m_outcomes)),\n+ m_stop_work(std::move(queues.stop_work))\n {\n+ assert(m_cleanup_queue && m_core_queue && m_outcomes && m_stop_work);\n }\n \n Session::Start Session::start(const std::shared_ptr<interfaces::Wallet>& wallet)\n {\n- {\n- std::lock_guard lock{m_mutex};\n- if (std::exchange(m_started, true)) return {{{}, execution::Rejection::Invalid}, {}};\n- }\n+ return startWith([&](Resources& resources) { resources.shared_wallet = wallet; });\n+}\n+\n+Session::Start Session::start(std::unique_ptr<interfaces::Wallet>& wallet, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ return startWith([&](Resources& resources) {\n+ resources.wallet = std::move(wallet);\n+ resources.unload_handler = std::move(unload_handler);\n+ });\n+}\n+\n+Session::Start Session::start(Source& source, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ if (auto* wallet = std::get_if<std::unique_ptr<interfaces::Wallet>>(&source)) return start(*wallet, unload_handler);\n+ auto& wallet = std::get<std::shared_ptr<interfaces::Wallet>>(source);\n+ return startWith([&](Resources& resources) {\n+ resources.shared_wallet = std::move(wallet);\n+ resources.unload_handler = std::move(unload_handler);\n+ });\n+}\n+\n+void Session::retireUnclaimed(Source& source, std::unique_ptr<interfaces::Handler>& unload_handler)\n+{\n+ struct UnclaimedWallet {\n+ Source source;\n+ std::unique_ptr<interfaces::Handler> handler;\n+\n+ ~UnclaimedWallet()\n+ {\n+ try {\n+ if (handler) handler->disconnect();\n+ } catch (...) {\n+ // Release both handles even when disconnection fails.\n+ }\n+ }\n+ };\n+ const auto make = [] { return std::make_unique<UnclaimedWallet>(); };\n+ const auto unused = walletopening::RetainValues<UnclaimedWallet>(shared_from_this(), make);\n+ if (!unused) std::terminate();\n+ unused->source = std::move(source);\n+ unused->handler = std::move(unload_handler);\n+}\n+\n+Session::Start Session::startWith(const std::function<void(Resources&)>& acquire)\n+{\n const auto self = shared_from_this();\n- const auto cleanup = execution::Submit(*m_retirement, [self] { return self->cleanup(); }, [self](bool failed) {\n- self->m_drained = true;\n- Update update; update.phase = Phase::Closed; update.failed = failed;\n- self->publish(std::move(update));\n- }, {}, {execution::Lane::Cleanup, sizeof(void*) * 8, m_retirement_key}, true);\n- if (!cleanup) {\n- m_closed->store(true);\n- m_drained = true;\n- Update failed; failed.phase = Phase::Closed; failed.failed = true; publish(std::move(failed));\n- return {cleanup, {}};\n- }\n+ std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{m_mutex};\n- m_cleanup = cleanup.id;\n- }\n- // Pin initialization before acquiring a native resource. A concurrent\n- // retirement-root shutdown may activate its reservation immediately.\n- auto initialization = m_retirement->borrow(m_retirement_key);\n- if (!initialization) {\n- retire();\n- return {{{}, initialization.rejection}, {}};\n- }\n- {\n- std::lock_guard lock{m_mutex};\n- m_resources->wallet = wallet;\n+ if (m_started) return {{{}, execution::Rejection::Invalid}, {}};\n+ if (m_drained || m_closed->load()) return {{{}, execution::Rejection::Closed}, {}};\n+ auto native = std::make_shared<Resources>();\n+ auto hold = m_native_cleanup->hold([self, native] {\n+ if (native->acquired) self->completeStop(self->cleanup(*native));\n+ });\n+ if (!hold) return {{{}, execution::Rejection::Closed}, {}};\n+ resources = std::shared_ptr<Resources>{std::move(hold), native.get()};\n+ acquire(*resources);\n+ resources->acquired = true;\n+ m_resources = resources;\n m_refresh_pending = true;\n+ m_started = true;\n }\n auto client = borrow();\n const auto admitted = read([self](interfaces::Wallet& value) {\n@@ -111,17 +167,14 @@ Session::Start Session::start(const std::shared_ptr<interfaces::Wallet>& wallet)\n std::shared_ptr<interfaces::Wallet> Session::borrow() const\n {\n std::lock_guard lock{m_mutex};\n- if (!observationOpen() || !m_resources->wallet) return {};\n- auto borrowed = m_retirement->borrow(m_retirement_key);\n- if (!borrowed) return {};\n- auto owner = std::make_shared<Borrower>(Borrower{std::move(*borrowed.lease), m_resources->wallet});\n- return {std::move(owner), m_resources->wallet.get()};\n+ if (!observationOpen() || !m_resources || !m_resources->get()) return {};\n+ return {m_resources, m_resources->get()};\n }\n \n void Session::close()\n {\n std::lock_guard lock{m_mutex};\n- m_admission_closed.store(true);\n+ m_actions_closed.store(true);\n m_source_epoch->closed.store(true);\n }\n \n@@ -135,34 +188,58 @@ bool Session::admitAction()\n \n bool Session::control(std::function<void()> effect)\n {\n- return bool(execution::Submit(*m_commands, [] {}, std::move(effect), {},\n- {execution::Lane::Control, sizeof(void*) * 8, m_command_key}));\n+ return bool(PostUtility(*m_outcomes, std::move(effect)));\n }\n \n-execution::Admission Session::postDomain(std::function<void()> work, size_t payload_bytes, execution::WorkClass kind)\n+execution::SubmitResult Session::postDomain(std::function<void()> work, execution::WorkClass kind)\n {\n if (kind == execution::WorkClass::Action ? !admitAction() : !available()) return {{}, execution::Rejection::Closed};\n const auto self = shared_from_this();\n- return execution::Submit(*m_commands, [self, work = std::move(work), kind] {\n+ auto run = [self, work = std::move(work), kind] {\n // Accepted command planning must consume its outcome even after close.\n if (kind == execution::WorkClass::Action || self->available()) work();\n- }, [] {}, {}, {execution::Lane::Domain, payload_bytes, m_command_key, kind});\n+ };\n+ return PostUtility(*m_outcomes, std::move(run));\n }\n \n-execution::Admission Session::retireValues(std::function<void()> work)\n+execution::SubmitResult Session::postDomainTask(std::shared_ptr<execution::Task> packet, execution::WorkClass)\n {\n- return execution::Submit(*m_commands, std::move(work), [] {}, {},\n- {execution::Lane::Cleanup, 256, {}, execution::WorkClass::Action});\n+ if (!observationOpen()) return {{}, execution::Rejection::Closed};\n+ return PostUtility(*m_outcomes, [packet = std::move(packet)] {\n+ packet->execute();\n+ packet->deliver();\n+ });\n }\n \n-execution::BorrowAdmission Session::holdValues(std::function<void()> cleanup)\n+std::function<execution::SubmitResult(std::shared_ptr<execution::Task>)> Session::observationPost(\n+ execution::Lane lane)\n {\n- const auto key = m_commands->allocateKey();\n- const auto reserved = execution::Submit(*m_commands, std::move(cleanup), [] {}, {},\n- {execution::Lane::Cleanup, 256, key, execution::WorkClass::Action}, true);\n- if (!reserved) return {{}, reserved.rejection};\n- auto held = m_commands->borrow(key);\n- m_commands->activateCleanup(reserved.id);\n+ assert(lane == execution::Lane::Core || lane == execution::Lane::Domain);\n+ return [self = shared_from_this(), lane](std::shared_ptr<execution::Task> packet) {\n+ if (lane == execution::Lane::Domain) return self->postDomainTask(std::move(packet), execution::WorkClass::Observation);\n+ if (!self->observationOpen()) return execution::SubmitResult{{}, execution::Rejection::Closed};\n+ return self->postCore(std::move(packet));\n+ };\n+}\n+\n+execution::SubmitResult Session::retireValues(std::function<void()> work)\n+{\n+ return PostUtility(*m_outcomes, std::move(work));\n+}\n+\n+std::shared_ptr<void> Session::holdValues(std::function<void()> cleanup)\n+{\n+ // A rejected callback can release an action and reenter releaseWork().\n+ // Keep its captures alive until the admission lock has been released.\n+ auto retire = std::make_shared<Notify>(std::move(cleanup));\n+ std::lock_guard lock{m_mutex};\n+ if (m_stop_requested) return {};\n+ auto held = m_value_cleanup->hold([self = shared_from_this(), retire] {\n+ try { (*retire)(); } catch (...) {}\n+ *retire = {};\n+ self->releaseWork();\n+ });\n+ if (held) ++m_work_references;\n return held;\n }\n \n@@ -181,46 +258,54 @@ std::function<bool()> Session::observationGuard() const\n };\n }\n \n+Session::Action::~Action()\n+{\n+ if (m_owner) m_owner->releaseWork();\n+}\n+\n std::shared_ptr<const Session::Action> Session::startAction()\n {\n- auto scope = m_commands->openActionScope(sizeof(Action) + 128);\n- if (!scope) return {};\n- execution::ResourceKey work_key;\n- try { work_key = m_commands->allocateKey(); } catch (...) { return {}; }\n- if (!admitAction()) return {};\n- auto wallet = borrow();\n- if (!wallet) return {};\n- return std::shared_ptr<const Action>{new Action{m_identity, std::move(scope), work_key, std::move(wallet)}};\n+ auto action = std::shared_ptr<Action>{new Action{m_identity}};\n+ std::lock_guard lock{m_mutex};\n+ if (!available() || !m_resources || !m_resources->get()) return {};\n+ action->m_owner = shared_from_this();\n+ ++m_work_references;\n+ ++m_consequences;\n+ return action;\n }\n \n-execution::Admission Session::submitActionWork(const std::shared_ptr<const Action>& action,\n- std::function<void()> work, size_t payload_bytes)\n+void Session::releaseWork()\n {\n- if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Core, payload_bytes, action->m_work_key, execution::WorkClass::Action});\n+ std::function<void(Notify)> stop_work;\n+ {\n+ std::lock_guard lock{m_mutex};\n+ assert(m_work_references > 0);\n+ if (--m_work_references == 0 && m_stop_requested) stop_work = std::exchange(m_stop_work, {});\n+ }\n+ if (stop_work) drainWork(std::move(stop_work));\n }\n \n-execution::Admission Session::reserveActionCleanup(const std::shared_ptr<const Action>& action,\n- std::function<void()> work)\n+interfaces::Wallet& Session::nativeWallet() const\n {\n- if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Cleanup, 256, action->m_work_key, execution::WorkClass::Action}, true);\n+ std::lock_guard lock{m_mutex};\n+ auto* wallet = m_resources ? m_resources->get() : nullptr;\n+ if (!wallet) throw std::logic_error{\"The wallet opening has no native wallet\"};\n+ return *wallet;\n }\n \n-bool Session::activateActionCleanup(const std::shared_ptr<const Action>& action, execution::TaskId id)\n+execution::SubmitResult Session::postCore(std::shared_ptr<execution::Task> packet)\n {\n- if (!action || action->m_identity != m_identity) return false;\n- return action->m_scope->activateCleanup(id);\n+ // Reserve Utility delivery before admitting Core work. A rejected Core\n+ // submission releases the reservation with no completed packet.\n+ return m_outcome_delivery->postWithOutcome(*m_core_queue, std::move(packet));\n }\n \n-execution::Admission Session::planAction(const std::shared_ptr<const Action>& action,\n- std::function<void()> work, size_t payload_bytes)\n+execution::SubmitResult Session::planAction(const std::shared_ptr<const Action>& action,\n+ std::function<void()> work)\n {\n if (!action || action->m_identity != m_identity) return {{}, execution::Rejection::Invalid};\n- return execution::Submit(*action->m_scope, [action, work = std::move(work)] { work(); }, [] {}, {},\n- {execution::Lane::Domain, payload_bytes, m_command_key, execution::WorkClass::Action});\n+ auto run = [action, work = std::move(work)] { work(); };\n+ return PostUtility(*m_outcomes, std::move(run));\n }\n \n void Session::onTransactions(Transactions consumer)\n@@ -236,7 +321,7 @@ void Session::onTransactions(Transactions consumer)\n // including a Domain publication that had already copied the old consumer.\n if (consumer && seed.transaction_revision && !postDomain([consumer = std::move(consumer), seed] {\n consumer(seed.transaction_revision, seed.transactions, true);\n- }, 256 + seed.transactions.size() * 128)) {\n+ })) {\n {\n std::lock_guard lock{m_mutex};\n m_pending.rescan = true;\n@@ -274,29 +359,79 @@ void Session::answerClose(Question question, bool accept)\n \n void Session::retire(bool remove_wallet)\n {\n- std::optional<execution::TaskId> cleanup;\n+ // Native ingress can report an unload while the facade still needs to\n+ // stop its producers. The facade calls stop() after that handoff.\n+ std::lock_guard lock{m_mutex};\n+ m_closed->store(true);\n+ m_remove |= remove_wallet;\n+ m_pending = {};\n+}\n+\n+void Session::stop(bool remove_wallet, Notify done)\n+{\n+ std::function<void(Notify)> stop_work;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_remove |= remove_wallet;\n- cleanup = m_cleanup;\n m_pending = {};\n+ if (!m_drained) {\n+ if (done) m_stop_callbacks.push_back(std::exchange(done, {}));\n+ m_stop_requested = true;\n+ // Accepted actions can still schedule follow-ups, and retained\n+ // values can still post their final cleanup on Utility.\n+ if (m_work_references == 0) stop_work = std::exchange(m_stop_work, {});\n+ }\n }\n- if (cleanup) m_retirement->activateCleanup(*cleanup);\n+ if (stop_work) drainWork(std::move(stop_work));\n+ if (done) done();\n }\n \n-bool Session::cleanup()\n+void Session::drainWork(std::function<void(Notify)> stop_work)\n+{\n+ stop_work([self = shared_from_this()] {\n+ std::shared_ptr<Resources> resources;\n+ {\n+ std::lock_guard lock{self->m_mutex};\n+ resources = std::move(self->m_resources);\n+ }\n+ if (!resources) self->completeStop(false);\n+ // The last borrower releases the wallet on its cleanup worker.\n+ });\n+}\n+\n+void Session::completeStop(bool failed)\n+{\n+ std::vector<Notify> callbacks;\n+ {\n+ std::lock_guard lock{m_mutex};\n+ m_closed->store(true);\n+ m_drained = true;\n+ callbacks.swap(m_stop_callbacks);\n+ }\n+ Update update;\n+ update.phase = Phase::Closed;\n+ update.failed = failed;\n+ publish(std::move(update));\n+ for (const auto& callback : callbacks) callback();\n+}\n+\n+bool Session::cleanup(Resources& resources)\n {\n m_closed->store(true);\n bool failed{false};\n- for (auto& handler : m_resources->handlers) {\n+ for (auto& handler : resources.handlers) {\n try { if (handler) handler->disconnect(); } catch (...) { failed = true; }\n }\n- m_resources->handlers.clear();\n+ resources.handlers.clear();\n bool remove;\n { std::lock_guard lock{m_mutex}; remove = m_remove; }\n- try { if (m_resources->wall\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 517,
"evidence_id": "81d25df498974b24ae81ded30581c33d",
"finding_id": "finding:5",
"kind": "new_source",
"line": 368,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/walletopening.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 7,
"source_job_id": 2828,
"text": "}\n\nvoid Session::stop(bool remove_wallet, Notify done)\n{\n std::function<void(Notify)> stop_work;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_remove |= remove_wallet;\n m_pending = {};\n if (!m_drained) {\n if (done) m_stop_callbacks.push_back(std::exchange(done, {}));\n m_stop_requested = true;\n // Accepted actions can still schedule follow-ups, and retained\n // values can still post their final cleanup on Utility.\n if (m_work_references == 0) stop_work = std::exchange(m_stop_work, {});\n }\n }\n if (stop_work) drainWork(std::move(stop_work));\n if (done) done();\n}\n\nvoid Session::drainWork(std::function<void(Notify)> stop_work)\n{\n stop_work([self = shared_from_this()] {\n std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{self->m_mutex};\n resources = std::move(self->m_resources);\n }\n if (!resources) self->completeStop(false);\n // The last borrower releases the wallet on its cleanup worker.\n });\n}\n\nvoid Session::completeStop(bool failed)\n{\n std::vector<Notify> callbacks;\n {\n std::lock_guard lock{m_mutex};\n m_closed->store(true);\n m_drained = true;\n callbacks.swap(m_stop_callbacks);\n }\n Update update;\n update.phase = Phase::Closed;\n update.failed = failed;\n publish(std::move(update));\n for (const auto& callback : callbacks) callback();\n}\n\nbool Session::cleanup(Resources& resources)\n{\n m_closed->store(true);\n bool failed{false};\n for (auto& handler : resources.handlers) {\n try { if (handler) handler->disconnect(); } catch (...) { failed = true; }\n }\n resources.handlers.clear();\n bool remove;\n { std::lock_guard lock{m_mutex}; remove = m_remove; }\n try { if (auto* wallet = resources.get(); wallet && remove) wallet->remove(); } catch (...) { failed = true; }\n // The original load observation records the removal before disconnecting.\n try { if (resources.unload_handler) resources.unload_handler->disconnect(); } catch (...) { failed = true; }\n resources.unload_handler.reset();\n resources.wallet.reset();\n resources.shared_wallet.reset();\n return failed;\n}\n\nvoid Session::ingress(int kind, const Txid& txid, ChangeType change)\n{\n m_source_epoch->advance();\n if (kind == 3) m_native_events.observeUnload();\n std::shared_ptr<Resources> resources;\n {\n std::lock_guard lock{m_mutex};\n resources = m_resources;\n }\n if (kind == 3) {\n retire();\n Update closing; closing.unloaded = true; closing.phase = Phase::Closing;\n publish(std::move(closing));\n const auto self = shared_from_this();\n control([self] {\n self->m_state.retire();\n Update update; update.unloaded = true;\n update.phase = self->m_state.phase();\n self->publish(std::move(update));\n });\n return;\n }\n if (!resources) {\n if (available()) { retire(); Update failed; failed.failed = true; publish(std::move(failed)); }\n return;\n }\n {\n std::lock_guard lock{m_mutex};\n if (!observationOpen()) return;\n if (kind == 4) m_metadata_dirty = true;\n else if (kind == 0) m_pending.status = true;\n else if (kind == 1) m_pending.addresses = true;\n else {\n m_transactions_pending = true;\n m_pending.transaction_revision = ++m_transaction_revision;\n if (m_pending.transactions.size() < 256 || m_pending.transactions.contains(txid)) m_pending.transactions[txid] = change;\n else m_pending.rescan = true;\n }\n }\n scheduleRefresh();\n}\n\nvoid Session::scheduleRefresh()\n{\n Update events;\n {\n std::lock_guard lock{m_mutex};\n if (!observationOpen() || m_refresh_pending || m_clock() < m_retry_after) return;\n if (!m_metadata_dirty && !m_pending.status && !m_pending.addresses && !m_pending.rescan && m_pending.transactions.empty()) return;\n m_refresh_pending = true;\n events = std::exchange(m_pending, {});\n m_metadata_dirty = false;\n }\n const auto self = shared_from_this();\n const bool transactions = events.rescan || !events.transactions.empty();\n const auto admitted = read([self](interfaces::Wallet& wallet) { return ReadMetadata(wallet, self->m_preferences, self->unavailableReceiveTypes()); },\n [self, events = std::move(events)](Metadata metadata) mutable { self->refreshed(std::move(metadata), std::move(events)); },\n [self, transactions](std::exception_ptr) { self->refreshFailed(transactions); }, execution::WorkClass::Observation);\n if (!admitted) refreshFailed(transactions);\n}\n\nvoid Session::refreshFailed(bool transactions)\n{\n {\n std::lock_guard lock{m_mutex};\n m_refresh_pending = false;\n if (!observationOpen()) return;\n // Reconcile a failed/undelivered notice instead of dropping its\n // consequences. Retry only after the bounded backoff, on a new notice\n // or an explicit clock tick; never spin on admission failure.\n m_pending.status = m_pending.addresses = true;\n m_pending.rescan |= transactions;\n if (transactions) m_pending.transaction_revision = m_transaction_revision;\n m_retry_after = m_clock() + std::chrono::seconds{std::min(30U, 1U << m_refresh_failures)};\n m_refresh_failures = std::min(5U, m_refresh_failures + 1);\n }\n Update update; update.failed = true; publish(std::move(update));\n}\n\nOutputType Session::preferredReceiveType(interfaces::Wallet& wallet) const",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f95b6a8f7cc5..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | An additive cluster check overrides testmempoolaccept for imported replacementsqml/psbtpolicy.cpp | addressed | AssessmentEvaluate now allows an exact Admission::Allowed result to override a failing additive chain-limits check, so the described replacement is not blocked by that approximation. path_diff: qml/psbtpolicy.cpp; new_source: qml/psbtpolicy.cpp [
{
"evidence_id": "9791470f18b7464cb9994bd439f9d043",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/psbtpolicy.cpp",
"source_generation": 7,
"source_job_id": 2828,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex a42a667a84..3cd08b0509 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -3,6 +3,7 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/psbtpolicy.h>\n+#include <qml/bitcoinunits.h>\n \n #include <coins.h>\n #include <consensus/consensus.h>\n@@ -24,14 +25,16 @@\n namespace {\n QString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n \n-void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n+void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts, bool enforce_raw_fee_cap)\n {\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- parameters.push_back(0); // Disable only testmempoolaccept's independent client max-fee-rate cap.\n+ // Raw PSBT broadcasts pass MAX_FEE_RATE to broadcastTransaction; wallet\n+ // sends and fee bumps already checked the wallet's own -maxtxfee limit.\n+ parameters.push_back(enforce_raw_fee_cap ? ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()) : UniValue{0});\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -46,9 +49,31 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n+ if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n+ if (!allowed) return;\n+ // An allowed conflict is a replacement. Name what it evicts; until the\n+ // lookup completes, the review must not imply that nothing is evicted.\n+ facts.replaces_unknown = true;\n+ UniValue outpoints{UniValue::VARR};\n+ for (const auto& input : transaction.vin) {\n+ UniValue outpoint{UniValue::VOBJ};\n+ outpoint.pushKV(\"txid\", input.prevout.hash.GetHex());\n+ outpoint.pushKV(\"vout\", uint64_t{input.prevout.n});\n+ outpoints.push_back(std::move(outpoint));\n+ }\n+ UniValue spending_parameters{UniValue::VARR};\n+ spending_parameters.push_back(std::move(outpoints));\n+ const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n+ if (!spending.isArray()) return;\n+ for (const auto& item : spending.getValues()) {\n+ if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n+ const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n+ if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n+ }\n+ facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n@@ -70,14 +95,17 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n {\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n+ facts.replaces.clear();\n+ facts.replaces_unknown = false;\n }\n } // namespace\n \n-psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n+psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain, bool enforce_raw_fee_cap)\n {\n- return [node, chain](CTransactionRef transaction, CAmount fee) {\n+ return [node, chain, enforce_raw_fee_cap](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n+ facts.within_fee_cap = !enforce_raw_fee_cap || !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -115,7 +143,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n- ReadAdmission(*node, *transaction, facts);\n+ ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n@@ -135,13 +163,23 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (facts.immature_inputs) return {State::Blocked, Tr(\"An input spends an immature coinbase output. Refresh the review after more blocks.\")};\n if (!facts.final) return {State::Blocked, Tr(\"The transaction lock time is not final at the observed chain tip.\")};\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n- if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n+ // checkChainLimits does not account for conflicting transactions a\n+ // replacement would evict; when testmempoolaccept already allowed this\n+ // exact transaction, do not override it with the non-RBF chain check.\n+ if (!facts.chain_limits && facts.admission != Admission::Allowed) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n+ if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n }\n if (facts.admission == Admission::Allowed) {\n+ if (!facts.replaces.isEmpty()) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n+ }\n+ if (facts.replaces_unknown) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n+ }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 187,
"evidence_id": "e7067ca05896434bb9071a35dd12f565",
"finding_id": "finding:4",
"kind": "new_source",
"line": 68,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/psbtpolicy.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 7,
"source_job_id": 2828,
"text": " spending_parameters.push_back(std::move(outpoints));\n const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n if (!spending.isArray()) return;\n for (const auto& item : spending.getValues()) {\n if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n}\n\nvoid ClearChainFacts(psbtpolicy::Facts& facts)\n{\n facts.observed = false;\n facts.missing_inputs = false;\n facts.immature_inputs = false;\n facts.final = true;\n facts.sufficient_fee = true;\n facts.chain_limits = true;\n facts.tip.clear();\n facts.chain_error.clear();\n}\n\nvoid ClearAdmissionFacts(psbtpolicy::Facts& facts)\n{\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n facts.replaces_unknown = false;\n}\n} // namespace\n\npsbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain, bool enforce_raw_fee_cap)\n{\n return [node, chain, enforce_raw_fee_cap](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n facts.within_fee_cap = !enforce_raw_fee_cap || !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n int height{-1}; int64_t mtp{0}; bool active{false};\n if (chain->findBlock(tip, interfaces::FoundBlock{}.height(height).mtpTime(mtp).inActiveChain(active))\n && active && height >= 0 && height < std::numeric_limits<int>::max()) {\n std::map<COutPoint, Coin> coins;\n for (const auto& input : transaction->vin) coins.try_emplace(input.prevout);\n chain->findCoins(coins); // Includes available mempool parents.\n for (const auto& [outpoint, coin] : coins) {\n facts.missing_inputs |= coin.IsSpent();\n facts.immature_inputs |= !coin.IsSpent() && coin.IsCoinBase()\n && int64_t(height) + 1 - coin.nHeight < COINBASE_MATURITY;\n }\n facts.final = IsFinalTx(*transaction, height + 1, mtp);\n const auto minimum = std::max(chain->mempoolMinFee(), chain->relayMinFee());\n facts.sufficient_fee = fee >= minimum.GetFee(GetVirtualTransactionSize(*transaction));\n const auto limits = chain->checkChainLimits(transaction);\n facts.chain_limits = bool(limits);\n if (!limits) facts.chain_error = QString::fromStdString(util::ErrorString(limits).translated).left(4096);\n // A reorg during this collection invalidates the whole observation.\n if (node->getBestBlockHash() == tip) {\n facts.tip = QString::fromStdString(tip.ToString());\n facts.observed = true;\n } else {\n ClearChainFacts(facts);\n }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts, enforce_raw_fee_cap);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);\n }\n return facts;\n };\n}\n\npsbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n{\n if (facts.observed) {\n if (facts.missing_inputs) return {State::Blocked, Tr(\"An input is missing or already spent at the observed chain tip. Refresh the review before submitting.\")};\n if (facts.immature_inputs) return {State::Blocked, Tr(\"An input spends an immature coinbase output. Refresh the review after more blocks.\")};\n if (!facts.final) return {State::Blocked, Tr(\"The transaction lock time is not final at the observed chain tip.\")};\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n // checkChainLimits does not account for conflicting transactions a\n // replacement would evict; when testmempoolaccept already allowed this\n // exact transaction, do not override it with the non-RBF chain check.\n if (!facts.chain_limits && facts.admission != Admission::Allowed) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n }\n if (facts.admission == Admission::Allowed) {\n if (!facts.replaces.isEmpty()) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n }\n if (facts.replaces_unknown) {\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n return {State::Unknown, Tr(\"Fully signed. Current node policy will be checked when you submit.\")};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f95b6a8f7cc5..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A known fee-bump refusal permanently locks the bump modelqml/models/bumptransactionmodel.cpp | still_present | AssessmentThe new-head code still maps Error::Commit to Phase::Uncertain in publishCommit. The reported recoverability problem is therefore not fixed by the supplied changes. new_source: qml/models/bumptransactionmodel.cpp [
{
"bounded": true,
"end_line": 456,
"evidence_id": "30df5a592113426582db9493a1a1155b",
"finding_id": "finding:3",
"kind": "new_source",
"line": 307,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/models/bumptransactionmodel.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 7,
"source_job_id": 2828,
"text": " const auto failed = owner->advance(ticket, {facts.session, facts.review, opening->available()},\n transactionattempt::Phase::Submitting, transactionattempt::Phase::Failed,\n [observer, post, attempt, revision](transactionattempt::Result failure) mutable {\n post([observer, snapshot = std::move(failure.snapshot), attempt, revision] () mutable {\n if (!observer) return;\n observer->m_error = BumpTransactionModel::tr(\"The fee increase could not be sent. Try again.\");\n observer->applyAttempt(std::move(snapshot), attempt, revision, false);\n });\n });\n if (!failed) post([observer, attempt, revision] {\n if (observer && observer->m_attempt_id == attempt && observer->m_view_revision == revision) {\n observer->m_committing = false;\n observer->m_error = BumpTransactionModel::tr(\"The fee increase could not be sent. Try again.\");\n observer->m_state = Failed;\n observer->publish();\n }\n });\n });\n if (!submitted) { m_error = tr(\"The fee increase could not be sent. Try again.\"); publish(); return 0; }\n m_commit_id = commit;\n m_commit_operation = std::move(operation); m_committing = true;\n m_needs_unlock = false; m_error.clear(); m_unlock_error.clear(); m_state = Committing;\n publish(); return commit;\n}\nvoid BumpTransactionModel::publishCommit(quint64 attempt, quint64 commit)\n{\n if (!m_committing || attempt != m_attempt_id || commit != m_commit_id || !m_commit_operation) return;\n const auto result = m_commit_operation->result();\n if (!result) return;\n if (m_closed) return;\n auto value = result->value.value_or(walletbump::Commit{});\n if (result->error) value.error = walletbump::Error::Uncertain;\n const auto outcome = value.committed ? transactionattempt::Phase::Settled\n : value.error == walletbump::Error::NeedsUnlock || value.error == walletbump::Error::IncorrectPassphrase ? transactionattempt::Phase::NeedsUnlock\n : value.error == walletbump::Error::Ineligible || value.error == walletbump::Error::Unavailable || value.error == walletbump::Error::Policy ? transactionattempt::Phase::NeedsRevalidation\n : value.error == walletbump::Error::Uncertain || value.error == walletbump::Error::Commit || value.error == walletbump::Error::RelockFailed || result->error ? transactionattempt::Phase::Uncertain\n : transactionattempt::Phase::Failed;\n const auto owner = m_attempt_owner;\n if (!owner) { m_state = Uncertain; m_committing = false; publish(); return; }\n const auto submitted = owner->advance(m_attempt_ticket, attemptFacts(), transactionattempt::Phase::Submitting, outcome,\n [observer = QPointer<BumpTransactionModel>{this}, post = m_post, value, attempt,\n revision = m_view_revision](transactionattempt::Result transition) mutable {\n post([observer, snapshot = std::move(transition.snapshot), value = std::move(value), attempt, revision] () mutable {\n if (!observer || observer->m_closed || observer->m_attempt_id != attempt || observer->m_view_revision != revision) return;\n observer->m_attempt_snapshot = std::move(snapshot);\n observer->m_state = ProjectState(observer->m_attempt_snapshot.phase);\n observer->m_committing = false;\n observer->m_needs_unlock = value.error == walletbump::Error::NeedsUnlock || value.error == walletbump::Error::IncorrectPassphrase;\n observer->m_unlock_error = value.error == walletbump::Error::IncorrectPassphrase ? ErrorMessage(value.error) : QString{};\n if (value.committed) {\n observer->m_new_txid = QString::fromStdString(value.txid.GetHex());\n observer->m_error.clear();\n } else {\n observer->m_error = value.message.isEmpty() ? ErrorMessage(value.error) : value.message;\n if (observer->m_state == NeedsRevalidation || observer->m_state == Failed) observer->m_review.reset();\n }\n const bool published = observer->publish();\n if (published && observer->m_opening && observer->m_opening->available() && observer->m_security_state_changed)\n observer->m_security_state_changed();\n });\n });\n if (!submitted) {\n m_committing = false;\n m_state = outcome == transactionattempt::Phase::Settled ? Succeeded\n : outcome == transactionattempt::Phase::NeedsRevalidation ? NeedsRevalidation\n : outcome == transactionattempt::Phase::NeedsUnlock ? NeedsConfirmation\n : outcome == transactionattempt::Phase::Uncertain ? Uncertain : Failed;\n m_error = value.message.isEmpty() ? ErrorMessage(value.error) : value.message;\n publish();\n }\n}\nstd::optional<walletbump::Commit> BumpTransactionModel::commitResult() const\n{\n if (m_observed_outcome) return m_observed_outcome;\n if (!m_commit_operation) return {};\n const auto result = m_commit_operation->result();\n return result ? result->value : std::nullopt;\n}\nbool BumpTransactionModel::canRecheckOutcome() const\n{\n const auto result = commitResult();\n return !m_closed && m_state == Uncertain && !busy() && m_opening && m_opening->available()\n && result && result->commit_attempted && result->candidate_txid != Txid{};\n}\nquint64 BumpTransactionModel::requestRecheckFeeBumpOutcome()\n{\n if (!canRecheckOutcome()) return 0;\n const auto original = *commitResult();\n const auto opening = m_opening;\n const auto action = opening->startAction();\n if (!action) return 0;\n const auto attempt = m_attempt_id, commit = m_commit_id, observation = ++m_observation_id;\n const QPointer<BumpTransactionModel> observer{this};\n auto operation = std::make_shared<execution::OwnedCommand<walletbump::Commit>>(\n [post = m_post, observer, attempt, commit, observation] {\n post([observer, attempt, commit, observation] { if (observer) observer->publishObservation(attempt, commit, observation); });\n });\n m_observation_operation = operation;\n m_rechecking = true;\n const auto submitted = operation->startWith([opening, action, original](auto done, auto failed) {\n return opening->perform(action, [original](interfaces::Wallet& wallet) { return walletbump::ObserveOutcome(wallet, original); },\n std::move(done), std::move(failed));\n });\n if (!observer || m_closed) return submitted ? observation : 0;\n if (!submitted) {\n m_rechecking = false;\n m_error = tr(\"The transaction status could not be checked, so it is not known yet.\");\n publish(); return 0;\n }\n publish(); return observation;\n}\nvoid BumpTransactionModel::publishObservation(quint64 attempt, quint64 commit, quint64 observation)\n{\n if (m_closed || !m_rechecking || m_attempt_id != attempt || m_commit_id != commit || m_observation_id != observation || !m_observation_operation) return;\n const auto result = m_observation_operation->result();\n if (!result) return;\n m_rechecking = false;\n if (result->error || !result->value) {\n m_error = tr(\"The transaction status could not be checked, so it is not known yet.\");\n } else {\n m_observed_outcome = *result->value;\n if (result->value->record == walletbump::Record::Recorded) {\n m_new_txid = QString::fromStdString(result->value->txid.GetHex());\n m_error = tr(\"The replacement is recorded in the wallet. Check its status before taking further action.\");\n } else {\n m_error = tr(\"The replacement could not be confirmed in the wallet. No transaction was resubmitted.\");\n }\n }\n publish();\n}\nBumpTransactionModel::WalletRecordState BumpTransactionModel::walletRecordState() const\n{\n const auto result = commitResult();\n if (!result) return WalletRecordUnknown;\n switch (result->record) {\n case walletbump::Record::Unknown: return WalletRecordUnknown;\n case walletbump::Record::AbsentAtObservation: return WalletRecordAbsentAtObservation;\n case walletbump::Record::Recorded: return WalletRecordRecorded;\n }\n return WalletRecordUnknown;\n}\nBumpTransactionModel::WalletSubmissionState BumpTransactionModel::walletSubmissionState() const\n{\n const auto result = commitResult();\n if (!result) return WalletSubmissionUnknown;\n switch (result->submission) {\n case walletbump::Submission::Unknown: return WalletSubmissionUnknown;\n case walletbump::Submission::Mempool: return WalletSubmissionMempool;\n case walletbump::Submission::Confirmed: return WalletSubmissionConfirmed;\n case walletbump::Submission::NotInMempool: return WalletSubmissionNotInMempool;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f95b6a8f7cc5..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A pre-commit signer exception traps Speed Up in Uncertainqml/walletbump.cpp | addressed | AssessmentExternal signer exceptions from signBumpTransaction are caught locally and converted to Error::Sign before commit is attempted, rather than reaching the outer catch as Error::Uncertain. The model classifies that pre-commit error as Failed, permitting retry. path_diff: qml/walletbump.cpp [
{
"evidence_id": "a08681582abc4063bdea7c41ac786d8b",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/walletbump.cpp",
"source_generation": 7,
"source_job_id": 2828,
"text": "diff --git a/qml/walletbump.cpp b/qml/walletbump.cpp\nindex e2065edf68..0a1864c4b1 100644\n--- a/qml/walletbump.cpp\n+++ b/qml/walletbump.cpp\n@@ -3,7 +3,6 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/walletbump.h>\n-#include <qml/walletopening.h>\n #include <qml/walletsend.h>\n #include <qml/models/signertransaction.h>\n #include <wallet/coincontrol.h>\n@@ -80,7 +79,7 @@ void Observe(interfaces::Wallet& wallet, Commit& result, bool exact_witness = fa\n } // namespace\n \n Preparation Prepare(interfaces::Wallet& wallet, const QString& txid, unsigned int target,\n- const std::shared_ptr<walletopening::Session>& opening)\n+ std::shared_ptr<Prepared> review)\n {\n Preparation result;\n try {\n@@ -89,17 +88,7 @@ Preparation Prepare(interfaces::Wallet& wallet, const QString& txid, unsigned in\n if (target < 1 || target > 1008) { result.error = Error::Invalid; return result; }\n const auto original = Txid::FromUint256(*parsed);\n if (!wallet.transactionCanBeBumped(original)) { result.error = Error::Ineligible; return result; }\n- // A transaction review is backend data, potentially much larger than\n- // its GUI fee strings. Reserve cleanup before constructing it so the\n- // last facade/command release never tears transaction vectors down on GUI.\n- struct ReviewStorage { std::unique_ptr<Prepared> value; };\n- const auto review_storage = std::make_shared<ReviewStorage>();\n- auto cleanup_borrower = opening->holdValues([review_storage] { review_storage->value.reset(); });\n- if (!cleanup_borrower) { result.error = Error::Uncertain; return result; }\n- const auto review_lifetime = std::make_shared<execution::ResourceLease>(std::move(*cleanup_borrower.lease));\n- review_storage->value = std::make_unique<Prepared>();\n- // The review alias pins the borrower until reserved cleanup can run.\n- auto review = std::shared_ptr<Prepared>{review_lifetime, review_storage->value.get()};\n+ if (!review) { result.error = Error::Uncertain; return result; }\n review->original = original;\n review->target_blocks = target;\n const auto original_transaction = wallet.getTx(original);\n@@ -175,7 +164,11 @@ Commit Execute(interfaces::Wallet& wallet, const Prepared& review, std::optional\n if (!wallet.unlock(*passphrase)) { relock_required = false; result.error = Error::IncorrectPassphrase; return finishAfterRelock(); }\n }\n CMutableTransaction signed_tx{review.transaction};\n- if (!wallet.signBumpTransaction(signed_tx)) { result.error = Error::Sign; return finishAfterRelock(); }\n+ // An external signer helper failure throws before any commit. It is a\n+ // definite signing failure, not an uncertain replacement outcome.\n+ bool signed_replacement{false};\n+ try { signed_replacement = wallet.signBumpTransaction(signed_tx); } catch (...) {}\n+ if (!signed_replacement) { result.error = Error::Sign; return finishAfterRelock(); }\n if (!MatchesUnsignedTransaction(review.transaction, signed_tx)) { result.error = Error::Changed; return finishAfterRelock(); }\n if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f95b6a8f7cc5..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | A predictable /tmp intent directory lets another local user prevent GUI startupqml/desktopintenttransport.cpp | addressed | AssessmentThe Unix transport path now uses QStandardPaths::RuntimeLocation and places the endpoint under its per-user runtime directory instead of predictable shared /tmp. The new code validates the directory’s type, owner, and permissions before use. path_diff: qml/desktopintenttransport.cpp; new_source: qml/desktopintenttransport.cpp [
{
"evidence_id": "dd6e762e9f894d02a4b07e628f30fc1c",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/desktopintenttransport.cpp",
"source_generation": 7,
"source_job_id": 2828,
"text": "diff --git a/qml/desktopintenttransport.cpp b/qml/desktopintenttransport.cpp\nindex 841d066889..df095f879a 100644\n--- a/qml/desktopintenttransport.cpp\n+++ b/qml/desktopintenttransport.cpp\n@@ -2,7 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/desktopintenttransport.h>\n-#include <qml/retainedvalue.h>\n+#include <qml/asyncjoin.h>\n #include <util/fs.h>\n \n #include <QCoreApplication>\n@@ -17,6 +17,8 @@\n #include <QLocalSocket>\n #include <QLockFile>\n #include <QMetaObject>\n+#include <QScopeGuard>\n+#include <QStandardPaths>\n #include <QStringList>\n #include <QThread>\n #include <QTimer>\n@@ -196,25 +198,26 @@ struct Discovery {\n struct Service::Flags {\n std::atomic_bool admission_closed{false}, stopping{false}, started{false}, retired{false};\n std::mutex mutex;\n- execution::TaskId retired_task;\n- std::function<void()> completed_stop;\n+ std::vector<std::function<void()>> completed_stops;\n bool probed{false}, probe_pending{false}, probe_terminal{false}; // Protected by mutex.\n };\n struct Service::State {\n struct Native;\n- std::shared_ptr<execution::Scheduler> scope;\n std::shared_ptr<Owner> owner;\n Limits limits;\n- execution::ResourceKey key;\n const std::shared_ptr<Flags> flags{std::make_shared<Flags>()};\n- std::shared_ptr<execution::ResourceLease> native_lifetime;\n- std::mutex mutex;\n+ // The same lock protects admission, pending delivery and the receiver\n+ // used to post work to the transport thread.\n Native* native{nullptr};\n+ size_t pending_deliveries{0};\n+ bool post(std::function<void(Native&)> work);\n+ void finishDelivery();\n+ void retireWhenIdle();\n };\n \n struct Service::State::Native final : QObject {\n struct Query { QJsonArray results; QStringList keys; size_t remaining{0}; bool unknown{false}; };\n- struct Reply { std::optional<desktopintent::Admission> admission; std::optional<Receipt> receipt; };\n+ struct Reply { std::optional<desktopintent::Acceptance> admission; std::optional<Receipt> receipt; };\n struct Cell {\n std::mutex mutex;\n QObject* receiver{nullptr}; std::function<void()> notify;\n@@ -230,7 +233,7 @@ struct Service::State::Native final : QObject {\n };\n struct Pending { uint64_t connection; std::shared_ptr<Cell> cell; std::shared_ptr<Query> query{}; qsizetype index{0}; QStringList keys{}; };\n const std::shared_ptr<State> state;\n- QLocalServer server;\n+ QLocalServer server{this};\n std::unique_ptr<QLockFile> instance_lock;\n struct Client { QLocalSocket* socket; Limits::Time admitted; };\n std::map<uint64_t, Client> clients;\n@@ -306,7 +309,7 @@ struct Service::State::Native final : QObject {\n QStringList keys; for (const auto& input : inputs) keys.push_back(input.producer_key);\n const auto cell = reserve(id, {}, 0, std::move(keys)); if (!cell) { send(id, {{\"status\", \"rejected\"}}); return; }\n const auto admitted = state->owner->admit(std::move(inputs), [cell](auto result) { cell->complete({std::move(result), {}}); });\n- if (!admitted) cell->complete({desktopintent::Admission{Error::Closed, {}}, {}});\n+ if (!admitted) cell->complete({desktopintent::Acceptance{Error::Closed, {}}, {}});\n } else if (command == \"query\") {\n const auto keys = object.value(\"keys\").toArray();\n if (keys.empty() || keys.size() > static_cast<qsizetype>(Queue::MAX_PENDING) || replies.size() + static_cast<size_t>(keys.size()) > MAX_REPLIES) { socket->abort(); return; }\n@@ -351,17 +354,19 @@ struct Service::State::Native final : QObject {\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n- std::shared_ptr<execution::ResourceLease> lifetime;\n- { std::lock_guard lock{state->mutex}; state->native = nullptr; lifetime = std::move(state->native_lifetime); }\n- delete this;\n- lifetime.reset(); // Only now may the original Native event loop drain.\n+ QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n #ifndef Q_OS_WIN\n- private_directory = QDir{QStringLiteral(\"/tmp\")}.filePath(QStringLiteral(\"qml-intent-%1\").arg(getuid()));\n+ // The runtime directory belongs to this user (Qt checks its owner and\n+ // mode). A fixed name in the shared /tmp could be created first by\n+ // another user, which would block delivery for this one.\n+ const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n+ if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n+ private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n@@ -440,37 +445,83 @@ struct Service::State::Native final : QObject {\n }\n };\n \n+bool Service::State::post(std::function<void(Native&)> work)\n+{\n+ std::lock_guard lock{flags->mutex};\n+ return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n+ work(*receiver);\n+ }, Qt::QueuedConnection);\n+}\n+\n+void Service::State::finishDelivery()\n+{\n+ {\n+ std::lock_guard lock{flags->mutex};\n+ --pending_deliveries;\n+ }\n+ retireWhenIdle();\n+}\n+\n+void Service::State::retireWhenIdle()\n+{\n+ std::lock_guard lock{flags->mutex};\n+ if (!flags->stopping || pending_deliveries || !native) return;\n+ auto* receiver = std::exchange(native, nullptr);\n+ if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n+}\n+\n Service::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\n Service::~Service() { stop(); }\n-std::shared_ptr<Service> Service::Create(std::shared_ptr<execution::Scheduler> scheduler, std::shared_ptr<Owner> owner, Limits limits)\n+bool Service::post(std::function<void()> work) const\n+{\n+ const auto state = m_state.load();\n+ return state && state->post([work = std::move(work)](State::Native&) { work(); });\n+}\n+\n+std::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n {\n const auto maximum = std::chrono::seconds{30};\n- if (!scheduler || !owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n+ if (!owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n limits.connect <= std::chrono::milliseconds::zero() || limits.connect > limits.startup ||\n limits.acknowledge <= std::chrono::milliseconds::zero() || limits.acknowledge > limits.startup ||\n limits.query <= std::chrono::milliseconds::zero() || limits.query > limits.startup ||\n limits.client <= std::chrono::milliseconds::zero() || limits.client > maximum ||\n limits.slice <= std::chrono::milliseconds::zero() || limits.slice > std::chrono::milliseconds{100}) return {};\n- auto scope = scheduler->openActionScope(1024); if (!scope) return {};\n- auto state = execution::RetainValues<State>(scope, [] { return std::make_unique<State>(); }); if (!state) return {};\n- state->scope = scope; state->owner = std::move(owner); state->limits = std::move(limits); state->key = scope->allocateKey();\n- const auto retired = execution::Submit(*scope, [] {}, [state] {\n- std::function<void()> done;\n- { std::lock_guard lock{state->mutex}; state->owner.reset(); }\n- { std::lock_guard lock{state->flags->mutex}; state->flags->retired = true; done = std::move(state->flags->completed_stop); }\n- if (done) done();\n- }, {}, {execution::Lane::Cleanup, 1024, state->key}, true);\n- auto borrowed = retired ? scope->borrow(state->key) : execution::BorrowAdmission{{}, retired.rejection};\n- if (!borrowed) { if (retired) scope->activateCleanup(retired.id); return {}; }\n- state->flags->retired_task = retired.id;\n- state->native_lifetime = std::make_shared<execution::ResourceLease>(std::move(*borrowed.lease));\n- return std::shared_ptr<Service>{new Service(std::move(state))};\n+ auto* const app = QCoreApplication::instance();\n+ Q_ASSERT(app && QThread::currentThread() == app->thread());\n+ auto state = std::make_shared<State>();\n+ state->owner = std::move(owner);\n+ state->limits = std::move(limits);\n+ auto thread = std::make_unique<QThread>();\n+ thread->setObjectName(QStringLiteral(\"desktop transport\"));\n+ auto native = std::make_unique<State::Native>(state);\n+ auto service = std::shared_ptr<Service>{new Service(state)};\n+ QObject::connect(thread.get(), &QThread::finished, native.get(), &QObject::deleteLater);\n+ QObject::connect(thread.get(), &QThread::finished, app, [app, state, worker = thread.get()] {\n+ JoinThreadAsync([state, worker] {\n+ if (!worker->wait()) std::terminate();\n+ state->owner.reset();\n+ std::vector<std::function<void()>> completed;\n+ {\n+ std::lock_guard lock{state->flags->mutex};\n+ state->flags->retired = true;\n+ completed = std::move(state->flags->completed_stops);\n+ }\n+ for (const auto& done : completed) {\n+ try { done(); } catch (...) {}\n+ }\n+ }, app, [worker] { delete worker; });\n+ }, Qt::QueuedConnection);\n+ native->moveToThread(thread.get());\n+ state->native = native.release();\n+ thread.release()->start();\n+ return service;\n }\n-execution::Admission Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n+execution::SubmitResult Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n {\n return begin(std::move(directory), std::move(network), std::move(inputs), false, std::move(completed), {});\n }\n-execution::Admission Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n+execution::SubmitResult Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n {\n if (inputs.size() > Queue::MAX_PENDING) return {{}, execution::Rejection::Invalid};\n const auto callback = std::move(completed);\n@@ -487,7 +538,7 @@ execution::Admission Service::probeExisting(QString directory, QString network,\n const auto missing = [callback] { if (callback) callback({ProbeStatus::Missing, {}}); };\n return begin(std::move(directory), std::move(network), inputs, true, transfer, missing);\n }\n-execution::Admission Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n+execution::SubmitResult Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n std::function<void(StartResult)> completed, std::function<void()> missing)\n {\n const auto state = m_state.load();\n@@ -497,82 +548,82 @@ execution::Admission Service::begin(QString directory, QString network, std::vec\n return {{}, execution::Rejection::Closed};\n if (existing_only) { m_flags->probed = true; m_flags->probe_pending = true; }\n else m_flags->started = true;\n+ ++state->pending_deliveries;\n }\n- const auto reject = [flags = m_flags, existing_only](execution::Rejection reason) {\n- if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- return execution::Admission{{}, reason};\n- };\n+ auto release_rejected = qScopeGuard([&] {\n+ if (existing_only) {\n+ std::lock_guard lock{m_flags->mutex};\n+ m_flags->probe_pending = false;\n+ m_flags->probe_terminal = true;\n+ }\n+ state->finishDelivery();\n+ });\n if (directory.size() > 4096 || QString::fromUtf8(directory.toUtf8()) != directory || network.isEmpty() || network.size() > 128 || directory.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\n'}) || inputs.size() > Queue::MAX_PENDING)\n- return reject(execution::Rejection::Invalid);\n- size_t bytes{1024};\n+ return {{}, execution::Rejection::Invalid};\n for (const auto& input : inputs) {\n- if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return reject(execution::Rejection::Capacity);\n- bytes += static_cast<size_t>(input.producer_key.size() + input.value.size()) * sizeof(QChar);\n+ if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return {{}, execution::Rejection::Capacity};\n }\n- auto held = state->scope->borrow(state->key); if (!held) return reject(held.rejection);\n- auto lifetime = std::make_shared<execution::ResourceLease>(std::move(*held.lease));\n- std::shared_ptr<Owner> owner;\n- { std::lock_guard lock{state->mutex}; owner = state->owner; }\n- const auto payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(inputs)); });\n- if (!payload) return reject(execution::Rejection::Capacity);\n+ const auto owner = state->owner;\n+ const auto payload = std::make_shared<const std::vector<Input>>(std::move(inputs));\n const auto claimed = std::make_shared<std::atomic_bool>(false);\n- const auto finish = [done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n+ const auto finish = [state, done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n if (claimed->exchange(true)) return;\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- if (done) done(std::move(result));\n+ try { if (done) done(std::move(result)); } catch (...) {}\n };\n- const auto submitted = execution::Submit(*state->scope, [state, directory = std::move(directory), network = std::move(network), payload, lifetime, existing_only] {\n- if (state->flags->admission_closed || (QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))\n- return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start on its background worker.\"))};\n- auto native = std::make_unique<State::Native>(state);\n- auto discovery = native->initialize(directory, network, existing_only);\n- if (discovery.result.status == StartStatus::Primary) {\n- std::lock_guard lock{state->mutex};\n- if (!state->flags->stopping) state->native = native.release();\n- else discovery.result = Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n+ const auto submitted = state->post([state, owner, directory = std::move(directory), network = std::move(network),\n+ payload, finish, claimed, missing = std::move(missing), existing_only](State::Native& native) {\n+ if (state->flags->admission_closed) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n }\n- return discovery;\n- }, [state, owner, payload, finish, lifetime, claimed, missing = std::move(missing)](Discovery discovery) {\n+ auto discovery = [&] {\n+ try { return native.initialize(directory, network, existing_only); }\n+ catch (...) { return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start.\"))}; }\n+ }();\n if (discovery.missing) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n if (!claimed->exchange(true)) {\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n { std::lock_guard lock{state->flags->mutex}; state->flags->probe_pending = false; }\n- if (missing) missing();\n+ try { if (missing) missing(); } catch (...) {}\n }\n return;\n }\n if (!discovery.endpoint.isEmpty()) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n try {\n- const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish, lifetime](ForwardingSnapshot snapshot) {\n+ const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish](ForwardingSnapshot snapshot) {\n if (snapshot.error != Error::None || state->flags->admission_closed) {\n finish(Rejected(QStringLiteral(\"The GUI could not transfer its pending requests.\"))); return;\n }\n- const auto forward_payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(snapshot.inputs)); });\n- if (!forward_payload) { finish(Rejected(QStringLiteral(\"The GUI could not retain its pending requests.\"))); return; }\n- const auto forwarded = execution::Submit(*state->scope, [state, endpoint, forward_payload, lifetime] {\n- if (state->flags->stopping) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n- // Once a frame may have left this process, an exception\n- // is an unknown outcome, never permission to replay.\n- try { return Forward(endpoint, *forward_payload, state->limits, state->flags->stopping); }\n- catch (...) { return Unknown(); }\n- }, [finish, lifetime, forward_payload](StartResult result) {\n- if (result.producer_keys.empty()) result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- }, [finish, lifetime, forward_payload](std::exception_ptr) {\n- auto result = Unknown(); result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- },\n- {execution::Lane::Core, 1024 + Queue::MAX_PENDING_BYTES, state->key});\n- if (!forwarded) finish(Rejected(QStringLiteral(\"The GUI could not start payment delivery.\")));\n+ try {\n+ const auto forwarded = state->post([state, endpoint, inputs = std::move(snapshot.inputs), finish](State::Native&) {\n+ if (state->flags->stopping) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n+ }\n+ // An exception after sending may have left a frame\n+ // in the other process. Its outcome remains unknown.\n+ auto result = [&] {\n+ try { return Fo\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 483,
"evidence_id": "f09af1b55f824158b12d81cce60dcc77",
"finding_id": "finding:1",
"kind": "new_source",
"line": 334,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "f95b6a8f7cc5b1f564a84ced96edc0f92b99e3a0",
"path": "qml/desktopintenttransport.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 7,
"source_job_id": 2828,
"text": " connect(deadline, &QTimer::timeout, this, [this, id] {\n const auto found = clients.find(id);\n if (found == clients.end()) return;\n try { if (!Remaining(state->limits, found->second.admitted, state->limits.client, 1)) found->second.socket->abort(); }\n catch (...) { found->second.socket->abort(); }\n });\n deadline->start(); ingress(id);\n }\n }\n void ingress(uint64_t id) {\n try { receive(id); }\n catch (...) {\n // Any already admitted queue mutation keeps its original receipt.\n // An unacknowledged caller can query; no exception becomes replay.\n const auto found = clients.find(id); if (found != clients.end()) found->second.socket->abort();\n }\n }\n void retire() {\n server.close();\n while (!replies.empty()) clearReply(replies.begin()->first);\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n#ifndef Q_OS_WIN\n // The runtime directory belongs to this user (Qt checks its owner and\n // mode). A fixed name in the shared /tmp could be created first by\n // another user, which would block delivery for this one.\n const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n if (lstat(encoded.constData(), &info)) {\n if (existing_only && errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n }\n if (!S_ISDIR(info.st_mode) || info.st_uid != getuid() || (info.st_mode & 0077))\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QFileInfo{private_directory}.canonicalFilePath();\n#else\n private_directory = QDir::tempPath();\n#endif\n const QString identity = canonical + QLatin1Char('\\n') + network;\n const auto digest = QCryptographicHash::hash(identity.toUtf8(), QCryptographicHash::Sha256).toHex().first(24);\n#ifndef Q_OS_WIN\n const auto endpoint = QDir{private_directory}.filePath(QString::fromLatin1(digest));\n if (QFile::encodeName(endpoint).size() > 100) return Rejected(QStringLiteral(\"The payment-delivery path is too long.\"));\n#else\n const QString endpoint = QStringLiteral(\"qml-intent-\") + QString::fromLatin1(digest);\n#endif\n if (existing_only) {\n // Discovery grants no listener/lock authority and mutates no local\n // queue. A known absent peer leaves normal final-profile startup\n // available; only a connected same-user peer permits forwarding.\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer)) {\n if (errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The payment-delivery endpoint could not be inspected.\"));\n }\n if (!S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during lookup.\"));\n const auto began = state->limits.now();\n const auto remaining = Remaining(state->limits, began, state->limits.startup, static_cast<int>(state->limits.connect.count()));\n if (!remaining) return Rejected(QStringLiteral(\"The payment-delivery lookup expired.\"));\n QLocalSocket probe; probe.connectToServer(endpoint);\n const bool connected = probe.waitForConnected(remaining);\n if (!connected) {\n if (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError)\n return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The existing payment-delivery endpoint could not be contacted.\"));\n }\n if (state->flags->admission_closed || !Remaining(state->limits, began, state->limits.startup, 1))\n return Rejected(QStringLiteral(\"The payment-delivery lookup expired or is closing.\"));\n if (!SameUser(probe)) return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n return {StartResult{}, endpoint};\n }\n instance_lock = std::make_unique<QLockFile>(QDir{private_directory}.filePath(QString::fromLatin1(digest) + QStringLiteral(\".lock\")));\n instance_lock->setStaleLockTime(0);\n if (instance_lock->tryLock(0)) {\n QLocalSocket probe; probe.connectToServer(endpoint); const bool live = probe.waitForConnected(200);\n bool reclaimable = !live && (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError);\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat socket_info{};\n if (lstat(path.constData(), &socket_info) == 0) {\n reclaimable &= S_ISSOCK(socket_info.st_mode) && socket_info.st_uid == getuid();\n if (reclaimable) reclaimable = QLocalServer::removeServer(endpoint);\n }\n#endif\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n if (reclaimable && !state->flags->admission_closed && server.listen(endpoint)) return StartResult{StartStatus::Primary, {}, {}};\n }\n instance_lock.reset();\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer) || !S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unavailable or unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n return {StartResult{}, endpoint};\n }\n};\n\nbool Service::State::post(std::function<void(Native&)> work)\n{\n std::lock_guard lock{flags->mutex};\n return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n work(*receiver);\n }, Qt::QueuedConnection);\n}\n\nvoid Service::State::finishDelivery()\n{\n {\n std::lock_guard lock{flags->mutex};\n --pending_deliveries;\n }\n retireWhenIdle();\n}\n\nvoid Service::State::retireWhenIdle()\n{\n std::lock_guard lock{flags->mutex};\n if (!flags->stopping || pending_deliveries || !native) return;\n auto* receiver = std::exchange(native, nullptr);\n if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n}\n\nService::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\nService::~Service() { stop(); }\nbool Service::post(std::function<void()> work) const\n{\n const auto state = m_state.load();\n return state && state->post([work = std::move(work)](State::Native&) { work(); });\n}\n\nstd::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n{\n const auto maximum = std::chrono::seconds{30};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · f95b6a8f7cc5..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | The settings extraction presents a superseded admission contractqml/models/settingseditormodel.cpp | unclear | AssessmentThe finding asks for a commit-sequencing change (squashing implementation, header, and test into the introducing commit). The supplied diff shows new-head code changes but does not establish the commit sequence, so it cannot confirm that the requested sequencing change occurred. path_diff: qml/models/settingseditormodel.cpp; new_source: qml/models/settingseditormodel.cpp [
{
"evidence_id": "65f9a625ab6f4035901c1fee4e503317",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "b47ab4fadf9579a377bcd82f5140d98da0819f7a",
"path": "qml/models/settingseditormodel.cpp",
"source_generation": 6,
"source_job_id": 2827,
"text": "diff --git a/qml/models/settingseditormodel.cpp b/qml/models/settingseditormodel.cpp\nindex b11e013365..c4a88fc816 100644\n--- a/qml/models/settingseditormodel.cpp\n+++ b/qml/models/settingseditormodel.cpp\n@@ -2,8 +2,8 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/models/settingseditormodel.h>\n+#include <qml/execution.h>\n #include <qml/guipresentation.h>\n-#include <qml/retainedsnapshot.h>\n #include <QCoreApplication>\n #include <QPointer>\n #include <QUuid>\n@@ -13,7 +13,7 @@ namespace {\n using namespace effectivesettings;\n size_t Index(Key key){return static_cast<size_t>(key);}\n QString Source(Provenance value){switch(value){case Provenance::Default:return QStringLiteral(\"default\");case Provenance::Configuration:return QStringLiteral(\"bitcoin.conf\");case Provenance::Persistent:return QStringLiteral(\"settings.json\");case Provenance::CommandLine:return QStringLiteral(\"command line\");case Provenance::Startup:return QStringLiteral(\"startup\");}return {};}\n-QString Failure(){return QCoreApplication::translate(\"SettingsEditorModel\",\"The background operation could not complete. The original write will not be repeated.\");}\n+QString Failure(){return QCoreApplication::translate(\"SettingsEditorModel\",\"The action could not finish. It will not be repeated.\");}\n }\n struct SettingsEditorModel::Projection {\n settingsedit::Session session;\n@@ -27,12 +27,25 @@ struct SettingsEditorModel::Mailbox {\n std::shared_ptr<const Projection> latest;\n std::atomic_bool retired{false},drained{false},notice_pending{false};\n };\n-struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n- State(QString id,Ports ports,std::shared_ptr<Mailbox> mailbox,std::function<void()> notify):session({id.toStdString(),\"effective-settings\"},settingsedit::Reducer::Mask{}.set()),ports(std::move(ports)),scope(this->ports.execution.scheduler->openActionScope()),key(this->ports.execution.scheduler->allocateKey()),io(this->ports.execution.scheduler->allocateKey()),notify(std::move(notify)),mailbox(std::move(mailbox)){}\n+struct SettingsEditorModel::State : std::enable_shared_from_this<State> {\n+ struct Queues {\n+ Queues(execution::Executor& executor, execution::Lane lane)\n+ : core(executor.makeQueue(lane)), utility(executor.makeQueue(execution::Lane::Utility)) {}\n+ execution::SerialQueue core, utility;\n+ // A refused outcome dispatch falls back on Core. Serialize that\n+ // delivery with any new Utility input before touching the reducer.\n+ std::recursive_mutex reducer;\n+ };\n+\n+ State(QString id, Ports ports, std::shared_ptr<Mailbox> mailbox, std::function<void()> notify,\n+ std::shared_ptr<Queues> worker_queues)\n+ : session({id.toStdString(), \"effective-settings\"}, settingsedit::Reducer::Mask{}.set()),\n+ ports(std::move(ports)), queues(std::move(worker_queues)),\n+ notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n+\n settingsedit::Session session;\n const Ports ports;\n- std::shared_ptr<execution::Scheduler> scope;\n- const execution::ResourceKey key,io;\n+ const std::shared_ptr<Queues> queues;\n const std::function<void()> notify;\n std::array<Value,settingsedit::FIELDS> running{};\n std::array<uint64_t,settingsedit::FIELDS> inputs{};\n@@ -43,8 +56,66 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n std::optional<effectivesettings::Result> receipt;\n const std::shared_ptr<Mailbox> mailbox;\n uint64_t finished_save{0},rejection{0};\n- ~State(){mailbox->drained.store(true);if(ports.retired)ports.retired();notify();}\n- execution::Admission post(const std::shared_ptr<execution::Scheduler>& target,std::function<void(State&)> command,std::function<void(std::exception_ptr)> failed={},size_t bytes=SettingsEditorModel::COMMAND_BYTES){if(!target)return {{},execution::Rejection::Closed};const auto self=shared_from_this();return execution::Submit(*target,[self,command=std::move(command)]{if(self->mailbox->retired.load())self->retire();command(*self);},[]{},std::move(failed),{execution::Lane::Domain,bytes,key,execution::WorkClass::Action});}\n+\n+ static void acknowledge(const std::shared_ptr<Mailbox>& mailbox,\n+ const std::function<void()>& retired,\n+ const std::function<void()>& notify)\n+ {\n+ mailbox->drained = true;\n+ if (retired) retired();\n+ notify();\n+ }\n+\n+ static void destroy(State* state)\n+ {\n+ const auto queues = state->queues;\n+ const auto retire = [state, queues] {\n+ const auto mailbox = state->mailbox;\n+ const auto retired = state->ports.retired;\n+ const auto notify = state->notify;\n+ delete state;\n+ // The last State reference accounts for the whole accepted save,\n+ // including its handoffs, even if the editor has been deleted.\n+ queues->core.close();\n+ queues->core.whenDrained([queues, mailbox, retired, notify] {\n+ queues->utility.close();\n+ queues->utility.whenDrained([mailbox, retired, notify] {\n+ acknowledge(mailbox, retired, notify);\n+ });\n+ });\n+ };\n+ if (!queues->utility.post(retire)) retire();\n+ }\n+\n+ template <typename Work, typename Done>\n+ bool submit(Work work, Done done,\n+ std::function<void(std::exception_ptr)> failed, execution::Lane lane)\n+ {\n+ auto task = execution::MakeTask(std::move(work), std::move(done), std::move(failed));\n+ if (lane == execution::Lane::Utility) {\n+ return queues->utility.post([queues = queues, task = std::move(task)] {\n+ std::lock_guard lock{queues->reducer};\n+ task->execute();\n+ task->deliver();\n+ });\n+ }\n+ return queues->core.post([queues = queues, task = std::move(task)]() mutable {\n+ task->execute();\n+ const auto deliver = [queues, task = std::move(task)] {\n+ std::lock_guard lock{queues->reducer};\n+ task->deliver();\n+ };\n+ if (!queues->utility.post(deliver)) deliver();\n+ });\n+ }\n+\n+ bool post(std::function<void(State&)> command, std::function<void(std::exception_ptr)> failed = {})\n+ {\n+ return submit([self = shared_from_this(), command = std::move(command)] {\n+ if (self->mailbox->retired.load()) self->retire();\n+ command(*self);\n+ }, [] {}, std::move(failed), execution::Lane::Utility);\n+ }\n QString restartSet()const {\n QString result;\n if(!initialized)return result;\n@@ -65,28 +136,26 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n if(self->mailbox->retired.load())self->retire();\n self->reading=false;if(!self->retired)self->observe(std::move(value));\n const bool again=std::exchange(self->read_pending,false);self->publish();\n- if(again&&!self->retired){if(!self->post(self->scope,[owner](State& state){state.read(owner);})&&owner)owner(false);}\n+ if(again&&!self->retired){if(!self->post([owner](State& state){state.read(owner);})&&owner)owner(false);}\n else if(owner)owner(true);\n };\n const auto rejected=[complete](std::exception_ptr){Snapshot failed;failed.error=Failure();complete(std::move(failed));};\n- if(!ports.read||!scope||!execution::Submit(*scope,ports.read,complete,rejected,{execution::Lane::Core,1024,io,execution::WorkClass::Observation})){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n+ if(!ports.read||!submit(ports.read,complete,rejected,execution::Lane::Core)){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n publish();\n }\n- void save(std::shared_ptr<execution::Scheduler> action,std::optional<uint64_t> token,std::function<void(bool)> owner){\n+ void save(std::optional<uint64_t> token,std::function<void(bool)> owner){\n if(retired||reading){publish();owner(false);return;}\n if(token&&!session.answerClose(*token,persistentedit::CloseChoice::Save)){publish();owner(false);return;}\n auto attempt=session.check();if(!attempt){publish();owner(false);return;}attempt->batch.accept_redownload=allow_redownload;\n redownload=false;const auto self=shared_from_this();publish();\n- const auto done=[self,action,attempt=*attempt,owner](Check checked){\n+ const auto done=[self,attempt=*attempt,owner](Check checked){\n if(self->mailbox->retired.load())self->retire();\n self->redownload=checked.validation.requires_redownload;\n self->redownload_attempt=self->redownload?std::make_optional(attempt):std::nullopt;\n if(!self->session.validated(attempt.attempt.token,checked.valid,checked.error,checked.validation.errors)){self->publish();owner(false);return;}\n self->publish();\n- // The review packet remains charged until this callback returns.\n- // Continue on the original admitted scope after its budget is freed;\n- // keep the immutable accepted attempt in State rather than copying\n- // it into another queued packet or waiting for GUI publication.\n+ // Keep the immutable accepted attempt in State. Continue after\n+ // the review callback returns, independently of GUI publication.\n const auto token=attempt.attempt.token;\n const bool redownload=attempt.batch.accept_redownload;\n const auto rejected=[self,token,owner](std::exception_ptr error){\n@@ -96,20 +165,20 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n if(error)try{std::rethrow_exception(error);}catch(const execution::NotStarted&){}catch(...){result.outcome=Outcome::Uncertain;}\n self->receipt=result;self->finish(accepted,std::move(result),false,owner);\n };\n- if(!self->post(action,[action,token,redownload,owner](State& state){state.write(action,token,redownload,owner);},rejected))rejected({});\n+ if(!self->post([token,redownload,owner](State& state){state.write(token,redownload,owner);},rejected))rejected({});\n };\n const auto failed=[done](std::exception_ptr){Check checked;checked.error=Failure();done(std::move(checked));};\n- if(!ports.review||!execution::Submit(*action,[review=ports.review,attempt=*attempt]{return review(attempt);},done,failed,{execution::Lane::Core,2*1024*1024,io,execution::WorkClass::Action})){Check checked;checked.error=Failure();done(std::move(checked));}\n+ if(!ports.review||!submit([review=ports.review,attempt=*attempt]{return review(attempt);},done,failed,execution::Lane::Core)){Check checked;checked.error=Failure();done(std::move(checked));}\n }\n- void write(const std::shared_ptr<execution::Scheduler>& action,uint64_t token,bool redownload,std::function<void(bool)> owner){\n+ void write(uint64_t token,bool redownload,std::function<void(bool)> owner){\n if(!session.active()||session.active()->attempt.token!=token){publish();owner(false);return;}\n auto accepted=*session.active();accepted.batch.accept_redownload=redownload;\n const auto self=shared_from_this();\n- const auto written=[self,accepted,action,owner](Result value){(void)action;self->receipt=value;self->finish(accepted,std::move(value),false,owner);};\n+ const auto written=[self,accepted,owner](Result value){self->receipt=value;self->finish(accepted,std::move(value),false,owner);};\n const auto failed=[written](std::exception_ptr error){Result result;result.outcome=Outcome::Uncertain;result.error=Failure();\n try{std::rethrow_exception(error);}catch(const execution::NotStarted&){result.outcome=Outcome::Rejected;}catch(...){}\n written(std::move(result));};\n- if(!ports.write||!execution::Submit(*action,[write=ports.write,accepted]{return write(accepted);},written,failed,{execution::Lane::Core,2*1024*1024,io,execution::WorkClass::Action})){Result result;result.outcome=Outcome::Rejected;result.error=Failure();written(std::move(result));}\n+ if(!ports.write||!submit([write=ports.write,accepted]{return write(accepted);},written,failed,execution::Lane::Core)){Result result;result.outcome=Outcome::Rejected;result.error=Failure();written(std::move(result));}\n }\n void finish(const settingsedit::Save& attempt,Result result,bool query,std::function<void(bool)> owner={}){\n if(mailbox->retired.load())retire();\n@@ -121,26 +190,56 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n publish();\n }\n void reconcile(){if(!receipt||!session.active()||session.editor().phase()!=persistentedit::Phase::Uncertain){publish();return;}const auto original=*session.active();auto value=*receipt;value.snapshot={};finish(original,std::move(value),true);}\n- void retire(){if(std::exchange(retired,true))return;read_pending=false;session.retire();scope.reset();publish();}\n+ void retire(){if(std::exchange(retired,true))return;read_pending=false;session.retire();publish();}\n \n };\n-SettingsEditorModel::SettingsEditorModel(Ports ports,QObject* parent):QObject(parent),m_id(QUuid::createUuid().toString(QUuid::WithoutBraces)),m_execution(ports.execution){\n- Q_ASSERT(m_execution.scheduler);m_execution.post=presentation::ReliablePost(std::move(m_execution.post));ports.execution=m_execution;\n- for(size_t i=0;i<m_entries.size();++i)m_entries[i]=new SettingsEntryModel(static_cast<Key>(i),*this);\n- m_mailbox=std::make_shared<Mailbox>();const auto original_retired=ports.retired;\n+SettingsEditorModel::SettingsEditorModel(Ports ports, QObject* parent)\n+ : QObject(parent), m_id(QUuid::createUuid().toString(QUuid::WithoutBraces)), m_post(presentation::ReliablePost(std::move(ports.post)))\n+{\n+ for (size_t i = 0; i < m_entries.size(); ++i) m_entries[i] = new SettingsEntryModel(static_cast<Key>(i), *this);\n+ m_mailbox = std::make_shared<Mailbox>();\n+ const auto original_retired = ports.retired;\n const QPointer<SettingsEditorModel> observer{this};\n- m_owner=execution::RetainSnapshot<std::shared_ptr<State>>(m_execution.scheduler,[id=m_id,ports=std::move(ports),mailbox=m_mailbox,observer,post=m_execution.post]()mutable{return std::make_unique<std::shared_ptr<State>>(std::make_shared<State>(id,std::move(ports),mailbox,[mailbox,observer,post]{\n- if(mailbox->notice_pending.exchange(true))return;\n- try{post([mailbox,observer]{mailbox->notice_pending.store(false);if(observer)observer->publish();});}catch(...){mailbox->notice_pending.store(false);throw;}\n- }));});\n- if(m_owner){m_state=*m_owner;m_retire_scope=(*m_owner)->scope;refresh();}\n- else{m_immediate_error=tr(\"The settings editor could not reserve cleanup.\");m_retired=true;m_mailbox->drained.store(true);if(original_retired)original_retired();m_execution.post([observer]{if(observer)observer->publish();});}\n+ const auto notify = [mailbox = m_mailbox, observer, post = m_post] {\n+ if (mailbox->notice_pending.exchange(true)) return;\n+ try {\n+ post([mailbox, observer] {\n+ mailbox->notice_pending = false;\n+ if (observer) observer->publish();\n+ });\n+ } catch (...) {\n+ mailbox->notice_pending = false;\n+ throw;\n+ }\n+ };\n+ if (ports.executor) {\n+ const auto queues = std::make_shared<State::Queues>(*ports.executor, ports.lane);\n+ m_owner = std::shared_ptr<State>{new State{m_id, std::move(ports), m_mailbox, notify, queues}, State::destroy};\n+ m_state = m_owner;\n+ refresh();\n+ } else {\n+ m_immediate_error = tr(\"The settings editor could not open. Try again.\");\n+ m_retired = true;\n+ m_mailbox->drained = true;\n+ if (original_retired) original_retired();\n+ m_post([observer] { if (observer) observer->publish(); });\n+ }\n }\n SettingsEditorModel::~SettingsEditorModel(){retire();}\n-bool SettingsEditorModel::command(std::function<void(State&)> callback,const QString& name,size_t bytes){\n- bool admitted{false};{const auto state=m_state.lock();admitted=!m_retired&&state&&bool(state->post(m_execution.scheduler,std::move(callback),{},bytes));}\n- if(admitted){m_immediate_error={};return true;}\n- m_immediate_error=tr(\"This settings command could not be admitted.\");const QPointer<SettingsEditorModel> guard{this};Q_EMIT changed();if(guard)Q_EMIT commandRejected(name,m_immediate_error);return false;\n+bool SettingsEditorModel::command(std::function<void(State&)> callback, const QString& name)\n+{\n+ const QPointer<SettingsEditorModel> observer{this};\n+ bool admitted{false};\n+ {\n+ const auto state = m_state.lock();\n+ admitted = !m_retired && state && state->post(std::move(callback));\n+ }\n+ if (!observer) return admitted;\n+ if (admitted) { m_immediate_error = {}; return true; }\n+ m_immediate_error = tr(\"This settings change could not start. Try again.\");\n+ Q_EMIT changed();\n+ if (observer) Q_EMIT commandRejected(name, m_immediate_error);\n+ return false;\n }\n void SettingsEditorModel::publish(){\n std::shared_ptr<const Projection> value;{std::lock_guard lock{m_mailbox->mutex};value=m_mailbox->latest;}\n@@ -149,8 +248,16 @@ void SettingsEditorModel::publish(){\n if(m_projection&&m_pending_save&&m_projection->finished_save>=m_pending_save){m_pending_save=0;m_immediate_error={};}\n const bool rejected=m_projection&&m_projection->rejection>m_seen_rejection;if(rejected)m_seen_rejection=m_projection->rejection;\n const bool drained=m_retired&&m_mailbox->drained.load()&&!m_drained;if(drained)m_drained=true;\n+ if(closeQuestion()){\n+ const auto token=closeToken();\n+ if(!m_prompt||m_prompt->token()!=token){\n+ if(m_prompt)m_prompt->deleteLater();\n+ m_prompt=new TextEditClosePrompt(token,this);\n+ connect(m_prompt,&TextEditClosePrompt::answered,this,[this](const QString& token,TextEditClosePrompt::Choice choice){answerClose(token,static_cast<CloseChoice>(choice));});\n+ }\n+ }else if(m_prompt){m_prompt->deleteLater();m_prompt=nullptr;}\n const QPointer<SettingsEditorModel> guard{this};for(auto* entry:m_entries){Q_EMIT entry->changed();if(!guard)return;}Q_EMIT changed();if(!guard)return;\n- if(rejected){Q_EMIT commandRejected(QStringLiteral(\"save\"),tr(\"This settings save did not start. The original draft and any earlier receipt are retained.\"));if(!guard)return;}\n+ if(rejected){Q_EMIT commandRejected(QStringLiteral(\"save\"),tr(\"The settings were not saved. Your edits are kept.\"));if(!guard)return;}\n if(!m_closed_emitted&&phase()==Closed){m_closed_emitted=true;Q_EMIT closed();if(!guard)return;}\n if(drained)Q_EMIT shutdownFinished();\n }\n@@ -172,7 +279,6 @@ SettingsSaveResult SettingsEditorModel::saveResult()const{\n return result;\n }\n QString SettingsEditorModel::lastSaveId()const{return QString::number(m_projection?m_projection->session.result().token:0);}\n-QString SettingsEditorModel::redownloadToken()const{return QString::number(m_projection?m_projection->redownload_token:0);}\n QString SettingsEditorModel::closeToken()const{return QString::number(m_projection?m_projection->session.editor().closeToken():0);}\n bool SettingsEditorModel::closeQuestion()const{return m_projection&&m_projection->session.editor().closeQuestion();}\n bool SettingsEditorModel::lastSavePresent()const{return m_projection&&m_projection->session.result().present;}\n@@ -185,14 +291,35 @@ bool SettingsEditorModel::redownloadWarning()const{return m_projection&&m_projec\n SettingsEntryModel* SettingsEditorModel::entry(const QString& key)const{for(auto* item:m_entries)if(ite\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 166,
"evidence_id": "42351ecca94c4b10b855a086990d82d8",
"finding_id": "finding:6",
"kind": "new_source",
"line": 17,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "b47ab4fadf9579a377bcd82f5140d98da0819f7a",
"path": "qml/models/settingseditormodel.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 6,
"source_job_id": 2827,
"text": "}\nstruct SettingsEditorModel::Projection {\n settingsedit::Session session;\n std::array<Value,settingsedit::FIELDS> running;\n std::array<uint64_t,settingsedit::FIELDS> inputs;\n bool reading{false},restart{false},notice{false},redownload{false};\n uint64_t redownload_token{0},finished_save{0},rejection{0};\n};\nstruct SettingsEditorModel::Mailbox {\n std::mutex mutex;\n std::shared_ptr<const Projection> latest;\n std::atomic_bool retired{false},drained{false},notice_pending{false};\n};\nstruct SettingsEditorModel::State : std::enable_shared_from_this<State> {\n struct Queues {\n Queues(execution::Executor& executor, execution::Lane lane)\n : core(executor.makeQueue(lane)), utility(executor.makeQueue(execution::Lane::Utility)) {}\n execution::SerialQueue core, utility;\n // A refused outcome dispatch falls back on Core. Serialize that\n // delivery with any new Utility input before touching the reducer.\n std::recursive_mutex reducer;\n };\n\n State(QString id, Ports ports, std::shared_ptr<Mailbox> mailbox, std::function<void()> notify,\n std::shared_ptr<Queues> worker_queues)\n : session({id.toStdString(), \"effective-settings\"}, settingsedit::Reducer::Mask{}.set()),\n ports(std::move(ports)), queues(std::move(worker_queues)),\n notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n\n settingsedit::Session session;\n const Ports ports;\n const std::shared_ptr<Queues> queues;\n const std::function<void()> notify;\n std::array<Value,settingsedit::FIELDS> running{};\n std::array<uint64_t,settingsedit::FIELDS> inputs{};\n bool initialized{false},reading{false},read_pending{false},retired{false},redownload{false},allow_redownload{false};\n QString pending_restart,acknowledged_restart;\n std::optional<settingsedit::Save> redownload_attempt;\n uint64_t read_token{0};\n std::optional<effectivesettings::Result> receipt;\n const std::shared_ptr<Mailbox> mailbox;\n uint64_t finished_save{0},rejection{0};\n\n static void acknowledge(const std::shared_ptr<Mailbox>& mailbox,\n const std::function<void()>& retired,\n const std::function<void()>& notify)\n {\n mailbox->drained = true;\n if (retired) retired();\n notify();\n }\n\n static void destroy(State* state)\n {\n const auto queues = state->queues;\n const auto retire = [state, queues] {\n const auto mailbox = state->mailbox;\n const auto retired = state->ports.retired;\n const auto notify = state->notify;\n delete state;\n // The last State reference accounts for the whole accepted save,\n // including its handoffs, even if the editor has been deleted.\n queues->core.close();\n queues->core.whenDrained([queues, mailbox, retired, notify] {\n queues->utility.close();\n queues->utility.whenDrained([mailbox, retired, notify] {\n acknowledge(mailbox, retired, notify);\n });\n });\n };\n if (!queues->utility.post(retire)) retire();\n }\n\n template <typename Work, typename Done>\n bool submit(Work work, Done done,\n std::function<void(std::exception_ptr)> failed, execution::Lane lane)\n {\n auto task = execution::MakeTask(std::move(work), std::move(done), std::move(failed));\n if (lane == execution::Lane::Utility) {\n return queues->utility.post([queues = queues, task = std::move(task)] {\n std::lock_guard lock{queues->reducer};\n task->execute();\n task->deliver();\n });\n }\n return queues->core.post([queues = queues, task = std::move(task)]() mutable {\n task->execute();\n const auto deliver = [queues, task = std::move(task)] {\n std::lock_guard lock{queues->reducer};\n task->deliver();\n };\n if (!queues->utility.post(deliver)) deliver();\n });\n }\n\n bool post(std::function<void(State&)> command, std::function<void(std::exception_ptr)> failed = {})\n {\n return submit([self = shared_from_this(), command = std::move(command)] {\n if (self->mailbox->retired.load()) self->retire();\n command(*self);\n }, [] {}, std::move(failed), execution::Lane::Utility);\n }\n QString restartSet()const {\n QString result;\n if(!initialized)return result;\n for(const auto& field:session.snapshot().fields)if(field.applicability==Applicability::Restart&&field.next_start!=running[Index(field.key)])result+=Name(field.key)+QLatin1Char('=')+settingsedit::Session::Format(field.next_start)+QLatin1Char('\\n');\n return result;\n }\n void publish(){const auto changes=restartSet();if(changes!=pending_restart){pending_restart=changes;acknowledged_restart={};}auto value=std::make_shared<const Projection>(Projection{session,running,inputs,reading,!changes.isEmpty(),!changes.isEmpty()&&acknowledged_restart!=changes,redownload,redownload_attempt?redownload_attempt->attempt.token:0,finished_save,rejection});{std::lock_guard lock{mailbox->mutex};mailbox->latest=std::move(value);}notify();}\n void observe(Snapshot value){if(!initialized&&value.ready){for(const auto& field:value.fields)if(Index(field.key)<settingsedit::FIELDS)running[Index(field.key)]=field.effective;initialized=true;}session.observe(std::move(value));}\n void read(std::function<void(bool)> owner={}){\n const auto finished=[&owner](bool result){if(owner)owner(result);};\n if(retired){finished(false);return;}\n const auto phase=session.editor().phase();\n if(reading||phase==persistentedit::Phase::Checking||phase==persistentedit::Phase::Saving){read_pending=true;finished(false);return;}\n if(phase==persistentedit::Phase::Uncertain||phase==persistentedit::Phase::Closed||read_token==UINT64_MAX){finished(false);return;}\n reading=true;read_pending=false;const auto token=++read_token;const auto self=shared_from_this();\n const auto complete=[self,token,owner](Snapshot value){\n if(token!=self->read_token){if(owner)owner(false);return;}\n if(self->mailbox->retired.load())self->retire();\n self->reading=false;if(!self->retired)self->observe(std::move(value));\n const bool again=std::exchange(self->read_pending,false);self->publish();\n if(again&&!self->retired){if(!self->post([owner](State& state){state.read(owner);})&&owner)owner(false);}\n else if(owner)owner(true);\n };\n const auto rejected=[complete](std::exception_ptr){Snapshot failed;failed.error=Failure();complete(std::move(failed));};\n if(!ports.read||!submit(ports.read,complete,rejected,execution::Lane::Core)){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n publish();\n }\n void save(std::optional<uint64_t> token,std::function<void(bool)> owner){\n if(retired||reading){publish();owner(false);return;}\n if(token&&!session.answerClose(*token,persistentedit::CloseChoice::Save)){publish();owner(false);return;}\n auto attempt=session.check();if(!attempt){publish();owner(false);return;}attempt->batch.accept_redownload=allow_redownload;\n redownload=false;const auto self=shared_from_this();publish();\n const auto done=[self,attempt=*attempt,owner](Check checked){\n if(self->mailbox->retired.load())self->retire();\n self->redownload=checked.validation.requires_redownload;\n self->redownload_attempt=self->redownload?std::make_optional(attempt):std::nullopt;\n if(!self->session.validated(attempt.attempt.token,checked.valid,checked.error,checked.validation.errors)){self->publish();owner(false);return;}\n self->publish();\n // Keep the immutable accepted attempt in State. Continue after\n // the review callback returns, independently of GUI publication.\n const auto token=attempt.attempt.token;\n const bool redownload=attempt.batch.accept_redownload;\n const auto rejected=[self,token,owner](std::exception_ptr error){\n if(!self->session.active()||self->session.active()->attempt.token!=token)return;\n const auto accepted=*self->session.active();\n Result result;result.outcome=Outcome::Rejected;result.error=Failure();\n if(error)try{std::rethrow_exception(error);}catch(const execution::NotStarted&){}catch(...){result.outcome=Outcome::Uncertain;}\n self->receipt=result;self->finish(accepted,std::move(result),false,owner);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b47ab4fadf95..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The commit inventory omits the trailing partial #1088 workaroundqml/walletreservations.cpp | unclear | AssessmentThe supplied diff is unrelated to the requested inventory and issue-status documentation change. It does not establish whether the description or issue attribution was refreshed. path_diff: qml/walletreservations.cpp [
{
"evidence_id": "d9f7e2cc4a1b4fe780755e6a8ba1068f",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "b47ab4fadf9579a377bcd82f5140d98da0819f7a",
"path": "qml/walletreservations.cpp",
"source_generation": 6,
"source_job_id": 2827,
"text": "diff --git a/qml/walletreservations.cpp b/qml/walletreservations.cpp\nindex 3181264e18..069e3c95b4 100644\n--- a/qml/walletreservations.cpp\n+++ b/qml/walletreservations.cpp\n@@ -383,7 +383,7 @@ void Store::allocateAddress(const std::shared_ptr<AddressWork>& work, bool reuse\n self->addressReady(work, std::move(address), saved ? Error::None : Error::ReservationPersistence);\n }, [self, work, address](std::exception_ptr error) { self->addressReady(work, address, TransportError(error)); });\n if (!admitted) self->addressReady(work, std::move(address), Error::Rejected);\n- }, [self, work, secret](std::exception_ptr error) { clearSecret(secret); self->addressReady(work, {}, TransportError(error)); }, work->queued.bytes);\n+ }, [self, work, secret](std::exception_ptr error) { clearSecret(secret); self->addressReady(work, {}, TransportError(error)); });\n if (!admitted) { clearSecret(secret); addressReady(work, {}, Error::Rejected); }\n }\n \n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b47ab4fadf95..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The signer-substitution commit adds a helper but no production enforcementqml/models/signertransaction.cpp | unclear | AssessmentThis finding concerns commit titles and cross-references. The supplied helper source is unchanged, and no commit-message evidence shows whether the requested attribution was updated. new_source: qml/models/signertransaction.cpp [
{
"bounded": true,
"end_line": 16,
"evidence_id": "85709d8940934ad1a34d93a650a7bc83",
"finding_id": "finding:4",
"kind": "new_source",
"line": 1,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "b47ab4fadf9579a377bcd82f5140d98da0819f7a",
"path": "qml/models/signertransaction.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 6,
"source_job_id": 2827,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include <qml/models/signertransaction.h>\n\n#include <algorithm>\n\nbool MatchesUnsignedTransaction(const CMutableTransaction& approved, const CMutableTransaction& received)\n{\n if (approved.version != received.version || approved.nLockTime != received.nLockTime ||\n approved.vout != received.vout || approved.vin.size() != received.vin.size()) return false;\n return std::equal(approved.vin.begin(), approved.vin.end(), received.vin.begin(), [](const CTxIn& expected, const CTxIn& actual) {\n return expected.prevout == actual.prevout && expected.nSequence == actual.nSequence;\n });\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b47ab4fadf95..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Backup and PSBT export confirmations have no height limit or scrollingqml/components/WalletBackupConfirmation.qml | unclear | AssessmentThe confirmation component is deleted, but the supplied diff does not show the replacement confirmation UI or establish whether both backup and PSBT-export dialogs now cap and scroll their content. path_diff: qml/components/WalletBackupConfirmation.qml [
{
"evidence_id": "7c18b613a27642d28e0026285c56b59b",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "b47ab4fadf9579a377bcd82f5140d98da0819f7a",
"path": "qml/components/WalletBackupConfirmation.qml",
"source_generation": 6,
"source_job_id": 2827,
"text": "diff --git a/qml/components/WalletBackupConfirmation.qml b/qml/components/WalletBackupConfirmation.qml\ndeleted file mode 100644\nindex f2e1c72f62..0000000000\n--- a/qml/components/WalletBackupConfirmation.qml\n+++ /dev/null\n@@ -1,78 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"walletBackupOverwritePopup\"\n- required property BackupFileOperation operation\n- readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n- parent: Overlay.overlay\n- width: parent ? Math.min(600, parent.width - 40) : 600\n- implicitHeight: content.implicitHeight + topPadding + bottomPadding\n- x: parent ? Math.round((parent.width - width) / 2) : 0\n- y: parent ? Math.round((parent.height - height) / 2) : 0\n- padding: 24\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.NoAutoClose\n- onOpened: content.forceActiveFocus()\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 10\n- border.color: Theme.color.neutral2\n- }\n- contentItem: ColumnLayout {\n- id: content\n- focus: true\n- spacing: 16\n- Keys.priority: Keys.BeforeItem\n- Keys.onEscapePressed: function(event) {\n- root.operation.refuse()\n- event.accepted = true\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.title\n- font: Theme.text.subtitle.font\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.replacing\n- ? qsTr(\"An existing file will be replaced at this final destination:\")\n- : qsTr(\"Save the backup at this final destination:\")\n- wrap: true\n- }\n- CoreText {\n- objectName: \"walletBackupFinalPathText\"\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.finalPath\n- wrapMode: Text.WrapAnywhere\n- }\n- RowLayout {\n- spacing: 12\n- NeutralButton {\n- objectName: \"walletBackupOverwriteRejectButton\"\n- text: qsTr(\"Cancel\")\n- onClicked: root.operation.refuse()\n- }\n- NeutralButton {\n- objectName: \"walletBackupOverwriteApproveButton\"\n- text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n- onClicked: root.operation.approve()\n- }\n- }\n- }\n-}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b47ab4fadf95..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1144 | Pruning recovery advice refers to a hidden date choiceqml/walletqmlcontroller.cpp | addressed | AssessmentThe preflight now distinguishes unavailable blocks for fixed descriptor timestamps from unavailable blocks for the chosen date. It gives fixed-date imports advice to use a node retaining those blocks, and reserves the later-date recommendation for the chosen-date case; the supplied test covers the dated-input message. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "d1a82573954d4a469360954baa07f177",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 23dab27ab4..452a87cf64 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -14,10 +14,14 @@\n #include <common/settings.h>\n #include <interfaces/chain.h>\n #include <interfaces/node.h>\n+#include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n #include <univalue.h>\n+#include <util/fs.h>\n #include <util/result.h>\n+#include <wallet/context.h>\n #include <wallet/imports.h>\n+#include <wallet/scan.h>\n #include <wallet/walletutil.h>\n #include <wallet/wallet.h>\n #include <util/translation.h>\n@@ -25,15 +29,21 @@\n \n #include <algorithm>\n #include <atomic>\n+#include <memory>\n #include <mutex>\n #include <optional>\n #include <stdexcept>\n+#include <system_error>\n #include <utility>\n+#include <vector>\n \n+#include <QByteArray>\n+#include <QDateTime>\n #include <QDir>\n #include <QDesktopServices>\n #include <QFileInfo>\n #include <QMetaObject>\n+#include <QPointer>\n #include <QRegularExpression>\n #include <QSettings>\n #include <QStringList>\n@@ -81,22 +91,79 @@ bool ErrorContains(const QString& error, const QString& needle)\n }\n \n // The import rescans from the oldest timestamp, which a pruned node may no longer have.\n-bool ScanBlocksPruned(interfaces::Wallet& wallet, const std::vector<wallet::ImportDescriptorRequest>& requests)\n+bool ScanBlocksPruned(interfaces::Chain& chain, std::optional<int64_t> oldest)\n {\n- wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (!raw_wallet) return false;\n- interfaces::Chain& chain{raw_wallet->chain()};\n if (!chain.havePruned()) return false;\n- std::optional<int64_t> oldest;\n- for (const auto& request : requests) {\n- if (request.timestamp) oldest = std::min(oldest.value_or(*request.timestamp), *request.timestamp);\n- }\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n }\n- const uint256 tip{WITH_LOCK(raw_wallet->cs_wallet, return raw_wallet->GetLastBlockHash())};\n- return !chain.hasBlocks(tip, height);\n+ const std::optional<int> prune_height{chain.getPruneHeight()};\n+ return prune_height && height <= *prune_height;\n+}\n+\n+// remove() only unloads the wallet. Its files are deleted too, so the name can be used again.\n+void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<interfaces::Wallet> wallet)\n+{\n+ const std::string name{wallet->getWalletName()};\n+ wallet::WalletContext* context{loader.context()};\n+ std::shared_ptr<wallet::CWallet> shared{context ? wallet::GetWallet(*context, name) : nullptr};\n+ wallet->remove();\n+ wallet.reset();\n+ if (!shared) return;\n+ std::vector<fs::path> paths{shared->GetDatabase().Files()};\n+ if (!name.empty() && !paths.empty()) paths.push_back(paths.front().parent_path());\n+ // The database closes once the last reference is gone.\n+ wallet::WaitForDeleteWallet(std::move(shared));\n+ std::error_code error;\n+ // A directory is only removed when empty.\n+ for (const fs::path& path : paths) fs::remove(path, error);\n+}\n+\n+// A view-only import saves its descriptors before it rescans. The wallet's\n+// best block is already the tip then, so after a crash it would load without\n+// the older transactions. This records where the rescan starts until it ends.\n+QString PendingImportKey(const std::string& wallet_name)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+{\n+ QSettings settings;\n+ if (time) {\n+ settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n+ } else {\n+ settings.remove(PendingImportKey(wallet_name));\n+ }\n+ settings.sync();\n+}\n+\n+std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+{\n+ const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n+ return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+}\n+\n+bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+{\n+ wallet::WalletContext* context{node.walletLoader().context()};\n+ const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n+ if (!wallet) return false;\n+ wallet::WalletRescanReserver reserver{*wallet};\n+ if (!reserver.reserve()) return false;\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ int start_height{0};\n+ uint256 start_block;\n+ bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))};\n+ if (!done) {\n+ // Progress is saved, so a later load continues from where this stopped too.\n+ done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n+ wallet::ScanResult::SUCCESS;\n+ }\n+ control.detach();\n+ return done;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -106,6 +173,33 @@ QString ImportErrorText(const wallet::ImportError& error)\n }\n } // namespace\n \n+bool RescanControl::attach(std::function<void()> abort)\n+{\n+ const std::lock_guard lock{m_mutex};\n+ if (m_cancelled) return false;\n+ m_abort = std::move(abort);\n+ return true;\n+}\n+\n+void RescanControl::detach()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_abort = nullptr;\n+}\n+\n+void RescanControl::cancel()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_cancelled = true;\n+ if (m_abort) m_abort();\n+}\n+\n+bool RescanControl::cancelled() const\n+{\n+ const std::lock_guard lock{m_mutex};\n+ return m_cancelled;\n+}\n+\n WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n@@ -120,6 +214,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n+ return ResumeImport(node, wallet_name, time, control);\n+ })\n {\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n@@ -372,6 +469,8 @@ void WalletQmlController::beginShutdown()\n const auto wallets = m_wallets;\n for (auto* wallet : wallets) removeWalletModel(wallet);\n retireWallet(m_empty_wallet, false);\n+ for (const auto& [name, control] : m_import_rescans) control->cancel();\n+ if (m_import_rescan_executor) m_import_rescan_executor->shutdown();\n m_notification_cleanup_executor = std::make_unique<BackendExecutor>();\n m_notification_cleanup_executor->setObjectName(QStringLiteral(\"wallet-notifications\"));\n connect(m_notification_cleanup_executor.get(), &BackendExecutor::drained, this, [this] {\n@@ -407,7 +506,8 @@ void WalletQmlController::retireWallet(WalletQmlModel* model, bool remove)\n \n void WalletQmlController::checkShutdownFinished()\n {\n- if (m_shutting_down && m_controller_drained && m_notifications_drained && m_retiring_wallets.empty() && !m_shutdown_complete) {\n+ if (m_shutting_down && m_controller_drained && m_notifications_drained && m_import_rescans_drained &&\n+ m_retiring_wallets.empty() && !m_shutdown_complete) {\n m_shutdown_complete = true;\n Q_EMIT walletsDrained();\n }\n@@ -418,6 +518,32 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n connect(wallet_model, &WalletQmlModel::walletUnloaded, this, [this, wallet_model]() {\n removeWalletModel(wallet_model);\n }, Qt::QueuedConnection);\n+ resumeInterruptedImport(wallet_model);\n+}\n+\n+void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n+{\n+ const QString name{wallet_model->name()};\n+ const std::optional<int64_t> time{PendingImport(name.toStdString())};\n+ if (!time) return;\n+ if (!m_import_rescan_executor) {\n+ m_import_rescan_executor = std::make_unique<BackendExecutor>();\n+ m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n+ m_import_rescans_drained = false;\n+ connect(m_import_rescan_executor.get(), &BackendExecutor::drained, this, [this] {\n+ m_import_rescans_drained = true;\n+ checkShutdownFinished();\n+ });\n+ }\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_rescans[name] = control;\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n+ // Stays pending when the rescan stops early, so the next load tries again.\n+ if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n+ }, [this, name, control] {\n+ const auto it{m_import_rescans.find(name)};\n+ if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ });\n }\n \n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n@@ -457,6 +583,7 @@ void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool r\n WalletListModel::LoadState::Closed,\n QString{});\n setWalletLoaded(next_selected_wallet != nullptr);\n+ if (const auto it{m_import_rescans.find(wallet_name)}; it != m_import_rescans.end()) it->second->cancel();\n retireWallet(wallet_model, remove);\n }\n \n@@ -524,7 +651,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n uint64_t wallet_creation_flags,\n WalletLoadAction load_action,\n bool report_create_error,\n- WalletSetupFn setup_wallet)\n+ WalletSetupFn setup_wallet,\n+ WalletCheckFn check_before_create)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -533,8 +661,13 @@ void WalletQmlController::createWalletAsync(const QString& name,\n setWalletLoadInProgress(true);\n \n m_wallet_command_executor->submit(this, [node = &m_node, wallet_name, passphrase = std::move(passphrase),\n- wallet_creation_flags, setup_wallet = std::move(setup_wallet)]() mutable {\n+ wallet_creation_flags, setup_wallet = std::move(setup_wallet),\n+ check_before_create = std::move(check_before_create)]() mutable {\n WalletCommandResult out;\n+ if (check_before_create && !(out.error = check_before_create()).isEmpty()) {\n+ QmlUtil::ClearSecureString(passphrase);\n+ return out;\n+ }\n std::vector<bilingual_str> warnings;\n auto wallet = node->walletLoader().createWallet(wallet_name.toStdString(), passphrase, wallet_creation_flags, warnings);\n QmlUtil::ClearSecureString(passphrase);\n@@ -544,7 +677,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- (*wallet)->remove();\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -684,19 +818,61 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n+ // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n+ std::optional<int64_t> oldest_dated;\n+ for (size_t i = 0; i < input.requests.size(); ++i) {\n+ const std::optional<int64_t>& time{input.requests[i].timestamp};\n+ if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n+ }\n+ const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n+ // An unset timestamp means now.\n+ int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n+ for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n+ std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_control = control;\n+ setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [requests = std::move(input.requests)](interfaces::Wallet& wallet) mutable {\n- if (ScanBlocksPruned(wallet, requests)) {\n- return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n+ if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ SetPendingImport(wallet.getWalletName(), rescan_from);\n+ std::vector<wallet::ImportResult> results;\n+ {\n+ const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // Starting a rescan clears an earlier abort.\n+ if (control->cancelled()) wallet.abortRescan();\n+ QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n+ if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ })};\n+ // Imports the descriptors, then rescans from the oldest timestamp.\n+ results = wallet.importDescriptors(requests);\n }\n- // Imports the descriptors, then rescans from the oldest timestamp.\n- for (const wallet::ImportResult& result : wallet.importDescriptors(requests)) {\n+ control->detach();\n+ if (control->cancelled()) return cancelled;\n+ // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n+ if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n+ for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n+ SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ return QString{};\n+ }, [node = &m_node, oldest_dated, chosen_date] {\n+ // Checked before the wallet file exists, so another date can be tried with the same name.\n+ wallet::WalletContext* context{node->walletLoader().context()};\n+ if (!context || !context->chain) return QString{};\n+ if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n+ }\n+ if (ScanBlocksPruned(*context->chain, chosen_date)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ }\n return QString{};\n });\n }\n@@ -742,6 +918,18 @@ QVariantMap WalletQmlController::describeViewOnlyImport(const QString& import_te\n return DescribeViewOnlyImport(import_text, address_type);\n }\n \n+void WalletQmlController::cancelViewOnlyImport()\n+{\n+ if (m_import_control) m_import_control->cancel();\n+}\n+\n+void WalletQmlController::setImportProgress(int progress)\n+{\n+ if (m_import_progress == progress) return;\n+ m_import_progress = progress;\n+ Q_EMIT importProgressChanged();\n+}\n+\n void WalletQmlController::requestOpenWalletSettings(WalletQmlModel* wallet)\n {\n if (!wallet) return;\n@@ -1412,3 +1600,8 @@ void WalletQmlController::setOpenLocalPathFnForTesting(OpenLocalPathFn fn)\n {\n m_open_local_path_fn = std::move(fn);\n }\n+\n+void WalletQmlController::setResumeImportFnForTesting(ResumeImportFn fn)\n+{\n+ m_resume_import_fn = std::move(fn);\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 813,
"evidence_id": "0a2afdfe365844e3bed59ece2cb99d75",
"finding_id": "finding:9",
"kind": "new_source",
"line": 664,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/walletqmlcontroller.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " wallet_creation_flags, setup_wallet = std::move(setup_wallet),\n check_before_create = std::move(check_before_create)]() mutable {\n WalletCommandResult out;\n if (check_before_create && !(out.error = check_before_create()).isEmpty()) {\n QmlUtil::ClearSecureString(passphrase);\n return out;\n }\n std::vector<bilingual_str> warnings;\n auto wallet = node->walletLoader().createWallet(wallet_name.toStdString(), passphrase, wallet_creation_flags, warnings);\n QmlUtil::ClearSecureString(passphrase);\n out.warnings = JoinWarnings(warnings);\n if (!wallet) {\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n return out;\n }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n return;\n }\n WalletQmlModel* wallet_model = addOrSelectWalletModel(std::move(out.wallet));\n if (load_action == WalletLoadAction::Load) Q_EMIT walletLoadSucceeded(wallet_model);\n else if (load_action == WalletLoadAction::Create) Q_EMIT walletCreateSucceeded(wallet_model);\n }, [this, report_create_error](std::exception_ptr) {\n m_deferred_wallet_name.clear();\n setWalletLoadInProgress(false);\n if (report_create_error) setWalletCreateError(tr(\"Wallet creation failed.\"));\n else setWalletLoadError(tr(\"Wallet creation failed.\"));\n });\n}\n\nvoid WalletQmlController::createSingleSigWallet(const QString &name, const QString &passphrase)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletCreateStatus();\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletCreateError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletCreateError(name_error);\n return;\n }\n\n SecureString secure_passphrase{QmlUtil::SecureStringFromQString(passphrase)};\n createWalletAsync(name.trimmed(),\n std::move(secure_passphrase),\n wallet::WALLET_FLAG_DESCRIPTORS,\n WalletLoadAction::Create,\n /*report_create_error=*/true);\n}\n\nbool WalletQmlController::createExternalSignerWallet(const QString& name)\n{\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return false;\n }\n\n const QString wallet_name = name.trimmed();\n const QString name_error = walletNameAvailabilityError(wallet_name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return false;\n }\n\n refreshExternalSignerStatus();\n if (!m_external_signer_path_configured) {\n setWalletLoadError(tr(\"Set an external signer path in Wallet settings first.\"));\n return false;\n }\n if (!m_external_signer_error.isEmpty()) {\n setWalletLoadError(m_external_signer_error);\n return false;\n }\n if (m_external_signer_count == 0) {\n setWalletLoadError(tr(\"Connect an external signer and try again.\"));\n return false;\n }\n if (m_external_signer_count > 1) {\n setWalletLoadError(tr(\"More than one external signer was found. Connect only one device and try again.\"));\n return false;\n }\n\n constexpr uint64_t flags = wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_EXTERNAL_SIGNER;\n createWalletAsync(wallet_name,\n SecureString{},\n flags,\n WalletLoadAction::Load,\n /*report_create_error=*/false);\n return true;\n}\n\nvoid WalletQmlController::createWatchOnlyWallet(const QString& name, const QString& import_text, qint64 birth_time,\n const QString& address_type)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n ViewOnlyImport input{ParseViewOnlyImport(import_text, address_type)};\n if (input.kind == ViewOnlyImport::Kind::Empty) {\n setWalletLoadError(tr(\"Enter descriptors, or an extended public key (xpub).\"));\n return;\n }\n if (!input.error.isEmpty()) {\n setWalletLoadError(input.error);\n return;\n }\n if (input.requests.empty()) {\n setWalletLoadError(tr(\"Choose the address type of this key.\"));\n return;\n }\n if (!input.undated.empty()) {\n if (birth_time < 0) {\n setWalletLoadError(tr(\"Choose when this wallet was created.\"));\n return;\n }\n for (const size_t index : input.undated) input.requests[index].timestamp = birth_time;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Three-way multipath imports incorrectly promise change coverageqml/viewonlyimport.cpp | addressed | AssessmentThe descriptor checker rejects more than two parsed expansions, preventing three-way multipath inputs from being previewed as receive-and-change coverage. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "a142e946638d494cb8a6abc0ca439d55",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex b13465cde8..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -24,6 +24,7 @@\n #include <array>\n #include <exception>\n #include <iterator>\n+#include <map>\n #include <optional>\n #include <set>\n #include <string>\n@@ -40,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -54,6 +57,12 @@ QString KeyLabel(const std::string& descriptor)\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n }\n \n+QString KeyId(const std::string& descriptor)\n+{\n+ const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n+ return match.captured(1) + match.captured(2);\n+}\n+\n // Parse derives public keys from private ones, which needs the signing\n // context, so private keys are found before parsing.\n bool HasPrivateKey(const std::string& descriptor)\n@@ -81,6 +90,11 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n+ // The wallet only splits two paths into receive and change. More would all be receive.\n+ if (parsed.size() > 2) {\n+ check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n+ return check;\n+ }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n@@ -92,12 +106,23 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n+ // The wallet derives the first address on import.\n+ FlatSigningProvider derived;\n+ std::vector<CScript> scripts;\n+ if (!desc->Expand(0, keys, scripts, derived)) {\n+ check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n+ return check;\n+ }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n- check.source = {check.types.front(), KeyLabel(descriptor), check.ranged, parsed.size() > 1};\n+ check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n@@ -145,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -179,6 +206,35 @@ ViewOnlyImport ParseJson(const std::string& text)\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n \n+ // The same checks the wallet makes, before the wallet file is created.\n+ const bool multipath{check.count > 1};\n+ if (request.active && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n+ }\n+ if (request.range && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n+ }\n+ if (request.internal && multipath) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n+ }\n+ if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n+ }\n+ if (check.ranged && request.next_index) {\n+ const int64_t first{request.range ? request.range->first : 0};\n+ if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n+ }\n+ }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n+\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n@@ -339,7 +395,8 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n- std::optional<OutputType> type{key.type ? key.type : PurposeType(path)};\n+ const std::optional<OutputType> path_type{PurposeType(path)};\n+ std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n@@ -349,6 +406,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n+ result.key_id = origin + QString::fromStdString(key.key);\n+ if (key.type && path_type && *key.type != *path_type) {\n+ //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n+ result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n+ .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n+ }\n return result;\n }\n \n@@ -365,6 +428,10 @@ ViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_t\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n+ // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n+ if (origin.hasMatch()) {\n+ return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n+ }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n@@ -395,8 +462,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n+ // An address type has one active receive and one active change descriptor.\n+ // The wallet activates requests in order, so a later one replaces an earlier one.\n+ std::map<std::pair<OutputType, bool>, size_t> active_slots;\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ const ImportDescriptorRequest& request{parsed.requests[i]};\n+ if (!request.active) continue;\n+ const OutputType type{parsed.sources[i].type};\n+ if (parsed.sources[i].multipath) {\n+ active_slots[{type, false}] = i;\n+ active_slots[{type, true}] = i;\n+ } else {\n+ active_slots[{type, request.internal.value_or(false)}] = i;\n+ }\n+ }\n+ std::vector<bool> active(parsed.requests.size(), false);\n+ for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n+\n // Receive and change of one key share a row.\n QVariantList rows;\n+ QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n@@ -406,18 +501,21 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- const auto same_row = [&](const QVariant& row) {\n- const QVariantMap map{row.toMap()};\n- return map.value(QStringLiteral(\"addressType\")) == type && map.value(QStringLiteral(\"key\")) == source.key &&\n- map.value(QStringLiteral(\"active\")) == request.active && map.value(QStringLiteral(\"ranged\")) == source.ranged;\n- };\n- auto row_it{std::ranges::find_if(rows, same_row)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n+ }\n if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), request.active},\n+ {QStringLiteral(\"active\"), bool(active[i])},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n@@ -432,6 +530,9 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n *row_it = row;\n }\n+ QStringList descriptors;\n+ for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n+ result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n@@ -439,6 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 219,
"evidence_id": "e3ab56f7fb8248518e6ccb3fbcc98d01",
"finding_id": "finding:8",
"kind": "new_source",
"line": 70,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " return std::ranges::any_of(util::SplitString(descriptor, \"()[],/#<>;*'\"), [](const std::string& token) {\n return DecodeExtKey(token).key.IsValid() || DecodeSecret(token).IsValid();\n });\n}\n\nDescriptorCheck CheckDescriptor(const std::string& descriptor)\n{\n DescriptorCheck check;\n if (HasPrivateKey(descriptor)) {\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) {\n check.error = QString::fromStdString(error);\n return check;\n }\n if (!keys.keys.empty()) {\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n // The wallet only splits two paths into receive and change. More would all be receive.\n if (parsed.size() > 2) {\n check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n return check;\n }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n desc->GetPubKeys(pubkeys, ext_pubs);\n const std::optional<OutputType> type{desc->GetOutputType()};\n if (!type || pubkeys.size() + ext_pubs.size() != 1 ||\n !SINGLE_KEY_SCRIPT.match(QString::fromStdString(desc->ToString())).hasMatch()) {\n check.error = QObject::tr(\"Only single-key descriptors can be imported: pkh, wpkh, sh(wpkh), or tr without scripts.\");\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n std::string path{desc->ToString()};\n path = path.substr(0, path.find('#'));\n std::ranges::replace(path, '\\'', 'h');\n check.paths.push_back(std::move(path));\n // The wallet derives the first address on import.\n FlatSigningProvider derived;\n std::vector<CScript> scripts;\n if (!desc->Expand(0, keys, scripts, derived)) {\n check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n return check;\n }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n : descriptor;\n return check;\n}\n\nvoid AddTypes(ViewOnlyImport& result, const DescriptorCheck& check)\n{\n for (const OutputType type : check.types) {\n if (std::ranges::find(result.output_types, type) == result.output_types.end()) {\n result.output_types.push_back(type);\n }\n }\n result.descriptor_count += check.count;\n}\n\nViewOnlyImport Failed(ViewOnlyImport::Kind kind, const QString& error)\n{\n ViewOnlyImport result;\n result.kind = kind;\n result.error = error;\n return result;\n}\n\nstd::optional<std::pair<int64_t, int64_t>> ReadRange(const UniValue& value)\n{\n if (value.isNum()) return std::pair<int64_t, int64_t>{0, value.getInt<int64_t>()};\n if (value.isArray() && value.size() == 2 && value[0].isNum() && value[1].isNum()) {\n return std::pair<int64_t, int64_t>{value[0].getInt<int64_t>(), value[1].getInt<int64_t>()};\n }\n return std::nullopt;\n}\n\nViewOnlyImport ParseJson(const std::string& text)\n{\n using Kind = ViewOnlyImport::Kind;\n UniValue root;\n if (!root.read(text)) return Failed(Kind::DescriptorJson, QObject::tr(\"This is not valid JSON.\"));\n // listdescriptors wraps the list in an object.\n const UniValue& list{root.isObject() ? root.find_value(\"descriptors\") : root};\n if (!list.isArray() || list.empty()) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"Expected a list of descriptors, like the one listdescriptors prints.\"));\n }\n\n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n //! Whether each path is active, and change.\n std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n try {\n const UniValue& entry{list[i]};\n const UniValue& desc{entry.isObject() ? entry.find_value(\"desc\") : NullUniValue};\n if (!desc.isStr()) return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has no \\\"desc\\\" text.\").arg(position));\n const DescriptorCheck check{CheckDescriptor(desc.get_str())};\n if (!check.error.isEmpty()) return Failed(Kind::DescriptorJson, QStringLiteral(\"%1: %2\").arg(position, check.error));\n\n ImportDescriptorRequest request;\n request.descriptor = check.descriptor;\n const UniValue& timestamp{entry.find_value(\"timestamp\")};\n if (timestamp.isNull()) {\n result.undated.push_back(result.requests.size());\n } else if (timestamp.isNum() && timestamp.getInt<int64_t>() >= 0) {\n request.timestamp = timestamp.getInt<int64_t>();\n } else if (!timestamp.isStr() || timestamp.get_str() != \"now\") {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has an invalid timestamp.\").arg(position));\n }\n if (const UniValue& active{entry.find_value(\"active\")}; !active.isNull()) request.active = active.get_bool();\n if (const UniValue& internal{entry.find_value(\"internal\")}; !internal.isNull()) request.internal = internal.get_bool();\n if (const UniValue& label{entry.find_value(\"label\")}; !label.isNull()) request.label = label.get_str();\n if (const UniValue& range{entry.find_value(\"range\")}; !range.isNull()) {\n request.range = ReadRange(range);\n if (!request.range) return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has an invalid range.\").arg(position));\n if (const auto bounds{CheckDescriptorRangeBounds(request.range->first, request.range->second)}; !bounds) {\n return Failed(Kind::DescriptorJson, QStringLiteral(\"%1: %2\").arg(position, QString::fromStdString(bounds.error())));\n }\n }\n const UniValue& next_index{entry.find_value(\"next_index\")};\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n\n // The same checks the wallet makes, before the wallet file is created.\n const bool multipath{check.count > 1};\n if (request.active && !check.ranged) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n }\n if (request.range && !check.ranged) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n }\n if (request.internal && multipath) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Origin-only grouping merges different receive and change keysqml/viewonlyimport.cpp | addressed | AssessmentPreview grouping now uses a key identity containing both the origin and serialized key rather than the display label alone, so different keys with matching origin metadata do not merge into one coverage row. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "32a5b166cb5f4303aca16cba7a5e6519",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex b13465cde8..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -24,6 +24,7 @@\n #include <array>\n #include <exception>\n #include <iterator>\n+#include <map>\n #include <optional>\n #include <set>\n #include <string>\n@@ -40,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -54,6 +57,12 @@ QString KeyLabel(const std::string& descriptor)\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n }\n \n+QString KeyId(const std::string& descriptor)\n+{\n+ const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n+ return match.captured(1) + match.captured(2);\n+}\n+\n // Parse derives public keys from private ones, which needs the signing\n // context, so private keys are found before parsing.\n bool HasPrivateKey(const std::string& descriptor)\n@@ -81,6 +90,11 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n+ // The wallet only splits two paths into receive and change. More would all be receive.\n+ if (parsed.size() > 2) {\n+ check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n+ return check;\n+ }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n@@ -92,12 +106,23 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n+ // The wallet derives the first address on import.\n+ FlatSigningProvider derived;\n+ std::vector<CScript> scripts;\n+ if (!desc->Expand(0, keys, scripts, derived)) {\n+ check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n+ return check;\n+ }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n- check.source = {check.types.front(), KeyLabel(descriptor), check.ranged, parsed.size() > 1};\n+ check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n@@ -145,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -179,6 +206,35 @@ ViewOnlyImport ParseJson(const std::string& text)\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n \n+ // The same checks the wallet makes, before the wallet file is created.\n+ const bool multipath{check.count > 1};\n+ if (request.active && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n+ }\n+ if (request.range && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n+ }\n+ if (request.internal && multipath) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n+ }\n+ if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n+ }\n+ if (check.ranged && request.next_index) {\n+ const int64_t first{request.range ? request.range->first : 0};\n+ if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n+ }\n+ }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n+\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n@@ -339,7 +395,8 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n- std::optional<OutputType> type{key.type ? key.type : PurposeType(path)};\n+ const std::optional<OutputType> path_type{PurposeType(path)};\n+ std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n@@ -349,6 +406,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n+ result.key_id = origin + QString::fromStdString(key.key);\n+ if (key.type && path_type && *key.type != *path_type) {\n+ //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n+ result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n+ .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n+ }\n return result;\n }\n \n@@ -365,6 +428,10 @@ ViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_t\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n+ // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n+ if (origin.hasMatch()) {\n+ return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n+ }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n@@ -395,8 +462,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n+ // An address type has one active receive and one active change descriptor.\n+ // The wallet activates requests in order, so a later one replaces an earlier one.\n+ std::map<std::pair<OutputType, bool>, size_t> active_slots;\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ const ImportDescriptorRequest& request{parsed.requests[i]};\n+ if (!request.active) continue;\n+ const OutputType type{parsed.sources[i].type};\n+ if (parsed.sources[i].multipath) {\n+ active_slots[{type, false}] = i;\n+ active_slots[{type, true}] = i;\n+ } else {\n+ active_slots[{type, request.internal.value_or(false)}] = i;\n+ }\n+ }\n+ std::vector<bool> active(parsed.requests.size(), false);\n+ for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n+\n // Receive and change of one key share a row.\n QVariantList rows;\n+ QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n@@ -406,18 +501,21 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- const auto same_row = [&](const QVariant& row) {\n- const QVariantMap map{row.toMap()};\n- return map.value(QStringLiteral(\"addressType\")) == type && map.value(QStringLiteral(\"key\")) == source.key &&\n- map.value(QStringLiteral(\"active\")) == request.active && map.value(QStringLiteral(\"ranged\")) == source.ranged;\n- };\n- auto row_it{std::ranges::find_if(rows, same_row)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n+ }\n if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), request.active},\n+ {QStringLiteral(\"active\"), bool(active[i])},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n@@ -432,6 +530,9 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n *row_it = row;\n }\n+ QStringList descriptors;\n+ for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n+ result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n@@ -439,6 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 530,
"evidence_id": "7f5c1a0c444f47b887ac3e750fed7dd4",
"finding_id": "finding:7",
"kind": "new_source",
"line": 381,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": "QString WrapKey(OutputType type, const QString& key)\n{\n switch (type) {\n case OutputType::LEGACY: return QStringLiteral(\"pkh(%1)\").arg(key);\n case OutputType::P2SH_SEGWIT: return QStringLiteral(\"sh(wpkh(%1))\").arg(key);\n case OutputType::BECH32: return QStringLiteral(\"wpkh(%1)\").arg(key);\n case OutputType::BECH32M: return QStringLiteral(\"tr(%1)\").arg(key);\n case OutputType::UNKNOWN: break;\n }\n return {};\n}\n\nViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, const QString& path, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n if (!type || *type == OutputType::UNKNOWN) return Failed(Kind::ExtendedKey, QObject::tr(\"Choose a valid address type.\"));\n }\n ViewOnlyImport result;\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n result.key_id = origin + QString::fromStdString(key.key);\n if (key.type && path_type && *key.type != *path_type) {\n //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n }\n return result;\n}\n\n} // namespace\n\nViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_type)\n{\n const QString trimmed{text.trimmed()};\n if (trimmed.isEmpty()) return {};\n\n const QRegularExpressionMatch origin{KEY_ORIGIN.match(trimmed)};\n const QString key_text{origin.hasMatch() ? origin.captured(3) : trimmed};\n if (const ExtendedKey key{ReadExtendedKey(key_text.toStdString())}; key.recognized) {\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n if (origin.hasMatch()) {\n return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n return ParseLines(text.split(QLatin1Char('\\n')));\n}\n\nQVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n const ViewOnlyImport parsed{ParseViewOnlyImport(text, address_type)};\n QVariantMap result;\n if (parsed.kind == Kind::Empty) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"empty\"));\n return result;\n }\n const QString kind{parsed.kind == Kind::ExtendedKey ? QStringLiteral(\"extendedKey\")\n : parsed.kind == Kind::Descriptors ? QStringLiteral(\"descriptors\")\n : QStringLiteral(\"descriptorJson\")};\n result.insert(QStringLiteral(\"kind\"), kind);\n if (!parsed.error.isEmpty()) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"invalid\"));\n result.insert(QStringLiteral(\"error\"), parsed.error);\n result.insert(QStringLiteral(\"errorLine\"), parsed.error_line);\n return result;\n }\n\n QStringList address_types;\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n // An address type has one active receive and one active change descriptor.\n // The wallet activates requests in order, so a later one replaces an earlier one.\n std::map<std::pair<OutputType, bool>, size_t> active_slots;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n if (!request.active) continue;\n const OutputType type{parsed.sources[i].type};\n if (parsed.sources[i].multipath) {\n active_slots[{type, false}] = i;\n active_slots[{type, true}] = i;\n } else {\n active_slots[{type, request.internal.value_or(false)}] = i;\n }\n }\n std::vector<bool> active(parsed.requests.size(), false);\n for (const auto& [slot, index] : active_slots) active[index] = true;\n QString warning{parsed.warning};\n if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n bool watches_change{false};\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n }\n warning = watches_change\n ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n }\n\n // Receive and change of one key share a row.\n QVariantList rows;\n QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n std::optional<int64_t> time;\n // An unset timestamp here was \"now\".\n if (std::ranges::find(parsed.undated, i) == parsed.undated.end()) time = request.timestamp.value_or(now);\n if (time) created = std::min(created.value_or(*time), *time);\n\n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n auto row_it{rows.begin()};\n for (; row_it != rows.end(); ++row_it) {\n const QVariantMap map{row_it->toMap()};\n if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n break;\n }\n }\n if (row_it == rows.end()) {\n row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n {QStringLiteral(\"active\"), bool(active[i])},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n }\n QVariantMap row{row_it->toMap()};\n const bool change{request.internal.value_or(false)};\n if (source.multipath || !change) row.insert(QStringLiteral(\"receive\"), true);\n if (source.multipath || change) row.insert(QStringLiteral(\"change\"), true);\n if (time) {\n const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Conflicting active descriptors remain active in the previewqml/viewonlyimport.cpp | addressed | AssessmentThe preview now tracks active status per output-type/receive-or-change slot and determines each displayed branch against the final slot owner. Multipath rows split when only one branch remains active, so an earlier descriptor replaced for receive is visibly inactive on that branch. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "1148c7402f6e41c089972a6748ae63da",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex b13465cde8..145f14baa5 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -24,6 +24,7 @@\n #include <array>\n #include <exception>\n #include <iterator>\n+#include <map>\n #include <optional>\n #include <set>\n #include <string>\n@@ -40,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -54,6 +57,12 @@ QString KeyLabel(const std::string& descriptor)\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n }\n \n+QString KeyId(const std::string& descriptor)\n+{\n+ const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n+ return match.captured(1) + match.captured(2);\n+}\n+\n // Parse derives public keys from private ones, which needs the signing\n // context, so private keys are found before parsing.\n bool HasPrivateKey(const std::string& descriptor)\n@@ -81,6 +90,11 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n+ // The wallet only splits two paths into receive and change. More would all be receive.\n+ if (parsed.size() > 2) {\n+ check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n+ return check;\n+ }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n@@ -92,12 +106,23 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n+ // The wallet derives the first address on import.\n+ FlatSigningProvider derived;\n+ std::vector<CScript> scripts;\n+ if (!desc->Expand(0, keys, scripts, derived)) {\n+ check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n+ return check;\n+ }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n- check.source = {check.types.front(), KeyLabel(descriptor), check.ranged, parsed.size() > 1};\n+ check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n@@ -145,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -179,6 +206,38 @@ ViewOnlyImport ParseJson(const std::string& text)\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n \n+ // The same checks the wallet makes, before the wallet file is created.\n+ const bool multipath{check.count > 1};\n+ if (request.active && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n+ }\n+ if (request.range && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n+ }\n+ if (request.internal && multipath) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n+ }\n+ if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n+ }\n+ // Without a range, the wallet's keypool size bounds it, which isn't known here.\n+ if (request.next_index && !request.range) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index but no range.\").arg(position));\n+ }\n+ if (check.ranged && request.next_index) {\n+ if (*request.next_index < request.range->first || *request.next_index > request.range->second) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n+ }\n+ }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n+\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n@@ -265,6 +324,8 @@ const std::array KNOWN_KEY_VERSIONS{\n // [fingerprint/path]key, the key origin form wallets export.\n const QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\n const QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n+// BIP45 and BIP48 are multisig cosigner paths.\n+const QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n \n struct ExtendedKey {\n bool recognized{false};\n@@ -338,8 +399,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n {\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n+ if (MULTISIG_PURPOSE.match(path).hasMatch()) {\n+ return Failed(Kind::ExtendedKey, QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\"));\n+ }\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n- std::optional<OutputType> type{key.type ? key.type : PurposeType(path)};\n+ const std::optional<OutputType> path_type{PurposeType(path)};\n+ std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n@@ -349,6 +414,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n+ result.key_id = origin + QString::fromStdString(key.key);\n+ if (key.type && path_type && *key.type != *path_type) {\n+ //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n+ result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n+ .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n+ }\n return result;\n }\n \n@@ -365,6 +436,10 @@ ViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_t\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n+ // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n+ if (origin.hasMatch()) {\n+ return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n+ }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n@@ -395,8 +470,38 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n- // Receive and change of one key share a row.\n+ // An address type has one active receive and one active change descriptor.\n+ // The wallet activates requests in order, so a later one replaces an earlier one.\n+ std::map<std::pair<OutputType, bool>, size_t> active_slots;\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ const ImportDescriptorRequest& request{parsed.requests[i]};\n+ if (!request.active) continue;\n+ const OutputType type{parsed.sources[i].type};\n+ if (parsed.sources[i].multipath) {\n+ active_slots[{type, false}] = i;\n+ active_slots[{type, true}] = i;\n+ } else {\n+ active_slots[{type, request.internal.value_or(false)}] = i;\n+ }\n+ }\n+ const auto branch_active = [&](size_t i, bool change) {\n+ const auto slot{active_slots.find({parsed.sources[i].type, change})};\n+ return slot != active_slots.end() && slot->second == i;\n+ };\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n+\n+ // Receive and change of one key share a row, unless only one of them stays active.\n QVariantList rows;\n+ QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n@@ -406,32 +511,40 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- const auto same_row = [&](const QVariant& row) {\n- const QVariantMap map{row.toMap()};\n- return map.value(QStringLiteral(\"addressType\")) == type && map.value(QStringLiteral(\"key\")) == source.key &&\n- map.value(QStringLiteral(\"active\")) == request.active && map.value(QStringLiteral(\"ranged\")) == source.ranged;\n- };\n- auto row_it{std::ranges::find_if(rows, same_row)};\n- if (row_it == rows.end()) {\n- rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n- {QStringLiteral(\"key\"), source.key},\n- {QStringLiteral(\"receive\"), false},\n- {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), request.active},\n- {QStringLiteral(\"ranged\"), source.ranged},\n- {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n- row_it = std::prev(rows.end());\n- }\n- QVariantMap row{row_it->toMap()};\n- const bool change{request.internal.value_or(false)};\n- if (source.multipath || !change) row.insert(QStringLiteral(\"receive\"), true);\n- if (source.multipath || change) row.insert(QStringLiteral(\"change\"), true);\n- if (time) {\n- const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n- row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n+ const std::vector<bool> branches{source.multipath ? std::vector<bool>{false, true} : std::vector<bool>{request.internal.value_or(false)}};\n+ for (const bool change : branches) {\n+ const bool active{branch_active(i, change)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == active && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n+ }\n+ if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n+ rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n+ {QStringLiteral(\"key\"), source.key},\n+ {QStringLiteral(\"receive\"), false},\n+ {QStringLiteral(\"change\"), false},\n+ {QStringLiteral(\"active\"), active},\n+ {QStringLiteral(\"ranged\"), source.ranged},\n+ {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n+ row_it = std::prev(rows.end());\n+ }\n+ QVariantMap row{row_it->toMap()};\n+ row.insert(change ? QStringLiteral(\"change\") : QStringLiteral(\"receive\"), true);\n+ if (time) {\n+ const qlonglong row_time{row.value(QStringLiteral(\"createdTime\")).toLongLong()};\n+ row.insert(QStringLiteral(\"createdTime\"), row_time < 0 ? qlonglong(*time) : std::min(row_time, qlonglong(*time)));\n+ }\n+ *row_it = row;\n }\n- *row_it = row;\n }\n+ QStringList descriptors;\n+ for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n+ result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n@@ -439,6 +552,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n@@ -450,3 +564,13 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n return result;\n }\n+\n+int64_t ResolveImportTimes(std::vector<ImportDescriptorRequest>& requests, int64_t now)\n+{\n+ int64_t oldest{now};\n+ for (ImportDescriptorRequest& request : requests) {\n+ request.timestamp = request.timestamp.value_or(now);\n+ oldest = std::min(oldest, *request.timestamp);\n+ }\n+ return oldest;\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 335,
"evidence_id": "2375e94b323e46f5a3bbe33fc1acf969",
"finding_id": "finding:6",
"kind": "new_source",
"line": 186,
"new_head": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"revision": "60c9d57773fbcffdd5f6355d1a695f07e8d51939",
"source_generation": 1,
"source_job_id": 2825,
"text": " request.descriptor = check.descriptor;\n const UniValue& timestamp{entry.find_value(\"timestamp\")};\n if (timestamp.isNull()) {\n result.undated.push_back(result.requests.size());\n } else if (timestamp.isNum() && timestamp.getInt<int64_t>() >= 0) {\n request.timestamp = timestamp.getInt<int64_t>();\n } else if (!timestamp.isStr() || timestamp.get_str() != \"now\") {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has an invalid timestamp.\").arg(position));\n }\n if (const UniValue& active{entry.find_value(\"active\")}; !active.isNull()) request.active = active.get_bool();\n if (const UniValue& internal{entry.find_value(\"internal\")}; !internal.isNull()) request.internal = internal.get_bool();\n if (const UniValue& label{entry.find_value(\"label\")}; !label.isNull()) request.label = label.get_str();\n if (const UniValue& range{entry.find_value(\"range\")}; !range.isNull()) {\n request.range = ReadRange(range);\n if (!request.range) return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has an invalid range.\").arg(position));\n if (const auto bounds{CheckDescriptorRangeBounds(request.range->first, request.range->second)}; !bounds) {\n return Failed(Kind::DescriptorJson, QStringLiteral(\"%1: %2\").arg(position, QString::fromStdString(bounds.error())));\n }\n }\n const UniValue& next_index{entry.find_value(\"next_index\")};\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n\n // The same checks the wallet makes, before the wallet file is created.\n const bool multipath{check.count > 1};\n if (request.active && !check.ranged) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n }\n if (request.range && !check.ranged) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n }\n if (request.internal && multipath) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n }\n if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n }\n // Without a range, the wallet's keypool size bounds it, which isn't known here.\n if (request.next_index && !request.range) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index but no range.\").arg(position));\n }\n if (check.ranged && request.next_index) {\n if (*request.next_index < request.range->first || *request.next_index > request.range->second) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n }\n }\n // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n for (size_t p = 0; p < check.paths.size(); ++p) {\n const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n if (!added && it->second != settings) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n }\n }\n\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n } catch (const std::exception&) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a field of the wrong type.\").arg(position));\n }\n }\n if (std::ranges::none_of(result.requests, &ImportDescriptorRequest::active)) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"None of these descriptors is active, so the wallet could not give out addresses.\"));\n }\n return result;\n}\n\nViewOnlyImport ParseLines(const QStringList& lines)\n{\n using Kind = ViewOnlyImport::Kind;\n ViewOnlyImport result;\n result.kind = Kind::Descriptors;\n const qsizetype filled{std::ranges::count_if(lines, [](const QString& line) { return !line.trimmed().isEmpty(); })};\n for (qsizetype i = 0; i < lines.size(); ++i) {\n const QString line{lines[i].trimmed()};\n if (line.isEmpty()) continue;\n if (filled == 1 && !line.contains(QLatin1Char('('))) {\n return Failed(Kind::Descriptors, QObject::tr(\"Enter descriptors, or an extended public key (xpub).\"));\n }\n const DescriptorCheck check{CheckDescriptor(line.toStdString())};\n if (!check.error.isEmpty()) {\n //: %1 is a line number, %2 explains what is wrong with that line.\n ViewOnlyImport failed{Failed(Kind::Descriptors, filled == 1 ? check.error : QObject::tr(\"Line %1: %2\").arg(i + 1).arg(check.error))};\n failed.error_line = int(i);\n return failed;\n }\n ImportDescriptorRequest request;\n request.descriptor = check.descriptor;\n request.active = check.ranged;\n // A multipath descriptor sets receive and change itself.\n if (check.ranged && check.count == 1) request.internal = check.change_chain;\n result.undated.push_back(result.requests.size());\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n }\n if (std::ranges::none_of(result.requests, &ImportDescriptorRequest::active)) {\n return Failed(Kind::Descriptors, QObject::tr(\"Add a ranged descriptor, one ending in /*, so the wallet can give out addresses.\"));\n }\n return result;\n}\n\nusing KeyVersion = std::array<unsigned char, 4>;\n\nstruct KnownKeyVersion {\n KeyVersion version;\n //! Testnet, signet and regtest share these.\n bool test;\n bool is_private;\n bool multisig;\n std::optional<OutputType> type;\n};\n\n// BIP32 and SLIP-132 versions. The prefix of a ypub or zpub names its script type.\nconst std::array KNOWN_KEY_VERSIONS{\n KnownKeyVersion{{0x04, 0x88, 0xb2, 0x1e}, false, false, false, std::nullopt}, // xpub\n KnownKeyVersion{{0x04, 0x9d, 0x7c, 0xb2}, false, false, false, OutputType::P2SH_SEGWIT}, // ypub\n KnownKeyVersion{{0x04, 0xb2, 0x47, 0x46}, false, false, false, OutputType::BECH32}, // zpub\n KnownKeyVersion{{0x02, 0x95, 0xb4, 0x3f}, false, false, true, std::nullopt}, // Ypub\n KnownKeyVersion{{0x02, 0xaa, 0x7e, 0xd3}, false, false, true, std::nullopt}, // Zpub\n KnownKeyVersion{{0x04, 0x35, 0x87, 0xcf}, true, false, false, std::nullopt}, // tpub\n KnownKeyVersion{{0x04, 0x4a, 0x52, 0x62}, true, false, false, OutputType::P2SH_SEGWIT}, // upub\n KnownKeyVersion{{0x04, 0x5f, 0x1c, 0xf6}, true, false, false, OutputType::BECH32}, // vpub\n KnownKeyVersion{{0x02, 0x42, 0x89, 0xef}, true, false, true, std::nullopt}, // Upub\n KnownKeyVersion{{0x02, 0x57, 0x54, 0x83}, true, false, true, std::nullopt}, // Vpub\n KnownKeyVersion{{0x04, 0x88, 0xad, 0xe4}, false, true, false, std::nullopt}, // xprv\n KnownKeyVersion{{0x04, 0x9d, 0x78, 0x78}, false, true, false, std::nullopt}, // yprv\n KnownKeyVersion{{0x04, 0xb2, 0x43, 0x0c}, false, true, false, std::nullopt}, // zprv\n KnownKeyVersion{{0x02, 0x95, 0xb0, 0x05}, false, true, true, std::nullopt}, // Yprv\n KnownKeyVersion{{0x02, 0xaa, 0x7a, 0x99}, false, true, true, std::nullopt}, // Zprv\n KnownKeyVersion{{0x04, 0x35, 0x83, 0x94}, true, true, false, std::nullopt}, // tprv\n KnownKeyVersion{{0x04, 0x4a, 0x4e, 0x28}, true, true, false, std::nullopt}, // uprv\n KnownKeyVersion{{0x04, 0x5f, 0x18, 0xbc}, true, true, false, std::nullopt}, // vprv\n KnownKeyVersion{{0x02, 0x42, 0x85, 0xb5}, true, true, true, std::nullopt}, // Uprv\n KnownKeyVersion{{0x02, 0x57, 0x50, 0x48}, true, true, true, std::nullopt}, // Vprv\n};\n\n// [fingerprint/path]key, the key origin form wallets export.\nconst QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\nconst QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n// BIP45 and BIP48 are multisig cosigner paths.\nconst QRegularExpression MULTISIG_PURPOSE{QStringLiteral(R\"(^/(45|48)['hH])\")};\n\nstruct ExtendedKey {\n bool recognized{false};\n QString error;\n //! The key with this network's xpub or tpub version.\n std::string key;\n std::optional<OutputType> type;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..60c9d57773fb 2026-11-25T19:04:19Z · gpt-6-luna |
| gui#1144 | Descriptor validation succeeds before a predictable post-creation import failureqml/viewonlyimport.cpp | addressed | AssessmentDescriptor validation now expands at index zero and rejects failed hardened public derivations; JSON parsing also validates active/range consistency, labels, and next-index bounds before the import can be submitted. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "045a958fcb20464296e679491e43d4d7",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex b13465cde8..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -24,6 +24,7 @@\n #include <array>\n #include <exception>\n #include <iterator>\n+#include <map>\n #include <optional>\n #include <set>\n #include <string>\n@@ -40,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -54,6 +57,12 @@ QString KeyLabel(const std::string& descriptor)\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n }\n \n+QString KeyId(const std::string& descriptor)\n+{\n+ const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n+ return match.captured(1) + match.captured(2);\n+}\n+\n // Parse derives public keys from private ones, which needs the signing\n // context, so private keys are found before parsing.\n bool HasPrivateKey(const std::string& descriptor)\n@@ -81,6 +90,11 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n+ // The wallet only splits two paths into receive and change. More would all be receive.\n+ if (parsed.size() > 2) {\n+ check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n+ return check;\n+ }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n@@ -92,12 +106,23 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n+ // The wallet derives the first address on import.\n+ FlatSigningProvider derived;\n+ std::vector<CScript> scripts;\n+ if (!desc->Expand(0, keys, scripts, derived)) {\n+ check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n+ return check;\n+ }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n- check.source = {check.types.front(), KeyLabel(descriptor), check.ranged, parsed.size() > 1};\n+ check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n@@ -145,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -179,6 +206,35 @@ ViewOnlyImport ParseJson(const std::string& text)\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n \n+ // The same checks the wallet makes, before the wallet file is created.\n+ const bool multipath{check.count > 1};\n+ if (request.active && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n+ }\n+ if (request.range && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n+ }\n+ if (request.internal && multipath) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n+ }\n+ if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n+ }\n+ if (check.ranged && request.next_index) {\n+ const int64_t first{request.range ? request.range->first : 0};\n+ if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n+ }\n+ }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n+\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n@@ -339,7 +395,8 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n- std::optional<OutputType> type{key.type ? key.type : PurposeType(path)};\n+ const std::optional<OutputType> path_type{PurposeType(path)};\n+ std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n@@ -349,6 +406,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n+ result.key_id = origin + QString::fromStdString(key.key);\n+ if (key.type && path_type && *key.type != *path_type) {\n+ //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n+ result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n+ .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n+ }\n return result;\n }\n \n@@ -365,6 +428,10 @@ ViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_t\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n+ // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n+ if (origin.hasMatch()) {\n+ return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n+ }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n@@ -395,8 +462,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n+ // An address type has one active receive and one active change descriptor.\n+ // The wallet activates requests in order, so a later one replaces an earlier one.\n+ std::map<std::pair<OutputType, bool>, size_t> active_slots;\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ const ImportDescriptorRequest& request{parsed.requests[i]};\n+ if (!request.active) continue;\n+ const OutputType type{parsed.sources[i].type};\n+ if (parsed.sources[i].multipath) {\n+ active_slots[{type, false}] = i;\n+ active_slots[{type, true}] = i;\n+ } else {\n+ active_slots[{type, request.internal.value_or(false)}] = i;\n+ }\n+ }\n+ std::vector<bool> active(parsed.requests.size(), false);\n+ for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n+\n // Receive and change of one key share a row.\n QVariantList rows;\n+ QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n@@ -406,18 +501,21 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- const auto same_row = [&](const QVariant& row) {\n- const QVariantMap map{row.toMap()};\n- return map.value(QStringLiteral(\"addressType\")) == type && map.value(QStringLiteral(\"key\")) == source.key &&\n- map.value(QStringLiteral(\"active\")) == request.active && map.value(QStringLiteral(\"ranged\")) == source.ranged;\n- };\n- auto row_it{std::ranges::find_if(rows, same_row)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n+ }\n if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), request.active},\n+ {QStringLiteral(\"active\"), bool(active[i])},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n@@ -432,6 +530,9 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n *row_it = row;\n }\n+ QStringList descriptors;\n+ for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n+ result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n@@ -439,6 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 194,
"evidence_id": "cddbecd722c64a15afd45a231b2612b4",
"finding_id": "finding:5",
"kind": "new_source",
"line": 45,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " std::vector<std::string> paths;\n};\n\n// A comma would mean more keys or a script tree.\nconst QRegularExpression SINGLE_KEY_SCRIPT{QStringLiteral(R\"(^(pkh|wpkh|sh\\(wpkh|tr)\\([^,]*$)\")};\nconst QRegularExpression CHANGE_CHAIN{QStringLiteral(R\"(/1/\\*\\))\")};\n// The key inside the innermost script, with its origin if it has one.\nconst QRegularExpression SCRIPT_KEY{QStringLiteral(R\"(\\((\\[[0-9a-fA-F]{8}[^\\]]*\\])?([^()\\[\\]/#,]+)(?=[/)]))\")};\n\nQString KeyLabel(const std::string& descriptor)\n{\n const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n}\n\nQString KeyId(const std::string& descriptor)\n{\n const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n return match.captured(1) + match.captured(2);\n}\n\n// Parse derives public keys from private ones, which needs the signing\n// context, so private keys are found before parsing.\nbool HasPrivateKey(const std::string& descriptor)\n{\n return std::ranges::any_of(util::SplitString(descriptor, \"()[],/#<>;*'\"), [](const std::string& token) {\n return DecodeExtKey(token).key.IsValid() || DecodeSecret(token).IsValid();\n });\n}\n\nDescriptorCheck CheckDescriptor(const std::string& descriptor)\n{\n DescriptorCheck check;\n if (HasPrivateKey(descriptor)) {\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) {\n check.error = QString::fromStdString(error);\n return check;\n }\n if (!keys.keys.empty()) {\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n // The wallet only splits two paths into receive and change. More would all be receive.\n if (parsed.size() > 2) {\n check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n return check;\n }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n desc->GetPubKeys(pubkeys, ext_pubs);\n const std::optional<OutputType> type{desc->GetOutputType()};\n if (!type || pubkeys.size() + ext_pubs.size() != 1 ||\n !SINGLE_KEY_SCRIPT.match(QString::fromStdString(desc->ToString())).hasMatch()) {\n check.error = QObject::tr(\"Only single-key descriptors can be imported: pkh, wpkh, sh(wpkh), or tr without scripts.\");\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n std::string path{desc->ToString()};\n path = path.substr(0, path.find('#'));\n std::ranges::replace(path, '\\'', 'h');\n check.paths.push_back(std::move(path));\n // The wallet derives the first address on import.\n FlatSigningProvider derived;\n std::vector<CScript> scripts;\n if (!desc->Expand(0, keys, scripts, derived)) {\n check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n return check;\n }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n : descriptor;\n return check;\n}\n\nvoid AddTypes(ViewOnlyImport& result, const DescriptorCheck& check)\n{\n for (const OutputType type : check.types) {\n if (std::ranges::find(result.output_types, type) == result.output_types.end()) {\n result.output_types.push_back(type);\n }\n }\n result.descriptor_count += check.count;\n}\n\nViewOnlyImport Failed(ViewOnlyImport::Kind kind, const QString& error)\n{\n ViewOnlyImport result;\n result.kind = kind;\n result.error = error;\n return result;\n}\n\nstd::optional<std::pair<int64_t, int64_t>> ReadRange(const UniValue& value)\n{\n if (value.isNum()) return std::pair<int64_t, int64_t>{0, value.getInt<int64_t>()};\n if (value.isArray() && value.size() == 2 && value[0].isNum() && value[1].isNum()) {\n return std::pair<int64_t, int64_t>{value[0].getInt<int64_t>(), value[1].getInt<int64_t>()};\n }\n return std::nullopt;\n}\n\nViewOnlyImport ParseJson(const std::string& text)\n{\n using Kind = ViewOnlyImport::Kind;\n UniValue root;\n if (!root.read(text)) return Failed(Kind::DescriptorJson, QObject::tr(\"This is not valid JSON.\"));\n // listdescriptors wraps the list in an object.\n const UniValue& list{root.isObject() ? root.find_value(\"descriptors\") : root};\n if (!list.isArray() || list.empty()) {\n return Failed(Kind::DescriptorJson, QObject::tr(\"Expected a list of descriptors, like the one listdescriptors prints.\"));\n }\n\n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n //! Whether each path is active, and change.\n std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n try {\n const UniValue& entry{list[i]};\n const UniValue& desc{entry.isObject() ? entry.find_value(\"desc\") : NullUniValue};\n if (!desc.isStr()) return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has no \\\"desc\\\" text.\").arg(position));\n const DescriptorCheck check{CheckDescriptor(desc.get_str())};\n if (!check.error.isEmpty()) return Failed(Kind::DescriptorJson, QStringLiteral(\"%1: %2\").arg(position, check.error));\n\n ImportDescriptorRequest request;\n request.descriptor = check.descriptor;\n const UniValue& timestamp{entry.find_value(\"timestamp\")};\n if (timestamp.isNull()) {\n result.undated.push_back(result.requests.size());\n } else if (timestamp.isNum() && timestamp.getInt<int64_t>() >= 0) {\n request.timestamp = timestamp.getInt<int64_t>();\n } else if (!timestamp.isStr() || timestamp.get_str() != \"now\") {\n return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has an invalid timestamp.\").arg(position));\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Long import rescans have no progress or cancellation controlsqml/walletqmlcontroller.cpp | addressed | AssessmentThe import setup now attaches an abort action, reports scan progress through the UI, and offers an explicit cancel control. Cancellation and shutdown interruption return errors, invoking created-wallet cleanup rather than retaining an incomplete import. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "28c6b4b3cfdf43848eb63b2c0f280f02",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 23dab27ab4..452a87cf64 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -14,10 +14,14 @@\n #include <common/settings.h>\n #include <interfaces/chain.h>\n #include <interfaces/node.h>\n+#include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n #include <univalue.h>\n+#include <util/fs.h>\n #include <util/result.h>\n+#include <wallet/context.h>\n #include <wallet/imports.h>\n+#include <wallet/scan.h>\n #include <wallet/walletutil.h>\n #include <wallet/wallet.h>\n #include <util/translation.h>\n@@ -25,15 +29,21 @@\n \n #include <algorithm>\n #include <atomic>\n+#include <memory>\n #include <mutex>\n #include <optional>\n #include <stdexcept>\n+#include <system_error>\n #include <utility>\n+#include <vector>\n \n+#include <QByteArray>\n+#include <QDateTime>\n #include <QDir>\n #include <QDesktopServices>\n #include <QFileInfo>\n #include <QMetaObject>\n+#include <QPointer>\n #include <QRegularExpression>\n #include <QSettings>\n #include <QStringList>\n@@ -81,22 +91,79 @@ bool ErrorContains(const QString& error, const QString& needle)\n }\n \n // The import rescans from the oldest timestamp, which a pruned node may no longer have.\n-bool ScanBlocksPruned(interfaces::Wallet& wallet, const std::vector<wallet::ImportDescriptorRequest>& requests)\n+bool ScanBlocksPruned(interfaces::Chain& chain, std::optional<int64_t> oldest)\n {\n- wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (!raw_wallet) return false;\n- interfaces::Chain& chain{raw_wallet->chain()};\n if (!chain.havePruned()) return false;\n- std::optional<int64_t> oldest;\n- for (const auto& request : requests) {\n- if (request.timestamp) oldest = std::min(oldest.value_or(*request.timestamp), *request.timestamp);\n- }\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n }\n- const uint256 tip{WITH_LOCK(raw_wallet->cs_wallet, return raw_wallet->GetLastBlockHash())};\n- return !chain.hasBlocks(tip, height);\n+ const std::optional<int> prune_height{chain.getPruneHeight()};\n+ return prune_height && height <= *prune_height;\n+}\n+\n+// remove() only unloads the wallet. Its files are deleted too, so the name can be used again.\n+void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<interfaces::Wallet> wallet)\n+{\n+ const std::string name{wallet->getWalletName()};\n+ wallet::WalletContext* context{loader.context()};\n+ std::shared_ptr<wallet::CWallet> shared{context ? wallet::GetWallet(*context, name) : nullptr};\n+ wallet->remove();\n+ wallet.reset();\n+ if (!shared) return;\n+ std::vector<fs::path> paths{shared->GetDatabase().Files()};\n+ if (!name.empty() && !paths.empty()) paths.push_back(paths.front().parent_path());\n+ // The database closes once the last reference is gone.\n+ wallet::WaitForDeleteWallet(std::move(shared));\n+ std::error_code error;\n+ // A directory is only removed when empty.\n+ for (const fs::path& path : paths) fs::remove(path, error);\n+}\n+\n+// A view-only import saves its descriptors before it rescans. The wallet's\n+// best block is already the tip then, so after a crash it would load without\n+// the older transactions. This records where the rescan starts until it ends.\n+QString PendingImportKey(const std::string& wallet_name)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+{\n+ QSettings settings;\n+ if (time) {\n+ settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n+ } else {\n+ settings.remove(PendingImportKey(wallet_name));\n+ }\n+ settings.sync();\n+}\n+\n+std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+{\n+ const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n+ return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+}\n+\n+bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+{\n+ wallet::WalletContext* context{node.walletLoader().context()};\n+ const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n+ if (!wallet) return false;\n+ wallet::WalletRescanReserver reserver{*wallet};\n+ if (!reserver.reserve()) return false;\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ int start_height{0};\n+ uint256 start_block;\n+ bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))};\n+ if (!done) {\n+ // Progress is saved, so a later load continues from where this stopped too.\n+ done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n+ wallet::ScanResult::SUCCESS;\n+ }\n+ control.detach();\n+ return done;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -106,6 +173,33 @@ QString ImportErrorText(const wallet::ImportError& error)\n }\n } // namespace\n \n+bool RescanControl::attach(std::function<void()> abort)\n+{\n+ const std::lock_guard lock{m_mutex};\n+ if (m_cancelled) return false;\n+ m_abort = std::move(abort);\n+ return true;\n+}\n+\n+void RescanControl::detach()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_abort = nullptr;\n+}\n+\n+void RescanControl::cancel()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_cancelled = true;\n+ if (m_abort) m_abort();\n+}\n+\n+bool RescanControl::cancelled() const\n+{\n+ const std::lock_guard lock{m_mutex};\n+ return m_cancelled;\n+}\n+\n WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n@@ -120,6 +214,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n+ return ResumeImport(node, wallet_name, time, control);\n+ })\n {\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n@@ -372,6 +469,8 @@ void WalletQmlController::beginShutdown()\n const auto wallets = m_wallets;\n for (auto* wallet : wallets) removeWalletModel(wallet);\n retireWallet(m_empty_wallet, false);\n+ for (const auto& [name, control] : m_import_rescans) control->cancel();\n+ if (m_import_rescan_executor) m_import_rescan_executor->shutdown();\n m_notification_cleanup_executor = std::make_unique<BackendExecutor>();\n m_notification_cleanup_executor->setObjectName(QStringLiteral(\"wallet-notifications\"));\n connect(m_notification_cleanup_executor.get(), &BackendExecutor::drained, this, [this] {\n@@ -407,7 +506,8 @@ void WalletQmlController::retireWallet(WalletQmlModel* model, bool remove)\n \n void WalletQmlController::checkShutdownFinished()\n {\n- if (m_shutting_down && m_controller_drained && m_notifications_drained && m_retiring_wallets.empty() && !m_shutdown_complete) {\n+ if (m_shutting_down && m_controller_drained && m_notifications_drained && m_import_rescans_drained &&\n+ m_retiring_wallets.empty() && !m_shutdown_complete) {\n m_shutdown_complete = true;\n Q_EMIT walletsDrained();\n }\n@@ -418,6 +518,32 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n connect(wallet_model, &WalletQmlModel::walletUnloaded, this, [this, wallet_model]() {\n removeWalletModel(wallet_model);\n }, Qt::QueuedConnection);\n+ resumeInterruptedImport(wallet_model);\n+}\n+\n+void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n+{\n+ const QString name{wallet_model->name()};\n+ const std::optional<int64_t> time{PendingImport(name.toStdString())};\n+ if (!time) return;\n+ if (!m_import_rescan_executor) {\n+ m_import_rescan_executor = std::make_unique<BackendExecutor>();\n+ m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n+ m_import_rescans_drained = false;\n+ connect(m_import_rescan_executor.get(), &BackendExecutor::drained, this, [this] {\n+ m_import_rescans_drained = true;\n+ checkShutdownFinished();\n+ });\n+ }\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_rescans[name] = control;\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n+ // Stays pending when the rescan stops early, so the next load tries again.\n+ if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n+ }, [this, name, control] {\n+ const auto it{m_import_rescans.find(name)};\n+ if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ });\n }\n \n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n@@ -457,6 +583,7 @@ void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool r\n WalletListModel::LoadState::Closed,\n QString{});\n setWalletLoaded(next_selected_wallet != nullptr);\n+ if (const auto it{m_import_rescans.find(wallet_name)}; it != m_import_rescans.end()) it->second->cancel();\n retireWallet(wallet_model, remove);\n }\n \n@@ -524,7 +651,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n uint64_t wallet_creation_flags,\n WalletLoadAction load_action,\n bool report_create_error,\n- WalletSetupFn setup_wallet)\n+ WalletSetupFn setup_wallet,\n+ WalletCheckFn check_before_create)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -533,8 +661,13 @@ void WalletQmlController::createWalletAsync(const QString& name,\n setWalletLoadInProgress(true);\n \n m_wallet_command_executor->submit(this, [node = &m_node, wallet_name, passphrase = std::move(passphrase),\n- wallet_creation_flags, setup_wallet = std::move(setup_wallet)]() mutable {\n+ wallet_creation_flags, setup_wallet = std::move(setup_wallet),\n+ check_before_create = std::move(check_before_create)]() mutable {\n WalletCommandResult out;\n+ if (check_before_create && !(out.error = check_before_create()).isEmpty()) {\n+ QmlUtil::ClearSecureString(passphrase);\n+ return out;\n+ }\n std::vector<bilingual_str> warnings;\n auto wallet = node->walletLoader().createWallet(wallet_name.toStdString(), passphrase, wallet_creation_flags, warnings);\n QmlUtil::ClearSecureString(passphrase);\n@@ -544,7 +677,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- (*wallet)->remove();\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -684,19 +818,61 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n+ // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n+ std::optional<int64_t> oldest_dated;\n+ for (size_t i = 0; i < input.requests.size(); ++i) {\n+ const std::optional<int64_t>& time{input.requests[i].timestamp};\n+ if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n+ }\n+ const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n+ // An unset timestamp means now.\n+ int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n+ for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n+ std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_control = control;\n+ setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [requests = std::move(input.requests)](interfaces::Wallet& wallet) mutable {\n- if (ScanBlocksPruned(wallet, requests)) {\n- return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n+ if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ SetPendingImport(wallet.getWalletName(), rescan_from);\n+ std::vector<wallet::ImportResult> results;\n+ {\n+ const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // Starting a rescan clears an earlier abort.\n+ if (control->cancelled()) wallet.abortRescan();\n+ QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n+ if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ })};\n+ // Imports the descriptors, then rescans from the oldest timestamp.\n+ results = wallet.importDescriptors(requests);\n }\n- // Imports the descriptors, then rescans from the oldest timestamp.\n- for (const wallet::ImportResult& result : wallet.importDescriptors(requests)) {\n+ control->detach();\n+ if (control->cancelled()) return cancelled;\n+ // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n+ if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n+ for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n+ SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ return QString{};\n+ }, [node = &m_node, oldest_dated, chosen_date] {\n+ // Checked before the wallet file exists, so another date can be tried with the same name.\n+ wallet::WalletContext* context{node->walletLoader().context()};\n+ if (!context || !context->chain) return QString{};\n+ if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n+ }\n+ if (ScanBlocksPruned(*context->chain, chosen_date)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ }\n return QString{};\n });\n }\n@@ -742,6 +918,18 @@ QVariantMap WalletQmlController::describeViewOnlyImport(const QString& import_te\n return DescribeViewOnlyImport(import_text, address_type);\n }\n \n+void WalletQmlController::cancelViewOnlyImport()\n+{\n+ if (m_import_control) m_import_control->cancel();\n+}\n+\n+void WalletQmlController::setImportProgress(int progress)\n+{\n+ if (m_import_progress == progress) return;\n+ m_import_progress = progress;\n+ Q_EMIT importProgressChanged();\n+}\n+\n void WalletQmlController::requestOpenWalletSettings(WalletQmlModel* wallet)\n {\n if (!wallet) return;\n@@ -1412,3 +1600,8 @@ void WalletQmlController::setOpenLocalPathFnForTesting(OpenLocalPathFn fn)\n {\n m_open_local_path_fn = std::move(fn);\n }\n+\n+void WalletQmlController::setResumeImportFnForTesting(ResumeImportFn fn)\n+{\n+ m_resume_import_fn = std::move(fn);\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 816,
"evidence_id": "e1f88933a0714af2965d069416ee7f8d",
"finding_id": "finding:4",
"kind": "new_source",
"line": 667,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/walletqmlcontroller.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " if (check_before_create && !(out.error = check_before_create()).isEmpty()) {\n QmlUtil::ClearSecureString(passphrase);\n return out;\n }\n std::vector<bilingual_str> warnings;\n auto wallet = node->walletLoader().createWallet(wallet_name.toStdString(), passphrase, wallet_creation_flags, warnings);\n QmlUtil::ClearSecureString(passphrase);\n out.warnings = JoinWarnings(warnings);\n if (!wallet) {\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n return out;\n }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n return;\n }\n WalletQmlModel* wallet_model = addOrSelectWalletModel(std::move(out.wallet));\n if (load_action == WalletLoadAction::Load) Q_EMIT walletLoadSucceeded(wallet_model);\n else if (load_action == WalletLoadAction::Create) Q_EMIT walletCreateSucceeded(wallet_model);\n }, [this, report_create_error](std::exception_ptr) {\n m_deferred_wallet_name.clear();\n setWalletLoadInProgress(false);\n if (report_create_error) setWalletCreateError(tr(\"Wallet creation failed.\"));\n else setWalletLoadError(tr(\"Wallet creation failed.\"));\n });\n}\n\nvoid WalletQmlController::createSingleSigWallet(const QString &name, const QString &passphrase)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletCreateStatus();\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletCreateError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletCreateError(name_error);\n return;\n }\n\n SecureString secure_passphrase{QmlUtil::SecureStringFromQString(passphrase)};\n createWalletAsync(name.trimmed(),\n std::move(secure_passphrase),\n wallet::WALLET_FLAG_DESCRIPTORS,\n WalletLoadAction::Create,\n /*report_create_error=*/true);\n}\n\nbool WalletQmlController::createExternalSignerWallet(const QString& name)\n{\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return false;\n }\n\n const QString wallet_name = name.trimmed();\n const QString name_error = walletNameAvailabilityError(wallet_name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return false;\n }\n\n refreshExternalSignerStatus();\n if (!m_external_signer_path_configured) {\n setWalletLoadError(tr(\"Set an external signer path in Wallet settings first.\"));\n return false;\n }\n if (!m_external_signer_error.isEmpty()) {\n setWalletLoadError(m_external_signer_error);\n return false;\n }\n if (m_external_signer_count == 0) {\n setWalletLoadError(tr(\"Connect an external signer and try again.\"));\n return false;\n }\n if (m_external_signer_count > 1) {\n setWalletLoadError(tr(\"More than one external signer was found. Connect only one device and try again.\"));\n return false;\n }\n\n constexpr uint64_t flags = wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_EXTERNAL_SIGNER;\n createWalletAsync(wallet_name,\n SecureString{},\n flags,\n WalletLoadAction::Load,\n /*report_create_error=*/false);\n return true;\n}\n\nvoid WalletQmlController::createWatchOnlyWallet(const QString& name, const QString& import_text, qint64 birth_time,\n const QString& address_type)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n ViewOnlyImport input{ParseViewOnlyImport(import_text, address_type)};\n if (input.kind == ViewOnlyImport::Kind::Empty) {\n setWalletLoadError(tr(\"Enter descriptors, or an extended public key (xpub).\"));\n return;\n }\n if (!input.error.isEmpty()) {\n setWalletLoadError(input.error);\n return;\n }\n if (input.requests.empty()) {\n setWalletLoadError(tr(\"Choose the address type of this key.\"));\n return;\n }\n if (!input.undated.empty()) {\n if (birth_time < 0) {\n setWalletLoadError(tr(\"Choose when this wallet was created.\"));\n return;\n }\n for (const size_t index : input.undated) input.requests[index].timestamp = birth_time;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return;\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Pruning rejection leaves a wallet database that blocks the suggested retryqml/walletqmlcontroller.cpp | addressed | AssessmentThe pruning check is now a pre-creation callback using chain access, so a pruning rejection occurs before the wallet database is created. The supplied functional diff also tests distinct advice for dated descriptors and reuse of the name following pruning rejection. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "42e1c2b54ecf4536b92f98e2fb27a890",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 23dab27ab4..452a87cf64 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -14,10 +14,14 @@\n #include <common/settings.h>\n #include <interfaces/chain.h>\n #include <interfaces/node.h>\n+#include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n #include <univalue.h>\n+#include <util/fs.h>\n #include <util/result.h>\n+#include <wallet/context.h>\n #include <wallet/imports.h>\n+#include <wallet/scan.h>\n #include <wallet/walletutil.h>\n #include <wallet/wallet.h>\n #include <util/translation.h>\n@@ -25,15 +29,21 @@\n \n #include <algorithm>\n #include <atomic>\n+#include <memory>\n #include <mutex>\n #include <optional>\n #include <stdexcept>\n+#include <system_error>\n #include <utility>\n+#include <vector>\n \n+#include <QByteArray>\n+#include <QDateTime>\n #include <QDir>\n #include <QDesktopServices>\n #include <QFileInfo>\n #include <QMetaObject>\n+#include <QPointer>\n #include <QRegularExpression>\n #include <QSettings>\n #include <QStringList>\n@@ -81,22 +91,79 @@ bool ErrorContains(const QString& error, const QString& needle)\n }\n \n // The import rescans from the oldest timestamp, which a pruned node may no longer have.\n-bool ScanBlocksPruned(interfaces::Wallet& wallet, const std::vector<wallet::ImportDescriptorRequest>& requests)\n+bool ScanBlocksPruned(interfaces::Chain& chain, std::optional<int64_t> oldest)\n {\n- wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (!raw_wallet) return false;\n- interfaces::Chain& chain{raw_wallet->chain()};\n if (!chain.havePruned()) return false;\n- std::optional<int64_t> oldest;\n- for (const auto& request : requests) {\n- if (request.timestamp) oldest = std::min(oldest.value_or(*request.timestamp), *request.timestamp);\n- }\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n }\n- const uint256 tip{WITH_LOCK(raw_wallet->cs_wallet, return raw_wallet->GetLastBlockHash())};\n- return !chain.hasBlocks(tip, height);\n+ const std::optional<int> prune_height{chain.getPruneHeight()};\n+ return prune_height && height <= *prune_height;\n+}\n+\n+// remove() only unloads the wallet. Its files are deleted too, so the name can be used again.\n+void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<interfaces::Wallet> wallet)\n+{\n+ const std::string name{wallet->getWalletName()};\n+ wallet::WalletContext* context{loader.context()};\n+ std::shared_ptr<wallet::CWallet> shared{context ? wallet::GetWallet(*context, name) : nullptr};\n+ wallet->remove();\n+ wallet.reset();\n+ if (!shared) return;\n+ std::vector<fs::path> paths{shared->GetDatabase().Files()};\n+ if (!name.empty() && !paths.empty()) paths.push_back(paths.front().parent_path());\n+ // The database closes once the last reference is gone.\n+ wallet::WaitForDeleteWallet(std::move(shared));\n+ std::error_code error;\n+ // A directory is only removed when empty.\n+ for (const fs::path& path : paths) fs::remove(path, error);\n+}\n+\n+// A view-only import saves its descriptors before it rescans. The wallet's\n+// best block is already the tip then, so after a crash it would load without\n+// the older transactions. This records where the rescan starts until it ends.\n+QString PendingImportKey(const std::string& wallet_name)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+{\n+ QSettings settings;\n+ if (time) {\n+ settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n+ } else {\n+ settings.remove(PendingImportKey(wallet_name));\n+ }\n+ settings.sync();\n+}\n+\n+std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+{\n+ const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n+ return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+}\n+\n+bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+{\n+ wallet::WalletContext* context{node.walletLoader().context()};\n+ const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n+ if (!wallet) return false;\n+ wallet::WalletRescanReserver reserver{*wallet};\n+ if (!reserver.reserve()) return false;\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ int start_height{0};\n+ uint256 start_block;\n+ bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))};\n+ if (!done) {\n+ // Progress is saved, so a later load continues from where this stopped too.\n+ done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n+ wallet::ScanResult::SUCCESS;\n+ }\n+ control.detach();\n+ return done;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -106,6 +173,33 @@ QString ImportErrorText(const wallet::ImportError& error)\n }\n } // namespace\n \n+bool RescanControl::attach(std::function<void()> abort)\n+{\n+ const std::lock_guard lock{m_mutex};\n+ if (m_cancelled) return false;\n+ m_abort = std::move(abort);\n+ return true;\n+}\n+\n+void RescanControl::detach()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_abort = nullptr;\n+}\n+\n+void RescanControl::cancel()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_cancelled = true;\n+ if (m_abort) m_abort();\n+}\n+\n+bool RescanControl::cancelled() const\n+{\n+ const std::lock_guard lock{m_mutex};\n+ return m_cancelled;\n+}\n+\n WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n@@ -120,6 +214,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n+ return ResumeImport(node, wallet_name, time, control);\n+ })\n {\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n@@ -372,6 +469,8 @@ void WalletQmlController::beginShutdown()\n const auto wallets = m_wallets;\n for (auto* wallet : wallets) removeWalletModel(wallet);\n retireWallet(m_empty_wallet, false);\n+ for (const auto& [name, control] : m_import_rescans) control->cancel();\n+ if (m_import_rescan_executor) m_import_rescan_executor->shutdown();\n m_notification_cleanup_executor = std::make_unique<BackendExecutor>();\n m_notification_cleanup_executor->setObjectName(QStringLiteral(\"wallet-notifications\"));\n connect(m_notification_cleanup_executor.get(), &BackendExecutor::drained, this, [this] {\n@@ -407,7 +506,8 @@ void WalletQmlController::retireWallet(WalletQmlModel* model, bool remove)\n \n void WalletQmlController::checkShutdownFinished()\n {\n- if (m_shutting_down && m_controller_drained && m_notifications_drained && m_retiring_wallets.empty() && !m_shutdown_complete) {\n+ if (m_shutting_down && m_controller_drained && m_notifications_drained && m_import_rescans_drained &&\n+ m_retiring_wallets.empty() && !m_shutdown_complete) {\n m_shutdown_complete = true;\n Q_EMIT walletsDrained();\n }\n@@ -418,6 +518,32 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n connect(wallet_model, &WalletQmlModel::walletUnloaded, this, [this, wallet_model]() {\n removeWalletModel(wallet_model);\n }, Qt::QueuedConnection);\n+ resumeInterruptedImport(wallet_model);\n+}\n+\n+void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n+{\n+ const QString name{wallet_model->name()};\n+ const std::optional<int64_t> time{PendingImport(name.toStdString())};\n+ if (!time) return;\n+ if (!m_import_rescan_executor) {\n+ m_import_rescan_executor = std::make_unique<BackendExecutor>();\n+ m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n+ m_import_rescans_drained = false;\n+ connect(m_import_rescan_executor.get(), &BackendExecutor::drained, this, [this] {\n+ m_import_rescans_drained = true;\n+ checkShutdownFinished();\n+ });\n+ }\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_rescans[name] = control;\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n+ // Stays pending when the rescan stops early, so the next load tries again.\n+ if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n+ }, [this, name, control] {\n+ const auto it{m_import_rescans.find(name)};\n+ if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ });\n }\n \n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n@@ -457,6 +583,7 @@ void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool r\n WalletListModel::LoadState::Closed,\n QString{});\n setWalletLoaded(next_selected_wallet != nullptr);\n+ if (const auto it{m_import_rescans.find(wallet_name)}; it != m_import_rescans.end()) it->second->cancel();\n retireWallet(wallet_model, remove);\n }\n \n@@ -524,7 +651,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n uint64_t wallet_creation_flags,\n WalletLoadAction load_action,\n bool report_create_error,\n- WalletSetupFn setup_wallet)\n+ WalletSetupFn setup_wallet,\n+ WalletCheckFn check_before_create)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -533,8 +661,13 @@ void WalletQmlController::createWalletAsync(const QString& name,\n setWalletLoadInProgress(true);\n \n m_wallet_command_executor->submit(this, [node = &m_node, wallet_name, passphrase = std::move(passphrase),\n- wallet_creation_flags, setup_wallet = std::move(setup_wallet)]() mutable {\n+ wallet_creation_flags, setup_wallet = std::move(setup_wallet),\n+ check_before_create = std::move(check_before_create)]() mutable {\n WalletCommandResult out;\n+ if (check_before_create && !(out.error = check_before_create()).isEmpty()) {\n+ QmlUtil::ClearSecureString(passphrase);\n+ return out;\n+ }\n std::vector<bilingual_str> warnings;\n auto wallet = node->walletLoader().createWallet(wallet_name.toStdString(), passphrase, wallet_creation_flags, warnings);\n QmlUtil::ClearSecureString(passphrase);\n@@ -544,7 +677,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- (*wallet)->remove();\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -684,19 +818,61 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n+ // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n+ std::optional<int64_t> oldest_dated;\n+ for (size_t i = 0; i < input.requests.size(); ++i) {\n+ const std::optional<int64_t>& time{input.requests[i].timestamp};\n+ if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n+ }\n+ const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n+ // An unset timestamp means now.\n+ int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n+ for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n+ std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_control = control;\n+ setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [requests = std::move(input.requests)](interfaces::Wallet& wallet) mutable {\n- if (ScanBlocksPruned(wallet, requests)) {\n- return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n+ if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ SetPendingImport(wallet.getWalletName(), rescan_from);\n+ std::vector<wallet::ImportResult> results;\n+ {\n+ const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // Starting a rescan clears an earlier abort.\n+ if (control->cancelled()) wallet.abortRescan();\n+ QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n+ if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ })};\n+ // Imports the descriptors, then rescans from the oldest timestamp.\n+ results = wallet.importDescriptors(requests);\n }\n- // Imports the descriptors, then rescans from the oldest timestamp.\n- for (const wallet::ImportResult& result : wallet.importDescriptors(requests)) {\n+ control->detach();\n+ if (control->cancelled()) return cancelled;\n+ // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n+ if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n+ for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n+ SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ return QString{};\n+ }, [node = &m_node, oldest_dated, chosen_date] {\n+ // Checked before the wallet file exists, so another date can be tried with the same name.\n+ wallet::WalletContext* context{node->walletLoader().context()};\n+ if (!context || !context->chain) return QString{};\n+ if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n+ }\n+ if (ScanBlocksPruned(*context->chain, chosen_date)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ }\n return QString{};\n });\n }\n@@ -742,6 +918,18 @@ QVariantMap WalletQmlController::describeViewOnlyImport(const QString& import_te\n return DescribeViewOnlyImport(import_text, address_type);\n }\n \n+void WalletQmlController::cancelViewOnlyImport()\n+{\n+ if (m_import_control) m_import_control->cancel();\n+}\n+\n+void WalletQmlController::setImportProgress(int progress)\n+{\n+ if (m_import_progress == progress) return;\n+ m_import_progress = progress;\n+ Q_EMIT importProgressChanged();\n+}\n+\n void WalletQmlController::requestOpenWalletSettings(WalletQmlModel* wallet)\n {\n if (!wallet) return;\n@@ -1412,3 +1600,8 @@ void WalletQmlController::setOpenLocalPathFnForTesting(OpenLocalPathFn fn)\n {\n m_open_local_path_fn = std::move(fn);\n }\n+\n+void WalletQmlController::setResumeImportFnForTesting(ResumeImportFn fn)\n+{\n+ m_resume_import_fn = std::move(fn);\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 812,
"evidence_id": "a2c05baff9084334a09758273437dbc3",
"finding_id": "finding:3",
"kind": "new_source",
"line": 663,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/walletqmlcontroller.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " m_wallet_command_executor->submit(this, [node = &m_node, wallet_name, passphrase = std::move(passphrase),\n wallet_creation_flags, setup_wallet = std::move(setup_wallet),\n check_before_create = std::move(check_before_create)]() mutable {\n WalletCommandResult out;\n if (check_before_create && !(out.error = check_before_create()).isEmpty()) {\n QmlUtil::ClearSecureString(passphrase);\n return out;\n }\n std::vector<bilingual_str> warnings;\n auto wallet = node->walletLoader().createWallet(wallet_name.toStdString(), passphrase, wallet_creation_flags, warnings);\n QmlUtil::ClearSecureString(passphrase);\n out.warnings = JoinWarnings(warnings);\n if (!wallet) {\n const auto error = util::ErrorString(wallet);\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n return out;\n }, [this, wallet_name, load_action, report_create_error](WalletCommandResult out) {\n if (m_deferred_wallet_name == wallet_name) m_deferred_wallet_name.clear();\n setWalletLoadWarnings(out.warnings);\n setWalletLoadInProgress(false);\n if (!out.wallet) {\n if (report_create_error) setWalletCreateError(out.error);\n else setWalletLoadError(out.error);\n return;\n }\n WalletQmlModel* wallet_model = addOrSelectWalletModel(std::move(out.wallet));\n if (load_action == WalletLoadAction::Load) Q_EMIT walletLoadSucceeded(wallet_model);\n else if (load_action == WalletLoadAction::Create) Q_EMIT walletCreateSucceeded(wallet_model);\n }, [this, report_create_error](std::exception_ptr) {\n m_deferred_wallet_name.clear();\n setWalletLoadInProgress(false);\n if (report_create_error) setWalletCreateError(tr(\"Wallet creation failed.\"));\n else setWalletLoadError(tr(\"Wallet creation failed.\"));\n });\n}\n\nvoid WalletQmlController::createSingleSigWallet(const QString &name, const QString &passphrase)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletCreateStatus();\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletCreateError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n const QString name_error = walletNameAvailabilityError(name);\n if (!name_error.isEmpty()) {\n setWalletCreateError(name_error);\n return;\n }\n\n SecureString secure_passphrase{QmlUtil::SecureStringFromQString(passphrase)};\n createWalletAsync(name.trimmed(),\n std::move(secure_passphrase),\n wallet::WALLET_FLAG_DESCRIPTORS,\n WalletLoadAction::Create,\n /*report_create_error=*/true);\n}\n\nbool WalletQmlController::createExternalSignerWallet(const QString& name)\n{\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return false;\n }\n\n const QString wallet_name = name.trimmed();\n const QString name_error = walletNameAvailabilityError(wallet_name);\n if (!name_error.isEmpty()) {\n setWalletLoadError(name_error);\n return false;\n }\n\n refreshExternalSignerStatus();\n if (!m_external_signer_path_configured) {\n setWalletLoadError(tr(\"Set an external signer path in Wallet settings first.\"));\n return false;\n }\n if (!m_external_signer_error.isEmpty()) {\n setWalletLoadError(m_external_signer_error);\n return false;\n }\n if (m_external_signer_count == 0) {\n setWalletLoadError(tr(\"Connect an external signer and try again.\"));\n return false;\n }\n if (m_external_signer_count > 1) {\n setWalletLoadError(tr(\"More than one external signer was found. Connect only one device and try again.\"));\n return false;\n }\n\n constexpr uint64_t flags = wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_EXTERNAL_SIGNER;\n createWalletAsync(wallet_name,\n SecureString{},\n flags,\n WalletLoadAction::Load,\n /*report_create_error=*/false);\n return true;\n}\n\nvoid WalletQmlController::createWatchOnlyWallet(const QString& name, const QString& import_text, qint64 birth_time,\n const QString& address_type)\n{\n if (m_wallet_load_in_progress) {\n return;\n }\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n ViewOnlyImport input{ParseViewOnlyImport(import_text, address_type)};\n if (input.kind == ViewOnlyImport::Kind::Empty) {\n setWalletLoadError(tr(\"Enter descriptors, or an extended public key (xpub).\"));\n return;\n }\n if (!input.error.isEmpty()) {\n setWalletLoadError(input.error);\n return;\n }\n if (input.requests.empty()) {\n setWalletLoadError(tr(\"Choose the address type of this key.\"));\n return;\n }\n if (!input.undated.empty()) {\n if (birth_time < 0) {\n setWalletLoadError(tr(\"Choose when this wallet was created.\"));\n return;\n }\n for (const size_t index : input.undated) input.requests[index].timestamp = birth_time;\n }\n\n const QString name_error = walletNameAvailabilityError(name);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Nested-SegWit-only and legacy-only imports retain unsupported bech32 defaultsqml/viewonlyimport.cpp | addressed | AssessmentReceive address types are now derived from active receive managers, and transaction change selection consults Core’s recipient-based choice before falling back to an available internal manager. Tests cover active receive-type updates and recipient-matched versus fallback change selection. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "14e54020e1b641d8a56712e0a42d2085",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex b13465cde8..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -24,6 +24,7 @@\n #include <array>\n #include <exception>\n #include <iterator>\n+#include <map>\n #include <optional>\n #include <set>\n #include <string>\n@@ -40,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -54,6 +57,12 @@ QString KeyLabel(const std::string& descriptor)\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n }\n \n+QString KeyId(const std::string& descriptor)\n+{\n+ const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n+ return match.captured(1) + match.captured(2);\n+}\n+\n // Parse derives public keys from private ones, which needs the signing\n // context, so private keys are found before parsing.\n bool HasPrivateKey(const std::string& descriptor)\n@@ -81,6 +90,11 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n+ // The wallet only splits two paths into receive and change. More would all be receive.\n+ if (parsed.size() > 2) {\n+ check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n+ return check;\n+ }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n@@ -92,12 +106,23 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n+ // The wallet derives the first address on import.\n+ FlatSigningProvider derived;\n+ std::vector<CScript> scripts;\n+ if (!desc->Expand(0, keys, scripts, derived)) {\n+ check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n+ return check;\n+ }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n- check.source = {check.types.front(), KeyLabel(descriptor), check.ranged, parsed.size() > 1};\n+ check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n@@ -145,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -179,6 +206,35 @@ ViewOnlyImport ParseJson(const std::string& text)\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n \n+ // The same checks the wallet makes, before the wallet file is created.\n+ const bool multipath{check.count > 1};\n+ if (request.active && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n+ }\n+ if (request.range && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n+ }\n+ if (request.internal && multipath) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n+ }\n+ if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n+ }\n+ if (check.ranged && request.next_index) {\n+ const int64_t first{request.range ? request.range->first : 0};\n+ if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n+ }\n+ }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n+\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n@@ -339,7 +395,8 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n- std::optional<OutputType> type{key.type ? key.type : PurposeType(path)};\n+ const std::optional<OutputType> path_type{PurposeType(path)};\n+ std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n@@ -349,6 +406,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n+ result.key_id = origin + QString::fromStdString(key.key);\n+ if (key.type && path_type && *key.type != *path_type) {\n+ //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n+ result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n+ .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n+ }\n return result;\n }\n \n@@ -365,6 +428,10 @@ ViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_t\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n+ // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n+ if (origin.hasMatch()) {\n+ return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n+ }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n@@ -395,8 +462,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n+ // An address type has one active receive and one active change descriptor.\n+ // The wallet activates requests in order, so a later one replaces an earlier one.\n+ std::map<std::pair<OutputType, bool>, size_t> active_slots;\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ const ImportDescriptorRequest& request{parsed.requests[i]};\n+ if (!request.active) continue;\n+ const OutputType type{parsed.sources[i].type};\n+ if (parsed.sources[i].multipath) {\n+ active_slots[{type, false}] = i;\n+ active_slots[{type, true}] = i;\n+ } else {\n+ active_slots[{type, request.internal.value_or(false)}] = i;\n+ }\n+ }\n+ std::vector<bool> active(parsed.requests.size(), false);\n+ for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n+\n // Receive and change of one key share a row.\n QVariantList rows;\n+ QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n@@ -406,18 +501,21 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- const auto same_row = [&](const QVariant& row) {\n- const QVariantMap map{row.toMap()};\n- return map.value(QStringLiteral(\"addressType\")) == type && map.value(QStringLiteral(\"key\")) == source.key &&\n- map.value(QStringLiteral(\"active\")) == request.active && map.value(QStringLiteral(\"ranged\")) == source.ranged;\n- };\n- auto row_it{std::ranges::find_if(rows, same_row)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n+ }\n if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), request.active},\n+ {QStringLiteral(\"active\"), bool(active[i])},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n@@ -432,6 +530,9 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n *row_it = row;\n }\n+ QStringList descriptors;\n+ for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n+ result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n@@ -439,6 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 468,
"evidence_id": "fddd37cce74543c383ad41bf6bae9372",
"finding_id": "finding:2",
"kind": "new_source",
"line": 319,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": "};\n\n// [fingerprint/path]key, the key origin form wallets export.\nconst QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\nconst QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n\nstruct ExtendedKey {\n bool recognized{false};\n QString error;\n //! The key with this network's xpub or tpub version.\n std::string key;\n std::optional<OutputType> type;\n};\n\nExtendedKey ReadExtendedKey(const std::string& text)\n{\n std::vector<unsigned char> data;\n if (!DecodeBase58Check(text, data, BIP32_EXTKEY_WITH_VERSION_SIZE) || data.size() != BIP32_EXTKEY_WITH_VERSION_SIZE) return {};\n const auto known{std::ranges::find_if(KNOWN_KEY_VERSIONS, [&](const KnownKeyVersion& known) {\n return std::equal(known.version.begin(), known.version.end(), data.begin());\n })};\n if (known == KNOWN_KEY_VERSIONS.end()) return {};\n\n ExtendedKey result;\n result.recognized = true;\n if (known->is_private) {\n result.error = QObject::tr(\"This is a private key. Enter the extended public key instead.\");\n return result;\n }\n if (known->multisig) {\n result.error = QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\");\n return result;\n }\n const std::vector<unsigned char>& prefix{Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY)};\n const KeyVersion& mainnet{KNOWN_KEY_VERSIONS.front().version};\n if (known->test == std::equal(mainnet.begin(), mainnet.end(), prefix.begin(), prefix.end())) {\n result.error = QObject::tr(\"This key is for a different network.\");\n return result;\n }\n std::copy(prefix.begin(), prefix.end(), data.begin());\n result.key = EncodeBase58Check(data);\n if (!DecodeExtPubKey(result.key).pubkey.IsValid()) {\n result.error = QObject::tr(\"This extended public key is not valid.\");\n return result;\n }\n result.type = known->type;\n return result;\n}\n\nstd::optional<OutputType> PurposeType(const QString& path)\n{\n const QRegularExpressionMatch match{ORIGIN_PURPOSE.match(path)};\n if (!match.hasMatch()) return std::nullopt;\n switch (match.captured(1).toInt()) {\n case 44: return OutputType::LEGACY;\n case 49: return OutputType::P2SH_SEGWIT;\n case 84: return OutputType::BECH32;\n case 86: return OutputType::BECH32M;\n }\n return std::nullopt;\n}\n\nQString WrapKey(OutputType type, const QString& key)\n{\n switch (type) {\n case OutputType::LEGACY: return QStringLiteral(\"pkh(%1)\").arg(key);\n case OutputType::P2SH_SEGWIT: return QStringLiteral(\"sh(wpkh(%1))\").arg(key);\n case OutputType::BECH32: return QStringLiteral(\"wpkh(%1)\").arg(key);\n case OutputType::BECH32M: return QStringLiteral(\"tr(%1)\").arg(key);\n case OutputType::UNKNOWN: break;\n }\n return {};\n}\n\nViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, const QString& path, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n if (!type || *type == OutputType::UNKNOWN) return Failed(Kind::ExtendedKey, QObject::tr(\"Choose a valid address type.\"));\n }\n ViewOnlyImport result;\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n result.key_id = origin + QString::fromStdString(key.key);\n if (key.type && path_type && *key.type != *path_type) {\n //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n }\n return result;\n}\n\n} // namespace\n\nViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_type)\n{\n const QString trimmed{text.trimmed()};\n if (trimmed.isEmpty()) return {};\n\n const QRegularExpressionMatch origin{KEY_ORIGIN.match(trimmed)};\n const QString key_text{origin.hasMatch() ? origin.captured(3) : trimmed};\n if (const ExtendedKey key{ReadExtendedKey(key_text.toStdString())}; key.recognized) {\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n if (origin.hasMatch()) {\n return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n return ParseLines(text.split(QLatin1Char('\\n')));\n}\n\nQVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n const ViewOnlyImport parsed{ParseViewOnlyImport(text, address_type)};\n QVariantMap result;\n if (parsed.kind == Kind::Empty) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"empty\"));\n return result;\n }\n const QString kind{parsed.kind == Kind::ExtendedKey ? QStringLiteral(\"extendedKey\")\n : parsed.kind == Kind::Descriptors ? QStringLiteral(\"descriptors\")\n : QStringLiteral(\"descriptorJson\")};\n result.insert(QStringLiteral(\"kind\"), kind);\n if (!parsed.error.isEmpty()) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"invalid\"));\n result.insert(QStringLiteral(\"error\"), parsed.error);\n result.insert(QStringLiteral(\"errorLine\"), parsed.error_line);\n return result;\n }\n\n QStringList address_types;\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n // An address type has one active receive and one active change descriptor.\n // The wallet activates requests in order, so a later one replaces an earlier one.\n std::map<std::pair<OutputType, bool>, size_t> active_slots;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Conflicting SLIP-132 and origin-purpose metadata goes unexplainedqml/viewonlyimport.cpp | addressed | AssessmentThe parser compares the extended key’s inferred type with the origin-path purpose and surfaces a warning explaining the conflict and which type will be used; the form includes that warning in the import summary. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "445722fd991b472a9d1d4bf05b4afca2",
"finding_id": "finding:13",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex b13465cde8..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -24,6 +24,7 @@\n #include <array>\n #include <exception>\n #include <iterator>\n+#include <map>\n #include <optional>\n #include <set>\n #include <string>\n@@ -40,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -54,6 +57,12 @@ QString KeyLabel(const std::string& descriptor)\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n }\n \n+QString KeyId(const std::string& descriptor)\n+{\n+ const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n+ return match.captured(1) + match.captured(2);\n+}\n+\n // Parse derives public keys from private ones, which needs the signing\n // context, so private keys are found before parsing.\n bool HasPrivateKey(const std::string& descriptor)\n@@ -81,6 +90,11 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n+ // The wallet only splits two paths into receive and change. More would all be receive.\n+ if (parsed.size() > 2) {\n+ check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n+ return check;\n+ }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n@@ -92,12 +106,23 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n+ // The wallet derives the first address on import.\n+ FlatSigningProvider derived;\n+ std::vector<CScript> scripts;\n+ if (!desc->Expand(0, keys, scripts, derived)) {\n+ check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n+ return check;\n+ }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n- check.source = {check.types.front(), KeyLabel(descriptor), check.ranged, parsed.size() > 1};\n+ check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n@@ -145,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -179,6 +206,35 @@ ViewOnlyImport ParseJson(const std::string& text)\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n \n+ // The same checks the wallet makes, before the wallet file is created.\n+ const bool multipath{check.count > 1};\n+ if (request.active && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n+ }\n+ if (request.range && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n+ }\n+ if (request.internal && multipath) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n+ }\n+ if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n+ }\n+ if (check.ranged && request.next_index) {\n+ const int64_t first{request.range ? request.range->first : 0};\n+ if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n+ }\n+ }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n+\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n@@ -339,7 +395,8 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n- std::optional<OutputType> type{key.type ? key.type : PurposeType(path)};\n+ const std::optional<OutputType> path_type{PurposeType(path)};\n+ std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n@@ -349,6 +406,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n+ result.key_id = origin + QString::fromStdString(key.key);\n+ if (key.type && path_type && *key.type != *path_type) {\n+ //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n+ result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n+ .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n+ }\n return result;\n }\n \n@@ -365,6 +428,10 @@ ViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_t\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n+ // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n+ if (origin.hasMatch()) {\n+ return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n+ }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n@@ -395,8 +462,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n+ // An address type has one active receive and one active change descriptor.\n+ // The wallet activates requests in order, so a later one replaces an earlier one.\n+ std::map<std::pair<OutputType, bool>, size_t> active_slots;\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ const ImportDescriptorRequest& request{parsed.requests[i]};\n+ if (!request.active) continue;\n+ const OutputType type{parsed.sources[i].type};\n+ if (parsed.sources[i].multipath) {\n+ active_slots[{type, false}] = i;\n+ active_slots[{type, true}] = i;\n+ } else {\n+ active_slots[{type, request.internal.value_or(false)}] = i;\n+ }\n+ }\n+ std::vector<bool> active(parsed.requests.size(), false);\n+ for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n+\n // Receive and change of one key share a row.\n QVariantList rows;\n+ QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n@@ -406,18 +501,21 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- const auto same_row = [&](const QVariant& row) {\n- const QVariantMap map{row.toMap()};\n- return map.value(QStringLiteral(\"addressType\")) == type && map.value(QStringLiteral(\"key\")) == source.key &&\n- map.value(QStringLiteral(\"active\")) == request.active && map.value(QStringLiteral(\"ranged\")) == source.ranged;\n- };\n- auto row_it{std::ranges::find_if(rows, same_row)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n+ }\n if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), request.active},\n+ {QStringLiteral(\"active\"), bool(active[i])},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n@@ -432,6 +530,9 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n *row_it = row;\n }\n+ QStringList descriptors;\n+ for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n+ result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n@@ -439,6 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 461,
"evidence_id": "a5453446fdb64b929dca050aa957655d",
"finding_id": "finding:13",
"kind": "new_source",
"line": 312,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " KnownKeyVersion{{0x02, 0x95, 0xb0, 0x05}, false, true, true, std::nullopt}, // Yprv\n KnownKeyVersion{{0x02, 0xaa, 0x7a, 0x99}, false, true, true, std::nullopt}, // Zprv\n KnownKeyVersion{{0x04, 0x35, 0x83, 0x94}, true, true, false, std::nullopt}, // tprv\n KnownKeyVersion{{0x04, 0x4a, 0x4e, 0x28}, true, true, false, std::nullopt}, // uprv\n KnownKeyVersion{{0x04, 0x5f, 0x18, 0xbc}, true, true, false, std::nullopt}, // vprv\n KnownKeyVersion{{0x02, 0x42, 0x85, 0xb5}, true, true, true, std::nullopt}, // Uprv\n KnownKeyVersion{{0x02, 0x57, 0x50, 0x48}, true, true, true, std::nullopt}, // Vprv\n};\n\n// [fingerprint/path]key, the key origin form wallets export.\nconst QRegularExpression KEY_ORIGIN{QStringLiteral(R\"(^\\[([0-9a-fA-F]{8})((?:/[0-9]+['hH]?)*)\\]([1-9A-HJ-NP-Za-km-z]+)$)\")};\nconst QRegularExpression ORIGIN_PURPOSE{QStringLiteral(R\"(^/(44|49|84|86)['hH])\")};\n\nstruct ExtendedKey {\n bool recognized{false};\n QString error;\n //! The key with this network's xpub or tpub version.\n std::string key;\n std::optional<OutputType> type;\n};\n\nExtendedKey ReadExtendedKey(const std::string& text)\n{\n std::vector<unsigned char> data;\n if (!DecodeBase58Check(text, data, BIP32_EXTKEY_WITH_VERSION_SIZE) || data.size() != BIP32_EXTKEY_WITH_VERSION_SIZE) return {};\n const auto known{std::ranges::find_if(KNOWN_KEY_VERSIONS, [&](const KnownKeyVersion& known) {\n return std::equal(known.version.begin(), known.version.end(), data.begin());\n })};\n if (known == KNOWN_KEY_VERSIONS.end()) return {};\n\n ExtendedKey result;\n result.recognized = true;\n if (known->is_private) {\n result.error = QObject::tr(\"This is a private key. Enter the extended public key instead.\");\n return result;\n }\n if (known->multisig) {\n result.error = QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\");\n return result;\n }\n const std::vector<unsigned char>& prefix{Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY)};\n const KeyVersion& mainnet{KNOWN_KEY_VERSIONS.front().version};\n if (known->test == std::equal(mainnet.begin(), mainnet.end(), prefix.begin(), prefix.end())) {\n result.error = QObject::tr(\"This key is for a different network.\");\n return result;\n }\n std::copy(prefix.begin(), prefix.end(), data.begin());\n result.key = EncodeBase58Check(data);\n if (!DecodeExtPubKey(result.key).pubkey.IsValid()) {\n result.error = QObject::tr(\"This extended public key is not valid.\");\n return result;\n }\n result.type = known->type;\n return result;\n}\n\nstd::optional<OutputType> PurposeType(const QString& path)\n{\n const QRegularExpressionMatch match{ORIGIN_PURPOSE.match(path)};\n if (!match.hasMatch()) return std::nullopt;\n switch (match.captured(1).toInt()) {\n case 44: return OutputType::LEGACY;\n case 49: return OutputType::P2SH_SEGWIT;\n case 84: return OutputType::BECH32;\n case 86: return OutputType::BECH32M;\n }\n return std::nullopt;\n}\n\nQString WrapKey(OutputType type, const QString& key)\n{\n switch (type) {\n case OutputType::LEGACY: return QStringLiteral(\"pkh(%1)\").arg(key);\n case OutputType::P2SH_SEGWIT: return QStringLiteral(\"sh(wpkh(%1))\").arg(key);\n case OutputType::BECH32: return QStringLiteral(\"wpkh(%1)\").arg(key);\n case OutputType::BECH32M: return QStringLiteral(\"tr(%1)\").arg(key);\n case OutputType::UNKNOWN: break;\n }\n return {};\n}\n\nViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, const QString& path, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n if (!type || *type == OutputType::UNKNOWN) return Failed(Kind::ExtendedKey, QObject::tr(\"Choose a valid address type.\"));\n }\n ViewOnlyImport result;\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n result.key_id = origin + QString::fromStdString(key.key);\n if (key.type && path_type && *key.type != *path_type) {\n //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n }\n return result;\n}\n\n} // namespace\n\nViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_type)\n{\n const QString trimmed{text.trimmed()};\n if (trimmed.isEmpty()) return {};\n\n const QRegularExpressionMatch origin{KEY_ORIGIN.match(trimmed)};\n const QString key_text{origin.hasMatch() ? origin.captured(3) : trimmed};\n if (const ExtendedKey key{ReadExtendedKey(key_text.toStdString())}; key.recognized) {\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n if (origin.hasMatch()) {\n return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n return ParseLines(text.split(QLatin1Char('\\n')));\n}\n\nQVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n const ViewOnlyImport parsed{ParseViewOnlyImport(text, address_type)};\n QVariantMap result;\n if (parsed.kind == Kind::Empty) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"empty\"));\n return result;\n }\n const QString kind{parsed.kind == Kind::ExtendedKey ? QStringLiteral(\"extendedKey\")\n : parsed.kind == Kind::Descriptors ? QStringLiteral(\"descriptors\")\n : QStringLiteral(\"descriptorJson\")};\n result.insert(QStringLiteral(\"kind\"), kind);\n if (!parsed.error.isEmpty()) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"invalid\"));\n result.insert(QStringLiteral(\"error\"), parsed.error);\n result.insert(QStringLiteral(\"errorLine\"), parsed.error_line);\n return result;\n }\n\n QStringList address_types;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Replacing the imported key retains its predecessor's type and date choicesqml/pages/wallet/CreateWalletForm.qml | addressed | AssessmentThe form now tracks an import identity and clears both address-type and birth-date choices when that identity changes, while leaving choices intact when the identity remains the same. path_diff: qml/pages/wallet/CreateWalletForm.qml; new_source: qml/pages/wallet/CreateWalletForm.qml [
{
"evidence_id": "f1e7e8ac96624cd3961a6b5e7b2fc245",
"finding_id": "finding:12",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/pages/wallet/CreateWalletForm.qml",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/pages/wallet/CreateWalletForm.qml b/qml/pages/wallet/CreateWalletForm.qml\nindex 0918ad37e7..a2b36f3b3f 100644\n--- a/qml/pages/wallet/CreateWalletForm.qml\n+++ b/qml/pages/wallet/CreateWalletForm.qml\n@@ -23,6 +23,8 @@ OnboardingView {\n readonly property var keyInfo: watchOnly && loadedChildView\n ? walletController.describeViewOnlyImport(loadedChildView.importText) : ({ \"status\": \"empty\" })\n readonly property bool needsAddressType: keyInfo.status === \"valid\" && keyInfo.needsAddressType === true\n+ readonly property string importId: keyInfo.status === \"valid\" && keyInfo.importId ? keyInfo.importId : \"\"\n+ property string previousImportId: \"\"\n readonly property var importInfo: needsAddressType && loadedChildView.addressTypeChoice.length > 0\n ? walletController.describeViewOnlyImport(loadedChildView.importText, loadedChildView.addressTypeChoice) : keyInfo\n readonly property bool needsBirthDate: importInfo.status === \"valid\" && importInfo.needsBirthDate === true\n@@ -61,7 +63,8 @@ OnboardingView {\n }\n if (importInfo.kind === \"extendedKey\") {\n //: %1 is an address type, such as \"Bech32 (SegWit)\".\n- return qsTr(\"Extended key. Imported as %1 receive and change addresses.\").arg(types)\n+ const summary = qsTr(\"Extended key. Imported as %1 receive and change addresses.\").arg(types)\n+ return importInfo.warning ? summary + \" \" + importInfo.warning : summary\n }\n let summary = importInfo.descriptorCount === 1\n //: %1 is an address type, such as \"Bech32 (SegWit)\".\n@@ -72,7 +75,7 @@ OnboardingView {\n //: %1 is the date the oldest pasted descriptor was created.\n summary += \" \" + qsTr(\"Created %1.\").arg(new Date(importInfo.createdTime * 1000).toLocaleDateString(Qt.locale(), \"d MMM yyyy\"))\n }\n- return summary\n+ return importInfo.warning ? summary + \" \" + importInfo.warning : summary\n }\n \n function submit() {\n@@ -93,7 +96,7 @@ OnboardingView {\n }\n \n title: \"\"\n- heading: watchOnly ? qsTr(\"View-only wallet\") : qsTr(\"Single-key wallet\")\n+ heading: watchOnly ? qsTr(\"Watch-only wallet\") : qsTr(\"Single-key wallet\")\n subheading: watchOnly\n ? qsTr(\"See balances and activity without keeping spending keys in this app. An external signer is needed to spend.\")\n : qsTr(\"You can control it in this application.\\nWallet data will be stored locally in your hard drive.\")\n@@ -105,6 +108,10 @@ OnboardingView {\n primaryButtonText: creating ? (watchOnly ? qsTr(\"Importing…\") : qsTr(\"Creating…\")) : qsTr(\"Create wallet\")\n primaryButtonObjectName: \"createWalletFormCreateButton\"\n primaryButtonEnabled: canCreate\n+ readonly property bool importRunning: watchOnly && creating && walletController.walletLoadInProgress\n+ secondaryButtonText: importRunning ? qsTr(\"Cancel import\") : \"\"\n+ secondaryButtonObjectName: \"createWalletFormCancelImportButton\"\n+ onSecondaryClicked: walletController.cancelViewOnlyImport()\n onCloseClicked: root.cancel()\n onPrimaryClicked: {\n if (!root.canCreate) return\n@@ -112,6 +119,16 @@ OnboardingView {\n else root.loadedChildView.openUnencryptedWarning()\n }\n \n+ // Choices made for one key or set of descriptors do not carry over to another.\n+ onImportIdChanged: {\n+ if (importId.length === 0) return\n+ if (previousImportId.length > 0 && importId !== previousImportId && loadedChildView) {\n+ loadedChildView.addressTypeChoice = \"\"\n+ loadedChildView.birthChoice = \"\"\n+ }\n+ previousImportId = importId\n+ }\n+\n Component.onCompleted: {\n walletController.clearWalletCreateStatus()\n walletController.clearWalletLoadStatus()\n@@ -127,10 +144,8 @@ OnboardingView {\n property alias encryptWallet: encryptCheck.checked\n property alias passwordText: passwordEntry.text\n property alias confirmText: confirmEntry.text\n- readonly property bool passwordLossAcknowledged: acknowledgement.loadedTrailingItem\n- ? acknowledgement.loadedTrailingItem.checked : false\n- readonly property bool unencryptedWalletAcknowledged: unencryptedAcknowledgement.loadedTrailingItem\n- ? unencryptedAcknowledgement.loadedTrailingItem.checked : false\n+ readonly property bool passwordLossAcknowledged: acknowledgement.checked\n+ readonly property bool unencryptedWalletAcknowledged: unencryptedAcknowledgement.checked\n \n function clearSecrets() {\n passwordEntry.text = \"\"\n@@ -148,12 +163,12 @@ OnboardingView {\n Layout.fillWidth: true\n label: qsTr(\"Wallet name\")\n fieldObjectName: \"createWalletNameInput\"\n- placeholderText: qsTr(\"Eg. My bitcoin wallet...\")\n+ placeholderText: qsTr(\"e.g. My bitcoin wallet\")\n supportingText: qsTr(\"You cannot change this later.\")\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n- fieldBackgroundColor: Theme.color.neutral2\n+ fieldBackgroundColor: Theme.color.surface2\n onTextEdited: {\n root.nameError = \"\"\n walletController.clearWalletCreateStatus()\n@@ -161,99 +176,75 @@ OnboardingView {\n }\n }\n \n- Separator {\n- Layout.fillWidth: true\n- Layout.topMargin: 4\n- Layout.bottomMargin: 4\n- }\n-\n- CoreText {\n- visible: !root.watchOnly\n- Layout.fillWidth: true\n- text: qsTr(\"SECURITY\")\n- color: Theme.color.neutral6\n- font: Theme.text.captionStrong.font\n- horizontalAlignment: Text.AlignLeft\n- }\n-\n- CheckBox {\n- id: encryptCheck\n- objectName: \"createWalletEncryptCheckBox\"\n+ // Consent in a form is a checkbox; nothing applies until Create.\n+ FormSection {\n+ objectName: \"createWalletSecuritySection\"\n visible: !root.watchOnly\n Layout.fillWidth: true\n- text: qsTr(\"Encrypt this wallet with a strong password.\")\n- checked: true\n- onCheckedChanged: {\n- if (!checked && acknowledgement.loadedTrailingItem)\n- acknowledgement.loadedTrailingItem.checked = false\n- if (checked && unencryptedAcknowledgement.loadedTrailingItem)\n- unencryptedAcknowledgement.loadedTrailingItem.checked = false\n+ Layout.topMargin: 8\n+ showBackground: false\n+ title: qsTr(\"Security\")\n+ rowSpacing: 16\n+\n+ CheckBox {\n+ id: encryptCheck\n+ objectName: \"createWalletEncryptCheckBox\"\n+ Layout.fillWidth: true\n+ text: qsTr(\"Encrypt this wallet with a strong password.\")\n+ description: qsTr(\"Recommended\")\n+ checked: true\n+ onCheckedChanged: {\n+ if (!checked) acknowledgement.checked = false\n+ if (checked) unencryptedAcknowledgement.checked = false\n+ }\n }\n- }\n- CoreText {\n- visible: !root.watchOnly\n- Layout.fillWidth: true\n- Layout.leftMargin: 30\n- Layout.topMargin: -12\n- text: qsTr(\"Recommended\")\n- color: Theme.color.neutral7\n- font: Theme.text.caption.font\n- horizontalAlignment: Text.AlignLeft\n- }\n \n- PasswordTextField {\n- id: passwordEntry\n- objectName: \"createWalletPasswordEntry\"\n- visible: !root.watchOnly && encryptCheck.checked\n- Layout.fillWidth: true\n- label: qsTr(\"Password\")\n- fieldObjectName: \"createWalletPasswordInput\"\n- placeholderText: qsTr(\"Enter password...\")\n- fieldSurface: true\n- labelSpacing: 6\n- messageSpacing: 8\n- fieldBackgroundColor: Theme.color.neutral2\n- onTextEdited: walletController.clearWalletCreateStatus()\n- }\n- PasswordTextField {\n- id: confirmEntry\n- objectName: \"createWalletConfirmPasswordEntry\"\n- visible: !root.watchOnly && encryptCheck.checked\n- Layout.fillWidth: true\n- label: qsTr(\"Confirm password\")\n- fieldObjectName: \"createWalletPasswordRepeatInput\"\n- placeholderText: qsTr(\"Enter password again...\")\n- fieldSurface: true\n- labelSpacing: 6\n- messageSpacing: 8\n- fieldBackgroundColor: Theme.color.neutral2\n- errorText: text.length > 0 && passwordEntry.text !== text\n- ? qsTr(\"Passwords don't match\") : \"\"\n- onTextEdited: walletController.clearWalletCreateStatus()\n- }\n+ PasswordTextField {\n+ id: passwordEntry\n+ objectName: \"createWalletPasswordEntry\"\n+ visible: encryptCheck.checked\n+ Layout.fillWidth: true\n+ label: qsTr(\"Password\")\n+ fieldObjectName: \"createWalletPasswordInput\"\n+ placeholderText: qsTr(\"Enter password…\")\n+ fieldSurface: true\n+ labelSpacing: 6\n+ messageSpacing: 8\n+ fieldBackgroundColor: Theme.color.surface2\n+ onTextEdited: walletController.clearWalletCreateStatus()\n+ }\n+ PasswordTextField {\n+ id: confirmEntry\n+ objectName: \"createWalletConfirmPasswordEntry\"\n+ visible: encryptCheck.checked\n+ Layout.fillWidth: true\n+ label: qsTr(\"Confirm password\")\n+ fieldObjectName: \"createWalletPasswordRepeatInput\"\n+ placeholderText: qsTr(\"Enter password again…\")\n+ fieldSurface: true\n+ labelSpacing: 6\n+ messageSpacing: 8\n+ fieldBackgroundColor: Theme.color.surface2\n+ errorText: text.length > 0 && passwordEntry.text !== text\n+ ? qsTr(\"Passwords don't match\") : \"\"\n+ onTextEdited: walletController.clearWalletCreateStatus()\n+ }\n \n- ListRow {\n- id: acknowledgement\n- objectName: \"createWalletPasswordConfirmToggle\"\n- visible: !root.watchOnly && encryptCheck.checked\n- Layout.fillWidth: true\n- description: qsTr(\"I understand that if I lose or forget this password I might lose access to the bitcoin stored in this wallet.\")\n- showDivider: false\n- accessibleRole: Accessible.CheckBox\n- trailingItem: OptionSwitch { }\n- onClicked: loadedTrailingItem.toggle()\n- }\n+ CheckBox {\n+ id: acknowledgement\n+ objectName: \"createWalletPasswordConfirmToggle\"\n+ visible: encryptCheck.checked\n+ Layout.fillWidth: true\n+ text: qsTr(\"I understand that if I lose or forget this password I might lose access to the bitcoin stored in this wallet.\")\n+ }\n \n- ListRow {\n- id: unencryptedAcknowledgement\n- objectName: \"createWalletUnencryptedConfirmToggle\"\n- visible: !root.watchOnly && !encryptCheck.checked\n- Layout.fillWidth: true\n- description: qsTr(\"I understand this wallet will be unencrypted. Anyone with access to its file may be able to spend my bitcoin. I cannot set a password later.\")\n- showDivider: false\n- accessibleRole: Accessible.CheckBox\n- trailingItem: OptionSwitch { }\n- onClicked: loadedTrailingItem.toggle()\n+ CheckBox {\n+ id: unencryptedAcknowledgement\n+ objectName: \"createWalletUnencryptedConfirmToggle\"\n+ visible: !encryptCheck.checked\n+ Layout.fillWidth: true\n+ text: qsTr(\"I understand this wallet will be unencrypted. Anyone with access to its file may be able to spend my bitcoin. I cannot set a password later.\")\n+ }\n }\n \n LabeledTextArea {\n@@ -266,12 +257,12 @@ OnboardingView {\n textStyle: Theme.text.monoDescription\n maximumInputHeight: 200\n //: \"listdescriptors\" is a Bitcoin Core command and is not translated.\n- placeholderText: qsTr(\"Paste descriptors one per line, the output of listdescriptors, or an xpub...\")\n+ placeholderText: qsTr(\"Paste descriptors one per line, the output of listdescriptors, or an xpub…\")\n supportingText: root.importSummary()\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n- fieldBackgroundColor: Theme.color.neutral2\n+ fieldBackgroundColor: Theme.color.surface2\n errorText: root.importInfo.status === \"invalid\" ? root.importInfo.error : \"\"\n onTextEdited: walletController.clearWalletLoadStatus()\n }\n@@ -279,15 +270,15 @@ OnboardingView {\n DescriptorHighlighter {\n objectName: \"watchOnlyImportHighlighter\"\n textDocument: root.watchOnly ? xpubEntry.textDocument : null\n- scriptColor: Theme.color.orange\n+ scriptColor: Theme.color.accentText\n originColor: Theme.color.neutral7\n keyColor: Theme.color.neutral9\n keyAlternateColor: Theme.color.neutral7\n- pathColor: Theme.color.blue\n+ pathColor: Theme.color.infoText\n checksumColor: Theme.color.neutral6\n- jsonNameColor: Theme.color.purple\n- jsonValueColor: Theme.color.green\n- errorColor: Qt.rgba(Theme.color.red.r, Theme.color.red.g, Theme.color.red.b, 0.2)\n+ jsonNameColor: Theme.color.syntaxKey\n+ jsonValueColor: Theme.color.neutral8\n+ errorColor: Theme.color.dangerTint\n errorLine: root.importInfo.status === \"invalid\" && root.importInfo.errorLine !== undefined\n ? root.importInfo.errorLine : -1\n }\n@@ -333,7 +324,7 @@ OnboardingView {\n Layout.preferredWidth: importRows.typeWidth\n text: modelData.addressType\n color: Theme.color.neutral8\n- font: Theme.text.caption.font\n+ textStyle: Theme.text.caption\n wrap: false\n horizontalAlignment: Text.AlignLeft\n }\n@@ -342,7 +333,7 @@ OnboardingView {\n Layout.preferredWidth: 1\n text: modelData.key\n color: Theme.color.neutral7\n- font: Theme.text.monoCaption.font\n+ textStyle: Theme.text.monoCaption\n wrap: false\n elide: Text.ElideMiddle\n horizontalAlignment: Text.AlignLeft\n@@ -355,7 +346,7 @@ OnboardingView {\n : modelData.receive && modelData.change ? qsTr(\"receive and change\")\n : modelData.receive ? qsTr(\"receive\") : qsTr(\"change\")\n color: Theme.color.neutral7\n- font: Theme.text.caption.font\n+ textStyle: Theme.text.caption\n wrap: false\n horizontalAlignment: Text.AlignLeft\n }\n@@ -375,7 +366,7 @@ OnboardingView {\n return qsTr(\"created %1\").arg(created)\n }\n color: Theme.color.neutral7\n- font: Theme.text.caption.font\n+ textStyle: Theme.text.caption\n wrap: false\n horizontalAlignment: Text.AlignLeft\n }\n@@ -400,29 +391,15 @@ OnboardingView {\n }\n }\n \n- ColumnLayout {\n+ FormSection {\n objectName: \"watchOnlyAddressType\"\n visible: root.watchOnly && root.needsAddressType\n Layout.fillWidth: true\n- spacing: 10\n-\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"Which addresses does this key use?\")\n- color: Theme.color.neutral8\n- font: Theme.text.description.font\n- horizontalAlignment: Text.AlignLeft\n- }\n-\n- CoreText {\n- Layout.fillWidth: true\n- Layout.topMargin: -6\n- text: qsTr(\"An xpub does not say. Check the wallet it came from.\")\n- color: Theme.color.neutral7\n- font: Theme.text.caption.font\n- wrapMode: Text.WordWrap\n- horizontalAlignment: Text.AlignLeft\n- }\n+ Layout.topMargin: 8\n+ showBackground: false\n+ title: qsTr(\"Which addresses does this key use?\")\n+ description: qsTr(\"An xpub does not say. Check the wallet it came from.\")\n+ rowSpacing: 10\n \n ButtonGroup { id: addressTypeGroup }\n \n@@ -442,25 +419,20 @@ OnboardingView {\n surfaceSelectionStyle: true\n text: modelData.label\n description: descriptions[modelData.id] || \"\"\n- checked: fields.addressTypeChoice === modelData.id\n+ selected: fields.addressTypeChoice === modelData.id\n onClicked: fields.addressTypeChoice = modelData.id\n }\n }\n }\n \n- ColumnLayout {\n+ FormSection {\n objectName: \"watchOnlyBirthDate\"\n visible: root.watchOnly && root.needsBirthDate\n Layout.fillWidth: true\n- spacing: 10\n-\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"When was this wallet created?\")\n- color: Theme.color.neutral8\n- font: Theme.text.description.font\n- horizontalAlignment: Text.AlignLeft\n- }\n+ Layout.topMargin: 8\n+ showBackground: false\n+ title: qsTr(\"When was this wallet created?\")\n+ rowSpacing: 10\n \n ButtonGroup { id: birthGroup }\n \n@@ -481,21 +453,35 @@ OnboardingView {\n surfaceSelectionStyle: true\n text: modelData.text\n description: modelData.description\n- checked: fields.birthChoice === modelData.choice\n+ selected: fields.birthChoice === modelData.choice\n onClicked: fields.birthChoice = modelData.choice\n }\n }\n }\n \n- CoreText {\n- objectName: \"watchOnlyScanNote\"\n+ RowLayout {\n visible: root.watchOnly && root.creating\n Layout.fillWidth: true\n- text: qsTr(\"Looking for this wallet's transactions. This can take a while.\")\n- color: Theme.color.neutral7\n- font: Theme.text.caption.font\n- wrapMode: Text.WordWrap\n- horizontalAlignment: Text.AlignLeft\n+ spacing: 8\n+\n+ SpinningIndicator {\n+ Layout.alignment: Qt.AlignTop\n+ running: parent.visible\n+ color: Theme.color.neutral7\n+ }\n+ CoreText {\n+ objectName: \"watchOnlyScanNote\"\n+ Layout.fillWidth: true\n+ text: walletController.importProgress >= 0\n+ //: %1 is how much of the blockchain has been searched, in percent.\n+ ? qsTr(\"Looking for this wallet's transactions, %1% done. Cancelling deletes the new wallet.\")\n+ .arg(walletController.importProgress)\n+ \n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 244,
"evidence_id": "2bd8248cc3614e219fce760276b36b74",
"finding_id": "finding:12",
"kind": "new_source",
"line": 95,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/pages/wallet/CreateWalletForm.qml",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " if (loadedChildView) loadedChildView.clearSecrets()\n }\n\n title: \"\"\n heading: watchOnly ? qsTr(\"Watch-only wallet\") : qsTr(\"Single-key wallet\")\n subheading: watchOnly\n ? qsTr(\"See balances and activity without keeping spending keys in this app. An external signer is needed to spend.\")\n : qsTr(\"You can control it in this application.\\nWallet data will be stored locally in your hard drive.\")\n maximumContentWidth: 800\n showBackButton: !creating && navigationStack\n ? (navigationStack.canGoBack !== undefined\n ? navigationStack.canGoBack : navigationStack.depth > 1) : false\n showCloseButton: modalView && !creating\n primaryButtonText: creating ? (watchOnly ? qsTr(\"Importing…\") : qsTr(\"Creating…\")) : qsTr(\"Create wallet\")\n primaryButtonObjectName: \"createWalletFormCreateButton\"\n primaryButtonEnabled: canCreate\n readonly property bool importRunning: watchOnly && creating && walletController.walletLoadInProgress\n secondaryButtonText: importRunning ? qsTr(\"Cancel import\") : \"\"\n secondaryButtonObjectName: \"createWalletFormCancelImportButton\"\n onSecondaryClicked: walletController.cancelViewOnlyImport()\n onCloseClicked: root.cancel()\n onPrimaryClicked: {\n if (!root.canCreate) return\n if (root.watchOnly || root.loadedChildView.encryptWallet) root.submit()\n else root.loadedChildView.openUnencryptedWarning()\n }\n\n // Choices made for one key or set of descriptors do not carry over to another.\n onImportIdChanged: {\n if (importId.length === 0) return\n if (previousImportId.length > 0 && importId !== previousImportId && loadedChildView) {\n loadedChildView.addressTypeChoice = \"\"\n loadedChildView.birthChoice = \"\"\n }\n previousImportId = importId\n }\n\n Component.onCompleted: {\n walletController.clearWalletCreateStatus()\n walletController.clearWalletLoadStatus()\n }\n Component.onDestruction: clearSecrets()\n\n childView: ColumnLayout {\n id: fields\n property alias walletName: nameEntry.text\n property alias importText: xpubEntry.text\n property string addressTypeChoice: \"\"\n property string birthChoice: \"\"\n property alias encryptWallet: encryptCheck.checked\n property alias passwordText: passwordEntry.text\n property alias confirmText: confirmEntry.text\n readonly property bool passwordLossAcknowledged: acknowledgement.checked\n readonly property bool unencryptedWalletAcknowledged: unencryptedAcknowledgement.checked\n\n function clearSecrets() {\n passwordEntry.text = \"\"\n confirmEntry.text = \"\"\n }\n function openUnencryptedWarning() {\n unencryptedWarning.open()\n }\n\n spacing: 16\n\n LabeledTextField {\n id: nameEntry\n objectName: \"createWalletNameEntry\"\n Layout.fillWidth: true\n label: qsTr(\"Wallet name\")\n fieldObjectName: \"createWalletNameInput\"\n placeholderText: qsTr(\"e.g. My bitcoin wallet\")\n supportingText: qsTr(\"You cannot change this later.\")\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n fieldBackgroundColor: Theme.color.surface2\n onTextEdited: {\n root.nameError = \"\"\n walletController.clearWalletCreateStatus()\n walletController.clearWalletLoadStatus()\n }\n }\n\n // Consent in a form is a checkbox; nothing applies until Create.\n FormSection {\n objectName: \"createWalletSecuritySection\"\n visible: !root.watchOnly\n Layout.fillWidth: true\n Layout.topMargin: 8\n showBackground: false\n title: qsTr(\"Security\")\n rowSpacing: 16\n\n CheckBox {\n id: encryptCheck\n objectName: \"createWalletEncryptCheckBox\"\n Layout.fillWidth: true\n text: qsTr(\"Encrypt this wallet with a strong password.\")\n description: qsTr(\"Recommended\")\n checked: true\n onCheckedChanged: {\n if (!checked) acknowledgement.checked = false\n if (checked) unencryptedAcknowledgement.checked = false\n }\n }\n\n PasswordTextField {\n id: passwordEntry\n objectName: \"createWalletPasswordEntry\"\n visible: encryptCheck.checked\n Layout.fillWidth: true\n label: qsTr(\"Password\")\n fieldObjectName: \"createWalletPasswordInput\"\n placeholderText: qsTr(\"Enter password…\")\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n fieldBackgroundColor: Theme.color.surface2\n onTextEdited: walletController.clearWalletCreateStatus()\n }\n PasswordTextField {\n id: confirmEntry\n objectName: \"createWalletConfirmPasswordEntry\"\n visible: encryptCheck.checked\n Layout.fillWidth: true\n label: qsTr(\"Confirm password\")\n fieldObjectName: \"createWalletPasswordRepeatInput\"\n placeholderText: qsTr(\"Enter password again…\")\n fieldSurface: true\n labelSpacing: 6\n messageSpacing: 8\n fieldBackgroundColor: Theme.color.surface2\n errorText: text.length > 0 && passwordEntry.text !== text\n ? qsTr(\"Passwords don't match\") : \"\"\n onTextEdited: walletController.clearWalletCreateStatus()\n }\n\n CheckBox {\n id: acknowledgement\n objectName: \"createWalletPasswordConfirmToggle\"\n visible: encryptCheck.checked\n Layout.fillWidth: true\n text: qsTr(\"I understand that if I lose or forget this password I might lose access to the bitcoin stored in this wallet.\")\n }\n\n CheckBox {\n id: unencryptedAcknowledgement\n objectName: \"createWalletUnencryptedConfirmToggle\"\n visible: !encryptCheck.checked",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | A mistyped origin-prefixed key receives a JSON errorqml/viewonlyimport.cpp | addressed | AssessmentWhen the origin expression matches but the key is unrecognized, parsing now returns an extended-public-key validity error instead of routing the input to JSON parsing. path_diff: qml/viewonlyimport.cpp; new_source: qml/viewonlyimport.cpp [
{
"evidence_id": "be2ee9176cbf4d5dbe849256b1516c67",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/viewonlyimport.cpp b/qml/viewonlyimport.cpp\nindex b13465cde8..4dbb3041d2 100644\n--- a/qml/viewonlyimport.cpp\n+++ b/qml/viewonlyimport.cpp\n@@ -24,6 +24,7 @@\n #include <array>\n #include <exception>\n #include <iterator>\n+#include <map>\n #include <optional>\n #include <set>\n #include <string>\n@@ -40,6 +41,8 @@ struct DescriptorCheck {\n bool ranged{false};\n bool change_chain{false};\n ViewOnlyImport::Source source;\n+ //! One per path, without checksum and with h for hardened steps.\n+ std::vector<std::string> paths;\n };\n \n // A comma would mean more keys or a script tree.\n@@ -54,6 +57,12 @@ QString KeyLabel(const std::string& descriptor)\n return match.captured(1).isEmpty() ? match.captured(2) : match.captured(1);\n }\n \n+QString KeyId(const std::string& descriptor)\n+{\n+ const QRegularExpressionMatch match{SCRIPT_KEY.match(QString::fromStdString(descriptor))};\n+ return match.captured(1) + match.captured(2);\n+}\n+\n // Parse derives public keys from private ones, which needs the signing\n // context, so private keys are found before parsing.\n bool HasPrivateKey(const std::string& descriptor)\n@@ -81,6 +90,11 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n check.error = QObject::tr(\"This includes a private key. Use the public descriptor instead.\");\n return check;\n }\n+ // The wallet only splits two paths into receive and change. More would all be receive.\n+ if (parsed.size() > 2) {\n+ check.error = QObject::tr(\"Only two paths, like <0;1> for receive and change, can be imported from one descriptor.\");\n+ return check;\n+ }\n for (const auto& desc : parsed) {\n std::set<CPubKey> pubkeys;\n std::set<CExtPubKey> ext_pubs;\n@@ -92,12 +106,23 @@ DescriptorCheck CheckDescriptor(const std::string& descriptor)\n return check;\n }\n if (std::ranges::find(check.types, *type) == check.types.end()) check.types.push_back(*type);\n+ std::string path{desc->ToString()};\n+ path = path.substr(0, path.find('#'));\n+ std::ranges::replace(path, '\\'', 'h');\n+ check.paths.push_back(std::move(path));\n+ // The wallet derives the first address on import.\n+ FlatSigningProvider derived;\n+ std::vector<CScript> scripts;\n+ if (!desc->Expand(0, keys, scripts, derived)) {\n+ check.error = QObject::tr(\"This derives hardened keys after a public key, which needs the private key. Use the key from after the hardened steps.\");\n+ return check;\n+ }\n }\n check.count = parsed.size();\n check.ranged = parsed.front()->IsRange();\n check.change_chain = parsed.size() == 1 &&\n CHANGE_CHAIN.match(QString::fromStdString(parsed.front()->ToString())).hasMatch();\n- check.source = {check.types.front(), KeyLabel(descriptor), check.ranged, parsed.size() > 1};\n+ check.source = {check.types.front(), KeyLabel(descriptor), KeyId(descriptor), check.ranged, parsed.size() > 1};\n // The wallet's importer requires a checksum.\n check.descriptor = descriptor.find('#') == std::string::npos\n ? descriptor + \"#\" + GetDescriptorChecksum(descriptor)\n@@ -145,6 +170,8 @@ ViewOnlyImport ParseJson(const std::string& text)\n \n ViewOnlyImport result;\n result.kind = Kind::DescriptorJson;\n+ //! Whether each path is active, and change.\n+ std::map<std::string, std::pair<bool, bool>> path_settings;\n for (size_t i = 0; i < list.size(); ++i) {\n //: %1 is the position of a descriptor in a pasted list.\n const QString position{QObject::tr(\"Descriptor %1\").arg(i + 1)};\n@@ -179,6 +206,35 @@ ViewOnlyImport ParseJson(const std::string& text)\n const UniValue& next{next_index.isNull() ? entry.find_value(\"next\") : next_index};\n if (!next.isNull()) request.next_index = next.getInt<int64_t>();\n \n+ // The same checks the wallet makes, before the wallet file is created.\n+ const bool multipath{check.count > 1};\n+ if (request.active && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 is active, but only a ranged descriptor can be.\").arg(position));\n+ }\n+ if (request.range && !check.ranged) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a range, but it is not ranged.\").arg(position));\n+ }\n+ if (request.internal && multipath) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has receive and change paths, so it can't also set \\\"internal\\\".\").arg(position));\n+ }\n+ if (!request.label.empty() && (check.ranged || multipath || request.internal.value_or(false))) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a label, but only a single receive address can have one.\").arg(position));\n+ }\n+ if (check.ranged && request.next_index) {\n+ const int64_t first{request.range ? request.range->first : 0};\n+ if (*request.next_index < first || (request.range && *request.next_index > request.range->second)) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 has a next index outside its range.\").arg(position));\n+ }\n+ }\n+ // The wallet applies a repeated descriptor again, so a later copy can turn off an earlier one.\n+ for (size_t p = 0; p < check.paths.size(); ++p) {\n+ const std::pair settings{request.active, multipath ? p == 1 : request.internal.value_or(false)};\n+ const auto [it, added]{path_settings.try_emplace(check.paths[p], settings)};\n+ if (!added && it->second != settings) {\n+ return Failed(Kind::DescriptorJson, QObject::tr(\"%1 repeats an earlier descriptor with other settings.\").arg(position));\n+ }\n+ }\n+\n result.requests.push_back(std::move(request));\n result.sources.push_back(check.source);\n AddTypes(result, check);\n@@ -339,7 +395,8 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n- std::optional<OutputType> type{key.type ? key.type : PurposeType(path)};\n+ const std::optional<OutputType> path_type{PurposeType(path)};\n+ std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n@@ -349,6 +406,12 @@ ViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, c\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n+ result.key_id = origin + QString::fromStdString(key.key);\n+ if (key.type && path_type && *key.type != *path_type) {\n+ //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n+ result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n+ .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n+ }\n return result;\n }\n \n@@ -365,6 +428,10 @@ ViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_t\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n+ // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n+ if (origin.hasMatch()) {\n+ return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n+ }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n@@ -395,8 +462,36 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n+ // An address type has one active receive and one active change descriptor.\n+ // The wallet activates requests in order, so a later one replaces an earlier one.\n+ std::map<std::pair<OutputType, bool>, size_t> active_slots;\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ const ImportDescriptorRequest& request{parsed.requests[i]};\n+ if (!request.active) continue;\n+ const OutputType type{parsed.sources[i].type};\n+ if (parsed.sources[i].multipath) {\n+ active_slots[{type, false}] = i;\n+ active_slots[{type, true}] = i;\n+ } else {\n+ active_slots[{type, request.internal.value_or(false)}] = i;\n+ }\n+ }\n+ std::vector<bool> active(parsed.requests.size(), false);\n+ for (const auto& [slot, index] : active_slots) active[index] = true;\n+ QString warning{parsed.warning};\n+ if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n+ bool watches_change{false};\n+ for (size_t i = 0; i < parsed.requests.size(); ++i) {\n+ watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n+ }\n+ warning = watches_change\n+ ? QObject::tr(\"No change descriptor is active, so this wallet can't prepare a transaction that needs change.\")\n+ : QObject::tr(\"Nothing here is for change addresses. Payments to the other wallet's change won't show, and this wallet can't prepare a transaction that needs change.\");\n+ }\n+\n // Receive and change of one key share a row.\n QVariantList rows;\n+ QStringList row_keys;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n const ViewOnlyImport::Source& source{parsed.sources[i]};\n@@ -406,18 +501,21 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n if (time) created = std::min(created.value_or(*time), *time);\n \n const QString type{QmlUtil::OutputTypeLabel(source.type)};\n- const auto same_row = [&](const QVariant& row) {\n- const QVariantMap map{row.toMap()};\n- return map.value(QStringLiteral(\"addressType\")) == type && map.value(QStringLiteral(\"key\")) == source.key &&\n- map.value(QStringLiteral(\"active\")) == request.active && map.value(QStringLiteral(\"ranged\")) == source.ranged;\n- };\n- auto row_it{std::ranges::find_if(rows, same_row)};\n+ auto row_it{rows.begin()};\n+ for (; row_it != rows.end(); ++row_it) {\n+ const QVariantMap map{row_it->toMap()};\n+ if (map.value(QStringLiteral(\"addressType\")) == type && row_keys[std::distance(rows.begin(), row_it)] == source.key_id &&\n+ map.value(QStringLiteral(\"active\")) == bool(active[i]) && map.value(QStringLiteral(\"ranged\")) == source.ranged) {\n+ break;\n+ }\n+ }\n if (row_it == rows.end()) {\n+ row_keys.append(source.key_id);\n rows.append(QVariantMap{{QStringLiteral(\"addressType\"), type},\n {QStringLiteral(\"key\"), source.key},\n {QStringLiteral(\"receive\"), false},\n {QStringLiteral(\"change\"), false},\n- {QStringLiteral(\"active\"), request.active},\n+ {QStringLiteral(\"active\"), bool(active[i])},\n {QStringLiteral(\"ranged\"), source.ranged},\n {QStringLiteral(\"createdTime\"), qlonglong(-1)}});\n row_it = std::prev(rows.end());\n@@ -432,6 +530,9 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n }\n *row_it = row;\n }\n+ QStringList descriptors;\n+ for (const ImportDescriptorRequest& request : parsed.requests) descriptors.append(QString::fromStdString(request.descriptor));\n+ result.insert(QStringLiteral(\"importId\"), parsed.kind == Kind::ExtendedKey ? parsed.key_id : descriptors.join(QLatin1Char('\\n')));\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"valid\"));\n result.insert(QStringLiteral(\"descriptorCount\"), qulonglong(parsed.descriptor_count));\n result.insert(QStringLiteral(\"addressTypes\"), address_types);\n@@ -439,6 +540,7 @@ QVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_t\n result.insert(QStringLiteral(\"needsBirthDate\"), !parsed.undated.empty() || (parsed.needs_address_type && parsed.requests.empty()));\n result.insert(QStringLiteral(\"createdTime\"), qlonglong(created.value_or(-1)));\n result.insert(QStringLiteral(\"needsAddressType\"), parsed.needs_address_type);\n+ result.insert(QStringLiteral(\"warning\"), warning);\n result.insert(QStringLiteral(\"rows\"), rows);\n if (parsed.needs_address_type) {\n QVariantList options;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 487,
"evidence_id": "798157ef2ea0435084cbbb6afb77fa73",
"finding_id": "finding:10",
"kind": "new_source",
"line": 338,
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/viewonlyimport.cpp",
"revision": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"source_generation": 1,
"source_job_id": 2825,
"text": " return std::equal(known.version.begin(), known.version.end(), data.begin());\n })};\n if (known == KNOWN_KEY_VERSIONS.end()) return {};\n\n ExtendedKey result;\n result.recognized = true;\n if (known->is_private) {\n result.error = QObject::tr(\"This is a private key. Enter the extended public key instead.\");\n return result;\n }\n if (known->multisig) {\n result.error = QObject::tr(\"This key is from a multisig wallet. Only single-key wallets can be imported.\");\n return result;\n }\n const std::vector<unsigned char>& prefix{Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY)};\n const KeyVersion& mainnet{KNOWN_KEY_VERSIONS.front().version};\n if (known->test == std::equal(mainnet.begin(), mainnet.end(), prefix.begin(), prefix.end())) {\n result.error = QObject::tr(\"This key is for a different network.\");\n return result;\n }\n std::copy(prefix.begin(), prefix.end(), data.begin());\n result.key = EncodeBase58Check(data);\n if (!DecodeExtPubKey(result.key).pubkey.IsValid()) {\n result.error = QObject::tr(\"This extended public key is not valid.\");\n return result;\n }\n result.type = known->type;\n return result;\n}\n\nstd::optional<OutputType> PurposeType(const QString& path)\n{\n const QRegularExpressionMatch match{ORIGIN_PURPOSE.match(path)};\n if (!match.hasMatch()) return std::nullopt;\n switch (match.captured(1).toInt()) {\n case 44: return OutputType::LEGACY;\n case 49: return OutputType::P2SH_SEGWIT;\n case 84: return OutputType::BECH32;\n case 86: return OutputType::BECH32M;\n }\n return std::nullopt;\n}\n\nQString WrapKey(OutputType type, const QString& key)\n{\n switch (type) {\n case OutputType::LEGACY: return QStringLiteral(\"pkh(%1)\").arg(key);\n case OutputType::P2SH_SEGWIT: return QStringLiteral(\"sh(wpkh(%1))\").arg(key);\n case OutputType::BECH32: return QStringLiteral(\"wpkh(%1)\").arg(key);\n case OutputType::BECH32M: return QStringLiteral(\"tr(%1)\").arg(key);\n case OutputType::UNKNOWN: break;\n }\n return {};\n}\n\nViewOnlyImport ParseExtendedKey(const ExtendedKey& key, const QString& origin, const QString& path, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n if (!key.error.isEmpty()) return Failed(Kind::ExtendedKey, key.error);\n // The key's prefix wins, then a BIP44, 49, 84 or 86 path.\n const std::optional<OutputType> path_type{PurposeType(path)};\n std::optional<OutputType> type{key.type ? key.type : path_type};\n const bool needs_address_type{!type};\n if (!type && !address_type.isEmpty()) {\n type = ParseOutputType(address_type.toStdString());\n if (!type || *type == OutputType::UNKNOWN) return Failed(Kind::ExtendedKey, QObject::tr(\"Choose a valid address type.\"));\n }\n ViewOnlyImport result;\n if (type) result = ParseLines({WrapKey(*type, origin + QString::fromStdString(key.key) + QStringLiteral(\"/<0;1>/*\"))});\n result.kind = Kind::ExtendedKey;\n result.needs_address_type = needs_address_type;\n result.key_id = origin + QString::fromStdString(key.key);\n if (key.type && path_type && *key.type != *path_type) {\n //: %1 and %2 are address types, such as \"Bech32 (SegWit)\".\n result.warning = QObject::tr(\"The key's prefix says %1, but its origin path says %2. It is imported as %1. Check the wallet it came from.\")\n .arg(QmlUtil::OutputTypeLabel(*key.type), QmlUtil::OutputTypeLabel(*path_type));\n }\n return result;\n}\n\n} // namespace\n\nViewOnlyImport ParseViewOnlyImport(const QString& text, const QString& address_type)\n{\n const QString trimmed{text.trimmed()};\n if (trimmed.isEmpty()) return {};\n\n const QRegularExpressionMatch origin{KEY_ORIGIN.match(trimmed)};\n const QString key_text{origin.hasMatch() ? origin.captured(3) : trimmed};\n if (const ExtendedKey key{ReadExtendedKey(key_text.toStdString())}; key.recognized) {\n const QString origin_text{origin.hasMatch() ? QStringLiteral(\"[%1%2]\").arg(origin.captured(1), origin.captured(2)) : QString{}};\n return ParseExtendedKey(key, origin_text, origin.captured(2), address_type);\n }\n // Only a key fits after a key origin, so this is a mistyped key rather than JSON.\n if (origin.hasMatch()) {\n return Failed(ViewOnlyImport::Kind::ExtendedKey, QObject::tr(\"This extended public key is not valid.\"));\n }\n if (trimmed.startsWith(QLatin1Char('[')) || trimmed.startsWith(QLatin1Char('{'))) {\n return ParseJson(trimmed.toStdString());\n }\n return ParseLines(text.split(QLatin1Char('\\n')));\n}\n\nQVariantMap DescribeViewOnlyImport(const QString& text, const QString& address_type)\n{\n using Kind = ViewOnlyImport::Kind;\n const ViewOnlyImport parsed{ParseViewOnlyImport(text, address_type)};\n QVariantMap result;\n if (parsed.kind == Kind::Empty) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"empty\"));\n return result;\n }\n const QString kind{parsed.kind == Kind::ExtendedKey ? QStringLiteral(\"extendedKey\")\n : parsed.kind == Kind::Descriptors ? QStringLiteral(\"descriptors\")\n : QStringLiteral(\"descriptorJson\")};\n result.insert(QStringLiteral(\"kind\"), kind);\n if (!parsed.error.isEmpty()) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"invalid\"));\n result.insert(QStringLiteral(\"error\"), parsed.error);\n result.insert(QStringLiteral(\"errorLine\"), parsed.error_line);\n return result;\n }\n\n QStringList address_types;\n for (const OutputType type : parsed.output_types) address_types.append(QmlUtil::OutputTypeLabel(type));\n const int64_t now{QDateTime::currentSecsSinceEpoch()};\n std::optional<int64_t> created;\n // An address type has one active receive and one active change descriptor.\n // The wallet activates requests in order, so a later one replaces an earlier one.\n std::map<std::pair<OutputType, bool>, size_t> active_slots;\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n const ImportDescriptorRequest& request{parsed.requests[i]};\n if (!request.active) continue;\n const OutputType type{parsed.sources[i].type};\n if (parsed.sources[i].multipath) {\n active_slots[{type, false}] = i;\n active_slots[{type, true}] = i;\n } else {\n active_slots[{type, request.internal.value_or(false)}] = i;\n }\n }\n std::vector<bool> active(parsed.requests.size(), false);\n for (const auto& [slot, index] : active_slots) active[index] = true;\n QString warning{parsed.warning};\n if (warning.isEmpty() && std::ranges::none_of(active_slots, [](const auto& slot) { return slot.first.second; })) {\n bool watches_change{false};\n for (size_t i = 0; i < parsed.requests.size(); ++i) {\n watches_change |= parsed.sources[i].multipath || parsed.requests[i].internal.value_or(false);\n }\n warning = watches_change",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1144 | Quitting during the import rescan retains incomplete wallet historyqml/walletqmlcontroller.cpp | addressed | AssessmentThe new code persists the import’s earliest rescan time before descriptor import, treats shutdown interruption as an error so the newly created wallet is discarded, and resumes pending rescans when a wallet model is registered. A functional regression case exercises restart recovery. path_diff: qml/walletqmlcontroller.cpp [
{
"evidence_id": "239f8e88b1f64a67a81d32a3efa7ba1d",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "c6ff067c1dff9e21a9623ca4347013b5ec600481",
"old_head": "0cc560f091e3d6d3137c8e3d9d63bbd83cd9e9e3",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 1,
"source_job_id": 2825,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex 23dab27ab4..452a87cf64 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -14,10 +14,14 @@\n #include <common/settings.h>\n #include <interfaces/chain.h>\n #include <interfaces/node.h>\n+#include <interfaces/wallet.h>\n #include <support/allocators/secure.h>\n #include <univalue.h>\n+#include <util/fs.h>\n #include <util/result.h>\n+#include <wallet/context.h>\n #include <wallet/imports.h>\n+#include <wallet/scan.h>\n #include <wallet/walletutil.h>\n #include <wallet/wallet.h>\n #include <util/translation.h>\n@@ -25,15 +29,21 @@\n \n #include <algorithm>\n #include <atomic>\n+#include <memory>\n #include <mutex>\n #include <optional>\n #include <stdexcept>\n+#include <system_error>\n #include <utility>\n+#include <vector>\n \n+#include <QByteArray>\n+#include <QDateTime>\n #include <QDir>\n #include <QDesktopServices>\n #include <QFileInfo>\n #include <QMetaObject>\n+#include <QPointer>\n #include <QRegularExpression>\n #include <QSettings>\n #include <QStringList>\n@@ -81,22 +91,79 @@ bool ErrorContains(const QString& error, const QString& needle)\n }\n \n // The import rescans from the oldest timestamp, which a pruned node may no longer have.\n-bool ScanBlocksPruned(interfaces::Wallet& wallet, const std::vector<wallet::ImportDescriptorRequest>& requests)\n+bool ScanBlocksPruned(interfaces::Chain& chain, std::optional<int64_t> oldest)\n {\n- wallet::CWallet* raw_wallet{wallet.wallet()};\n- if (!raw_wallet) return false;\n- interfaces::Chain& chain{raw_wallet->chain()};\n if (!chain.havePruned()) return false;\n- std::optional<int64_t> oldest;\n- for (const auto& request : requests) {\n- if (request.timestamp) oldest = std::min(oldest.value_or(*request.timestamp), *request.timestamp);\n- }\n int height{0};\n if (!oldest || !chain.findFirstBlockWithTimeAndHeight(*oldest - TIMESTAMP_WINDOW, 0, interfaces::FoundBlock().height(height))) {\n return false;\n }\n- const uint256 tip{WITH_LOCK(raw_wallet->cs_wallet, return raw_wallet->GetLastBlockHash())};\n- return !chain.hasBlocks(tip, height);\n+ const std::optional<int> prune_height{chain.getPruneHeight()};\n+ return prune_height && height <= *prune_height;\n+}\n+\n+// remove() only unloads the wallet. Its files are deleted too, so the name can be used again.\n+void DiscardCreatedWallet(interfaces::WalletLoader& loader, std::unique_ptr<interfaces::Wallet> wallet)\n+{\n+ const std::string name{wallet->getWalletName()};\n+ wallet::WalletContext* context{loader.context()};\n+ std::shared_ptr<wallet::CWallet> shared{context ? wallet::GetWallet(*context, name) : nullptr};\n+ wallet->remove();\n+ wallet.reset();\n+ if (!shared) return;\n+ std::vector<fs::path> paths{shared->GetDatabase().Files()};\n+ if (!name.empty() && !paths.empty()) paths.push_back(paths.front().parent_path());\n+ // The database closes once the last reference is gone.\n+ wallet::WaitForDeleteWallet(std::move(shared));\n+ std::error_code error;\n+ // A directory is only removed when empty.\n+ for (const fs::path& path : paths) fs::remove(path, error);\n+}\n+\n+// A view-only import saves its descriptors before it rescans. The wallet's\n+// best block is already the tip then, so after a crash it would load without\n+// the older transactions. This records where the rescan starts until it ends.\n+QString PendingImportKey(const std::string& wallet_name)\n+{\n+ return QStringLiteral(\"pendingViewOnlyImports/%1\").arg(QString::fromLatin1(QByteArray::fromStdString(wallet_name).toHex()));\n+}\n+\n+void SetPendingImport(const std::string& wallet_name, std::optional<int64_t> time)\n+{\n+ QSettings settings;\n+ if (time) {\n+ settings.setValue(PendingImportKey(wallet_name), qlonglong(*time));\n+ } else {\n+ settings.remove(PendingImportKey(wallet_name));\n+ }\n+ settings.sync();\n+}\n+\n+std::optional<int64_t> PendingImport(const std::string& wallet_name)\n+{\n+ const QVariant time{QSettings{}.value(PendingImportKey(wallet_name))};\n+ return time.isValid() ? std::optional<int64_t>{time.toLongLong()} : std::nullopt;\n+}\n+\n+bool ResumeImport(interfaces::Node& node, const std::string& wallet_name, int64_t time, RescanControl& control)\n+{\n+ wallet::WalletContext* context{node.walletLoader().context()};\n+ const std::shared_ptr<wallet::CWallet> wallet{context ? wallet::GetWallet(*context, wallet_name) : nullptr};\n+ if (!wallet) return false;\n+ wallet::WalletRescanReserver reserver{*wallet};\n+ if (!reserver.reserve()) return false;\n+ if (!control.attach([&wallet] { wallet->Scanner().Abort(); })) return false;\n+ int start_height{0};\n+ uint256 start_block;\n+ bool done{!wallet->chain().findFirstBlockWithTimeAndHeight(time - TIMESTAMP_WINDOW, 0,\n+ interfaces::FoundBlock().hash(start_block).height(start_height))};\n+ if (!done) {\n+ // Progress is saved, so a later load continues from where this stopped too.\n+ done = wallet->Scanner().Scan(start_block, start_height, /*max_height=*/{}, reserver, /*save_progress=*/true).status ==\n+ wallet::ScanResult::SUCCESS;\n+ }\n+ control.detach();\n+ return done;\n }\n \n QString ImportErrorText(const wallet::ImportError& error)\n@@ -106,6 +173,33 @@ QString ImportErrorText(const wallet::ImportError& error)\n }\n } // namespace\n \n+bool RescanControl::attach(std::function<void()> abort)\n+{\n+ const std::lock_guard lock{m_mutex};\n+ if (m_cancelled) return false;\n+ m_abort = std::move(abort);\n+ return true;\n+}\n+\n+void RescanControl::detach()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_abort = nullptr;\n+}\n+\n+void RescanControl::cancel()\n+{\n+ const std::lock_guard lock{m_mutex};\n+ m_cancelled = true;\n+ if (m_abort) m_abort();\n+}\n+\n+bool RescanControl::cancelled() const\n+{\n+ const std::lock_guard lock{m_mutex};\n+ return m_cancelled;\n+}\n+\n WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)\n : QObject(parent)\n , m_node(node)\n@@ -120,6 +214,9 @@ WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent\n , m_open_local_path_fn([](const QString& path) {\n return QDesktopServices::openUrl(QUrl::fromLocalFile(path));\n })\n+ , m_resume_import_fn([&node](const std::string& wallet_name, int64_t time, RescanControl& control) {\n+ return ResumeImport(node, wallet_name, time, control);\n+ })\n {\n m_empty_wallet->setNode(&m_node);\n m_wallet_command_executor->setObjectName(QStringLiteral(\"wallet-commands\"));\n@@ -372,6 +469,8 @@ void WalletQmlController::beginShutdown()\n const auto wallets = m_wallets;\n for (auto* wallet : wallets) removeWalletModel(wallet);\n retireWallet(m_empty_wallet, false);\n+ for (const auto& [name, control] : m_import_rescans) control->cancel();\n+ if (m_import_rescan_executor) m_import_rescan_executor->shutdown();\n m_notification_cleanup_executor = std::make_unique<BackendExecutor>();\n m_notification_cleanup_executor->setObjectName(QStringLiteral(\"wallet-notifications\"));\n connect(m_notification_cleanup_executor.get(), &BackendExecutor::drained, this, [this] {\n@@ -407,7 +506,8 @@ void WalletQmlController::retireWallet(WalletQmlModel* model, bool remove)\n \n void WalletQmlController::checkShutdownFinished()\n {\n- if (m_shutting_down && m_controller_drained && m_notifications_drained && m_retiring_wallets.empty() && !m_shutdown_complete) {\n+ if (m_shutting_down && m_controller_drained && m_notifications_drained && m_import_rescans_drained &&\n+ m_retiring_wallets.empty() && !m_shutdown_complete) {\n m_shutdown_complete = true;\n Q_EMIT walletsDrained();\n }\n@@ -418,6 +518,32 @@ void WalletQmlController::registerWalletModel(WalletQmlModel* wallet_model)\n connect(wallet_model, &WalletQmlModel::walletUnloaded, this, [this, wallet_model]() {\n removeWalletModel(wallet_model);\n }, Qt::QueuedConnection);\n+ resumeInterruptedImport(wallet_model);\n+}\n+\n+void WalletQmlController::resumeInterruptedImport(WalletQmlModel* wallet_model)\n+{\n+ const QString name{wallet_model->name()};\n+ const std::optional<int64_t> time{PendingImport(name.toStdString())};\n+ if (!time) return;\n+ if (!m_import_rescan_executor) {\n+ m_import_rescan_executor = std::make_unique<BackendExecutor>();\n+ m_import_rescan_executor->setObjectName(QStringLiteral(\"wallet-import-rescan\"));\n+ m_import_rescans_drained = false;\n+ connect(m_import_rescan_executor.get(), &BackendExecutor::drained, this, [this] {\n+ m_import_rescans_drained = true;\n+ checkShutdownFinished();\n+ });\n+ }\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_rescans[name] = control;\n+ m_import_rescan_executor->submit(this, [resume = m_resume_import_fn, name = name.toStdString(), time = *time, control] {\n+ // Stays pending when the rescan stops early, so the next load tries again.\n+ if (resume(name, time, *control)) SetPendingImport(name, std::nullopt);\n+ }, [this, name, control] {\n+ const auto it{m_import_rescans.find(name)};\n+ if (it != m_import_rescans.end() && it->second == control) m_import_rescans.erase(it);\n+ });\n }\n \n void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool remove)\n@@ -457,6 +583,7 @@ void WalletQmlController::removeWalletModel(WalletQmlModel* wallet_model, bool r\n WalletListModel::LoadState::Closed,\n QString{});\n setWalletLoaded(next_selected_wallet != nullptr);\n+ if (const auto it{m_import_rescans.find(wallet_name)}; it != m_import_rescans.end()) it->second->cancel();\n retireWallet(wallet_model, remove);\n }\n \n@@ -524,7 +651,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n uint64_t wallet_creation_flags,\n WalletLoadAction load_action,\n bool report_create_error,\n- WalletSetupFn setup_wallet)\n+ WalletSetupFn setup_wallet,\n+ WalletCheckFn check_before_create)\n {\n const QString wallet_name = name.trimmed();\n if (setup_wallet) {\n@@ -533,8 +661,13 @@ void WalletQmlController::createWalletAsync(const QString& name,\n setWalletLoadInProgress(true);\n \n m_wallet_command_executor->submit(this, [node = &m_node, wallet_name, passphrase = std::move(passphrase),\n- wallet_creation_flags, setup_wallet = std::move(setup_wallet)]() mutable {\n+ wallet_creation_flags, setup_wallet = std::move(setup_wallet),\n+ check_before_create = std::move(check_before_create)]() mutable {\n WalletCommandResult out;\n+ if (check_before_create && !(out.error = check_before_create()).isEmpty()) {\n+ QmlUtil::ClearSecureString(passphrase);\n+ return out;\n+ }\n std::vector<bilingual_str> warnings;\n auto wallet = node->walletLoader().createWallet(wallet_name.toStdString(), passphrase, wallet_creation_flags, warnings);\n QmlUtil::ClearSecureString(passphrase);\n@@ -544,7 +677,8 @@ void WalletQmlController::createWalletAsync(const QString& name,\n out.error = QString::fromStdString(error.translated.empty() ? error.original : error.translated);\n if (out.error.isEmpty()) out.error = tr(\"Wallet creation failed.\");\n } else if (setup_wallet && !(out.error = setup_wallet(**wallet)).isEmpty()) {\n- (*wallet)->remove();\n+ DiscardCreatedWallet(node->walletLoader(), std::move(*wallet));\n+ SetPendingImport(wallet_name.toStdString(), std::nullopt);\n } else {\n out.wallet = std::move(*wallet);\n }\n@@ -684,19 +818,61 @@ void WalletQmlController::createWatchOnlyWallet(const QString& name, const QStri\n const uint64_t creation_flags = wallet::WALLET_FLAG_DISABLE_PRIVATE_KEYS |\n wallet::WALLET_FLAG_DESCRIPTORS |\n wallet::WALLET_FLAG_BLANK_WALLET;\n+ // Only undated requests take the chosen date, so a dated one can need pruned blocks whatever the date.\n+ std::optional<int64_t> oldest_dated;\n+ for (size_t i = 0; i < input.requests.size(); ++i) {\n+ const std::optional<int64_t>& time{input.requests[i].timestamp};\n+ if (time && std::ranges::find(input.undated, i) == input.undated.end()) oldest_dated = std::min(oldest_dated.value_or(*time), *time);\n+ }\n+ const std::optional<int64_t> chosen_date{input.undated.empty() ? std::nullopt : std::optional{birth_time}};\n+ // An unset timestamp means now.\n+ int64_t rescan_from{QDateTime::currentSecsSinceEpoch()};\n+ for (const auto& request : input.requests) rescan_from = std::min(rescan_from, request.timestamp.value_or(rescan_from));\n+ std::vector<wallet::ImportDescriptorRequest> requests{std::move(input.requests)};\n+ auto control{std::make_shared<RescanControl>()};\n+ m_import_control = control;\n+ setImportProgress(-1);\n createWalletAsync(name.trimmed(),\n SecureString{},\n creation_flags,\n WalletLoadAction::Create,\n /*report_create_error=*/false,\n- [requests = std::move(input.requests)](interfaces::Wallet& wallet) mutable {\n- if (ScanBlocksPruned(wallet, requests)) {\n- return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ [node = &m_node, requests, rescan_from, control, guard = QPointer{this},\n+ bridge = m_notification_bridge](interfaces::Wallet& wallet) mutable {\n+ const QString cancelled{WalletQmlController::tr(\"The import was cancelled, and its wallet was deleted.\")};\n+ if (!control->attach([&wallet] { wallet.abortRescan(); })) return cancelled;\n+ SetPendingImport(wallet.getWalletName(), rescan_from);\n+ std::vector<wallet::ImportResult> results;\n+ {\n+ const auto progress{wallet.handleShowProgress([&wallet, control, guard, bridge](const std::string&, int percent) {\n+ // Starting a rescan clears an earlier abort.\n+ if (control->cancelled()) wallet.abortRescan();\n+ QMetaObject::invokeMethod(bridge.get(), [guard, percent] {\n+ if (guard) guard->setImportProgress(percent < 100 ? percent : -1);\n+ }, Qt::QueuedConnection);\n+ })};\n+ // Imports the descriptors, then rescans from the oldest timestamp.\n+ results = wallet.importDescriptors(requests);\n }\n- // Imports the descriptors, then rescans from the oldest timestamp.\n- for (const wallet::ImportResult& result : wallet.importDescriptors(requests)) {\n+ control->detach();\n+ if (control->cancelled()) return cancelled;\n+ // Shutdown stops the rescan early without an error, which would keep a wallet missing history.\n+ if (node->shutdownRequested()) return WalletQmlController::tr(\"The import was interrupted before it found all transactions.\");\n+ for (const wallet::ImportResult& result : results) {\n if (result.has_error()) return ImportErrorText(*result.error);\n }\n+ SetPendingImport(wallet.getWalletName(), std::nullopt);\n+ return QString{};\n+ }, [node = &m_node, oldest_dated, chosen_date] {\n+ // Checked before the wallet file exists, so another date can be tried with the same name.\n+ wallet::WalletContext* context{node->walletLoader().context()};\n+ if (!context || !context->chain) return QString{};\n+ if (ScanBlocksPruned(*context->chain, oldest_dated)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when these descriptors were created, so it can't find their older transactions. Import them on a node that keeps all blocks.\");\n+ }\n+ if (ScanBlocksPruned(*context->chain, chosen_date)) {\n+ return WalletQmlController::tr(\"This node no longer has the blocks from when this wallet was created, so it can't find the older transactions. Choose a later date, or import it on a node that keeps all blocks.\");\n+ }\n return QString{};\n });\n }\n@@ -742,6 +918,18 @@ QVariantMap WalletQmlController::describeViewOnlyImport(const QString& import_te\n return DescribeViewOnlyImport(import_text, address_type);\n }\n \n+void WalletQmlController::cancelViewOnlyImport()\n+{\n+ if (m_import_control) m_import_control->cancel();\n+}\n+\n+void WalletQmlController::setImportProgress(int progress)\n+{\n+ if (m_import_progress == progress) return;\n+ m_import_progress = progress;\n+ Q_EMIT importProgressChanged();\n+}\n+\n void WalletQmlController::requestOpenWalletSettings(WalletQmlModel* wallet)\n {\n if (!wallet) return;\n@@ -1412,3 +1600,8 @@ void WalletQmlController::setOpenLocalPathFnForTesting(OpenLocalPathFn fn)\n {\n m_open_local_path_fn = std::move(fn);\n }\n+\n+void WalletQmlController::setResumeImportFnForTesting(ResumeImportFn fn)\n+{\n+ m_resume_import_fn = std::move(fn);\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 0cc560f091e3..c6ff067c1dff 2026-11-25T02:29:03Z · gpt-6-luna |
| gui#1142 | Retained secret QString storage is released without cleansingqml/secretinput.cpp | still_present | AssessmentThe new excerpt shows Input storing the QString and defining its constructor, but no cleansing destructor or exclusive-ownership check; the reported retained-text cleansing gap is not shown as fixed. path_diff: qml/secretinput.cpp; new_source: qml/secretinput.cpp [
{
"evidence_id": "4bc81ccc474e40bd82a58f02704854a7",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/secretinput.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/secretinput.cpp b/qml/secretinput.cpp\nindex eb595f20af..2bf1d5006f 100644\n--- a/qml/secretinput.cpp\n+++ b/qml/secretinput.cpp\n@@ -2,47 +2,17 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/secretinput.h>\n+#include <bitcoin-build-config.h> // IWYU pragma: keep\n #include <qml/retainedvalue.h>\n+#include <qml/walletopening.h>\n #include <support/cleanse.h>\n #include <QByteArray>\n #include <limits>\n \n namespace secretinput {\n-bool Inventory::reserve(size_t bytes)\n-{\n- if (bytes > m_max_bytes) return false;\n- const auto inputs = m_inputs.fetch_add(1);\n- if (inputs >= m_max_inputs) {\n- m_inputs.fetch_sub(1);\n- return false;\n- }\n- const auto owned = m_bytes.fetch_add(bytes);\n- if (owned > m_max_bytes - bytes) {\n- m_bytes.fetch_sub(bytes);\n- m_inputs.fetch_sub(1);\n- return false;\n- }\n- return true;\n-}\n-void Inventory::release(size_t bytes)\n-{\n- m_bytes.fetch_sub(bytes);\n- m_inputs.fetch_sub(1);\n-}\n-class Reservation final {\n-public:\n- Reservation(std::shared_ptr<Inventory> inventory, size_t bytes) : m_inventory(std::move(inventory)), m_bytes(bytes) {\n- if (!m_inventory->reserve(bytes)) throw Failure{Error::Unavailable};\n- }\n- ~Reservation() { m_inventory->release(m_bytes); }\n-private:\n- std::shared_ptr<Inventory> m_inventory;\n- size_t m_bytes;\n-};\n-Input::Input(QString text, size_t bytes, std::unique_ptr<Reservation> reservation)\n- : m_reservation(std::move(reservation)), m_text(std::move(text)), m_bytes(bytes) {}\n-Input::~Input() = default;\n-CaptureResult Capture(const std::shared_ptr<execution::Scheduler>& scheduler, const QString& text, size_t transport_bytes, std::shared_ptr<Inventory> inventory)\n+namespace {\n+template <typename Retain>\n+CaptureResult CaptureInput(const QString& text, Retain retain)\n {\n // Peak conservative accounting: retained UTF16 plus temporary UTF8 and\n // secure UTF8 allocation. No scan of the original literal is necessary.\n@@ -52,22 +22,28 @@ CaptureResult Capture(const std::shared_ptr<execution::Scheduler>& scheduler, co\n if (units > (std::numeric_limits<size_t>::max() - OVERHEAD) / BYTES_PER_CODE_UNIT)\n return {{}, Error::TransportBudget};\n const size_t bytes = OVERHEAD + units * BYTES_PER_CODE_UNIT;\n- if (bytes > transport_bytes) return {{}, Error::TransportBudget, bytes};\n- if (!scheduler) return {{}, Error::Unavailable, bytes};\n- // Shared process inventory remains charged through actual Native teardown,\n- // including ordinary-command refusal and a stalled Cleanup lane.\n std::shared_ptr<Input> retained;\n try {\n- static const auto process_inventory = std::make_shared<Inventory>();\n- if (!inventory) inventory = process_inventory;\n- auto reservation = std::make_unique<Reservation>(inventory, bytes);\n- retained = execution::RetainValues<Input>(scheduler, [&text, bytes, reservation = std::move(reservation)]() mutable {\n- return std::make_unique<Input>(text, bytes, std::move(reservation));\n- });\n+ retained = retain([&text, bytes] { return std::make_unique<Input>(text, bytes); });\n } catch (...) { return {{}, Error::Unavailable, bytes}; }\n const auto error = retained ? Error::None : Error::Unavailable;\n return {std::move(retained), error, bytes};\n }\n+} // namespace\n+\n+Input::Input(QString text, size_t bytes) : m_text(std::move(text)), m_bytes(bytes) {}\n+CaptureResult Capture(const execution::ValueCleanup& hold, const QString& text)\n+{\n+ return CaptureInput(text, [&hold](auto make) { return execution::RetainValues<Input>(hold, make); });\n+}\n+\n+#ifdef ENABLE_WALLET\n+CaptureResult Capture(const std::shared_ptr<walletopening::Session>& opening, const QString& text)\n+{\n+ return CaptureInput(text, [&opening](auto make) { return walletopening::RetainValues<Input>(opening, make); });\n+}\n+#endif\n+\n size_t Bytes(const Captured& input) { return input ? input->bytes() : 0; }\n SecureString Materialize(const Captured& input)\n {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 73,
"evidence_id": "fc1cddb5ef4a49ec841acf7eafaca119",
"finding_id": "finding:9",
"kind": "new_source",
"line": 12,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/secretinput.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 4,
"source_job_id": 2819,
"text": "namespace secretinput {\nnamespace {\ntemplate <typename Retain>\nCaptureResult CaptureInput(const QString& text, Retain retain)\n{\n // Peak conservative accounting: retained UTF16 plus temporary UTF8 and\n // secure UTF8 allocation. No scan of the original literal is necessary.\n constexpr size_t BYTES_PER_CODE_UNIT{8};\n constexpr size_t OVERHEAD{512};\n const auto units = static_cast<size_t>(text.size());\n if (units > (std::numeric_limits<size_t>::max() - OVERHEAD) / BYTES_PER_CODE_UNIT)\n return {{}, Error::TransportBudget};\n const size_t bytes = OVERHEAD + units * BYTES_PER_CODE_UNIT;\n std::shared_ptr<Input> retained;\n try {\n retained = retain([&text, bytes] { return std::make_unique<Input>(text, bytes); });\n } catch (...) { return {{}, Error::Unavailable, bytes}; }\n const auto error = retained ? Error::None : Error::Unavailable;\n return {std::move(retained), error, bytes};\n}\n} // namespace\n\nInput::Input(QString text, size_t bytes) : m_text(std::move(text)), m_bytes(bytes) {}\nCaptureResult Capture(const execution::ValueCleanup& hold, const QString& text)\n{\n return CaptureInput(text, [&hold](auto make) { return execution::RetainValues<Input>(hold, make); });\n}\n\n#ifdef ENABLE_WALLET\nCaptureResult Capture(const std::shared_ptr<walletopening::Session>& opening, const QString& text)\n{\n return CaptureInput(text, [&opening](auto make) { return walletopening::RetainValues<Input>(opening, make); });\n}\n#endif\n\nsize_t Bytes(const Captured& input) { return input ? input->bytes() : 0; }\nSecureString Materialize(const Captured& input)\n{\n if (!input) throw Failure{Error::Unavailable};\n return input->materialize();\n}\nSecureString Input::materialize() const\n{\n // Native-only boundary. Manual executors intentionally control this same\n // action in tests without relying on a physical GUI/thread identity check.\n QByteArray utf8;\n try {\n utf8 = m_text.toUtf8();\n SecureString secret;\n try {\n secret.assign(utf8.constData(), utf8.constData() + utf8.size());\n } catch (...) {\n if (!utf8.isEmpty()) memory_cleanse(utf8.data(), static_cast<size_t>(utf8.size()));\n throw;\n }\n if (!utf8.isEmpty()) memory_cleanse(utf8.data(), static_cast<size_t>(utf8.size()));\n return secret;\n } catch (...) {\n throw Failure{Error::Materialization};\n }\n}\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | macOS artifact instructions omit preparation of the new helper.github/workflows/artifacts.yml | addressed | AssessmentThe new artifact workflow uploads only bitcoin-core-app, removing the supplied workflow evidence that the helper is shipped as a sibling executable. This eliminates the specific mismatch described between the uploaded artifact and the README preparation instructions, though the evidence does not establish other packaging behavior. path_diff: .github/workflows/artifacts.yml; new_source: .github/workflows/artifacts.yml [
{
"evidence_id": "834aa0809a6e424fbc948c42812c8a7b",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": ".github/workflows/artifacts.yml",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml\nindex 354c427df8..0cd946fec9 100644\n--- a/.github/workflows/artifacts.yml\n+++ b/.github/workflows/artifacts.yml\n@@ -75,7 +75,4 @@ jobs:\n - uses: actions/upload-artifact@v7\n with:\n name: unsecure_${{ matrix.os }}_gui\n- path: |\n- build/bin/bitcoin-core-app\n- build/bin/bitcoin-core-profile-inspector\n- if-no-files-found: error\n+ path: build/bin/bitcoin-core-app\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 78,
"evidence_id": "00a4725fe1b54325b55fed5ac44a84a8",
"finding_id": "finding:8",
"kind": "new_source",
"line": 50,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": ".github/workflows/artifacts.yml",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 4,
"source_job_id": 2819,
"text": " echo \"CCACHE_DIR=${{ runner.temp }}/ccache\" >> \"$GITHUB_ENV\"\n\n - name: Restore Ccache cache\n uses: actions/cache/restore@v6\n id: ccache-cache\n with:\n path: ${{ env.CCACHE_DIR }}\n key: ${{ matrix.os }}-ccache-${{ github.run_id }}\n restore-keys: ${{ matrix.os }}-ccache-\n\n - name: Build\n run: |\n git submodule update --init\n cmake -B build \\\n -DBUILD_APP_TESTS=${{ env.BUILD_APP_TESTS }} \\\n -DENABLE_IPC=OFF\n cmake --build build -j\"$(nproc)\"\n\n - name: Save Ccache cache\n uses: actions/cache/save@v6\n if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'\n with:\n path: ${{ env.CCACHE_DIR }}\n key: ${{ matrix.os }}-ccache-${{ github.run_id }}\n\n - uses: actions/upload-artifact@v7\n with:\n name: unsecure_${{ matrix.os }}_gui\n path: build/bin/bitcoin-core-app",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Signer verification accepts signatures that do not commit to all outputsqml/psbtsignatures.cpp | addressed | AssessmentThe new code adds output-commitment checks for partial signatures, taproot signatures, and finalized inputs, and constrains declared sighash types. This directly addresses accepting signer contributions that do not commit to outputs. path_diff: qml/psbtsignatures.cpp; new_source: qml/psbtsignatures.cpp [
{
"evidence_id": "597505ad98594175baea2b9e65cde093",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/psbtsignatures.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/psbtsignatures.cpp b/qml/psbtsignatures.cpp\nindex 3d5dbdb47e..ac97168b46 100644\n--- a/qml/psbtsignatures.cpp\n+++ b/qml/psbtsignatures.cpp\n@@ -62,6 +62,55 @@ std::optional<EcdsaContext> GetEcdsaContext(const PSBTInput& input, const CTxOut\n return result;\n }\n \n+bool EcdsaCommitsToAll(const std::vector<unsigned char>& signature)\n+{\n+ return !signature.empty() && signature.back() == SIGHASH_ALL;\n+}\n+bool SchnorrCommitsToAll(const std::vector<unsigned char>& signature)\n+{\n+ return signature.size() == 64 || (signature.size() == 65 && signature.back() == SIGHASH_ALL);\n+}\n+// Any DER-encoded push in a finalized ECDSA script is a signature.\n+bool EcdsaItemsCommitToAll(const std::vector<std::vector<unsigned char>>& items)\n+{\n+ return std::ranges::all_of(items, [](const auto& item) {\n+ return item.empty() || !CheckSignatureEncoding(item, SCRIPT_VERIFY_DERSIG, nullptr) || EcdsaCommitsToAll(item);\n+ });\n+}\n+std::optional<std::vector<std::vector<unsigned char>>> Pushes(const CScript& script)\n+{\n+ std::vector<std::vector<unsigned char>> pushes;\n+ auto cursor = script.begin();\n+ opcodetype opcode;\n+ std::vector<unsigned char> push;\n+ while (cursor != script.end()) {\n+ if (!script.GetOp(cursor, opcode, push)) return {};\n+ pushes.push_back(push);\n+ }\n+ return pushes;\n+}\n+bool FinalizedCommitsToAll(const PSBTInput& input)\n+{\n+ if (!input.final_script_sig.empty()) {\n+ const auto pushes = Pushes(input.final_script_sig);\n+ if (!pushes || !EcdsaItemsCommitToAll(*pushes)) return false;\n+ }\n+ auto stack = input.final_script_witness.stack;\n+ if (stack.empty()) return true;\n+ CTxOut utxo;\n+ int version;\n+ std::vector<unsigned char> program;\n+ // Without the spent output the witness kind is unknown; refuse it.\n+ if (!input.GetUTXO(utxo)) return false;\n+ if (!utxo.scriptPubKey.IsWitnessProgram(version, program) || version != 1 || program.size() != 32) return EcdsaItemsCommitToAll(stack);\n+ if (stack.size() >= 2 && !stack.back().empty() && stack.back()[0] == ANNEX_TAG) stack.pop_back();\n+ if (stack.size() == 1) return SchnorrCommitsToAll(stack.front());\n+ // Script path: the last two items are the script and the control block.\n+ // Earlier 64- or 65-byte items are the signatures tapscript checks.\n+ stack.resize(stack.size() - 2);\n+ return std::ranges::all_of(stack, [](const auto& item) { return (item.size() != 64 && item.size() != 65) || SchnorrCommitsToAll(item); });\n+}\n+\n bool HasTapleafContext(const PSBTInput& input, const std::vector<unsigned char>& program,\n const XOnlyPubKey& key, const uint256& leaf)\n {\n@@ -187,3 +236,14 @@ bool psbtsignatures::VerifyFinalizedInputs(const PartiallySignedTransaction& doc\n }\n return true;\n }\n+\n+bool psbtsignatures::CommitsToAllOutputs(const PartiallySignedTransaction& document)\n+{\n+ return std::ranges::all_of(document.inputs, [](const PSBTInput& input) {\n+ if (input.sighash_type && *input.sighash_type != SIGHASH_DEFAULT && *input.sighash_type != SIGHASH_ALL) return false;\n+ return std::ranges::all_of(input.partial_sigs, [](const auto& entry) { return EcdsaCommitsToAll(entry.second.second); }) &&\n+ (input.m_tap_key_sig.empty() || SchnorrCommitsToAll(input.m_tap_key_sig)) &&\n+ std::ranges::all_of(input.m_tap_script_sigs, [](const auto& entry) { return SchnorrCommitsToAll(entry.second); }) &&\n+ FinalizedCommitsToAll(input);\n+ });\n+}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 227,
"evidence_id": "931d6fadef97460f9e8c519259ab1a29",
"finding_id": "finding:7",
"kind": "new_source",
"line": 78,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/psbtsignatures.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 4,
"source_job_id": 2819,
"text": " });\n}\nstd::optional<std::vector<std::vector<unsigned char>>> Pushes(const CScript& script)\n{\n std::vector<std::vector<unsigned char>> pushes;\n auto cursor = script.begin();\n opcodetype opcode;\n std::vector<unsigned char> push;\n while (cursor != script.end()) {\n if (!script.GetOp(cursor, opcode, push)) return {};\n pushes.push_back(push);\n }\n return pushes;\n}\nbool FinalizedCommitsToAll(const PSBTInput& input)\n{\n if (!input.final_script_sig.empty()) {\n const auto pushes = Pushes(input.final_script_sig);\n if (!pushes || !EcdsaItemsCommitToAll(*pushes)) return false;\n }\n auto stack = input.final_script_witness.stack;\n if (stack.empty()) return true;\n CTxOut utxo;\n int version;\n std::vector<unsigned char> program;\n // Without the spent output the witness kind is unknown; refuse it.\n if (!input.GetUTXO(utxo)) return false;\n if (!utxo.scriptPubKey.IsWitnessProgram(version, program) || version != 1 || program.size() != 32) return EcdsaItemsCommitToAll(stack);\n if (stack.size() >= 2 && !stack.back().empty() && stack.back()[0] == ANNEX_TAG) stack.pop_back();\n if (stack.size() == 1) return SchnorrCommitsToAll(stack.front());\n // Script path: the last two items are the script and the control block.\n // Earlier 64- or 65-byte items are the signatures tapscript checks.\n stack.resize(stack.size() - 2);\n return std::ranges::all_of(stack, [](const auto& item) { return (item.size() != 64 && item.size() != 65) || SchnorrCommitsToAll(item); });\n}\n\nbool HasTapleafContext(const PSBTInput& input, const std::vector<unsigned char>& program,\n const XOnlyPubKey& key, const uint256& leaf)\n{\n for (const auto& [script_version, controls] : input.m_tap_scripts) {\n const auto& [bytes, version] = script_version;\n if (version != TAPROOT_LEAF_TAPSCRIPT || ComputeTapleafHash(version, bytes) != leaf) continue;\n const CScript script{bytes.begin(), bytes.end()};\n if (HasCodeSeparator(script)) continue;\n // Partial verification does not execute a script. Recognize one\n // unambiguous signing policy and quarantine other script forms.\n auto cursor = script.begin();\n opcodetype opcode;\n std::vector<unsigned char> push;\n if (!script.GetOp(cursor, opcode, push) || push.size() != 32 || !std::equal(push.begin(), push.end(), key.begin()) ||\n !script.GetOp(cursor, opcode) || opcode != OP_CHECKSIG || cursor != script.end()) continue;\n for (const auto& control : controls) {\n if (control.size() < TAPROOT_CONTROL_BASE_SIZE || control.size() > TAPROOT_CONTROL_MAX_SIZE ||\n (control.size() - TAPROOT_CONTROL_BASE_SIZE) % TAPROOT_CONTROL_NODE_SIZE != 0 ||\n (control[0] & TAPROOT_LEAF_MASK) != version) continue;\n const XOnlyPubKey internal{std::span{control}.subspan(1, 32)};\n if (XOnlyPubKey{program}.CheckTapTweak(internal, ComputeTaprootMerkleRoot(control, leaf), control[0] & 1)) return true;\n }\n }\n return false;\n}\n} // namespace\n\npsbtsignatures::Status psbtsignatures::VerifyPartialInputs(const PartiallySignedTransaction& document)\n{\n if (!VerifyFinalizedInputs(document, false)) return Status::Invalid;\n const auto transaction = document.GetUnsignedTx();\n const auto data = PrecomputePSBTData(document);\n if (!transaction || !data || transaction->vin.size() != document.inputs.size()) return Status::Unknown;\n Status result{Status::Valid};\n for (size_t i = 0; i < document.inputs.size(); ++i) {\n const auto& input = document.inputs[i];\n CTxOut utxo;\n if (!input.GetUTXO(utxo)) { result = Status::Unknown; continue; }\n MutableTransactionSignatureChecker checker{&*transaction, static_cast<unsigned int>(i), utxo.nValue, *data, MissingDataBehavior::FAIL};\n const auto context = GetEcdsaContext(input, utxo);\n for (const auto& [id, signature] : input.partial_sigs) {\n const auto& [key, bytes] = signature;\n if (!key.IsFullyValid() || key.GetID() != id ||\n !CheckSignatureEncoding(bytes, SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_STRICTENC | SCRIPT_VERIFY_LOW_S, nullptr) || bytes.empty()) return Status::Invalid;\n if (!context) { result = Status::Unknown; continue; }\n const auto member = ContainsSigningKey(context->script, key);\n if (!member) { result = Status::Unknown; continue; }\n if (!*member) return Status::Invalid;\n if (\n (context->version == SigVersion::WITNESS_V0 && !key.IsCompressed()) ||\n !checker.CheckECDSASignature(bytes, {key.begin(), key.end()}, context->script, context->version)) return Status::Invalid;\n }\n int version;\n std::vector<unsigned char> program;\n const bool taproot = utxo.scriptPubKey.IsWitnessProgram(version, program) && version == 1 && program.size() == 32;\n if ((!input.m_tap_key_sig.empty() || !input.m_tap_script_sigs.empty()) && !data->m_spent_outputs_ready) {\n result = Status::Unknown;\n continue;\n }\n if (!input.m_tap_key_sig.empty()) {\n if (!taproot) return Status::Invalid;\n ScriptExecutionData execution;\n execution.m_annex_init = true;\n execution.m_annex_present = false;\n if (!checker.CheckSchnorrSignature(input.m_tap_key_sig, program, SigVersion::TAPROOT, execution)) return Status::Invalid;\n }\n for (const auto& [key_leaf, signature] : input.m_tap_script_sigs) {\n const auto& [key, leaf] = key_leaf;\n if (!taproot) return Status::Invalid;\n if (!HasTapleafContext(input, program, key, leaf)) { result = Status::Unknown; continue; }\n ScriptExecutionData execution;\n execution.m_annex_init = true;\n execution.m_annex_present = false;\n execution.m_tapleaf_hash_init = true;\n execution.m_tapleaf_hash = leaf;\n execution.m_codeseparator_pos_init = true;\n execution.m_codeseparator_pos = std::numeric_limits<uint32_t>::max();\n if (!checker.CheckSchnorrSignature(signature, key, SigVersion::TAPSCRIPT, execution)) return Status::Invalid;\n }\n // Do not recreate the MuSig2 protocol or an interpreter here.\n if (!input.m_musig2_partial_sigs.empty()) result = Status::Unknown;\n }\n return result;\n}\n\npsbtsignatures::Status psbtsignatures::VerifyContributions(const PartiallySignedTransaction& original,\n const PartiallySignedTransaction& returned)\n{\n if (original.inputs.size() != returned.inputs.size()) return Status::Invalid;\n auto contributions = returned;\n const auto remove_unchanged = [](auto& values, const auto& prior) {\n std::erase_if(values, [&prior](const auto& entry) {\n const auto found = prior.find(entry.first);\n return found != prior.end() && found->second == entry.second;\n });\n };\n for (size_t i = 0; i < contributions.inputs.size(); ++i) {\n auto& input = contributions.inputs[i];\n const auto& prior = original.inputs[i];\n remove_unchanged(input.partial_sigs, prior.partial_sigs);\n remove_unchanged(input.m_tap_script_sigs, prior.m_tap_script_sigs);\n if (input.m_tap_key_sig == prior.m_tap_key_sig) input.m_tap_key_sig.clear();\n for (auto& [group, values] : input.m_musig2_partial_sigs) {\n const auto found = prior.m_musig2_partial_sigs.find(group);\n if (found != prior.m_musig2_partial_sigs.end()) remove_unchanged(values, found->second);\n }\n std::erase_if(input.m_musig2_partial_sigs, [](const auto& group) { return group.second.empty(); });\n }\n return VerifyPartialInputs(contributions);\n}\n\nbool psbtsignatures::VerifyFinalizedInputs(const PartiallySignedTransaction& document, bool require_all)\n{\n if (document.inputs.empty()) return false;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | Backup confirmation has no height bound for long pathsqml/components/WalletBackupConfirmation.qml | unclear | AssessmentThe old confirmation component is deleted, but the supplied evidence does not show the new confirmation surface or a long-path regression test. path_diff: qml/components/WalletBackupConfirmation.qml [
{
"evidence_id": "a154bce00e22461b88981a98ec4207ce",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/components/WalletBackupConfirmation.qml",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/components/WalletBackupConfirmation.qml b/qml/components/WalletBackupConfirmation.qml\ndeleted file mode 100644\nindex f2e1c72f62..0000000000\n--- a/qml/components/WalletBackupConfirmation.qml\n+++ /dev/null\n@@ -1,78 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"walletBackupOverwritePopup\"\n- required property BackupFileOperation operation\n- readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n- parent: Overlay.overlay\n- width: parent ? Math.min(600, parent.width - 40) : 600\n- implicitHeight: content.implicitHeight + topPadding + bottomPadding\n- x: parent ? Math.round((parent.width - width) / 2) : 0\n- y: parent ? Math.round((parent.height - height) / 2) : 0\n- padding: 24\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.NoAutoClose\n- onOpened: content.forceActiveFocus()\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 10\n- border.color: Theme.color.neutral2\n- }\n- contentItem: ColumnLayout {\n- id: content\n- focus: true\n- spacing: 16\n- Keys.priority: Keys.BeforeItem\n- Keys.onEscapePressed: function(event) {\n- root.operation.refuse()\n- event.accepted = true\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.title\n- font: Theme.text.subtitle.font\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.replacing\n- ? qsTr(\"An existing file will be replaced at this final destination:\")\n- : qsTr(\"Save the backup at this final destination:\")\n- wrap: true\n- }\n- CoreText {\n- objectName: \"walletBackupFinalPathText\"\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.finalPath\n- wrapMode: Text.WrapAnywhere\n- }\n- RowLayout {\n- spacing: 12\n- NeutralButton {\n- objectName: \"walletBackupOverwriteRejectButton\"\n- text: qsTr(\"Cancel\")\n- onClicked: root.operation.refuse()\n- }\n- NeutralButton {\n- objectName: \"walletBackupOverwriteApproveButton\"\n- text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n- onClicked: root.operation.approve()\n- }\n- }\n- }\n-}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The new Sign-only action rejects already-signed foreign inputsqml/psbtwork.cpp | addressed | AssessmentPrepareReview now computes ownership of unsigned inputs separately, assigning key_can_send based on those outstanding unsigned inputs, while retaining all-input ownership for can_commit_complete. This removes the all-input ownership restriction from signing eligibility while preserving commit restrictions. path_diff: qml/psbtwork.cpp [
{
"evidence_id": "45ee6689dc924bb590c0628e3bd63528",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "bc79778bb5661ea6fee9ae084801919772328532",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/psbtwork.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/psbtwork.cpp b/qml/psbtwork.cpp\nindex dc83755db1..03f91e8c65 100644\n--- a/qml/psbtwork.cpp\n+++ b/qml/psbtwork.cpp\n@@ -9,6 +9,7 @@\n #include <qml/models/transactionflow.h>\n #include <qml/flowpresentation.h>\n #include <qml/bitcoinunits.h>\n+#include <qml/psbtpolicy.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <key_io.h>\n@@ -22,7 +23,6 @@\n #include <QCoreApplication>\n #include <QFile>\n #include <QIODevice>\n-#include <QSaveFile>\n #include <QUrl>\n #include <algorithm>\n #include <limits>\n@@ -99,21 +99,6 @@ private:\n QFile& m_file;\n };\n \n-class QtFileWriter final : public psbtwork::FileWriter\n-{\n-public:\n- explicit QtFileWriter(QSaveFile& file) : m_file{file} {}\n-\n- bool open() override { return m_file.open(QIODevice::WriteOnly); }\n- qint64 write(const QByteArray& bytes) override { return m_file.write(bytes); }\n- void cancel() override { m_file.cancelWriting(); }\n- bool commit() override { return m_file.commit(); }\n- QString errorString() override { return m_file.errorString(); }\n-\n-private:\n- QSaveFile& m_file;\n-};\n-\n } // namespace\n \n QString psbtwork::LocalFilePath(const QString& path)\n@@ -167,30 +152,6 @@ QString psbtwork::ErrorText(common::PSBTError error)\n return QString::fromStdString(common::PSBTErrorString(error).translated);\n }\n \n-QString psbtwork::WriteFile(psbtwork::FileWriter& writer, const PartiallySignedTransaction& psbt)\n-{\n- if (!writer.open()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n-\n- const QByteArray raw{SerializeRaw(psbt)};\n- if (writer.write(raw) != raw.size()) {\n- writer.cancel();\n- return Tr(\"Could not write the complete PSBT file.\");\n- }\n- if (!writer.commit()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n- return {};\n-}\n-\n-QString psbtwork::SaveFile(const PartiallySignedTransaction& psbt, const QString& path)\n-{\n- QSaveFile file{LocalFilePath(path)};\n- QtFileWriter writer{file};\n- return psbtwork::WriteFile(writer, psbt);\n-}\n-\n std::optional<std::pair<int, int>> psbtwork::Multisig(const PartiallySignedTransaction& psbt, std::size_t index)\n {\n if (index >= psbt.inputs.size()) return std::nullopt;\n@@ -380,7 +341,7 @@ Broadcast NodeBroadcast(interfaces::Node* node)\n if (!node) return {};\n return [node](CTransactionRef transaction) {\n std::string detail;\n- const auto code = node->broadcastTransaction(transaction, node::DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK(), node::DEFAULT_MAX_RAW_TX_FEE_RATE, detail);\n+ const auto code = node->broadcastTransaction(transaction, psbtpolicy::MaxFee(), psbtpolicy::MAX_FEE_RATE, detail);\n QString error;\n if (code != node::TransactionError::OK) {\n error = TransactionErrorText(code);\n@@ -425,12 +386,6 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code = Error::Fee; result.error = Tr(\"The transaction fee is missing or invalid.\"); return finishAfterRelock();\n }\n }\n- if (request.kind == Kind::Save) {\n- result.error = context.save(*request.document, request.path);\n- result.saved = result.error.isEmpty();\n- result.code = result.saved ? Error::None : Error::Core;\n- return finishAfterRelock();\n- }\n if (request.kind == Kind::Clipboard) {\n result.clipboard = SerializePsbtBase64(*request.document);\n return finishAfterRelock();\n@@ -477,7 +432,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n : signer_threw ? Error::Uncertain : Error::UnverifiedSignatures;\n result.error = result.signature_status == psbtsignatures::Status::Invalid\n ? Tr(\"The signer returned invalid signatures for the reviewed transaction.\")\n- : Tr(\"The returned PSBT needs more verification information. The original document is unchanged; export the unverified result to reconcile it.\");\n+ : Tr(\"The signer returned a PSBT that cannot be verified yet. The original PSBT is unchanged; export the result to check it elsewhere.\");\n if (result.signature_status == psbtsignatures::Status::Unknown)\n result.quarantined_document = std::make_shared<const PartiallySignedTransaction>(std::move(candidate));\n return finishAfterRelock();\n@@ -492,7 +447,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n retained->complete = complete;\n result.snapshot = std::move(retained);\n if (sign_error) { result.code = Error::Core; result.error = Tr(\"Could not sign PSBT: %1\").arg(ErrorText(*sign_error)); }\n- if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"The signer ended without a confirmed outcome. The retained PSBT must be reconciled before retrying.\"); }\n+ if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"It is not known what the signer did. Check the PSBT before trying again.\"); }\n request.status = complete ? Tr(\"PSBT signed. Transaction is ready for broadcast.\")\n : signed_inputs ? Tr(\"Signed %n input(s). More signatures are still required.\", nullptr, signed_inputs)\n : Tr(\"This wallet could not add any signatures to the PSBT.\");\n@@ -541,8 +496,8 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code=Error::Core;\n result.error=Tr(\"The signing password could not be prepared. Signing did not begin.\");\n } catch (...) {\n- result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign || request.kind == Kind::Save ? Error::Uncertain : Error::Core;\n- result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action ended without a confirmed outcome. Reconcile before retrying.\") : Tr(\"The PSBT could not be processed.\");\n+ result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign ? Error::Uncertain : Error::Core;\n+ result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action may not have finished. Check its status before trying again.\") : Tr(\"The PSBT could not be processed.\");\n }\n return finishAfterRelock();\n }\n@@ -558,7 +513,10 @@ DocumentResult ExportReview(interfaces::Wallet& wallet, std::shared_ptr<const Pa\n tx = CMutableTransaction{*reviewed};\n for (auto& input : tx.vin) { input.scriptSig.clear(); input.scriptWitness.SetNull(); }\n }\n- PartiallySignedTransaction document = source ? *source : PartiallySignedTransaction{tx, 2};\n+ // A file this app creates is version 0, as Bitcoin-Qt writes since\n+ // bitcoin/bitcoin#36539: Core before v32 cannot read version 2 (#1112).\n+ // An imported PSBT is saved back in the version it arrived with.\n+ PartiallySignedTransaction document = source ? *source : PartiallySignedTransaction{tx, /*version=*/0};\n const auto approved = document.GetUnsignedTx();\n if (!approved || (reviewed && !MatchesUnsignedTransaction(tx, *approved))) return {{}, Tr(\"The reviewed transaction changed.\")};\n if (proof && approved_fee && !psbtfee::MatchesReview(document, *proof, approved_fee)) return {{}, Tr(\"The transaction fee changed after review.\")};\n@@ -677,13 +635,19 @@ ImportResult PrepareReview(interfaces::Wallet& wallet, std::shared_ptr<const Par\n if (wallet.getTx(finalized.GetHash())) { result.disposition = ImportResult::Disposition::Known; return result; }\n }\n const bool owned_inputs = std::all_of(tx->vin.begin(), tx->vin.end(), [&](const CTxIn& input) { return wallet.txinIsMine(input); });\n+ // Inputs another party has already signed need no key from this\n+ // wallet; every input still unsigned must be one this wallet owns.\n+ bool owned_unsigned_inputs{true};\n+ for (size_t i = 0; i < tx->vin.size(); ++i) {\n+ if (!PSBTInputSigned(assessment->inputs[i]) && !wallet.txinIsMine(tx->vin[i])) { owned_unsigned_inputs = false; break; }\n+ }\n std::optional<std::pair<int, int>> multisig;\n if (!snapshot->complete) for (size_t i = 0; i < assessment->inputs.size(); ++i) if ((multisig = Multisig(*assessment, i))) break;\n const bool signer = !wallet.privateKeysDisabled() || wallet.hasExternalSigner();\n- result.key_can_send = !multisig && owned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n+ result.key_can_send = !multisig && owned_unsigned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n result.can_commit_complete = !multisig && owned_inputs;\n result.key_can_broadcast = snapshot->can_broadcast;\n- const bool may_send = result.can_commit_complete && (snapshot->complete || result.key_can_send);\n+ const bool may_send = (result.can_commit_complete && snapshot->complete) || result.key_can_send;\n auto review = std::make_shared<walletreview::Snapshot>();\n review->transaction = snapshot->signature_state == SignatureState::Verified ? MakeTransactionRef(finalized) : MakeTransactionRef(*tx);\n review->assessment = assessment;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..bc79778bb566 2026-11-23T14:48:05Z · gpt-6-luna |
| gui#1142 | PSBT readiness ignores the submission path's fee capsqml/psbtwork.cpp | addressed | AssessmentThe new policy wiring supplies distinct raw-broadcast and wallet policies. Wallet sends use the wallet policy, while the raw-broadcast policy retains its fee cap; the policy implementation likewise makes the cap conditional on the selected path. new_source: qml/psbtwork.cpp; path_diff: qml/psbtwork.cpp [
{
"bounded": true,
"end_line": 701,
"evidence_id": "0358f9a5c64e4342bcfb9aed013562b3",
"finding_id": "finding:4",
"kind": "new_source",
"line": 661,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/psbtwork.cpp",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 4,
"source_job_id": 2819,
"text": " for (const auto& output : tx->vout) {\n CTxDestination destination;\n if (!ExtractDestination(output.scriptPubKey, destination)) {\n if (output.nValue == 0 && output.scriptPubKey.IsUnspendable()) continue;\n result.message = Tr(\"Only PSBTs with standard address outputs are supported right now.\"); return result;\n }\n // Imported documents do not provide authoritative change intent.\n // Ownership alone cannot distinguish a self-transfer recipient\n // from change, and signing capability must not alter the review.\n const auto address = QString::fromStdString(EncodeDestination(destination));\n std::string label;\n wallet.getAddress(destination, &label, nullptr);\n if (!MoneyRange(output.nValue) || output.nValue > MAX_MONEY - review->amount) { result.message = Tr(\"The PSBT contains invalid amounts.\"); return result; }\n review->amount += output.nValue;\n review->recipients.append({address, QString::fromStdString(label), output.nValue, false});\n review->destinations.insert(address);\n review->notes.insert(address, QString::fromStdString(label));\n }\n if (review->recipients.empty()) { result.message = Tr(\"The PSBT does not have any recipient outputs to review.\"); return result; }\n if (review->recipients.size() > 25) { result.message = Tr(\"The PSBT has more recipients than this send flow supports.\"); return result; }\n if (review->amount <= 0) { result.message = Tr(\"The PSBT does not send a positive amount.\"); return result; }\n review->presentation = walletreview::FormatRecipients(review->recipients, display_unit);\n review->flow = CollectReviewFlow(wallet, review->transaction, assessment, snapshot->proof, review->destinations, display_unit, review->notes);\n auto output_rows = review->flow.value(QStringLiteral(\"outputs\")).toList();\n for (auto& value : output_rows) {\n auto row = value.toMap();\n row.insert(QStringLiteral(\"changeKnown\"), false);\n value = row;\n }\n review->flow.insert(QStringLiteral(\"outputs\"), output_rows);\n review->flow.insert(QStringLiteral(\"presentation\"), PrepareTransactionFlowPresentation(review->flow));\n if (!snapshot->proof->amount) result.message = Tr(\"The transaction fee is missing or invalid. Add valid input information before broadcasting.\");\n else if (multisig) result.message = Tr(\"This transaction requires %1 of %2 signatures.\").arg(multisig->first).arg(multisig->second);\n else if (!review->can_send && !snapshot->complete) result.message = Tr(\"This wallet does not have the keys to sign this transaction.\");\n result.document = snapshot->document;\n result.review = std::move(review);\n result.disposition = ImportResult::Disposition::Review;\n } catch (...) { result.message = Tr(\"The PSBT could not be reviewed.\"); }\n return result;\n}\n} // namespace psbtwork",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"evidence_id": "347640a576e74c8c99adec967231d423",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/psbtwork.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/psbtwork.cpp b/qml/psbtwork.cpp\nindex dc83755db1..03f91e8c65 100644\n--- a/qml/psbtwork.cpp\n+++ b/qml/psbtwork.cpp\n@@ -9,6 +9,7 @@\n #include <qml/models/transactionflow.h>\n #include <qml/flowpresentation.h>\n #include <qml/bitcoinunits.h>\n+#include <qml/psbtpolicy.h>\n #include <interfaces/node.h>\n #include <interfaces/wallet.h>\n #include <key_io.h>\n@@ -22,7 +23,6 @@\n #include <QCoreApplication>\n #include <QFile>\n #include <QIODevice>\n-#include <QSaveFile>\n #include <QUrl>\n #include <algorithm>\n #include <limits>\n@@ -99,21 +99,6 @@ private:\n QFile& m_file;\n };\n \n-class QtFileWriter final : public psbtwork::FileWriter\n-{\n-public:\n- explicit QtFileWriter(QSaveFile& file) : m_file{file} {}\n-\n- bool open() override { return m_file.open(QIODevice::WriteOnly); }\n- qint64 write(const QByteArray& bytes) override { return m_file.write(bytes); }\n- void cancel() override { m_file.cancelWriting(); }\n- bool commit() override { return m_file.commit(); }\n- QString errorString() override { return m_file.errorString(); }\n-\n-private:\n- QSaveFile& m_file;\n-};\n-\n } // namespace\n \n QString psbtwork::LocalFilePath(const QString& path)\n@@ -167,30 +152,6 @@ QString psbtwork::ErrorText(common::PSBTError error)\n return QString::fromStdString(common::PSBTErrorString(error).translated);\n }\n \n-QString psbtwork::WriteFile(psbtwork::FileWriter& writer, const PartiallySignedTransaction& psbt)\n-{\n- if (!writer.open()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n-\n- const QByteArray raw{SerializeRaw(psbt)};\n- if (writer.write(raw) != raw.size()) {\n- writer.cancel();\n- return Tr(\"Could not write the complete PSBT file.\");\n- }\n- if (!writer.commit()) {\n- return Tr(\"Could not save PSBT: %1\").arg(writer.errorString());\n- }\n- return {};\n-}\n-\n-QString psbtwork::SaveFile(const PartiallySignedTransaction& psbt, const QString& path)\n-{\n- QSaveFile file{LocalFilePath(path)};\n- QtFileWriter writer{file};\n- return psbtwork::WriteFile(writer, psbt);\n-}\n-\n std::optional<std::pair<int, int>> psbtwork::Multisig(const PartiallySignedTransaction& psbt, std::size_t index)\n {\n if (index >= psbt.inputs.size()) return std::nullopt;\n@@ -380,7 +341,7 @@ Broadcast NodeBroadcast(interfaces::Node* node)\n if (!node) return {};\n return [node](CTransactionRef transaction) {\n std::string detail;\n- const auto code = node->broadcastTransaction(transaction, node::DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK(), node::DEFAULT_MAX_RAW_TX_FEE_RATE, detail);\n+ const auto code = node->broadcastTransaction(transaction, psbtpolicy::MaxFee(), psbtpolicy::MAX_FEE_RATE, detail);\n QString error;\n if (code != node::TransactionError::OK) {\n error = TransactionErrorText(code);\n@@ -425,12 +386,6 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code = Error::Fee; result.error = Tr(\"The transaction fee is missing or invalid.\"); return finishAfterRelock();\n }\n }\n- if (request.kind == Kind::Save) {\n- result.error = context.save(*request.document, request.path);\n- result.saved = result.error.isEmpty();\n- result.code = result.saved ? Error::None : Error::Core;\n- return finishAfterRelock();\n- }\n if (request.kind == Kind::Clipboard) {\n result.clipboard = SerializePsbtBase64(*request.document);\n return finishAfterRelock();\n@@ -477,7 +432,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n : signer_threw ? Error::Uncertain : Error::UnverifiedSignatures;\n result.error = result.signature_status == psbtsignatures::Status::Invalid\n ? Tr(\"The signer returned invalid signatures for the reviewed transaction.\")\n- : Tr(\"The returned PSBT needs more verification information. The original document is unchanged; export the unverified result to reconcile it.\");\n+ : Tr(\"The signer returned a PSBT that cannot be verified yet. The original PSBT is unchanged; export the result to check it elsewhere.\");\n if (result.signature_status == psbtsignatures::Status::Unknown)\n result.quarantined_document = std::make_shared<const PartiallySignedTransaction>(std::move(candidate));\n return finishAfterRelock();\n@@ -492,7 +447,7 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n retained->complete = complete;\n result.snapshot = std::move(retained);\n if (sign_error) { result.code = Error::Core; result.error = Tr(\"Could not sign PSBT: %1\").arg(ErrorText(*sign_error)); }\n- if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"The signer ended without a confirmed outcome. The retained PSBT must be reconciled before retrying.\"); }\n+ if (signer_threw) { result.code = Error::Uncertain; result.error = Tr(\"It is not known what the signer did. Check the PSBT before trying again.\"); }\n request.status = complete ? Tr(\"PSBT signed. Transaction is ready for broadcast.\")\n : signed_inputs ? Tr(\"Signed %n input(s). More signatures are still required.\", nullptr, signed_inputs)\n : Tr(\"This wallet could not add any signatures to the PSBT.\");\n@@ -541,8 +496,8 @@ Result Execute(interfaces::Wallet* wallet, Request request, const Context& conte\n result.code=Error::Core;\n result.error=Tr(\"The signing password could not be prepared. Signing did not begin.\");\n } catch (...) {\n- result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign || request.kind == Kind::Save ? Error::Uncertain : Error::Core;\n- result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action ended without a confirmed outcome. Reconcile before retrying.\") : Tr(\"The PSBT could not be processed.\");\n+ result.code = request.kind == Kind::Broadcast || request.kind == Kind::Sign ? Error::Uncertain : Error::Core;\n+ result.error = result.code == Error::Uncertain ? Tr(\"The PSBT action may not have finished. Check its status before trying again.\") : Tr(\"The PSBT could not be processed.\");\n }\n return finishAfterRelock();\n }\n@@ -558,7 +513,10 @@ DocumentResult ExportReview(interfaces::Wallet& wallet, std::shared_ptr<const Pa\n tx = CMutableTransaction{*reviewed};\n for (auto& input : tx.vin) { input.scriptSig.clear(); input.scriptWitness.SetNull(); }\n }\n- PartiallySignedTransaction document = source ? *source : PartiallySignedTransaction{tx, 2};\n+ // A file this app creates is version 0, as Bitcoin-Qt writes since\n+ // bitcoin/bitcoin#36539: Core before v32 cannot read version 2 (#1112).\n+ // An imported PSBT is saved back in the version it arrived with.\n+ PartiallySignedTransaction document = source ? *source : PartiallySignedTransaction{tx, /*version=*/0};\n const auto approved = document.GetUnsignedTx();\n if (!approved || (reviewed && !MatchesUnsignedTransaction(tx, *approved))) return {{}, Tr(\"The reviewed transaction changed.\")};\n if (proof && approved_fee && !psbtfee::MatchesReview(document, *proof, approved_fee)) return {{}, Tr(\"The transaction fee changed after review.\")};\n@@ -677,13 +635,19 @@ ImportResult PrepareReview(interfaces::Wallet& wallet, std::shared_ptr<const Par\n if (wallet.getTx(finalized.GetHash())) { result.disposition = ImportResult::Disposition::Known; return result; }\n }\n const bool owned_inputs = std::all_of(tx->vin.begin(), tx->vin.end(), [&](const CTxIn& input) { return wallet.txinIsMine(input); });\n+ // Inputs another party has already signed need no key from this\n+ // wallet; every input still unsigned must be one this wallet owns.\n+ bool owned_unsigned_inputs{true};\n+ for (size_t i = 0; i < tx->vin.size(); ++i) {\n+ if (!PSBTInputSigned(assessment->inputs[i]) && !wallet.txinIsMine(tx->vin[i])) { owned_unsigned_inputs = false; break; }\n+ }\n std::optional<std::pair<int, int>> multisig;\n if (!snapshot->complete) for (size_t i = 0; i < assessment->inputs.size(); ++i) if ((multisig = Multisig(*assessment, i))) break;\n const bool signer = !wallet.privateKeysDisabled() || wallet.hasExternalSigner();\n- result.key_can_send = !multisig && owned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n+ result.key_can_send = !multisig && owned_unsigned_inputs && signer && snapshot->unsigned_inputs > 0 && snapshot->could_sign >= snapshot->unsigned_inputs;\n result.can_commit_complete = !multisig && owned_inputs;\n result.key_can_broadcast = snapshot->can_broadcast;\n- const bool may_send = result.can_commit_complete && (snapshot->complete || result.key_can_send);\n+ const bool may_send = (result.can_commit_complete && snapshot->complete) || result.key_can_send;\n auto review = std::make_shared<walletreview::Snapshot>();\n review->transaction = snapshot->signature_state == SignatureState::Verified ? MakeTransactionRef(finalized) : MakeTransactionRef(*tx);\n review->assessment = assessment;\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Closing Address details can discard text entered during the initial readqml/models/texteditsessionmodel.cpp | addressed | AssessmentThe new code records pending input during Loading, treats it as dirty in the projection, defers close while that input awaits the initial read, and requests close after the input is reconciled. It also handles read failure by clearing the deferred close state. This directly addresses the reported loss-on-close path. path_diff: qml/models/texteditsessionmodel.cpp; new_source: qml/models/texteditsessionmodel.cpp [
{
"evidence_id": "47df19257963491c85f60b9ed06bd0fe",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/models/texteditsessionmodel.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/models/texteditsessionmodel.cpp b/qml/models/texteditsessionmodel.cpp\nindex 176952eb14..c3b5875f85 100644\n--- a/qml/models/texteditsessionmodel.cpp\n+++ b/qml/models/texteditsessionmodel.cpp\n@@ -2,9 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/models/texteditsessionmodel.h>\n-#include <qml/atomicsharedptr.h>\n #include <qml/guipresentation.h>\n-#include <qml/retainedsnapshot.h>\n #include <QPointer>\n #include <QUuid>\n #include <limits>\n@@ -38,6 +36,8 @@ struct TextEditSessionModel::Projection {\n bool valid{false};\n uint64_t rejection{0};\n TextEditError rejected_error;\n+ // Typed while the current value was still loading; not yet in the draft.\n+ bool pending_input{false};\n };\n struct TextEditSessionModel::Mailbox {\n std::mutex mutex;\n@@ -47,11 +47,9 @@ struct TextEditSessionModel::Mailbox {\n struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n State(QString editor_id, QString entity, Ports ports, std::shared_ptr<Mailbox> mailbox, std::function<void()> notify)\n : editor({editor_id.toStdString(), entity.toStdString()}), ports(std::move(ports)),\n- scope(this->ports.execution.scheduler->openActionScope()), key(this->ports.execution.scheduler->allocateKey()), notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n+ notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n Reducer editor;\n const Ports ports;\n- ownership::AtomicSharedPtr<execution::Scheduler> scope;\n- const execution::ResourceKey key;\n const std::function<void()> notify;\n TextEditError error;\n TextEditSaveResult result;\n@@ -59,23 +57,27 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n bool reading{false}, error_from_save{false}, validation_valid{false};\n uint64_t rejection{0};\n TextEditError rejected_error;\n- struct PendingSave { QString value; uint64_t input; Writer writer; std::shared_ptr<execution::Scheduler> scope; uint64_t request; };\n+ struct PendingSave { QString value; uint64_t input; Writer writer; uint64_t request; };\n std::optional<std::pair<QString, uint64_t>> pending_input;\n+ // Close was asked while input typed during Loading waited for the value;\n+ // it is asked again once that input is in the draft, so Close can ask.\n+ bool close_after_load{false}, read_failed{false};\n std::optional<PendingSave> pending_save;\n const std::shared_ptr<Mailbox> mailbox;\n ~State() { mailbox->drained.store(true); try { notify(); } catch (...) {} }\n \n- execution::Admission postUsing(const std::shared_ptr<execution::Scheduler>& target, std::function<void(State&)> command)\n+ bool post(std::function<void(State&)> command)\n {\n- if (!target) return {{}, execution::Rejection::Closed};\n- const auto self = shared_from_this();\n- return execution::Submit(*target, [self, command = std::move(command)] {\n- if (self->mailbox->retired.load()) self->retire(); else command(*self);\n- }, [] {}, {},\n- {execution::Lane::Domain, 131072, key, execution::WorkClass::Action});\n+ auto work = [self = shared_from_this(), command = std::move(command)] {\n+ if (self->mailbox->retired.load()) self->retire();\n+ else command(*self);\n+ };\n+ const auto task = execution::MakeTask(std::move(work), [] {}, {});\n+ return ports.postWork([task] {\n+ task->execute();\n+ task->deliver();\n+ });\n }\n- execution::Admission post(std::function<void(State&)> command) { return postUsing(scope.load(), std::move(command)); }\n- execution::Admission ingress(std::function<void(State&)> command) { return postUsing(ports.execution.scheduler, std::move(command)); }\n bool evaluate() const\n {\n try { return editor.draft()[0].size() <= 32768 && (!ports.validate || ports.validate(editor.draft()[0])); }\n@@ -83,14 +85,14 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n }\n void publish()\n {\n- auto value = std::make_shared<const Projection>(Projection{editor, error, result, input, seen_request, !reading && validation_valid, rejection, rejected_error});\n+ auto value = std::make_shared<const Projection>(Projection{editor, error, result, input, seen_request, !reading && validation_valid, rejection, rejected_error, bool(pending_input)});\n { std::lock_guard lock{mailbox->mutex}; mailbox->latest = std::move(value); }\n notify();\n }\n void edit(QString value, uint64_t sequence)\n {\n if (sequence <= input) return;\n- if (editor.phase() == persistentedit::Phase::Loading) { pending_input = {std::move(value), sequence}; return; }\n+ if (editor.phase() == persistentedit::Phase::Loading) { pending_input = {std::move(value), sequence}; publish(); return; }\n if (editor.edit(0, std::move(value))) { input = sequence; error = {}; error_from_save = false; validation_valid = evaluate();\n if (!validation_valid) error = {TextEditError::Invalid, tr(\"The text is too long or is not valid.\")}; }\n publish();\n@@ -112,11 +114,15 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n if (!self->error_from_save && self->editor.phase() != persistentedit::Phase::Uncertain)\n self->error = self->validation_valid ? TextEditError{} : TextEditError{TextEditError::Invalid, tr(\"The text is too long or is not valid.\")};\n const auto queued = std::exchange(self->pending_input, {});\n- if (const auto save = std::exchange(self->pending_save, {})) {\n- self->edit(save->value, save->input); self->save(save->writer, save->scope, save->request);\n+ if (auto save = std::exchange(self->pending_save, {})) {\n+ self->edit(save->value, save->input); self->save(std::move(save->writer), save->request);\n }\n if (queued) self->edit(queued->first, queued->second);\n+ self->read_failed = false;\n+ if (std::exchange(self->close_after_load, false)) self->editor.requestClose();\n } else {\n+ // A second Close closes: there is no value to save the input against.\n+ self->read_failed = true; self->close_after_load = false;\n if (self->pending_save) self->seen_request = std::max(self->seen_request, self->pending_save->request);\n self->pending_save.reset();\n if (!self->error_from_save) self->error = value.error.code == TextEditError::None\n@@ -145,10 +151,10 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n result.outcome = static_cast<TextEditSaveResult::Outcome>(outcome);\n result.value = persisted ? value : QString{}; result.error = failure;\n }\n- void save(Writer writer, std::shared_ptr<execution::Scheduler> action, uint64_t request)\n+ void save(Writer writer, uint64_t request)\n {\n if (editor.phase() == persistentedit::Phase::Loading && pending_input) {\n- pending_save = PendingSave{pending_input->first, pending_input->second, std::move(writer), std::move(action), request}; return;\n+ pending_save = PendingSave{pending_input->first, pending_input->second, std::move(writer), request}; return;\n }\n seen_request = std::max(seen_request, request);\n // A loaded editor can save its captured draft while a refresh is in\n@@ -158,7 +164,7 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n if (!attempt) {\n if (editor.conflicts().any()) { error = {TextEditError::Changed, tr(\"Resolve the changed value before saving.\")}; reject(error); }\n else if (editor.busy() || editor.phase() == persistentedit::Phase::Uncertain)\n- reject({TextEditError::Refused, tr(\"The original save has not settled. It will not be repeated.\")});\n+ reject({TextEditError::Refused, tr(\"The save is still in progress. It will not be repeated.\")});\n publish(); return;\n }\n publish(); // Checking is observable while validation runs on Domain.\n@@ -174,19 +180,17 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n reading = false;\n publish();\n const auto self = shared_from_this();\n- const auto done = [self, accepted, action](Write value) {\n- // Retain the original intent through its independently owned outcome.\n- (void)action;\n+ const auto done = [self, accepted](Write value) {\n self->finish(accepted, value, false);\n };\n try {\n- if (writer && writer(accepted, done, action)) return;\n+ if (writer && writer(accepted, done)) return;\n Write rejected; rejected.outcome = persistentedit::Outcome::Rejected;\n- rejected.error = {TextEditError::Refused, tr(\"The save could not be scheduled.\")};\n+ rejected.error = {TextEditError::Refused, tr(\"Saving could not start. Try again.\")};\n finish(accepted, rejected, false);\n } catch (...) {\n Write uncertain; uncertain.outcome = persistentedit::Outcome::Unknown;\n- uncertain.error = {TextEditError::Unknown, tr(\"The save outcome is not yet confirmed. It will not be repeated.\")};\n+ uncertain.error = {TextEditError::Unknown, tr(\"The save may not have finished. It will not be repeated.\")};\n finish(accepted, uncertain, false);\n }\n }\n@@ -209,7 +213,7 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n if (pending_save) seen_request = std::max(seen_request, pending_save->request);\n pending_save.reset(); pending_input.reset();\n error = {TextEditError::Closed, tr(\"This editor is closed.\")};\n- editor.retire(); scope.store({}); publish();\n+ editor.retire(); publish();\n }\n void reconcile()\n {\n@@ -224,21 +228,22 @@ struct TextEditSessionModel::State : std::enable_shared_from_this<State> {\n self->finish(attempt, value, true);\n })); } catch (...) {}\n if (!admitted && editor.phase() == persistentedit::Phase::Uncertain) {\n- error = {TextEditError::Unknown, tr(\"The original save outcome remains unknown. It will not be repeated.\")}; publish();\n+ error = {TextEditError::Unknown, tr(\"The save may not have finished. It will not be repeated.\")}; publish();\n }\n }\n };\n \n TextEditSessionModel::TextEditSessionModel(QString entity, Ports ports, QObject* parent)\n- : QObject(parent), m_editor_id(QUuid::createUuid().toString(QUuid::WithoutBraces)), m_entity_id(std::move(entity)), m_execution(ports.execution)\n+ : QObject(parent), m_editor_id(QUuid::createUuid().toString(QUuid::WithoutBraces)), m_entity_id(std::move(entity))\n {\n- Q_ASSERT(m_execution.scheduler);\n- m_execution.post = presentation::ReliablePost(std::move(m_execution.post));\n- ports.execution = m_execution;\n+ Q_ASSERT(ports.postWork && ports.value_cleanup);\n+ auto post = presentation::ReliablePost(std::move(ports.post));\n const QPointer<TextEditSessionModel> observer{this};\n m_mailbox = std::make_shared<Mailbox>();\n- m_state_owner = execution::RetainSnapshot<std::shared_ptr<State>>(m_execution.scheduler,\n- [editor_id = m_editor_id, entity_id = m_entity_id, ports = std::move(ports), mailbox = m_mailbox, observer, post = m_execution.post]() mutable {\n+ const auto value_cleanup = ports.value_cleanup;\n+ const bool can_post = bool(ports.postWork);\n+ auto make_state =\n+ [editor_id = m_editor_id, entity_id = m_entity_id, ports = std::move(ports), mailbox = m_mailbox, observer, post = std::move(post)]() mutable {\n return std::make_unique<std::shared_ptr<State>>(std::make_shared<State>(editor_id, entity_id, std::move(ports), mailbox, [mailbox, observer, post] {\n if (mailbox->notice_pending.exchange(true)) return;\n try { post([mailbox, observer] {\n@@ -246,10 +251,10 @@ TextEditSessionModel::TextEditSessionModel(QString entity, Ports ports, QObject*\n if (observer) observer->publish();\n }); } catch (...) { mailbox->notice_pending.store(false); throw; }\n }));\n- });\n+ };\n+ if (value_cleanup && can_post) m_state_owner = execution::RetainValues<std::shared_ptr<State>>(value_cleanup, std::move(make_state));\n if (m_state_owner) {\n- // Frontend locks borrow the reserved cleanup lease, never the actor's\n- // shared_from_this counter. Their last release cannot destroy State on GUI.\n+ // GUI references release the original owner on its worker queue.\n m_state = std::shared_ptr<State>{m_state_owner, m_state_owner->get()};\n m_mailbox = (*m_state_owner)->mailbox;\n }\n@@ -287,11 +292,11 @@ bool TextEditSessionModel::submit(std::function<void(State&)> command, const QSt\n bool admitted{false};\n {\n const auto state = m_state.lock();\n- admitted = available() && state && bool(state->ingress(std::move(command)));\n+ admitted = available() && state && state->post(std::move(command));\n }\n if (!guard) return false;\n if (admitted) { m_immediate_error = {}; return true; }\n- m_immediate_error = {m_retired ? TextEditError::Closed : TextEditError::Refused, tr(\"This editor command could not be scheduled.\")};\n+ m_immediate_error = {m_retired ? TextEditError::Closed : TextEditError::Refused, tr(\"This change could not be applied. Try again.\")};\n const auto rejected = m_immediate_error;\n Q_EMIT changed();\n if (guard) Q_EMIT commandRejected(name, rejected);\n@@ -337,7 +342,7 @@ TextEditSessionModel::Phase TextEditSessionModel::phase() const {\n if (m_pending_save_sequence && m_projection && m_projection->editor.phase() == persistentedit::Phase::Editing) return Checking;\n return m_projection ? static_cast<Phase>(m_projection->editor.phase()) : m_retired ? Closed : Loading;\n }\n-bool TextEditSessionModel::dirty() const { return m_projection && m_projection->editor.dirty(); }\n+bool TextEditSessionModel::dirty() const { return m_projection && (m_projection->editor.dirty() || m_projection->pending_input); }\n bool TextEditSessionModel::valid() const { return !m_input_invalid && m_projection && m_projection->valid; }\n bool TextEditSessionModel::busy() const {\n return !(m_mailbox && m_mailbox->drained.load()) && (m_pending_save_sequence || (m_projection && m_projection->editor.busy()));\n@@ -357,14 +362,14 @@ bool TextEditSessionModel::refuseBusy(const QString& command)\n {\n if (!available() || !busy()) return false;\n Q_EMIT commandRejected(m_editor_id + \"/\" + command + \"/\" + QUuid::createUuid().toString(QUuid::WithoutBraces),\n- (TextEditError{TextEditError::Refused, tr(\"The original save is still in progress.\")}));\n+ (TextEditError{TextEditError::Refused, tr(\"The save is still in progress.\")}));\n return true;\n }\n void TextEditSessionModel::save() { saveCommand(); }\n void TextEditSessionModel::saveCommand(std::optional<uint64_t> close_token)\n {\n if (refuseBusy(QStringLiteral(\"save\"))) return;\n- const auto action = available() && !m_input_invalid && m_next_save_sequence != UINT64_MAX ? m_execution.scheduler->openActionScope() : nullptr;\n+ const bool can_submit = available() && !m_input_invalid && m_next_save_sequence != UINT64_MAX;\n const auto request = m_next_save_sequence == UINT64_MAX ? 0 : m_next_save_sequence + 1;\n const auto value = m_text.text(); const auto sequence = m_input_sequence;\n const QPointer<TextEditSessionModel> observer{this};\n@@ -372,17 +377,19 @@ void TextEditSessionModel::saveCommand(std::optional<uint64_t> close_token)\n {\n const auto state = m_state.lock();\n Writer writer;\n- try { if (action && state) writer = state->ports.admitWrite ? state->ports.admitWrite() : state->ports.write; }\n+ try {\n+ if (can_submit && state) writer = state->ports.admitWrite ? state->ports.admitWrite() : state->ports.write;\n+ }\n catch (...) {}\n if (!observer) return;\n- admitted = action && writer && state && bool(state->postUsing(action, [writer = std::move(writer), action, close_token, value, sequence, request](State& state) {\n+ admitted = writer && state->post([writer = std::move(writer), close_token, value, sequence, request](State& state) mutable {\n state.edit(value, sequence);\n if (close_token && !state.editor.answerClose(*close_token, persistentedit::CloseChoice::Save)) {\n state.seen_request = std::max(state.seen_request, request);\n state.reject({TextEditError::Changed, tr(\"The close question changed. Review the current edit before answering.\")}); state.publish(); return;\n }\n- state.save(writer, action, request);\n- }));\n+ state.save(std::move(writer), request);\n+ });\n }\n if (!observer) return;\n if (admitted) {\n@@ -390,18 +397,22 @@ void TextEditSessionModel::saveCommand(std::optional<uint64_t> close_token)\n m_immediate_error = {}; Q_EMIT changed(); return;\n }\n m_immediate_error = {!available() ? TextEditError::Closed : m_input_invalid ? TextEditError::Invalid : TextEditError::Refused,\n- !available() ? tr(\"This editor is closed.\") : m_input_invalid ? tr(\"Correct the rejected text before saving.\") : tr(\"The save could not be admitted.\")};\n+ !available() ? tr(\"This editor is closed.\") : m_input_invalid ? tr(\"Correct the rejected text before saving.\") : tr(\"Saving could not start. Try again.\")};\n const auto rejected = m_immediate_error;\n const QPointer<TextEditSessionModel> guard{this};\n Q_EMIT changed(); if (guard) Q_EMIT commandRejected(QStringLiteral(\"save\"), rejected);\n }\n void TextEditSessionModel::discard() { if (refuseBusy(QStringLiteral(\"discard\"))) return; m_input_invalid = false; submit([sequence = m_input_sequence](State& state) {\n state.input = std::max(state.input, sequence);\n- state.pending_input.reset(); state.pending_save.reset();\n+ state.pending_input.reset(); state.pending_save.reset(); state.close_after_load = false;\n if (state.editor.discard()) { state.error = {}; state.error_from_save = false; state.validation_valid = state.evaluate(); }\n state.publish();\n }, QStringLiteral(\"discard\")); }\n-void TextEditSessionModel::requestClose() { if (phase() == Closed || refuseBusy(QStringLiteral(\"requestClose\"))) return; submit([](State& state) { state.editor.requestClose(); state.publish(); }, QStringLiteral(\"requestClose\")); }\n+void TextEditSessionModel::requestClose() { if (phase() == Closed || refuseBusy(QStringLiteral(\"requestClose\"))) return; submit([](State& state) {\n+ if (state.editor.phase() == persistentedit::Phase::Loading && state.pending_input && !state.read_failed) state.close_after_load = true;\n+ else state.editor.requestClose();\n+ state.publish();\n+}, QStringLiteral(\"requestClose\")); }\n void TextEditSessionModel::answerClose(const QString& token, CloseChoice choice)\n {\n bool okay{false}; const auto number = token.toULongLong(&okay);\n@@ -426,8 +437,7 @@ void TextEditSessionModel::retire()\n if (std::exchange(m_retired, true)) return;\n if (m_mailbox) m_mailbox->retired.store(true);\n if (const auto state = m_state.lock()) state->post([](State& owner) { owner.retire(); });\n- // The detached GUI projection must not hold the wallet scheduler's cleanup\n- // lease or lifetime scope. Accepted effects retain their own original owner.\n+ // Accepted effects retain their original owner through worker delivery.\n m_state_owner.reset();\n const QPointer<Te\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 445,
"evidence_id": "6920807230ed4d04963605e2a8966aa9",
"finding_id": "finding:3",
"kind": "new_source",
"line": 374,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/models/texteditsessionmodel.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 4,
"source_job_id": 2819,
"text": " const auto value = m_text.text(); const auto sequence = m_input_sequence;\n const QPointer<TextEditSessionModel> observer{this};\n bool admitted{false};\n {\n const auto state = m_state.lock();\n Writer writer;\n try {\n if (can_submit && state) writer = state->ports.admitWrite ? state->ports.admitWrite() : state->ports.write;\n }\n catch (...) {}\n if (!observer) return;\n admitted = writer && state->post([writer = std::move(writer), close_token, value, sequence, request](State& state) mutable {\n state.edit(value, sequence);\n if (close_token && !state.editor.answerClose(*close_token, persistentedit::CloseChoice::Save)) {\n state.seen_request = std::max(state.seen_request, request);\n state.reject({TextEditError::Changed, tr(\"The close question changed. Review the current edit before answering.\")}); state.publish(); return;\n }\n state.save(std::move(writer), request);\n });\n }\n if (!observer) return;\n if (admitted) {\n m_next_save_sequence = request; m_pending_save_sequence = request;\n m_immediate_error = {}; Q_EMIT changed(); return;\n }\n m_immediate_error = {!available() ? TextEditError::Closed : m_input_invalid ? TextEditError::Invalid : TextEditError::Refused,\n !available() ? tr(\"This editor is closed.\") : m_input_invalid ? tr(\"Correct the rejected text before saving.\") : tr(\"Saving could not start. Try again.\")};\n const auto rejected = m_immediate_error;\n const QPointer<TextEditSessionModel> guard{this};\n Q_EMIT changed(); if (guard) Q_EMIT commandRejected(QStringLiteral(\"save\"), rejected);\n}\nvoid TextEditSessionModel::discard() { if (refuseBusy(QStringLiteral(\"discard\"))) return; m_input_invalid = false; submit([sequence = m_input_sequence](State& state) {\n state.input = std::max(state.input, sequence);\n state.pending_input.reset(); state.pending_save.reset(); state.close_after_load = false;\n if (state.editor.discard()) { state.error = {}; state.error_from_save = false; state.validation_valid = state.evaluate(); }\n state.publish();\n}, QStringLiteral(\"discard\")); }\nvoid TextEditSessionModel::requestClose() { if (phase() == Closed || refuseBusy(QStringLiteral(\"requestClose\"))) return; submit([](State& state) {\n if (state.editor.phase() == persistentedit::Phase::Loading && state.pending_input && !state.read_failed) state.close_after_load = true;\n else state.editor.requestClose();\n state.publish();\n}, QStringLiteral(\"requestClose\")); }\nvoid TextEditSessionModel::answerClose(const QString& token, CloseChoice choice)\n{\n bool okay{false}; const auto number = token.toULongLong(&okay);\n if (!okay || choice < Save || choice > KeepEditing || refuseBusy(QStringLiteral(\"answerClose\"))) return;\n if (choice == Save) { saveCommand(number); return; }\n submit([number, choice](State& state) {\n if (state.editor.answerClose(number, static_cast<persistentedit::CloseChoice>(choice)) && choice == Discard) {\n state.error = {}; state.error_from_save = false; state.validation_valid = state.evaluate();\n }\n state.publish();\n }, QStringLiteral(\"answerClose\"));\n}\nvoid TextEditSessionModel::resolveConflict(const QString& field, ConflictChoice choice)\n{\n if (field != QStringLiteral(\"text\") || (choice != KeepEdit && choice != UseCurrent)) return;\n submit([choice](State& state) { if (state.editor.resolve(0, choice == KeepEdit)) { state.error = {}; state.error_from_save = false; state.validation_valid = state.evaluate(); } state.publish(); }, QStringLiteral(\"resolveConflict\"));\n}\nvoid TextEditSessionModel::refresh() { submit([](State& state) { state.read(); }, QStringLiteral(\"refresh\")); }\nvoid TextEditSessionModel::reconcile() { submit([](State& state) { state.reconcile(); }, QStringLiteral(\"reconcile\")); }\nvoid TextEditSessionModel::retire()\n{\n if (std::exchange(m_retired, true)) return;\n if (m_mailbox) m_mailbox->retired.store(true);\n if (const auto state = m_state.lock()) state->post([](State& owner) { owner.retire(); });\n // Accepted effects retain their original owner through worker delivery.\n m_state_owner.reset();\n const QPointer<TextEditSessionModel> guard{this};\n m_text.setAvailable(false);\n if (guard) Q_EMIT changed();\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | The amount-parsing fix introduces paste routing before its componentqml/controls/BitcoinAmountInputField.qml | unclear | AssessmentThe new amount field no longer instantiates CapturedPaste, but it still handles payment-URI routing. The evidence does not show the extraction commit or its component contract, so it is insufficient to determine whether the requested separation was achieved. path_diff: qml/controls/BitcoinAmountInputField.qml; new_source: qml/controls/BitcoinAmountInputField.qml [
{
"evidence_id": "4c5bb7fe8161492294b1f86629316c6e",
"finding_id": "finding:13",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/controls/BitcoinAmountInputField.qml",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/controls/BitcoinAmountInputField.qml b/qml/controls/BitcoinAmountInputField.qml\nindex d6dcd10ef2..a4f16338a0 100644\n--- a/qml/controls/BitcoinAmountInputField.qml\n+++ b/qml/controls/BitcoinAmountInputField.qml\n@@ -15,7 +15,6 @@ ColumnLayout {\n property bool showErrorMessage: true\n readonly property string effectiveErrorText: errorText || (amount ? amount.inputError : \"\")\n property bool readOnly: false\n- readonly property bool pastePending: pasteIntent.pending\n property string labelText: qsTr(\"Amount\")\n property string accessibleName: labelText\n property alias inputObjectName: amountInput.objectName\n@@ -30,66 +29,46 @@ ColumnLayout {\n signal inputTextChanged\n signal textEdited\n signal editingFinished(string value)\n- signal pasteRequested(var payload)\n+ // A pasted payment URI. With interceptPaste it is imported, not inserted.\n+ signal paymentUriPasted(string text)\n \n function syncFromAmount(force) {\n if (root.amount && (force || !amountInput.activeFocus)) root.amount.resetInput()\n }\n \n- function paymentUri(text) {\n- if (!root.interceptPaste || text.length > 512) return \"\"\n- const trimmed = String(text).trim()\n- return trimmed.toLowerCase().startsWith(\"bitcoin:\") ? trimmed : \"\"\n- }\n- function shortProvenance(previous, current, clipboard) {\n- if (previous.length > 512 || current.length > 512 || clipboard.length > 512 || !clipboard.length\n- || previous === current || current.length < clipboard.length) return false\n- const unchanged = current.length - clipboard.length\n- if (unchanged > previous.length) return false\n- let prefix = 0\n- let suffix = 0\n- while (prefix < Math.min(previous.length, current.length) && previous[prefix] === current[prefix]) prefix++\n- while (suffix < Math.min(previous.length, current.length)\n- && previous[previous.length - suffix - 1] === current[current.length - suffix - 1]) suffix++\n- const low = Math.max(0, unchanged - suffix)\n- const high = Math.min(prefix, unchanged)\n- const found = current.indexOf(clipboard, low)\n- return low <= high && found >= 0 && found <= high\n- }\n- function pastedPaymentUri(previous, current) {\n- const clipboard = Clipboard.text()\n- const uri = paymentUri(clipboard)\n- return uri.length && shortProvenance(previous, current, clipboard) ? uri : \"\"\n- }\n- function capturePaste(text, primary) { return pasteIntent.capture(text, primary, false, \"\", \"\", undefined) }\n- function applyCapturedPaste(payload) { return pasteIntent.apply(payload) }\n- function cancelPaste(payload) { if (pasteIntent.intent === payload) pasteIntent.cancel() }\n- function paste() { pasteIntent.request(false) }\n- onAmountChanged: pasteIntent.cancel()\n-\n- CapturedPaste {\n- id: pasteIntent\n- textInput: amountInput\n- context: root.amount\n- active: root.visible && root.enabled && !root.readOnly && !!root.amount\n- menuObjectName: root.inputObjectName + \"ContextMenu\"\n- onRequested: (payload) => {\n- if (root.interceptPaste) root.pasteRequested(payload)\n- else apply(payload)\n+ function paste(primary) {\n+ const text = primary ? Clipboard.selectionText() : Clipboard.text()\n+ if (!text.length || !root.enabled || root.readOnly || !root.amount) return\n+ if (root.interceptPaste && BitcoinUri.isPaymentUri(text)) {\n+ root.paymentUriPasted(text)\n+ return\n }\n- onRestoreRequested: (payload) => amountInput.restoreFromModel()\n- // A change to the amount's input cancels a captured paste (see the\n- // Connections below), so a paste applies only to the text it captured.\n- onLiteralRequested: (payload) => {\n- if (!root.amount) return\n- let cursor = payload.cursor\n- if (payload.edited) root.amount.editInput(payload.current)\n- else cursor = root.amount.paste(payload.text, payload.start, payload.end)\n+ const start = Math.min(amountInput.selectionStart, amountInput.selectionEnd)\n+ const end = Math.max(amountInput.selectionStart, amountInput.selectionEnd)\n+ if (amountInput.length - (end - start) + text.length <= amountInput.maximumLength) {\n+ // The field's own edit keeps Ctrl+Z working; the model reads the result.\n+ amountInput.pasting = true\n+ amountInput.remove(start, end)\n+ amountInput.insert(start, text)\n+ amountInput.pasting = false\n+ root.amount.editInput(amountInput.text)\n+ } else {\n+ // Too long for the field: the model refuses the exact original\n+ // input instead of the field cutting it to a prefix.\n+ const cursor = root.amount.paste(text, start, end)\n amountInput.restoreFromModel()\n if (cursor >= 0) amountInput.cursorPosition = Math.min(cursor, amountInput.length)\n- root.inputTextChanged()\n- root.textEdited()\n }\n+ root.inputTextChanged()\n+ root.textEdited()\n+ }\n+\n+ TextEditMenu {\n+ id: editMenu\n+ textInput: amountInput\n+ pasteEnabled: root.enabled && !root.readOnly && !!root.amount\n+ menuObjectName: root.inputObjectName + \"ContextMenu\"\n+ onPasteRequested: (primary) => root.paste(primary)\n }\n \n function amountInputPlaceholder(unit) {\n@@ -124,30 +103,24 @@ ColumnLayout {\n \n TextField {\n id: amountInput\n+ // A paste in progress; its edit is reported once it is complete.\n+ property bool pasting: false\n function restoreFromModel() {\n text = Qt.binding(function() { return root.amount ? root.amount.inputText : \"\" })\n }\n function finishAmountEditing() {\n- if (pasteIntent.pending) return\n if (root.amount) root.amount.format()\n root.editingFinished(text)\n }\n \n+ // A native paste of a payment URI is imported; other URI text\n+ // is not an amount, so the field keeps its previous text.\n function handlePaymentUriInput() {\n- if (!root.interceptPaste || pasteIntent.literalActive) return false\n- const previous = root.amount ? root.amount.inputText : \"\"\n- const current = text\n- const cursor = cursorPosition\n- const clipboard = Clipboard.text()\n- const longEdit = previous.length > 512 || current.length > 512 || clipboard.length > 512\n- const uri = longEdit ? \"\" : root.paymentUri(clipboard)\n- const fromClipboard = !longEdit && uri.length > 0 && root.shortProvenance(previous, current, clipboard)\n- const typedUri = !longEdit && current.toLowerCase().indexOf(\"bitcoin:\") >= 0\n- if (!longEdit && !fromClipboard && !typedUri) return false\n+ if (!root.interceptPaste) return false\n+ const uri = BitcoinUri.pastedPaymentUri(root.amount ? root.amount.inputText : \"\", text, Clipboard.text())\n+ if (!uri.length && text.toLowerCase().indexOf(\"bitcoin:\") < 0) return false\n restoreFromModel()\n- // This bounded routing check never authorizes an import or\n- // decides provenance. Native classifies the captured edit.\n- pasteIntent.nativeEdit(clipboard, previous, current, cursor)\n+ if (uri.length) root.paymentUriPasted(uri)\n return true\n }\n Accessible.name: root.accessibleName\n@@ -166,14 +139,14 @@ ColumnLayout {\n \n Keys.onPressed: (event) => {\n if (root.interceptPaste && event.matches(StandardKey.Paste)) {\n- pasteIntent.request(false)\n+ root.paste(false)\n event.accepted = true\n }\n }\n \n text: root.amount ? root.amount.inputText : \"\"\n onTextEdited: {\n- pasteIntent.invalidate()\n+ if (pasting) return\n if (handlePaymentUriInput()) return\n if (root.amount) root.amount.editInput(text)\n root.inputTextChanged()\n@@ -184,15 +157,11 @@ ColumnLayout {\n // Intercept long native commits before business validation; the model\n // refuses the exact original input instead of parsing a cut prefix.\n maximumLength: root.interceptPaste ? 2147483647 : 129\n- readOnly: root.readOnly || pasteIntent.pending\n+ readOnly: root.readOnly\n MouseArea {\n anchors.fill: parent\n acceptedButtons: Qt.RightButton | Qt.MiddleButton\n- onPressed: (mouse) => pasteIntent.pointerPressed(mouse)\n- }\n- Connections {\n- target: root.amount\n- function onInputChanged() { pasteIntent.invalidate() }\n+ onPressed: (mouse) => editMenu.pointerPressed(mouse)\n }\n \n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 189,
"evidence_id": "b2730f993a204233872541c41d10bf5d",
"finding_id": "finding:13",
"kind": "new_source",
"line": 40,
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/controls/BitcoinAmountInputField.qml",
"revision": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"source_generation": 4,
"source_job_id": 2819,
"text": " const text = primary ? Clipboard.selectionText() : Clipboard.text()\n if (!text.length || !root.enabled || root.readOnly || !root.amount) return\n if (root.interceptPaste && BitcoinUri.isPaymentUri(text)) {\n root.paymentUriPasted(text)\n return\n }\n const start = Math.min(amountInput.selectionStart, amountInput.selectionEnd)\n const end = Math.max(amountInput.selectionStart, amountInput.selectionEnd)\n if (amountInput.length - (end - start) + text.length <= amountInput.maximumLength) {\n // The field's own edit keeps Ctrl+Z working; the model reads the result.\n amountInput.pasting = true\n amountInput.remove(start, end)\n amountInput.insert(start, text)\n amountInput.pasting = false\n root.amount.editInput(amountInput.text)\n } else {\n // Too long for the field: the model refuses the exact original\n // input instead of the field cutting it to a prefix.\n const cursor = root.amount.paste(text, start, end)\n amountInput.restoreFromModel()\n if (cursor >= 0) amountInput.cursorPosition = Math.min(cursor, amountInput.length)\n }\n root.inputTextChanged()\n root.textEdited()\n }\n\n TextEditMenu {\n id: editMenu\n textInput: amountInput\n pasteEnabled: root.enabled && !root.readOnly && !!root.amount\n menuObjectName: root.inputObjectName + \"ContextMenu\"\n onPasteRequested: (primary) => root.paste(primary)\n }\n\n function amountInputPlaceholder(unit) {\n if (unit === BitcoinAmount.SAT) return \"0\"\n if (unit === BitcoinAmount.MicroBTC) return \"0.00\"\n if (unit === BitcoinAmount.MilliBTC) return \"0.00000\"\n return \"0.00000000\"\n }\n\n function flippedDisplayUnit(unit) {\n return unit === BitcoinAmount.SAT ? BitcoinAmount.BTC : BitcoinAmount.SAT\n }\n\n Layout.fillWidth: true\n spacing: Theme.space.xs\n\n Item {\n id: inputRow\n Layout.fillWidth: true\n Layout.preferredHeight: 56\n\n CoreText {\n id: lbl\n visible: root.showLabel\n width: visible ? 128 : 0\n anchors.left: parent.left\n anchors.verticalCenter: parent.verticalCenter\n horizontalAlignment: Text.AlignLeft\n text: root.labelText\n textStyle: Theme.text.body\n }\n\n TextField {\n id: amountInput\n // A paste in progress; its edit is reported once it is complete.\n property bool pasting: false\n function restoreFromModel() {\n text = Qt.binding(function() { return root.amount ? root.amount.inputText : \"\" })\n }\n function finishAmountEditing() {\n if (root.amount) root.amount.format()\n root.editingFinished(text)\n }\n\n // A native paste of a payment URI is imported; other URI text\n // is not an amount, so the field keeps its previous text.\n function handlePaymentUriInput() {\n if (!root.interceptPaste) return false\n const uri = BitcoinUri.pastedPaymentUri(root.amount ? root.amount.inputText : \"\", text, Clipboard.text())\n if (!uri.length && text.toLowerCase().indexOf(\"bitcoin:\") < 0) return false\n restoreFromModel()\n if (uri.length) root.paymentUriPasted(uri)\n return true\n }\n Accessible.name: root.accessibleName\n anchors.left: lbl.right\n anchors.right: unitToggle.left\n anchors.verticalCenter: parent.verticalCenter\n leftPadding: 0\n enabled: root.enabled\n font: Theme.text.body.font\n color: Theme.color.neutral9\n placeholderTextColor: enabled ? Theme.color.placeholder : Theme.color.disabledContent\n verticalAlignment: TextInput.AlignVCenter\n background: Item {}\n placeholderText: root.placeholderText\n selectByMouse: true\n\n Keys.onPressed: (event) => {\n if (root.interceptPaste && event.matches(StandardKey.Paste)) {\n root.paste(false)\n event.accepted = true\n }\n }\n\n text: root.amount ? root.amount.inputText : \"\"\n onTextEdited: {\n if (pasting) return\n if (handlePaymentUriInput()) return\n if (root.amount) root.amount.editInput(text)\n root.inputTextChanged()\n root.textEdited()\n }\n onEditingFinished: finishAmountEditing()\n onActiveFocusChanged: if (!activeFocus) finishAmountEditing()\n // Intercept long native commits before business validation; the model\n // refuses the exact original input instead of parsing a cut prefix.\n maximumLength: root.interceptPaste ? 2147483647 : 129\n readOnly: root.readOnly\n MouseArea {\n anchors.fill: parent\n acceptedButtons: Qt.RightButton | Qt.MiddleButton\n onPressed: (mouse) => editMenu.pointerPressed(mouse)\n }\n\n }\n\n AmountUnitButton {\n id: unitToggle\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n opacity: root.enabled ? 1.0 : 0.5\n enabled: root.enabled && !!root.amount && root.amount.inputAcceptable\n unit: root.amount ? root.amount.unit : BitcoinAmount.BTC\n onClicked: {\n root.amount.format()\n ApplicationModels.optionsModel.displayUnit = root.flippedDisplayUnit(root.amount.unit)\n }\n }\n }\n\n RowLayout {\n id: errorRow\n Layout.fillWidth: true\n visible: root.showErrorMessage && root.effectiveErrorText.length > 0\n\n Icon {\n source: \"image://images/alert-filled\"",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | Fixes #1063 identifies the helper commit rather than fee enforcementqml/models/psbtfeeservices.cpp | unclear | AssessmentThe evidence shows changes to the fee helper implementation, but the finding asks for commit-message and issue-attribution changes. No supplied commit metadata establishes whether those changes were made. path_diff: qml/models/psbtfeeservices.cpp [
{
"evidence_id": "c3222aa969184132a4609dfd96eb9310",
"finding_id": "finding:12",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/models/psbtfeeservices.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/models/psbtfeeservices.cpp b/qml/models/psbtfeeservices.cpp\nindex d9f8fa8624..ea21ef5162 100644\n--- a/qml/models/psbtfeeservices.cpp\n+++ b/qml/models/psbtfeeservices.cpp\n@@ -3,8 +3,10 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/models/psbtfeeservices.h>\n+#include <qml/executor.h>\n #include <qml/psbtdocument.h>\n #include <qml/retainedvalue.h>\n+#include <qml/walletopening.h>\n \n #include <coins.h>\n #include <interfaces/node.h>\n@@ -75,26 +77,34 @@ psbtfee::Resolution psbtfee::Resolve(const PartiallySignedTransaction& document,\n return result;\n }\n \n-execution::Admission psbtfee::Request(const Services& services, std::shared_ptr<const PartiallySignedTransaction> document,\n- std::shared_ptr<const Analysis> seed, std::function<void(Resolution)> publish)\n+execution::SubmitResult psbtfee::Request(const Services& services, std::shared_ptr<const PartiallySignedTransaction> document,\n+ std::shared_ptr<const Analysis> seed, const std::shared_ptr<FeeRequest>& request,\n+ const std::shared_ptr<walletopening::Session>& opening)\n {\n- if (!services.scheduler || !services.lookup || !services.post) return {{}, execution::Rejection::Transport};\n- // The GUI only receives aliases. Dropped or obsolete callbacks never free\n- // a PSBT, authenticated output map or raw transaction on the GUI thread.\n- auto output = execution::RetainValues<Resolution>(services.scheduler, [] { return std::make_unique<Resolution>(); });\n- if (!output) return {{}, execution::Rejection::Capacity};\n- auto post = [transport = services.post, publish = std::move(publish)](Resolution resolution) {\n- auto value = std::make_shared<Resolution>(std::move(resolution));\n- transport([publish, value] { publish(std::move(*value)); });\n+ if (!services.lookup || !services.post) return {{}, execution::Rejection::Transport};\n+ const auto submit = opening ? opening->observationPost() : nullptr;\n+ if (!opening && (!services.core || !services.utility || !services.value_cleanup)) return {{}, execution::Rejection::Transport};\n+ if (opening && (!submit || !opening->available())) return {{}, execution::Rejection::Closed};\n+ // A retained result owns the PSBT, authenticated output map and raw\n+ // transaction on the same cleanup queue even if GUI drops the review.\n+ const auto make_output = [] { return std::make_unique<Resolution>(); };\n+ auto output = opening ? walletopening::RetainValues<Resolution>(opening, make_output)\n+ : execution::RetainValues<Resolution>(services.value_cleanup, make_output);\n+ if (!output) return {{}, execution::Rejection::Closed};\n+ auto work = [opening, document = std::move(document), seed = std::move(seed),\n+ lookup = services.lookup, policy = services.policy, output] {\n+ if (opening && !opening->available()) throw execution::NotStarted{execution::NotStarted::Cause::Cancelled};\n+ *output = Resolve(*document, *seed, lookup, policy);\n+ auto value = *output;\n+ if (value.proof) value.proof = std::shared_ptr<const Analysis>{output, value.proof.get()};\n+ if (value.analysis) value.analysis = std::shared_ptr<const psbtwork::Snapshot>{output, value.analysis.get()};\n+ if (value.transaction) value.transaction = CTransactionRef{output, value.transaction.get()};\n+ return value;\n };\n- return execution::Submit(*services.scheduler,\n- [document = std::move(document), seed = std::move(seed), lookup = services.lookup, policy = services.policy, output] {\n- *output = Resolve(*document, *seed, lookup, policy);\n- auto value = *output;\n- if (value.proof) value.proof = std::shared_ptr<const Analysis>{output, value.proof.get()};\n- if (value.analysis) value.analysis = std::shared_ptr<const psbtwork::Snapshot>{output, value.analysis.get()};\n- if (value.transaction) value.transaction = CTransactionRef{output, value.transaction.get()};\n- return value;\n- },\n- post, [post](std::exception_ptr) { post({{}, false, true}); });\n+ return request->startWith([&](auto done, auto failed) {\n+ auto task = execution::MakeTask(std::move(work), std::move(done), std::move(failed));\n+ if (submit) return submit(std::move(task));\n+ auto delivery = std::make_shared<execution::ValueCleanupQueue>(services.utility);\n+ return delivery->postWithOutcome(*services.core, std::move(task));\n+ });\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The startup rewrite removes error routing that a later commit restoresqml/bitcoin.cpp | unclear | AssessmentThis is a commit-sequencing and review-continuity suggestion. The supplied evidence shows current startup error-routing code but not the commit history/messages needed to determine whether the repair was folded into the rewrite. path_diff: qml/bitcoin.cpp [
{
"evidence_id": "2de40398096647d5aec636cbb07b4352",
"finding_id": "finding:11",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/bitcoin.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/bitcoin.cpp b/qml/bitcoin.cpp\nindex d821f59de2..a1e12b7721 100644\n--- a/qml/bitcoin.cpp\n+++ b/qml/bitcoin.cpp\n@@ -7,7 +7,7 @@\n #include <qml/atomicsharedptr.h>\n #include <bitcoin-build-config.h> // IWYU pragma: keep\n \n-#include <qml/models/backuppolicyoperation.h>\n+#include <qml/models/filesaveoperation.h>\n #include <qml/bitcoin.h>\n #include <qml/bitcoinqmlapplication.h>\n \n@@ -25,8 +25,7 @@\n #include <noui.h>\n #include <qml/appmode.h>\n #include <qml/applicationmodels.h>\n-#include <qml/backendexecutor.h>\n-#include <qml/models/imageexportoperation.h>\n+#include <qml/executor.h>\n #include <qml/components/ownedqrimage.h>\n #include <qml/buttonkeyactivation.h>\n #include <qml/quithandler.h>\n@@ -53,6 +52,7 @@\n #include <qml/androidnotifier.h>\n #endif\n #include <qml/components/blockclockdial.h>\n+#include <qml/presentationservices.h>\n #include <qml/controls/linegraph.h>\n #include <qml/guiconstants.h>\n #include <qml/imageprovider.h>\n@@ -60,6 +60,20 @@\n #include <qml/models/banlistmodel.h>\n #include <qml/models/bitcoinaddress.h>\n #include <qml/models/bitcoinurimodel.h>\n+#include <qml/models/sendimportmodel.h>\n+#include <qml/models/preparationoperation.h>\n+#include <qml/models/psbtoperation.h>\n+#include <qml/models/paymentrequestdeletecontroller.h>\n+#include <qml/models/paymentrequestviewcontroller.h>\n+#include <qml/models/senddraftcontroller.h>\n+#include <qml/models/feebumpcontroller.h>\n+#include <qml/models/walletbackupcontroller.h>\n+#include <qml/models/walletpasswordcontroller.h>\n+#include <qml/models/settingsnavigationcontroller.h>\n+#include <qml/models/senddraftinterface.h>\n+#include <qml/models/sendoperation.h>\n+#include <qml/models/transactionreviewcontroller.h>\n+#include <qml/models/transactionreviewinterface.h>\n #include <qml/models/blockclockmodel.h>\n #include <qml/models/blockclockhistory.h>\n #include <qml/models/chainmodel.h>\n@@ -73,13 +87,14 @@\n #include <qml/models/desktoptrayiconcontroller.h>\n #include <qml/models/desktopwindowbehaviormodel.h>\n #include <qml/models/onboardingoptionsmodel.h>\n-#include <qml/models/options_model.h>\n+#include <qml/models/settingsmodel.h>\n #include <qml/models/uipreferences.h>\n #include <qml/models/peerdetailsmodel.h>\n #include <qml/models/peercommandmodel.h>\n+#include <qml/models/peercommandcontroller.h>\n #include <qml/models/peercommandoperation.h>\n #include <qml/models/peerselectionmodel.h>\n-#include <qml/models/peerlistsortproxy.h>\n+#include <qml/models/peerlistproxymodel.h>\n #include <qml/models/peerlistmodel.h>\n #include <qml/models/rpcconsolemodel.h>\n #include <qml/models/settings_keys.h>\n@@ -105,26 +120,31 @@\n #include <qml/models/activityexportoperation.h>\n #include <qml/models/addresslistmodel.h>\n #include <qml/models/bumptransactionmodel.h>\n-#include <qml/models/paymentrequest.h>\n #include <qml/models/sendrecipient.h>\n #include <qml/models/walletlistmodel.h>\n #include <qml/models/walletselectionmodel.h>\n #include <qml/models/walletcreationmodel.h>\n #include <qml/models/walletoperationpresentationmodel.h>\n-#include <qml/models/walletqmlmodel.h>\n-#include <qml/models/walletqmlmodeltransaction.h>\n+#include <qml/models/coinslistmodel.h>\n+#include <qml/models/sendrecipientslistmodel.h>\n+#include <qml/models/walletmodel.h>\n+#include <qml/models/walletimporttarget.h>\n+#include <qml/models/transactionreviewmodel.h>\n #include <qml/models/fileexportoperation.h>\n-#include <qml/walletqmlcontroller.h>\n+#include <qml/walletcontroller.h>\n #endif\n \n #include <algorithm>\n+#include <array>\n #include <cassert>\n #include <cstdio>\n #include <atomic>\n #include <exception>\n #include <functional>\n #include <memory>\n+#include <mutex>\n #include <optional>\n+#include <utility>\n #include <vector>\n \n #include <QApplication>\n@@ -270,12 +290,14 @@ bool StartupErrorInWindow(QQuickWindow& window, const QString& summary, QmlQuitH\n }\n \n bool InitErrorMessageBox(\n- const QString& summary, const execution::SnapshotServices& services,\n+ const QString& summary, presentation::Post post,\n+ execution::Executor& executor, execution::Lane preferences_lane,\n std::shared_ptr<const startupdiagnostics::Collection> full_message,\n QmlQuitHandler& quit_handler,\n const std::function<void(QQmlApplicationEngine&)>& engine_created,\n- StartupDiagnosticsModel* existing_details = nullptr,\n- std::shared_ptr<std::atomic_bool> diagnostic_loss = {},bool wallet_enabled=false)\n+ PresentationServices& diagnostics, StartupDiagnosticsModel* existing_details = nullptr,\n+ std::shared_ptr<std::atomic_bool> diagnostic_loss = {},bool wallet_enabled=false,\n+ PresentationServices* presentation_services = nullptr, const QString& automation_socket = {})\n {\n static AppMode error_app_mode = SetupAppMode(wallet_enabled);\n error_app_mode.setWalletEnabled(wallet_enabled);\n@@ -289,8 +311,9 @@ bool InitErrorMessageBox(\n startup::ErrorDetails details_owner;\n const auto engine = CreateInitErrorEngine();\n engine_created(*engine);\n- startup::InstallPreferences(*engine, services, UiPreferencesNamespace::Capture(), startup::PreferencesPhase::ErrorHandoff);\n- details_owner = startup::PrepareErrorDetails(services, summary, std::move(full_message), existing_details, diagnostic_loss);\n+ startup::InstallPreferences(*engine, executor, preferences_lane, post,\n+ UiPreferencesNamespace::Capture(), startup::PreferencesPhase::ErrorHandoff);\n+ details_owner = startup::PrepareErrorDetails(std::move(post), summary, std::move(full_message), existing_details, diagnostic_loss, diagnostics);\n auto* details = details_owner.model;\n if (details_owner.replacement_message) engine->rootContext()->setContextProperty(\"message\", *details_owner.replacement_message);\n if (engine->rootContext()->contextProperty(\"message\").isNull()) engine->rootContext()->setContextProperty(\"message\", summary);\n@@ -298,11 +321,20 @@ bool InitErrorMessageBox(\n startup::RecordProjectionOutcome(*details, diagnostic_loss);\n });\n engine->rootContext()->setContextProperty(\"startupDiagnostics\", details);\n+ // Without services, complete diagnostics report output as unavailable.\n+ if (presentation_services) engine->rootContext()->setContextProperty(\"presentationServices\", presentation_services);\n engine->load(QUrl(QStringLiteral(\"qrc:///qml/pages/initerrormessage.qml\")));\n if (engine->rootObjects().isEmpty()) {\n return EXIT_FAILURE;\n }\n auto* window = qobject_cast<QQuickWindow*>(engine->rootObjects().first());\n+#ifdef ENABLE_TEST_AUTOMATION\n+ // Functional tests read and close a startup error shown before any other window.\n+ std::unique_ptr<TestBridge> test_bridge;\n+ if (!automation_socket.isEmpty()) test_bridge = std::make_unique<TestBridge>(engine.get(), automation_socket);\n+#else\n+ Q_UNUSED(automation_socket);\n+#endif\n if (window) ExecStartupDialog(*engine, *window, quit_handler);\n return false;\n }\n@@ -415,11 +447,7 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n QQmlEngine::setObjectOwnership(bitcoin_uri_model_instance, QQmlEngine::CppOwnership);\n return bitcoin_uri_model_instance;\n });\n- qmlRegisterUncreatableType<ImageExportOperation>(\"org.bitcoincore.qt\", 1, 0, \"ImageExportOperation\", \"Owned by an image export request\");\n- qmlRegisterUncreatableType<BackupFileOperation>(\"org.bitcoincore.qt\", 1, 0, \"BackupFileOperation\", \"Owned by a backup request\");\n-#ifdef ENABLE_WALLET\n- qmlRegisterUncreatableType<FileExportOperationModel>(\"org.bitcoincore.qt\", 1, 0, \"FileExportOperationModel\", \"Owned by a file export request\");\n-#endif\n+ qmlRegisterUncreatableType<FileSaveOperation>(\"org.bitcoincore.qt\", 1, 0, \"FileSaveOperation\", \"Started by a save request\");\n qmlRegisterSingletonType<GlobalSettings>(\"org.bitcoincore.qt\", 1, 0, \"GlobalSettings\", [](QQmlEngine*, QJSEngine*) -> QObject* {\n return new GlobalSettings(QStringLiteral(QAPP_APP_NAME_DEFAULT));\n });\n@@ -431,10 +459,13 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qmlRegisterType<OwnedQrImage>(\"org.bitcoincore.qt\", 1, 0, \"OwnedQrImage\");\n qmlRegisterType<AppPreferences>(\"org.bitcoincore.qt\", 1, 0, \"AppPreferences\");\n qmlRegisterUncreatableType<UiPreferencesStore>(\"org.bitcoincore.qt\", 1, 0, \"UiPreferencesStore\", \"Owned by the application engine\");\n+ qmlRegisterUncreatableType<PresentationServices>(\"org.bitcoincore.qt\", 1, 0, \"PresentationServices\", \"Owned by the application\");\n qmlRegisterType<LineGraph>(\"org.bitcoincore.qt\", 1, 0, \"LineGraph\");\n qmlRegisterUncreatableType<PeerDetailsModel>(\"org.bitcoincore.qt\", 1, 0, \"PeerDetailsModel\", \"\");\n qmlRegisterUncreatableType<PeerCommandModel>(\"org.bitcoincore.qt\", 1, 0, \"PeerCommandModel\", \"Application peer commands\");\n qmlRegisterUncreatableType<PeerCommandOperation>(\"org.bitcoincore.qt\", 1, 0, \"PeerCommandOperation\", \"Captured peer command\");\n+ qmlRegisterUncreatableType<PeerActionsInterface>(\"org.bitcoincore.qt\", 1, 0, \"PeerActionsInterface\", \"A peer\");\n+ qmlRegisterType<PeerCommandController>(\"org.bitcoincore.qt\", 1, 0, \"PeerCommandController\");\n qmlRegisterType<PeerSelectionModel>(\"org.bitcoincore.qt\", 1, 0, \"PeerSelectionModel\");\n qRegisterMetaType<PeerCommandResult>();\n qmlRegisterUncreatableMetaObject(PeerCommandResult::staticMetaObject, \"org.bitcoincore.qt\", 1, 0, \"PeerCommandResult\", \"Retained peer result\");\n@@ -447,33 +478,47 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qmlRegisterUncreatableMetaObject(SettingsSaveResult::staticMetaObject,\"org.bitcoincore.qt\",1,0,\"SettingsSaveResult\",\"Retained settings outcome\");\n qRegisterMetaType<SettingsSaveResult>();\n qmlRegisterUncreatableType<SettingsEditorModel>(\"org.bitcoincore.qt\",1,0,\"SettingsEditorModel\",\"Owned by the settings form\");\n+ qmlRegisterUncreatableType<SettingsEditorFactoryInterface>(\"org.bitcoincore.qt\",1,0,\"SettingsEditorFactoryInterface\",\"The options\");\n+ qmlRegisterType<SettingsNavigationController>(\"org.bitcoincore.qt\",1,0,\"SettingsNavigationController\");\n qmlRegisterUncreatableType<SettingsEntryModel>(\"org.bitcoincore.qt\",1,0,\"SettingsEntryModel\",\"Owned by a settings editor\");\n qmlRegisterUncreatableType<CoreSettingsModel>(\"org.bitcoincore.qt\",1,0,\"CoreSettingsModel\",\"Owned by settings\");\n- qmlRegisterUncreatableType<CoreProxyDraft>(\"org.bitcoincore.qt\",1,0,\"CoreProxyDraft\",\"Owned by a settings form\");\n- qmlRegisterUncreatableType<OptionsTransactionLinks>(\"org.bitcoincore.qt\", 1, 0, \"OptionsTransactionLinks\", \"Owned by options\");\n+ qmlRegisterType<CoreProxyDraft>(\"org.bitcoincore.qt\",1,0,\"CoreProxyDraft\");\n+ qmlRegisterType<OptionsTransactionLinks>(\"org.bitcoincore.qt\", 1, 0, \"OptionsTransactionLinks\");\n qmlRegisterUncreatableType<FlowDetailsModel>(\"org.bitcoincore.qt\", 1, 0, \"FlowDetailsModel\", \"Owned by a transaction review\");\n qmlRegisterUncreatableType<DebugLogModel>(\"org.bitcoincore.qt\", 1, 0, \"DebugLogModel\", \"\");\n qmlRegisterUncreatableType<RpcConsoleModel>(\"org.bitcoincore.qt\", 1, 0, \"RpcConsoleModel\", \"\");\n qmlRegisterType<MonospaceOutputModel>(\"org.bitcoincore.qt\", 1, 0, \"MonospaceOutputModel\");\n qmlRegisterType<BitcoinAmount>(\"org.bitcoincore.qt\", 1, 0, \"BitcoinAmount\");\n qmlRegisterType<BitcoinAddress>(\"org.bitcoincore.qt\", 1, 0, \"BitcoinAddress\");\n+ qmlRegisterUncreatableType<ImportOperation>(\"org.bitcoincore.qt\", 1, 0, \"ImportOperation\", \"An import owned by its source\");\n+ qmlRegisterUncreatableType<ImportTarget>(\"org.bitcoincore.qt\", 1, 0, \"ImportTarget\", \"A send draft\");\n+ qmlRegisterType<SendImportModel>(\"org.bitcoincore.qt\", 1, 0, \"SendImportModel\");\n+ qmlRegisterUncreatableType<SendOperation>(\"org.bitcoincore.qt\", 1, 0, \"SendOperation\", \"Started by a wallet\");\n+ qmlRegisterUncreatableType<PsbtOperation>(\"org.bitcoincore.qt\", 1, 0, \"PsbtOperation\", \"Started by a wallet\");\n+ qmlRegisterUncreatableType<PreparationOperation>(\"org.bitcoincore.qt\", 1, 0, \"PreparationOperation\", \"Started by a wallet\");\n+ qmlRegisterUncreatableType<SendDraftInterface>(\"org.bitcoincore.qt\", 1, 0, \"SendDraftInterface\", \"A wallet\");\n+ qmlRegisterType<SendDraftController>(\"org.bitcoincore.qt\", 1, 0, \"SendDraftController\");\n+ qmlRegisterUncreatableType<TransactionReviewInterface>(\"org.bitcoincore.qt\", 1, 0, \"TransactionReviewInterface\", \"A wallet\");\n+ qmlRegisterType<TransactionReviewController>(\"org.bitcoincore.qt\", 1, 0, \"TransactionReviewController\");\n #ifdef ENABLE_WALLET\n qmlRegisterUncreatableType<PaymentImportOperation>(\"org.bitcoincore.qt\", 1, 0, \"PaymentImportOperation\", \"Owned by an import request\");\n+ qmlRegisterType<WalletImportTarget>(\"org.bitcoincore.qt\", 1, 0, \"WalletImportTarget\");\n #else\n qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"PaymentImportOperation\", \"Wallet support is not compiled\");\n+ qmlRegisterTypeNotAvailable(\"org.bitcoincore.qt\", 1, 0, \"WalletImportTarget\", \"Wallet support is not compiled\");\n #endif\n- qmlRegisterUncreatableType<BitcoinUriParseOperation>(\"org.bitcoincore.qt\", 1, 0, \"BitcoinUriParseOperation\", \"Owned by a payment URI request\");\n qmlRegisterType<ExactTextDocument>(\"org.bitcoincore.qt\", 1, 0, \"ExactTextDocument\");\n qmlRegisterUncreatableType<TextEditSessionModel>(\"org.bitcoincore.qt\", 1, 0, \"TextEditSessionModel\", \"Owned by an editor factory\");\n qmlRegisterUncreatableType<TextEditInput>(\"org.bitcoincore.qt\", 1, 0, \"TextEditInput\", \"Owned by an editor\");\n qmlRegisterUncreatableType<TextEditClosePrompt>(\"org.bitcoincore.qt\", 1, 0, \"TextEditClosePrompt\", \"Owned by an editor\");\n qRegisterMetaType<TextEditError>(); qRegisterMetaType<TextEditSaveResult>(); qRegisterMetaType<TextEditConflict>(); qRegisterMetaType<QList<TextEditConflict>>();\n #ifdef ENABLE_WALLET\n- qRegisterMetaType<ActivityExportResult>();\n- qmlRegisterUncreatableType<ActivityExportOperation>(\"org.bitcoincore.qt\", 1, 0, \"ActivityExportOperation\", \"Owned by the original export action\");\n+ qmlRegisterType<PaymentRequestDeleteController>(\"org.bitcoincore.qt\", 1, 0, \"PaymentRequestDeleteController\");\n+ qmlRegisterType<PaymentRequestViewController>(\"org.bitcoincore.qt\", 1, 0, \"PaymentRequestViewController\");\n qmlRegisterType<ActivityFilterProxyModel>(\"org.bitcoincore.qt\", 1, 0, \"ActivityFilterProxyModel\");\n- qmlRegisterUncreatableType<TransactionActivityModel>(\"org.bitcoincore.qt\", 1, 0, \"TransactionActivityModel\", \"Owned by WalletQmlModel\");\n+ qmlRegisterUncreatableType<TransactionActivityModel>(\"org.bitcoincore.qt\", 1, 0, \"TransactionActivityModel\", \"Owned by WalletModel\");\n qmlRegisterUncreatableType<ActivityDetailModel>(\"org.bitcoincore.qt\", 1, 0, \"ActivityDetailModel\", \"Owned by an Activity view\");\n+ qmlRegisterType<ActivityDetailController>(\"org.bitcoincore.qt\", 1, 0, \"ActivityDetailController\");\n qRegisterMetaType<MessageSigningError>(); qRegisterMetaType<MessageVerificationSnapshot>();\n qmlRegisterUncreatableType<SignVerifyMessageModel>(\"org.bitcoincore.qt\", 1, 0, \"SignVerifyMessageModel\", \"Owned by a wallet\");\n qmlRegisterUncreatableType<MessageSigningPrompt>(\"org.bitcoincore.qt\", 1, 0, \"MessageSigningPrompt\", \"Owned by a signing attempt\");\n@@ -481,7 +526,7 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qmlRegisterUncreatableType<SignerDiscoveryModel>(\"org.bitcoincore.qt\", 1, 0, \"SignerDiscoveryModel\", \"Owned by application signer discovery\");\n qmlRegisterUncreatableMetaObject(SignerDiscoveryError::staticMetaObject, \"org.bitcoincore.qt\", 1, 0, \"SignerDiscoveryError\", \"Error value\");\n qRegisterMetaType<SignerDiscoveryError>();\n- qmlRegisterUncreatableType<WalletCreationModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationModel\", \"Owned by a creation form\");\n+ qmlRegisterType<WalletCreationModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationModel\");\n qmlRegisterUncreatableType<WalletCreationText>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationText\", \"Owned by a creation form\");\n qmlRegisterUncreatableType<WalletOperationModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletOperationModel\", \"Owned by an immutable wallet operation\");\n qmlRegisterUncreatableType<WalletOperationPrompt>(\"org.bitcoincore.qt\", 1, 0, \"WalletOperationPrompt\", \"Owned by an immutable wallet operation\");\n@@ -489,48 +534,70 @@ void RegisterQmlTypes(AppMode& app_mode, BuildInfo& build_info, Clipboard& clipb\n qRegisterMetaType<WalletOperationError>(); qRegisterMetaType<WalletOperationResult>(); qRegisterMetaType<WalletCreationReceipt>();\n qmlRegisterUncreatableType<WalletProvisioningCheck>(\"org.bitcoincore.qt\", 1, 0, \"WalletProvisioningCheck\", \"Owned by the wallet controller\");\n qmlRegisterUncreatableType<WalletSelectionModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletSelectionModel\", \"Owned by a window\");\n- qmlRegisterType<PaymentRequest>(\"org.bitcoincore.qt\", 1, 0, \"PaymentRequest\");\n+ qmlRegisterUncreatableType<WalletNamesController>(\"org.bitcoincore.qt\", 1, 0, \"WalletNamesController\", \"Owned by the wallet controller\");\n+ qmlRegisterUncreatableType<WalletCreationController>(\"org.bitcoincore.qt\", 1, 0, \"WalletCreationController\", \"Owned by the wallet controller\");\n RegisterReceiveTypes();\n qmlRegisterUncreatableType<ReceiveRequestOperation>(\"org.bitcoincore.qt\", 1, 0, \"ReceiveRequestOperation\", \"Owned by a receive request command\");\n qmlRegisterUncreatableType<Transaction>(\"org.bitcoincore.qt\", 1, 0, \"Transaction\", \"\");\n qmlRegisterUncreatableType<FeeSelectionModel>(\"org.bitcoincore.qt\", 1, 0, \"FeeSelectionModel\", \"\");\n qmlRegisterUncreatableType<FeeRateEntry>(\"org.bitcoincore.qt\", 1, 0, \"FeeRateEntry\", \"\");\n qmlRegisterUncreatableType<SendRecipient>(\"org.bitcoincore.qt\", 1, 0, \"SendRecipient\", \"\");\n+ qmlRegisterUncreatableType<SendRecipientsListModel>(\"org.bitcoincore.qt\", 1, 0, \"SendRecipientsListModel\", \"Owned by a wallet\");\n+ qmlRegisterUncreatableType<CoinsListModel>(\"org.bitcoincore.qt\", 1, 0, \"CoinsListModel\", \"Owned by a wallet\");\n \n qmlRegisterUncreatableType<BumpTransactionModel>(\"org.bitcoincore.qt\", 1, 0, \"BumpTransactionModel\",\n \"BumpTransactionModel cannot be instantiated from QML\");\n+ qmlRegisterUncreatableType<WalletSecurityInterface>(\"org.bitcoincore.qt\", 1, 0, \"WalletSecurityInterface\", \"A wallet\");\n+ qmlRegisterUncreatableType<SecurityOperation>(\"org.bitcoincore.qt\", 1, 0, \"SecurityOperation\", \"Started by a wallet\");\n+ qmlRegisterType<WalletPasswordController>(\"org.bitcoincore.qt\", 1, 0, \"WalletPasswordController\");\n+ qmlRegisterUncreatableType<WalletBackupInterface>(\"org.bitcoincore.qt\", 1, 0, \"WalletBackupInterface\", \"A wallet\");\n+ qmlRegisterType<WalletBackupController>(\"org.bitcoincore.qt\", 1, 0, \"WalletBackupController\");\n+ qmlRegisterUncreatableType<FeeBumpOperation>(\"org.bitcoincore.qt\", 1, 0, \"FeeBumpOperation\", \"Opened by a FeeBumpController\");\n+ qmlRegisterUncreatableType<FeeBumpInterface>(\"org.bitcoincore.qt\", 1, 0, \"FeeBumpInterface\", \"A wallet\");\n+ qmlRegisterType<FeeBumpController>(\"org.bitcoincore.qt\", 1, 0, \"FeeBumpController\");\n qmlRegisterUncreatableType<WalletSecurityModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletSecurityModel\", \"Owned by a wallet opening\");\n qmlRegisterUncreatableType<SecurityOperationModel>(\"org.bitcoincore.qt\", 1, 0, \"SecurityOperationModel\", \"Owned by a security command\");\n- qmlRegisterUncreatableType<WalletQmlModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletQmlModel\",\n- \"WalletQmlModel cannot be instantiated from QML\");\n- qmlRegisterUncreatableType<WalletQmlModelTransaction>(\"org.bitcoincore.qt\", 1, 0, \"WalletQmlModelTransaction\",\n- \"WalletQmlModelTransaction cannot be instantiated from QML\");\n+ qmlRegisterUncreatableType<WalletModel>(\"org.bitcoincore.qt\", 1, 0, \"WalletModel\",\n+ \n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The settings-model introduction presents a superseded edit-budget policyqml/models/settingseditormodel.cpp | addressed | AssessmentThe new-head diff replaces the old SettingsEditorModel scheduler admission path and removes the reported fixed 393216-byte per-command reservation interface. The superseded admission policy is not present in the final implementation. path_diff: qml/models/settingseditormodel.cpp; new_source: qml/models/settingseditormodel.cpp [
{
"evidence_id": "2f717a3218d744f6a1f64cb6fe623814",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/models/settingseditormodel.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/models/settingseditormodel.cpp b/qml/models/settingseditormodel.cpp\nindex b11e013365..c4a88fc816 100644\n--- a/qml/models/settingseditormodel.cpp\n+++ b/qml/models/settingseditormodel.cpp\n@@ -2,8 +2,8 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/models/settingseditormodel.h>\n+#include <qml/execution.h>\n #include <qml/guipresentation.h>\n-#include <qml/retainedsnapshot.h>\n #include <QCoreApplication>\n #include <QPointer>\n #include <QUuid>\n@@ -13,7 +13,7 @@ namespace {\n using namespace effectivesettings;\n size_t Index(Key key){return static_cast<size_t>(key);}\n QString Source(Provenance value){switch(value){case Provenance::Default:return QStringLiteral(\"default\");case Provenance::Configuration:return QStringLiteral(\"bitcoin.conf\");case Provenance::Persistent:return QStringLiteral(\"settings.json\");case Provenance::CommandLine:return QStringLiteral(\"command line\");case Provenance::Startup:return QStringLiteral(\"startup\");}return {};}\n-QString Failure(){return QCoreApplication::translate(\"SettingsEditorModel\",\"The background operation could not complete. The original write will not be repeated.\");}\n+QString Failure(){return QCoreApplication::translate(\"SettingsEditorModel\",\"The action could not finish. It will not be repeated.\");}\n }\n struct SettingsEditorModel::Projection {\n settingsedit::Session session;\n@@ -27,12 +27,25 @@ struct SettingsEditorModel::Mailbox {\n std::shared_ptr<const Projection> latest;\n std::atomic_bool retired{false},drained{false},notice_pending{false};\n };\n-struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n- State(QString id,Ports ports,std::shared_ptr<Mailbox> mailbox,std::function<void()> notify):session({id.toStdString(),\"effective-settings\"},settingsedit::Reducer::Mask{}.set()),ports(std::move(ports)),scope(this->ports.execution.scheduler->openActionScope()),key(this->ports.execution.scheduler->allocateKey()),io(this->ports.execution.scheduler->allocateKey()),notify(std::move(notify)),mailbox(std::move(mailbox)){}\n+struct SettingsEditorModel::State : std::enable_shared_from_this<State> {\n+ struct Queues {\n+ Queues(execution::Executor& executor, execution::Lane lane)\n+ : core(executor.makeQueue(lane)), utility(executor.makeQueue(execution::Lane::Utility)) {}\n+ execution::SerialQueue core, utility;\n+ // A refused outcome dispatch falls back on Core. Serialize that\n+ // delivery with any new Utility input before touching the reducer.\n+ std::recursive_mutex reducer;\n+ };\n+\n+ State(QString id, Ports ports, std::shared_ptr<Mailbox> mailbox, std::function<void()> notify,\n+ std::shared_ptr<Queues> worker_queues)\n+ : session({id.toStdString(), \"effective-settings\"}, settingsedit::Reducer::Mask{}.set()),\n+ ports(std::move(ports)), queues(std::move(worker_queues)),\n+ notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n+\n settingsedit::Session session;\n const Ports ports;\n- std::shared_ptr<execution::Scheduler> scope;\n- const execution::ResourceKey key,io;\n+ const std::shared_ptr<Queues> queues;\n const std::function<void()> notify;\n std::array<Value,settingsedit::FIELDS> running{};\n std::array<uint64_t,settingsedit::FIELDS> inputs{};\n@@ -43,8 +56,66 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n std::optional<effectivesettings::Result> receipt;\n const std::shared_ptr<Mailbox> mailbox;\n uint64_t finished_save{0},rejection{0};\n- ~State(){mailbox->drained.store(true);if(ports.retired)ports.retired();notify();}\n- execution::Admission post(const std::shared_ptr<execution::Scheduler>& target,std::function<void(State&)> command,std::function<void(std::exception_ptr)> failed={},size_t bytes=SettingsEditorModel::COMMAND_BYTES){if(!target)return {{},execution::Rejection::Closed};const auto self=shared_from_this();return execution::Submit(*target,[self,command=std::move(command)]{if(self->mailbox->retired.load())self->retire();command(*self);},[]{},std::move(failed),{execution::Lane::Domain,bytes,key,execution::WorkClass::Action});}\n+\n+ static void acknowledge(const std::shared_ptr<Mailbox>& mailbox,\n+ const std::function<void()>& retired,\n+ const std::function<void()>& notify)\n+ {\n+ mailbox->drained = true;\n+ if (retired) retired();\n+ notify();\n+ }\n+\n+ static void destroy(State* state)\n+ {\n+ const auto queues = state->queues;\n+ const auto retire = [state, queues] {\n+ const auto mailbox = state->mailbox;\n+ const auto retired = state->ports.retired;\n+ const auto notify = state->notify;\n+ delete state;\n+ // The last State reference accounts for the whole accepted save,\n+ // including its handoffs, even if the editor has been deleted.\n+ queues->core.close();\n+ queues->core.whenDrained([queues, mailbox, retired, notify] {\n+ queues->utility.close();\n+ queues->utility.whenDrained([mailbox, retired, notify] {\n+ acknowledge(mailbox, retired, notify);\n+ });\n+ });\n+ };\n+ if (!queues->utility.post(retire)) retire();\n+ }\n+\n+ template <typename Work, typename Done>\n+ bool submit(Work work, Done done,\n+ std::function<void(std::exception_ptr)> failed, execution::Lane lane)\n+ {\n+ auto task = execution::MakeTask(std::move(work), std::move(done), std::move(failed));\n+ if (lane == execution::Lane::Utility) {\n+ return queues->utility.post([queues = queues, task = std::move(task)] {\n+ std::lock_guard lock{queues->reducer};\n+ task->execute();\n+ task->deliver();\n+ });\n+ }\n+ return queues->core.post([queues = queues, task = std::move(task)]() mutable {\n+ task->execute();\n+ const auto deliver = [queues, task = std::move(task)] {\n+ std::lock_guard lock{queues->reducer};\n+ task->deliver();\n+ };\n+ if (!queues->utility.post(deliver)) deliver();\n+ });\n+ }\n+\n+ bool post(std::function<void(State&)> command, std::function<void(std::exception_ptr)> failed = {})\n+ {\n+ return submit([self = shared_from_this(), command = std::move(command)] {\n+ if (self->mailbox->retired.load()) self->retire();\n+ command(*self);\n+ }, [] {}, std::move(failed), execution::Lane::Utility);\n+ }\n QString restartSet()const {\n QString result;\n if(!initialized)return result;\n@@ -65,28 +136,26 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n if(self->mailbox->retired.load())self->retire();\n self->reading=false;if(!self->retired)self->observe(std::move(value));\n const bool again=std::exchange(self->read_pending,false);self->publish();\n- if(again&&!self->retired){if(!self->post(self->scope,[owner](State& state){state.read(owner);})&&owner)owner(false);}\n+ if(again&&!self->retired){if(!self->post([owner](State& state){state.read(owner);})&&owner)owner(false);}\n else if(owner)owner(true);\n };\n const auto rejected=[complete](std::exception_ptr){Snapshot failed;failed.error=Failure();complete(std::move(failed));};\n- if(!ports.read||!scope||!execution::Submit(*scope,ports.read,complete,rejected,{execution::Lane::Core,1024,io,execution::WorkClass::Observation})){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n+ if(!ports.read||!submit(ports.read,complete,rejected,execution::Lane::Core)){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n publish();\n }\n- void save(std::shared_ptr<execution::Scheduler> action,std::optional<uint64_t> token,std::function<void(bool)> owner){\n+ void save(std::optional<uint64_t> token,std::function<void(bool)> owner){\n if(retired||reading){publish();owner(false);return;}\n if(token&&!session.answerClose(*token,persistentedit::CloseChoice::Save)){publish();owner(false);return;}\n auto attempt=session.check();if(!attempt){publish();owner(false);return;}attempt->batch.accept_redownload=allow_redownload;\n redownload=false;const auto self=shared_from_this();publish();\n- const auto done=[self,action,attempt=*attempt,owner](Check checked){\n+ const auto done=[self,attempt=*attempt,owner](Check checked){\n if(self->mailbox->retired.load())self->retire();\n self->redownload=checked.validation.requires_redownload;\n self->redownload_attempt=self->redownload?std::make_optional(attempt):std::nullopt;\n if(!self->session.validated(attempt.attempt.token,checked.valid,checked.error,checked.validation.errors)){self->publish();owner(false);return;}\n self->publish();\n- // The review packet remains charged until this callback returns.\n- // Continue on the original admitted scope after its budget is freed;\n- // keep the immutable accepted attempt in State rather than copying\n- // it into another queued packet or waiting for GUI publication.\n+ // Keep the immutable accepted attempt in State. Continue after\n+ // the review callback returns, independently of GUI publication.\n const auto token=attempt.attempt.token;\n const bool redownload=attempt.batch.accept_redownload;\n const auto rejected=[self,token,owner](std::exception_ptr error){\n@@ -96,20 +165,20 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n if(error)try{std::rethrow_exception(error);}catch(const execution::NotStarted&){}catch(...){result.outcome=Outcome::Uncertain;}\n self->receipt=result;self->finish(accepted,std::move(result),false,owner);\n };\n- if(!self->post(action,[action,token,redownload,owner](State& state){state.write(action,token,redownload,owner);},rejected))rejected({});\n+ if(!self->post([token,redownload,owner](State& state){state.write(token,redownload,owner);},rejected))rejected({});\n };\n const auto failed=[done](std::exception_ptr){Check checked;checked.error=Failure();done(std::move(checked));};\n- if(!ports.review||!execution::Submit(*action,[review=ports.review,attempt=*attempt]{return review(attempt);},done,failed,{execution::Lane::Core,2*1024*1024,io,execution::WorkClass::Action})){Check checked;checked.error=Failure();done(std::move(checked));}\n+ if(!ports.review||!submit([review=ports.review,attempt=*attempt]{return review(attempt);},done,failed,execution::Lane::Core)){Check checked;checked.error=Failure();done(std::move(checked));}\n }\n- void write(const std::shared_ptr<execution::Scheduler>& action,uint64_t token,bool redownload,std::function<void(bool)> owner){\n+ void write(uint64_t token,bool redownload,std::function<void(bool)> owner){\n if(!session.active()||session.active()->attempt.token!=token){publish();owner(false);return;}\n auto accepted=*session.active();accepted.batch.accept_redownload=redownload;\n const auto self=shared_from_this();\n- const auto written=[self,accepted,action,owner](Result value){(void)action;self->receipt=value;self->finish(accepted,std::move(value),false,owner);};\n+ const auto written=[self,accepted,owner](Result value){self->receipt=value;self->finish(accepted,std::move(value),false,owner);};\n const auto failed=[written](std::exception_ptr error){Result result;result.outcome=Outcome::Uncertain;result.error=Failure();\n try{std::rethrow_exception(error);}catch(const execution::NotStarted&){result.outcome=Outcome::Rejected;}catch(...){}\n written(std::move(result));};\n- if(!ports.write||!execution::Submit(*action,[write=ports.write,accepted]{return write(accepted);},written,failed,{execution::Lane::Core,2*1024*1024,io,execution::WorkClass::Action})){Result result;result.outcome=Outcome::Rejected;result.error=Failure();written(std::move(result));}\n+ if(!ports.write||!submit([write=ports.write,accepted]{return write(accepted);},written,failed,execution::Lane::Core)){Result result;result.outcome=Outcome::Rejected;result.error=Failure();written(std::move(result));}\n }\n void finish(const settingsedit::Save& attempt,Result result,bool query,std::function<void(bool)> owner={}){\n if(mailbox->retired.load())retire();\n@@ -121,26 +190,56 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n publish();\n }\n void reconcile(){if(!receipt||!session.active()||session.editor().phase()!=persistentedit::Phase::Uncertain){publish();return;}const auto original=*session.active();auto value=*receipt;value.snapshot={};finish(original,std::move(value),true);}\n- void retire(){if(std::exchange(retired,true))return;read_pending=false;session.retire();scope.reset();publish();}\n+ void retire(){if(std::exchange(retired,true))return;read_pending=false;session.retire();publish();}\n \n };\n-SettingsEditorModel::SettingsEditorModel(Ports ports,QObject* parent):QObject(parent),m_id(QUuid::createUuid().toString(QUuid::WithoutBraces)),m_execution(ports.execution){\n- Q_ASSERT(m_execution.scheduler);m_execution.post=presentation::ReliablePost(std::move(m_execution.post));ports.execution=m_execution;\n- for(size_t i=0;i<m_entries.size();++i)m_entries[i]=new SettingsEntryModel(static_cast<Key>(i),*this);\n- m_mailbox=std::make_shared<Mailbox>();const auto original_retired=ports.retired;\n+SettingsEditorModel::SettingsEditorModel(Ports ports, QObject* parent)\n+ : QObject(parent), m_id(QUuid::createUuid().toString(QUuid::WithoutBraces)), m_post(presentation::ReliablePost(std::move(ports.post)))\n+{\n+ for (size_t i = 0; i < m_entries.size(); ++i) m_entries[i] = new SettingsEntryModel(static_cast<Key>(i), *this);\n+ m_mailbox = std::make_shared<Mailbox>();\n+ const auto original_retired = ports.retired;\n const QPointer<SettingsEditorModel> observer{this};\n- m_owner=execution::RetainSnapshot<std::shared_ptr<State>>(m_execution.scheduler,[id=m_id,ports=std::move(ports),mailbox=m_mailbox,observer,post=m_execution.post]()mutable{return std::make_unique<std::shared_ptr<State>>(std::make_shared<State>(id,std::move(ports),mailbox,[mailbox,observer,post]{\n- if(mailbox->notice_pending.exchange(true))return;\n- try{post([mailbox,observer]{mailbox->notice_pending.store(false);if(observer)observer->publish();});}catch(...){mailbox->notice_pending.store(false);throw;}\n- }));});\n- if(m_owner){m_state=*m_owner;m_retire_scope=(*m_owner)->scope;refresh();}\n- else{m_immediate_error=tr(\"The settings editor could not reserve cleanup.\");m_retired=true;m_mailbox->drained.store(true);if(original_retired)original_retired();m_execution.post([observer]{if(observer)observer->publish();});}\n+ const auto notify = [mailbox = m_mailbox, observer, post = m_post] {\n+ if (mailbox->notice_pending.exchange(true)) return;\n+ try {\n+ post([mailbox, observer] {\n+ mailbox->notice_pending = false;\n+ if (observer) observer->publish();\n+ });\n+ } catch (...) {\n+ mailbox->notice_pending = false;\n+ throw;\n+ }\n+ };\n+ if (ports.executor) {\n+ const auto queues = std::make_shared<State::Queues>(*ports.executor, ports.lane);\n+ m_owner = std::shared_ptr<State>{new State{m_id, std::move(ports), m_mailbox, notify, queues}, State::destroy};\n+ m_state = m_owner;\n+ refresh();\n+ } else {\n+ m_immediate_error = tr(\"The settings editor could not open. Try again.\");\n+ m_retired = true;\n+ m_mailbox->drained = true;\n+ if (original_retired) original_retired();\n+ m_post([observer] { if (observer) observer->publish(); });\n+ }\n }\n SettingsEditorModel::~SettingsEditorModel(){retire();}\n-bool SettingsEditorModel::command(std::function<void(State&)> callback,const QString& name,size_t bytes){\n- bool admitted{false};{const auto state=m_state.lock();admitted=!m_retired&&state&&bool(state->post(m_execution.scheduler,std::move(callback),{},bytes));}\n- if(admitted){m_immediate_error={};return true;}\n- m_immediate_error=tr(\"This settings command could not be admitted.\");const QPointer<SettingsEditorModel> guard{this};Q_EMIT changed();if(guard)Q_EMIT commandRejected(name,m_immediate_error);return false;\n+bool SettingsEditorModel::command(std::function<void(State&)> callback, const QString& name)\n+{\n+ const QPointer<SettingsEditorModel> observer{this};\n+ bool admitted{false};\n+ {\n+ const auto state = m_state.lock();\n+ admitted = !m_retired && state && state->post(std::move(callback));\n+ }\n+ if (!observer) return admitted;\n+ if (admitted) { m_immediate_error = {}; return true; }\n+ m_immediate_error = tr(\"This settings change could not start. Try again.\");\n+ Q_EMIT changed();\n+ if (observer) Q_EMIT commandRejected(name, m_immediate_error);\n+ return false;\n }\n void SettingsEditorModel::publish(){\n std::shared_ptr<const Projection> value;{std::lock_guard lock{m_mailbox->mutex};value=m_mailbox->latest;}\n@@ -149,8 +248,16 @@ void SettingsEditorModel::publish(){\n if(m_projection&&m_pending_save&&m_projection->finished_save>=m_pending_save){m_pending_save=0;m_immediate_error={};}\n const bool rejected=m_projection&&m_projection->rejection>m_seen_rejection;if(rejected)m_seen_rejection=m_projection->rejection;\n const bool drained=m_retired&&m_mailbox->drained.load()&&!m_drained;if(drained)m_drained=true;\n+ if(closeQuestion()){\n+ const auto token=closeToken();\n+ if(!m_prompt||m_prompt->token()!=token){\n+ if(m_prompt)m_prompt->deleteLater();\n+ m_prompt=new TextEditClosePrompt(token,this);\n+ connect(m_prompt,&TextEditClosePrompt::answered,this,[this](const QString& token,TextEditClosePrompt::Choice choice){answerClose(token,static_cast<CloseChoice>(choice));});\n+ }\n+ }else if(m_prompt){m_prompt->deleteLater();m_prompt=nullptr;}\n const QPointer<SettingsEditorModel> guard{this};for(auto* entry:m_entries){Q_EMIT entry->changed();if(!guard)return;}Q_EMIT changed();if(!guard)return;\n- if(rejected){Q_EMIT commandRejected(QStringLiteral(\"save\"),tr(\"This settings save did not start. The original draft and any earlier receipt are retained.\"));if(!guard)return;}\n+ if(rejected){Q_EMIT commandRejected(QStringLiteral(\"save\"),tr(\"The settings were not saved. Your edits are kept.\"));if(!guard)return;}\n if(!m_closed_emitted&&phase()==Closed){m_closed_emitted=true;Q_EMIT closed();if(!guard)return;}\n if(drained)Q_EMIT shutdownFinished();\n }\n@@ -172,7 +279,6 @@ SettingsSaveResult SettingsEditorModel::saveResult()const{\n return result;\n }\n QString SettingsEditorModel::lastSaveId()const{return QString::number(m_projection?m_projection->session.result().token:0);}\n-QString SettingsEditorModel::redownloadToken()const{return QString::number(m_projection?m_projection->redownload_token:0);}\n QString SettingsEditorModel::closeToken()const{return QString::number(m_projection?m_projection->session.editor().closeToken():0);}\n bool SettingsEditorModel::closeQuestion()const{return m_projection&&m_projection->session.editor().closeQuestion();}\n bool SettingsEditorModel::lastSavePresent()const{return m_projection&&m_projection->session.result().present;}\n@@ -185,14 +291,35 @@ bool SettingsEditorModel::redownloadWarning()const{return m_projection&&m_projec\n SettingsEntryModel* SettingsEditorModel::entry(const QString& key)const{for(auto* item:m_entries)if(ite\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 166,
"evidence_id": "39f1f0dc38844cc694a3a49042f6bac8",
"finding_id": "finding:10",
"kind": "new_source",
"line": 17,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/models/settingseditormodel.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 4,
"source_job_id": 2819,
"text": "}\nstruct SettingsEditorModel::Projection {\n settingsedit::Session session;\n std::array<Value,settingsedit::FIELDS> running;\n std::array<uint64_t,settingsedit::FIELDS> inputs;\n bool reading{false},restart{false},notice{false},redownload{false};\n uint64_t redownload_token{0},finished_save{0},rejection{0};\n};\nstruct SettingsEditorModel::Mailbox {\n std::mutex mutex;\n std::shared_ptr<const Projection> latest;\n std::atomic_bool retired{false},drained{false},notice_pending{false};\n};\nstruct SettingsEditorModel::State : std::enable_shared_from_this<State> {\n struct Queues {\n Queues(execution::Executor& executor, execution::Lane lane)\n : core(executor.makeQueue(lane)), utility(executor.makeQueue(execution::Lane::Utility)) {}\n execution::SerialQueue core, utility;\n // A refused outcome dispatch falls back on Core. Serialize that\n // delivery with any new Utility input before touching the reducer.\n std::recursive_mutex reducer;\n };\n\n State(QString id, Ports ports, std::shared_ptr<Mailbox> mailbox, std::function<void()> notify,\n std::shared_ptr<Queues> worker_queues)\n : session({id.toStdString(), \"effective-settings\"}, settingsedit::Reducer::Mask{}.set()),\n ports(std::move(ports)), queues(std::move(worker_queues)),\n notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n\n settingsedit::Session session;\n const Ports ports;\n const std::shared_ptr<Queues> queues;\n const std::function<void()> notify;\n std::array<Value,settingsedit::FIELDS> running{};\n std::array<uint64_t,settingsedit::FIELDS> inputs{};\n bool initialized{false},reading{false},read_pending{false},retired{false},redownload{false},allow_redownload{false};\n QString pending_restart,acknowledged_restart;\n std::optional<settingsedit::Save> redownload_attempt;\n uint64_t read_token{0};\n std::optional<effectivesettings::Result> receipt;\n const std::shared_ptr<Mailbox> mailbox;\n uint64_t finished_save{0},rejection{0};\n\n static void acknowledge(const std::shared_ptr<Mailbox>& mailbox,\n const std::function<void()>& retired,\n const std::function<void()>& notify)\n {\n mailbox->drained = true;\n if (retired) retired();\n notify();\n }\n\n static void destroy(State* state)\n {\n const auto queues = state->queues;\n const auto retire = [state, queues] {\n const auto mailbox = state->mailbox;\n const auto retired = state->ports.retired;\n const auto notify = state->notify;\n delete state;\n // The last State reference accounts for the whole accepted save,\n // including its handoffs, even if the editor has been deleted.\n queues->core.close();\n queues->core.whenDrained([queues, mailbox, retired, notify] {\n queues->utility.close();\n queues->utility.whenDrained([mailbox, retired, notify] {\n acknowledge(mailbox, retired, notify);\n });\n });\n };\n if (!queues->utility.post(retire)) retire();\n }\n\n template <typename Work, typename Done>\n bool submit(Work work, Done done,\n std::function<void(std::exception_ptr)> failed, execution::Lane lane)\n {\n auto task = execution::MakeTask(std::move(work), std::move(done), std::move(failed));\n if (lane == execution::Lane::Utility) {\n return queues->utility.post([queues = queues, task = std::move(task)] {\n std::lock_guard lock{queues->reducer};\n task->execute();\n task->deliver();\n });\n }\n return queues->core.post([queues = queues, task = std::move(task)]() mutable {\n task->execute();\n const auto deliver = [queues, task = std::move(task)] {\n std::lock_guard lock{queues->reducer};\n task->deliver();\n };\n if (!queues->utility.post(deliver)) deliver();\n });\n }\n\n bool post(std::function<void(State&)> command, std::function<void(std::exception_ptr)> failed = {})\n {\n return submit([self = shared_from_this(), command = std::move(command)] {\n if (self->mailbox->retired.load()) self->retire();\n command(*self);\n }, [] {}, std::move(failed), execution::Lane::Utility);\n }\n QString restartSet()const {\n QString result;\n if(!initialized)return result;\n for(const auto& field:session.snapshot().fields)if(field.applicability==Applicability::Restart&&field.next_start!=running[Index(field.key)])result+=Name(field.key)+QLatin1Char('=')+settingsedit::Session::Format(field.next_start)+QLatin1Char('\\n');\n return result;\n }\n void publish(){const auto changes=restartSet();if(changes!=pending_restart){pending_restart=changes;acknowledged_restart={};}auto value=std::make_shared<const Projection>(Projection{session,running,inputs,reading,!changes.isEmpty(),!changes.isEmpty()&&acknowledged_restart!=changes,redownload,redownload_attempt?redownload_attempt->attempt.token:0,finished_save,rejection});{std::lock_guard lock{mailbox->mutex};mailbox->latest=std::move(value);}notify();}\n void observe(Snapshot value){if(!initialized&&value.ready){for(const auto& field:value.fields)if(Index(field.key)<settingsedit::FIELDS)running[Index(field.key)]=field.effective;initialized=true;}session.observe(std::move(value));}\n void read(std::function<void(bool)> owner={}){\n const auto finished=[&owner](bool result){if(owner)owner(result);};\n if(retired){finished(false);return;}\n const auto phase=session.editor().phase();\n if(reading||phase==persistentedit::Phase::Checking||phase==persistentedit::Phase::Saving){read_pending=true;finished(false);return;}\n if(phase==persistentedit::Phase::Uncertain||phase==persistentedit::Phase::Closed||read_token==UINT64_MAX){finished(false);return;}\n reading=true;read_pending=false;const auto token=++read_token;const auto self=shared_from_this();\n const auto complete=[self,token,owner](Snapshot value){\n if(token!=self->read_token){if(owner)owner(false);return;}\n if(self->mailbox->retired.load())self->retire();\n self->reading=false;if(!self->retired)self->observe(std::move(value));\n const bool again=std::exchange(self->read_pending,false);self->publish();\n if(again&&!self->retired){if(!self->post([owner](State& state){state.read(owner);})&&owner)owner(false);}\n else if(owner)owner(true);\n };\n const auto rejected=[complete](std::exception_ptr){Snapshot failed;failed.error=Failure();complete(std::move(failed));};\n if(!ports.read||!submit(ports.read,complete,rejected,execution::Lane::Core)){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n publish();\n }\n void save(std::optional<uint64_t> token,std::function<void(bool)> owner){\n if(retired||reading){publish();owner(false);return;}\n if(token&&!session.answerClose(*token,persistentedit::CloseChoice::Save)){publish();owner(false);return;}\n auto attempt=session.check();if(!attempt){publish();owner(false);return;}attempt->batch.accept_redownload=allow_redownload;\n redownload=false;const auto self=shared_from_this();publish();\n const auto done=[self,attempt=*attempt,owner](Check checked){\n if(self->mailbox->retired.load())self->retire();\n self->redownload=checked.validation.requires_redownload;\n self->redownload_attempt=self->redownload?std::make_optional(attempt):std::nullopt;\n if(!self->session.validated(attempt.attempt.token,checked.valid,checked.error,checked.validation.errors)){self->publish();owner(false);return;}\n self->publish();\n // Keep the immutable accepted attempt in State. Continue after\n // the review callback returns, independently of GUI publication.\n const auto token=attempt.attempt.token;\n const bool redownload=attempt.batch.accept_redownload;\n const auto rejected=[self,token,owner](std::exception_ptr error){\n if(!self->session.active()||self->session.active()->attempt.token!=token)return;\n const auto accepted=*self->session.active();\n Result result;result.outcome=Outcome::Rejected;result.error=Failure();\n if(error)try{std::rethrow_exception(error);}catch(const execution::NotStarted&){}catch(...){result.outcome=Outcome::Uncertain;}\n self->receipt=result;self->finish(accepted,std::move(result),false,owner);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Backup can rename over a loaded wallet's live databaseqml/models/backuppolicyio.cpp | addressed | AssessmentInspection and the final pre-install check both screen destinations against loaded wallet database file identity. The final check is serialized by the coordinator mutex, preventing the reported overwrite of an unchanged loaded wallet database. path_diff: qml/models/backuppolicyio.cpp; new_source: qml/models/backuppolicyio.cpp [
{
"evidence_id": "66b6384197f1446ab3dfb5484b751d78",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/models/backuppolicyio.cpp",
"source_generation": 4,
"source_job_id": 2819,
"text": "diff --git a/qml/models/backuppolicyio.cpp b/qml/models/backuppolicyio.cpp\nindex 7f2a43eccc..8ce3d25dd0 100644\n--- a/qml/models/backuppolicyio.cpp\n+++ b/qml/models/backuppolicyio.cpp\n@@ -15,6 +15,7 @@\n #include <QUrl>\n \n #include <algorithm>\n+#include <system_error>\n #include <utility>\n \n namespace {\n@@ -123,8 +124,33 @@ backup::Proposal backup::InspectPng(const std::string& raw)\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n }\n \n+namespace {\n+bool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n+{\n+ if (!coordinator.wallet_files) return false;\n+ const fs::path destination{fs::PathFromString(path)};\n+ std::error_code error;\n+ for (const auto& file : coordinator.wallet_files()) {\n+ const fs::path database{fs::PathFromString(file)};\n+ // SQLite keeps a journal next to the database while it writes.\n+ for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n+ if (fs::equivalent(destination, candidate, error)) return true;\n+ }\n+ }\n+ return false;\n+}\n+} // namespace\n+\n+backup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n+{\n+ if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n+ proposal.error = Error::WalletFile;\n+ }\n+ return proposal;\n+}\n+\n backup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n- InstallCoordinator& coordinator, std::function<bool()> admission)\n+ InstallCoordinator& coordinator, std::function<bool()> submitted)\n {\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n@@ -138,12 +164,12 @@ backup::WriteResult backup::Write(const Proposal& approved, bool destination_app\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n- const auto current = ReadTarget(final_path);\n+ const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n- if (admission && !admission()) return {Error::Changed};\n+ if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 184,
"evidence_id": "109c3540845a430b9243ba53b24612f4",
"finding_id": "finding:1",
"kind": "new_source",
"line": 119,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "5d343e746e6a9f61b99719483b2370ff5af1640b",
"path": "qml/models/backuppolicyio.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 4,
"source_job_id": 2819,
"text": " if (!url.isValid() || !url.isLocalFile() || !QDir::isAbsolutePath(url.toLocalFile())) return {{}, {}, false, false, Error::InvalidPath};\n QString path = QDir::cleanPath(url.toLocalFile());\n if (path.contains(QChar{0}) || QFileInfo{path}.isDir()) return {{}, {}, false, false, Error::InvalidPath};\n const QString selected = path;\n if (!path.endsWith(QStringLiteral(\".png\"), Qt::CaseInsensitive)) path += QStringLiteral(\".png\");\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n}\n\nnamespace {\nbool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n{\n if (!coordinator.wallet_files) return false;\n const fs::path destination{fs::PathFromString(path)};\n std::error_code error;\n for (const auto& file : coordinator.wallet_files()) {\n const fs::path database{fs::PathFromString(file)};\n // SQLite keeps a journal next to the database while it writes.\n for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n if (fs::equivalent(destination, candidate, error)) return true;\n }\n }\n return false;\n}\n} // namespace\n\nbackup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n{\n if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n proposal.error = Error::WalletFile;\n }\n return proposal;\n}\n\nbackup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n InstallCoordinator& coordinator, std::function<bool()> submitted)\n{\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n const QString parent = QFileInfo{final_path}.absolutePath();\n QTemporaryDir staging{QDir{parent}.filePath(QStringLiteral(\".bitcoin-backup-XXXXXX\"))};\n if (!staging.isValid()) return {Error::Staging};\n const QString staged_path = staging.filePath(QStringLiteral(\"wallet.backup\"));\n if (!producer(Utf8(staged_path))) return {Error::CoreBackup};\n const QFileInfo staged_info{staged_path};\n if (!staged_info.isFile() || staged_info.isSymLink()) return {Error::CoreBackup};\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n } else {\n // QFile's non-replacing rename also protects against a destination\n // created after inspection; never use an overwriting rename here.\n installed = QFile::rename(staged_path, final_path);\n }\n if (!installed) return {Error::Install};\n DirectoryCommit(fs::PathFromString(Utf8(parent)));\n return {};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 5d343e746e6a..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | The #1063 fix is attributed to a helper-only committest/CMakeLists.txt | unclear | AssessmentThis finding concerns commit-message attribution and issue traceability. The supplied code diff does not include the relevant commit messages or show whether the attribution was changed. path_diff: test/CMakeLists.txt [
{
"evidence_id": "01b3b4d8827c4c39aef1b81a05ce1c9b",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "test/CMakeLists.txt",
"source_generation": 2,
"source_job_id": 2781,
"text": "diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt\nindex 1170acb3a0..1dc049d546 100644\n--- a/test/CMakeLists.txt\n+++ b/test/CMakeLists.txt\n@@ -36,8 +36,7 @@ add_test(NAME bitcoinqml_test_directory_checks\n \n add_executable(bitcoinqml_bootstrap_tests\n test_bootstrap.cpp\n- ../qml/backendexecutor.cpp\n- ../qml/execution.cpp\n+ ../qml/executor.cpp\n ../qml/quithandler.h\n )\n target_include_directories(bitcoinqml_bootstrap_tests PRIVATE ..)\n@@ -56,6 +55,7 @@ add_executable(bitcoinqml_unit_tests\n test_backuppolicyoperation.cpp\n test_fileexportoperation.cpp\n test_execution.cpp\n+ test_executor.cpp\n test_guipresentation.cpp\n test_atomicsharedptr.cpp\n test_persistenttrees.cpp\n@@ -73,7 +73,6 @@ add_executable(bitcoinqml_unit_tests\n test_startuppolicy.cpp\n test_startuppreparation.cpp\n test_startuproleprofile.cpp\n- test_startupprofile.cpp\n test_qtlogsink.cpp\n test_bitcoinaddress.cpp\n test_blockclockdial.cpp\n@@ -81,6 +80,9 @@ add_executable(bitcoinqml_unit_tests\n test_blockclockmodel.cpp\n test_bitcoinuri.cpp\n test_bitcoinurimodel.cpp\n+ test_sendimportmodel.cpp\n+ test_transactionreviewcontroller.cpp\n+ test_senddraftcontroller.cpp\n test_qmlfiledialog.cpp\n test_bitcoinamount.cpp\n test_debuglogmodel.cpp\n@@ -93,7 +95,6 @@ add_executable(bitcoinqml_unit_tests\n test_qmlbitcoinunits.cpp\n test_imageprovider.cpp\n test_qrimageprovider.cpp\n- test_imageexportoperation.cpp\n test_qmlengine.cpp\n test_nodemodel.cpp\n test_nodelifecycle.cpp\n@@ -116,8 +117,6 @@ add_executable(bitcoinqml_unit_tests\n test_onboarding_storage.cpp\n test_onboardingasync.cpp\n test_onboardingflow.cpp\n- test_profileinspection.cpp\n- test_profileinspectionprocess.cpp\n test_banlistmodel.cpp\n test_display_settings.cpp\n test_qtinfolog.cpp\n@@ -136,7 +135,6 @@ endif()\n if(ENABLE_WALLET)\n target_sources(bitcoinqml_unit_tests PRIVATE\n test_activityexportoperation.cpp\n- test_profileinspectionowner.cpp\n test_activityfilterproxymodel.cpp\n test_addresslistmodel.cpp\n test_bumptransactionmodel.cpp\n@@ -154,6 +152,8 @@ if(ENABLE_WALLET)\n test_paymentrequesteditormodel.cpp\n test_requestsharingmodel.cpp\n test_walletreceivemodel.cpp\n+ test_walletpagecontrollers.cpp\n+ test_walletqmlmodelsurface.cpp\n test_sendrecipientslistmodel.cpp\n test_sendrecipient.cpp\n test_feeselection.cpp\n@@ -183,10 +183,8 @@ if(ENABLE_WALLET)\n endif()\n \n include(${PROJECT_SOURCE_DIR}/cmake/FocusedUnitTests.cmake)\n-# The executable's early child-process entry point uses this existing provider.\n configure_focused_unit_build(bitcoinqml_unit_tests\n- ${CMAKE_CURRENT_BINARY_DIR}/unit-build-selection.json\n- SUPPORT_SOURCES test_startupprofile.cpp)\n+ ${CMAKE_CURRENT_BINARY_DIR}/unit-build-selection.json)\n \n target_compile_definitions(bitcoinqml_unit_tests\n PRIVATE\n@@ -219,11 +217,6 @@ target_link_libraries(bitcoinqml_unit_tests\n Qt6::Widgets\n )\n \n-if(APPLE)\n- # The native Dock regression deliberately links both app and Core metaobjects.\n- target_link_libraries(bitcoinqml_unit_tests PRIVATE bitcoinqt)\n-endif()\n-\n add_test(NAME bitcoinqml_unit_tests COMMAND bitcoinqml_unit_tests -platform minimal)\n if(APP_UNIT_TEST_CLASSES)\n set_tests_properties(bitcoinqml_unit_tests PROPERTIES LABELS \"unit;focused-build\")\n@@ -286,6 +279,32 @@ add_executable(bitcoinqml_qmltests\n qmlcoverage.cpp\n mocks/receiveqmlfixture.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/messagesigningprompt.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/sendimportports.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/sendimportmodel.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/sendimportmodel.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/sendoperation.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/psbtoperation.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/preparationoperation.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/senddraftcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/senddraftcontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/senddraftinterface.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/securityoperation.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletsecurityinterface.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletpasswordcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletpasswordcontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletavailabilityinterface.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletpagecontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletpagecontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletbackupinterface.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletbackupcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletbackupcontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/feebumpoperation.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/feebumpinterface.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/feebumpcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/feebumpcontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/transactionreviewcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/transactionreviewcontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/transactionreviewinterface.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/exacttextdocument.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/exacttextdocument.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/texteditsessionmodel.cpp\n@@ -294,10 +313,14 @@ add_executable(bitcoinqml_qmltests\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/paymentrequesteditormodel.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/receiptreconciliationmodel.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/receiptreconciliationmodel.h\n- ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/receivereservationmodel.cpp\n- ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/receivereservationmodel.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/addressreservationmodel.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/addressreservationmodel.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletreceivemodel.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/walletreceivemodel.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/paymentrequestdeletecontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/paymentrequestdeletecontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/paymentrequestviewcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/paymentrequestviewcontroller.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/requestsharingmodel.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/requestsharingmodel.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/requestimageexportoperation.cpp\n@@ -306,6 +329,7 @@ add_executable(bitcoinqml_qmltests\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/activityexportoperation.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/backuppolicyoperation.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/backuppolicyoperation.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/filesaveoperation.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/backuppolicy.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/walletrequesterror.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/walletrequesterror.h\n@@ -320,6 +344,13 @@ add_executable(bitcoinqml_qmltests\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/settingsvalues.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/settingssession.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/settingseditormodel.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/settingseditorfactoryinterface.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/settingsnavigationcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/settingsnavigationcontroller.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/peercommandoperation.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/peeractionsinterface.h\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/peercommandcontroller.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/peercommandcontroller.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/signerconfiguration.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/signerdiscoverymodel.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/walletcreation.h\n@@ -332,14 +363,16 @@ add_executable(bitcoinqml_qmltests\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/bitcoinaddress.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/uipreferences.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/models/uipreferences.h\n- ${CMAKE_CURRENT_SOURCE_DIR}/../qml/backendexecutor.cpp\n- ${CMAKE_CURRENT_SOURCE_DIR}/../qml/execution.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/amountparse.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/bitcoinamount.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/bitcoinunits.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/buttonkeyactivation.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/components/blockclockdial.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/presentationservices.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/presentationservices.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/controls/linegraph.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/executor.cpp\n+ ${CMAKE_CURRENT_SOURCE_DIR}/../qml/retainedvalue.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/qrimageprovider.cpp\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/globalsettings.h\n ${CMAKE_CURRENT_SOURCE_DIR}/../qml/motionpreference.h\n@@ -401,9 +434,13 @@ endforeach()\n if(NOT qml_test_names)\n message(FATAL_ERROR \"QML test manifest selected no component test files\")\n endif()\n+# Africa/Cairo moved its clocks from 00:00 to 01:00 on 2026-04-24, so that\n+# local midnight does not exist. The calendar must still draw that day (#1128).\n+add_test(NAME bitcoinqml_calendar_midnight_dst COMMAND ${qml_test_launcher} $<TARGET_FILE:bitcoinqml_qmltests> -platform ${qml_test_platform}\n+ -input \"${qml_test_input_dir}/tst_activitylist.qml\" \"ActivityList::test_calendar_draws_every_day_of_every_month_once\")\n # Seed the longest suites so clean builds do not need timing history to schedule\n # them first. These are relative scheduling hints, not timeouts or assertions.\n-set_tests_properties(bitcoinqml_qml_sendcreate bitcoinqml_qml_requestpayment PROPERTIES COST 20)\n+set_tests_properties(bitcoinqml_qml_sendcreate PROPERTIES COST 20)\n set_tests_properties(bitcoinqml_qml_activitylist PROPERTIES COST 16)\n \n # Qt 6.2 has no QTest::failOnWarning(); leave this check disabled there too,\n@@ -436,6 +473,18 @@ set_property(TEST ${qml_test_names} PROPERTY ENVIRONMENT\n # console.warn() from console.log() during QML loading and teardown.\n set_property(TEST ${qml_test_names} APPEND PROPERTY ENVIRONMENT\n \"QT_MESSAGE_PATTERN=[%{type}] %{category}: %{message}\")\n+# The DST entry runs one component case like the others, in a fixed zone. It is\n+# kept out of qml_test_names and the bitcoinqml_qml_ prefix, whose warning\n+# policy must be identical with no extra environment, and copies\n+# that policy here.\n+list(GET qml_test_names 0 qml_policy_source)\n+foreach(property IN ITEMS ENVIRONMENT FAIL_REGULAR_EXPRESSION LABELS TIMEOUT)\n+ get_property(value TEST ${qml_policy_source} PROPERTY ${property})\n+ if(value)\n+ set_property(TEST bitcoinqml_calendar_midnight_dst PROPERTY ${property} \"${value}\")\n+ endif()\n+endforeach()\n+set_property(TEST bitcoinqml_calendar_midnight_dst APPEND PROPERTY ENVIRONMENT \"TZ=Africa/Cairo\")\n \n get_target_property(qt_lib_type Qt6::Core TYPE)\n if(qt_lib_type STREQUAL \"STATIC_LIBRARY\")\n@@ -457,7 +506,3 @@ endif()\n \n add_subdirectory(integration)\n \n-if(TARGET bitcoin-core-profile-inspector)\n- add_dependencies(bitcoinqml_unit_tests bitcoin-core-profile-inspector)\n- add_dependencies(bitcoinqml_integration_tests bitcoin-core-profile-inspector)\n-endif()\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f042e865e0c..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | The decimal-parse commit also carries the paste lifecycle APIqml/bitcoinamount.h | addressed | AssessmentThe source-to-new diff removes the ticketed requestPaste/requestEditInput/cancelInput lifecycle API from BitcoinAmount's public interface, replacing it with the simpler paste API. This directly removes the unrelated lifecycle machinery from the amount interface implicated by the finding. path_diff: qml/bitcoinamount.h; new_source: qml/bitcoinamount.h [
{
"evidence_id": "ad44ea30ea554d8694ad3179e56f3def",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "cc508c18a413d2798ceaf9bf09818682977f2683",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/bitcoinamount.h",
"source_generation": 2,
"source_job_id": 2781,
"text": "diff --git a/qml/bitcoinamount.h b/qml/bitcoinamount.h\nindex a67ca461..bdc1f7de 100644\n--- a/qml/bitcoinamount.h\n+++ b/qml/bitcoinamount.h\n@@ -9,9 +9,17 @@\n \n #include <QObject>\n #include <QString>\n-#include <atomic>\n-#include <memory>\n \n+#include <initializer_list>\n+\n+/** One amount: its exact value in satoshis, the display unit, and the text\n+ * the user is editing. Input that does not parse keeps the previous value.\n+ *\n+ * valueEdited() is emitted before a user edit changes the value, so an owner\n+ * can record the edit as user intent before amountChanged() and inputChanged()\n+ * trigger validation. Values set by a model (setSatoshi with Origin::Model)\n+ * are not user edits and do not emit valueEdited().\n+ */\n class BitcoinAmount : public QObject\n {\n Q_OBJECT\n@@ -27,12 +35,6 @@ class BitcoinAmount : public QObject\n Q_PROPERTY(bool inputDirty READ inputDirty NOTIFY inputDirtyChanged)\n Q_PROPERTY(QString inputError READ inputError NOTIFY inputChanged)\n Q_PROPERTY(bool zeroIsEmpty READ zeroIsEmpty WRITE setZeroIsEmpty NOTIFY inputChanged)\n- Q_PROPERTY(quint64 inputRevision READ inputRevision NOTIFY inputChanged)\n- Q_PROPERTY(bool inputPending READ inputPending CONSTANT)\n- Q_PROPERTY(quint64 inputOperationId READ inputOperationId NOTIFY inputOperationChanged)\n- Q_PROPERTY(InputOperationState inputOperationState READ inputOperationState NOTIFY inputOperationChanged)\n- Q_PROPERTY(QString inputOperationError READ inputOperationError NOTIFY inputOperationChanged)\n- Q_PROPERTY(int inputCursorPosition READ inputCursorPosition NOTIFY inputOperationChanged)\n Q_PROPERTY(qint64 satoshi READ satoshi WRITE setSatoshi NOTIFY amountChanged)\n \n public:\n@@ -48,14 +50,16 @@ public:\n enum class InputState { Empty, Incomplete, Invalid, Valid };\n Q_ENUM(InputState)\n \n- enum class InputOperationState { InputIdle, InputApplied, InputRejected, InputStale, InputClosed };\n- Q_ENUM(InputOperationState)\n- explicit BitcoinAmount(QObject *parent = nullptr);\n- static void setDefaultAdmissionGate(std::shared_ptr<std::atomic_bool> gate);\n- void setOwnerAdmissionGate(std::shared_ptr<std::atomic_bool> gate) { m_owner_gate = std::move(gate); }\n- void setInputAdmissionGate(std::shared_ptr<std::atomic_bool> gate) { m_edit_gate = std::move(gate); }\n+ /** Whether a value comes from the user or from a model. */\n+ enum class Origin { User, Model };\n+\n+ /** Longest input that is parsed. Longer input is invalid as a whole and\n+ * is never shortened to a valid prefix. */\n+ static constexpr int MAX_INPUT_LENGTH{128};\n+\n+ explicit BitcoinAmount(QObject* parent = nullptr);\n \n- Unit unit() const;\n+ Unit unit() const { return m_unit; }\n void setUnit(Unit unit);\n QString unitLabel() const;\n \n@@ -63,12 +67,11 @@ public:\n QString displayWithUnit() const;\n QString localizedDisplay() const;\n QString localizedDisplayWithUnit() const;\n- void fromDisplay(const QString& new_amount);\n- qint64 satoshi() const;\n- void setSatoshi(qint64 new_amount);\n- // Owned observation, not a new user amount intent.\n- void setProjectedSatoshi(qint64 value) { assignCanonical(value, true, true); }\n- void clearProjected() { assignCanonical(0, false, true); }\n+ void fromDisplay(const QString& text);\n+ qint64 satoshi() const { return m_satoshi; }\n+ void setSatoshi(qint64 value) { setSatoshi(value, Origin::User); }\n+ void setSatoshi(qint64 value, Origin origin);\n+ void clear(Origin origin);\n \n bool isSet() const { return m_isSet; }\n \n@@ -80,33 +83,22 @@ public:\n bool zeroIsEmpty() const { return m_zero_is_empty; }\n void setZeroIsEmpty(bool empty);\n Q_INVOKABLE void editInput(const QString& text) { fromDisplay(text); }\n- // Parse has an existing 128-character ORIGINAL-input budget. Long literals\n- // are refused before any trim/prefix parse; the 129-character view is an\n- // invalid overflow sentinel, never a silently accepted numeric prefix.\n- Q_INVOKABLE quint64 requestPaste(const QString& literal, int selection_start, int selection_end, qint64 expected_revision = -1);\n- Q_INVOKABLE quint64 requestEditInput(const QString& text, qint64 expected_revision = -1, int cursor = -1);\n- Q_INVOKABLE bool cancelInput(quint64 ticket);\n- void closeAdmission();\n- quint64 inputRevision() const { return m_input_revision; }\n- bool inputPending() const { return false; }\n- quint64 inputOperationId() const { return m_input_operation_id; }\n- InputOperationState inputOperationState() const { return m_input_operation_state; }\n- QString inputOperationError() const { return m_input_operation_error; }\n- int inputCursorPosition() const { return m_input_cursor; }\n+ /** Replace the characters from start to end of the input with text, as a\n+ * user edit. Returns the cursor position after the pasted text, or -1 if\n+ * the range is not inside the current input. */\n+ Q_INVOKABLE int paste(const QString& text, int start, int end);\n Q_INVOKABLE bool commitTo(BitcoinAmount* target);\n Q_INVOKABLE void resetInput();\n- Q_INVOKABLE void restoreInput() { if (!admissionClosed()) Q_EMIT inputChanged(); }\n Q_INVOKABLE void format();\n \n static QString satsToBtcString(qint64 sat);\n \n public Q_SLOTS:\n void flipUnit();\n- void clear();\n+ void clear() { clear(Origin::User); }\n \n Q_SIGNALS:\n void valueEdited();\n- void inputOperationChanged();\n void inputDirtyChanged();\n void inputChanged();\n void unitChanged();\n@@ -115,20 +107,15 @@ Q_SIGNALS:\n void displayWithUnitChanged();\n \n private:\n- bool admissionClosed() const { return m_input_closed || (m_app_gate && m_app_gate->load()) || (m_owner_gate && m_owner_gate->load()); }\n- bool inputAdmissionClosed() const { return admissionClosed() || (m_edit_gate && m_edit_gate->load()); }\n- std::shared_ptr<std::atomic_bool> m_edit_gate;\n- std::shared_ptr<std::atomic_bool> m_app_gate, m_owner_gate;\n- void assignCanonical(qint64 value, bool is_set, bool reset_input = false);\n+ /** Emit signals in order. Stops and returns false if a slot destroyed\n+ * this object. */\n+ bool notify(std::initializer_list<void (BitcoinAmount::*)()> emitted);\n+ /** Emit valueEdited() for a user edit. Returns false if a slot destroyed\n+ * this object. */\n+ bool announceEdit(Origin origin);\n+ void assignValue(qint64 value, bool is_set, bool reset_input);\n QString formattedInput() const;\n \n- quint64 beginInputRequest(qint64 expected_revision);\n- quint64 applyInputRequest(const QString& bounded_text, bool over_budget, int cursor, quint64 ticket);\n- quint64 m_input_revision{0}, m_input_operation_id{0};\n- InputOperationState m_input_operation_state{InputOperationState::InputIdle};\n- QString m_input_operation_error;\n- int m_input_cursor{0};\n- bool m_input_closed{false};\n QString m_input_text;\n QString m_baseline_text;\n InputState m_input_state{InputState::Empty};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 129,
"evidence_id": "7ae6821692364417983828ea5e1b6825",
"finding_id": "finding:6",
"kind": "new_source",
"line": 56,
"new_head": "cc508c18a413d2798ceaf9bf09818682977f2683",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/bitcoinamount.h",
"revision": "cc508c18a413d2798ceaf9bf09818682977f2683",
"source_generation": 2,
"source_job_id": 2781,
"text": " /** Longest input that is parsed. Longer input is invalid as a whole and\n * is never shortened to a valid prefix. */\n static constexpr int MAX_INPUT_LENGTH{128};\n\n explicit BitcoinAmount(QObject* parent = nullptr);\n\n Unit unit() const { return m_unit; }\n void setUnit(Unit unit);\n QString unitLabel() const;\n\n QString toDisplay() const;\n QString displayWithUnit() const;\n QString localizedDisplay() const;\n QString localizedDisplayWithUnit() const;\n void fromDisplay(const QString& text);\n qint64 satoshi() const { return m_satoshi; }\n void setSatoshi(qint64 value) { setSatoshi(value, Origin::User); }\n void setSatoshi(qint64 value, Origin origin);\n void clear(Origin origin);\n\n bool isSet() const { return m_isSet; }\n\n QString inputText() const { return m_input_text; }\n InputState inputState() const { return m_input_state; }\n bool inputAcceptable() const { return m_input_state == InputState::Empty || m_input_state == InputState::Valid; }\n bool inputDirty() const { return m_input_dirty; }\n QString inputError() const;\n bool zeroIsEmpty() const { return m_zero_is_empty; }\n void setZeroIsEmpty(bool empty);\n Q_INVOKABLE void editInput(const QString& text) { fromDisplay(text); }\n /** Replace the characters from start to end of the input with text, as a\n * user edit. Returns the cursor position after the pasted text, or -1 if\n * the range is not inside the current input. */\n Q_INVOKABLE int paste(const QString& text, int start, int end);\n Q_INVOKABLE bool commitTo(BitcoinAmount* target);\n Q_INVOKABLE void resetInput();\n Q_INVOKABLE void format();\n\n static QString satsToBtcString(qint64 sat);\n\npublic Q_SLOTS:\n void flipUnit();\n void clear() { clear(Origin::User); }\n\nQ_SIGNALS:\n void valueEdited();\n void inputDirtyChanged();\n void inputChanged();\n void unitChanged();\n void amountChanged();\n void displayChanged();\n void displayWithUnitChanged();\n\nprivate:\n /** Emit signals in order. Stops and returns false if a slot destroyed\n * this object. */\n bool notify(std::initializer_list<void (BitcoinAmount::*)()> emitted);\n /** Emit valueEdited() for a user edit. Returns false if a slot destroyed\n * this object. */\n bool announceEdit(Origin origin);\n void assignValue(qint64 value, bool is_set, bool reset_input);\n QString formattedInput() const;\n\n QString m_input_text;\n QString m_baseline_text;\n InputState m_input_state{InputState::Empty};\n bool m_input_dirty{false};\n bool m_zero_is_empty{false};\n qint64 m_satoshi{0};\n bool m_isSet{false};\n Unit m_unit{Unit::BTC};\n};\n\n#endif // BITCOIN_QML_BITCOINAMOUNT_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f042e865e0c..cc508c18a413 2026-11-18T15:41:23Z · gpt-6-luna |
| gui#1142 | Backup confirmation has no height cap or scrollingqml/components/WalletBackupConfirmation.qml | unclear | AssessmentThe old confirmation component is deleted, but no supplied new-head evidence shows the replacement UI or whether it caps the popup and keeps approval controls reachable. path_diff: qml/components/WalletBackupConfirmation.qml [
{
"evidence_id": "b95ed9c111724bd3a6b5ff7a1b32f3a4",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/components/WalletBackupConfirmation.qml",
"source_generation": 2,
"source_job_id": 2781,
"text": "diff --git a/qml/components/WalletBackupConfirmation.qml b/qml/components/WalletBackupConfirmation.qml\ndeleted file mode 100644\nindex f2e1c72f62..0000000000\n--- a/qml/components/WalletBackupConfirmation.qml\n+++ /dev/null\n@@ -1,78 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"walletBackupOverwritePopup\"\n- required property BackupFileOperation operation\n- readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n- parent: Overlay.overlay\n- width: parent ? Math.min(600, parent.width - 40) : 600\n- implicitHeight: content.implicitHeight + topPadding + bottomPadding\n- x: parent ? Math.round((parent.width - width) / 2) : 0\n- y: parent ? Math.round((parent.height - height) / 2) : 0\n- padding: 24\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.NoAutoClose\n- onOpened: content.forceActiveFocus()\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 10\n- border.color: Theme.color.neutral2\n- }\n- contentItem: ColumnLayout {\n- id: content\n- focus: true\n- spacing: 16\n- Keys.priority: Keys.BeforeItem\n- Keys.onEscapePressed: function(event) {\n- root.operation.refuse()\n- event.accepted = true\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.title\n- font: Theme.text.subtitle.font\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.replacing\n- ? qsTr(\"An existing file will be replaced at this final destination:\")\n- : qsTr(\"Save the backup at this final destination:\")\n- wrap: true\n- }\n- CoreText {\n- objectName: \"walletBackupFinalPathText\"\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.finalPath\n- wrapMode: Text.WrapAnywhere\n- }\n- RowLayout {\n- spacing: 12\n- NeutralButton {\n- objectName: \"walletBackupOverwriteRejectButton\"\n- text: qsTr(\"Cancel\")\n- onClicked: root.operation.refuse()\n- }\n- NeutralButton {\n- objectName: \"walletBackupOverwriteApproveButton\"\n- text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n- onClicked: root.operation.approve()\n- }\n- }\n- }\n-}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f042e865e0c..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | PSBT readiness omits the submission fee capsqml/psbtpolicy.cpp | addressed | AssessmentReadAdmission now passes the configured maximum fee rate to testmempoolaccept, and Evaluate blocks transactions whose authenticated fee exceeds MaxFee. The readiness result therefore no longer claims acceptance for the above-cap case described in the finding. path_diff: qml/psbtpolicy.cpp; new_source: qml/psbtpolicy.cpp [
{
"evidence_id": "2aaa7d81ac594e769082259368a5bc8d",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/psbtpolicy.cpp",
"source_generation": 2,
"source_job_id": 2781,
"text": "diff --git a/qml/psbtpolicy.cpp b/qml/psbtpolicy.cpp\nindex a42a667a84..dac47edbc0 100644\n--- a/qml/psbtpolicy.cpp\n+++ b/qml/psbtpolicy.cpp\n@@ -3,6 +3,7 @@\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n \n #include <qml/psbtpolicy.h>\n+#include <qml/bitcoinunits.h>\n \n #include <coins.h>\n #include <consensus/consensus.h>\n@@ -31,7 +32,8 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n- parameters.push_back(0); // Disable only testmempoolaccept's independent client max-fee-rate cap.\n+ // The same fee-rate cap that submission passes to broadcastTransaction.\n+ parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n@@ -46,9 +48,31 @@ void ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbt\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n+ if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n+ if (!allowed) return;\n+ // An allowed conflict is a replacement. Name what it evicts; until the\n+ // lookup completes, the review must not imply that nothing is evicted.\n+ facts.replaces_unknown = true;\n+ UniValue outpoints{UniValue::VARR};\n+ for (const auto& input : transaction.vin) {\n+ UniValue outpoint{UniValue::VOBJ};\n+ outpoint.pushKV(\"txid\", input.prevout.hash.GetHex());\n+ outpoint.pushKV(\"vout\", uint64_t{input.prevout.n});\n+ outpoints.push_back(std::move(outpoint));\n+ }\n+ UniValue spending_parameters{UniValue::VARR};\n+ spending_parameters.push_back(std::move(outpoints));\n+ const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n+ if (!spending.isArray()) return;\n+ for (const auto& item : spending.getValues()) {\n+ if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n+ const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n+ if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n+ }\n+ facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n@@ -70,6 +94,8 @@ void ClearAdmissionFacts(psbtpolicy::Facts& facts)\n {\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n+ facts.replaces.clear();\n+ facts.replaces_unknown = false;\n }\n } // namespace\n \n@@ -78,6 +104,7 @@ psbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain*\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n+ facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n@@ -137,11 +164,18 @@ psbtpolicy::Decision psbtpolicy::Evaluate(const Facts& facts)\n if (!facts.sufficient_fee) return {State::Blocked, Tr(\"The fee is below the node's current advertised minimum.\")};\n if (!facts.chain_limits) return {State::Blocked, facts.chain_error.isEmpty() ? Tr(\"The transaction exceeds the node's current mempool chain limits.\") : facts.chain_error};\n }\n+ if (!facts.within_fee_cap) return {State::Blocked, Tr(\"The fee is above the node's maximum of %1 for one transaction.\").arg(QmlBitcoinUnits::format(QmlBitcoinUnits::Unit::BTC, MaxFee()) + QStringLiteral(\" BTC\"))};\n if (facts.admission == Admission::Rejected) {\n const QString reason = facts.admission_error.isEmpty() ? Tr(\"The node currently rejects this transaction.\") : facts.admission_error;\n return {State::Blocked, reason};\n }\n if (facts.admission == Admission::Allowed) {\n+ if (!facts.replaces.isEmpty()) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction as a replacement. Submitting it removes unconfirmed transaction %1 from the mempool.\").arg(facts.replaces.join(QStringLiteral(\", \")))};\n+ }\n+ if (facts.replaces_unknown) {\n+ return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction, but it could not be checked whether submitting it removes an unconfirmed transaction from the mempool. Submission will check current policy again.\")};\n+ }\n return {State::NoKnownObstacle, Tr(\"The node currently accepts this exact transaction. Submission will check current policy again.\")};\n }\n if (facts.observed) return {State::NoKnownObstacle, Tr(\"Fully signed. Read-only node checks found no obstacle; submission will check current policy, including conflicts and replacements.\")};\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 153,
"evidence_id": "430c23bcbdb445b794a9a033e1b7aa36",
"finding_id": "finding:4",
"kind": "new_source",
"line": 4,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/psbtpolicy.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 2,
"source_job_id": 2781,
"text": "\n#include <qml/psbtpolicy.h>\n#include <qml/bitcoinunits.h>\n\n#include <coins.h>\n#include <consensus/consensus.h>\n#include <consensus/tx_verify.h>\n#include <core_io.h>\n#include <interfaces/chain.h>\n#include <interfaces/node.h>\n#include <policy/policy.h>\n#include <univalue.h>\n#include <util/result.h>\n\n#include <QCoreApplication>\n\n#include <algorithm>\n#include <limits>\n#include <map>\n#include <utility>\n\nnamespace {\nQString Tr(const char* text) { return QCoreApplication::translate(\"PsbtQmlModel\", text); }\n\nvoid ReadAdmission(interfaces::Node& node, const CTransaction& transaction, psbtpolicy::Facts& facts)\n{\n try {\n UniValue raw_transactions{UniValue::VARR};\n raw_transactions.push_back(EncodeHexTx(transaction));\n UniValue parameters{UniValue::VARR};\n parameters.push_back(std::move(raw_transactions));\n // The same fee-rate cap that submission passes to broadcastTransaction.\n parameters.push_back(ValueFromAmount(psbtpolicy::MAX_FEE_RATE.GetFeePerK()));\n const UniValue response = node.executeRpc(\"testmempoolaccept\", parameters, \"\");\n if (!response.isArray() || response.size() != 1) return;\n const UniValue& result = response[0];\n if (!result.isObject() || !result.exists(\"txid\") || !result[\"txid\"].isStr()\n || !result.exists(\"wtxid\") || !result[\"wtxid\"].isStr()\n || result[\"txid\"].get_str() != transaction.GetHash().ToString()\n || result[\"wtxid\"].get_str() != transaction.GetWitnessHash().ToString()\n || !result.exists(\"allowed\") || !result[\"allowed\"].isBool()) return;\n\n const bool allowed = result[\"allowed\"].get_bool();\n QString reason;\n if (!allowed && result.exists(\"reject-reason\")) {\n if (!result[\"reject-reason\"].isStr()) return;\n reason = QString::fromStdString(result[\"reject-reason\"].get_str()).left(1024);\n if (reason == QLatin1String(\"max-fee-exceeded\")) reason = Tr(\"The fee rate is above the node's maximum for one transaction.\");\n }\n facts.admission = allowed ? psbtpolicy::Admission::Allowed : psbtpolicy::Admission::Rejected;\n facts.admission_error = std::move(reason);\n if (!allowed) return;\n // An allowed conflict is a replacement. Name what it evicts; until the\n // lookup completes, the review must not imply that nothing is evicted.\n facts.replaces_unknown = true;\n UniValue outpoints{UniValue::VARR};\n for (const auto& input : transaction.vin) {\n UniValue outpoint{UniValue::VOBJ};\n outpoint.pushKV(\"txid\", input.prevout.hash.GetHex());\n outpoint.pushKV(\"vout\", uint64_t{input.prevout.n});\n outpoints.push_back(std::move(outpoint));\n }\n UniValue spending_parameters{UniValue::VARR};\n spending_parameters.push_back(std::move(outpoints));\n const UniValue spending = node.executeRpc(\"gettxspendingprevout\", spending_parameters, \"\");\n if (!spending.isArray()) return;\n for (const auto& item : spending.getValues()) {\n if (!item.isObject() || !item.exists(\"spendingtxid\") || !item[\"spendingtxid\"].isStr()) continue;\n const auto txid = QString::fromStdString(item[\"spendingtxid\"].get_str());\n if (txid != QString::fromStdString(transaction.GetHash().ToString()) && !facts.replaces.contains(txid)) facts.replaces.push_back(txid);\n }\n facts.replaces_unknown = false;\n } catch (...) {\n // An RPC exception is an unavailable observation, not a transaction result.\n }\n}\n\nvoid ClearChainFacts(psbtpolicy::Facts& facts)\n{\n facts.observed = false;\n facts.missing_inputs = false;\n facts.immature_inputs = false;\n facts.final = true;\n facts.sufficient_fee = true;\n facts.chain_limits = true;\n facts.tip.clear();\n facts.chain_error.clear();\n}\n\nvoid ClearAdmissionFacts(psbtpolicy::Facts& facts)\n{\n facts.admission = psbtpolicy::Admission::Unknown;\n facts.admission_error.clear();\n facts.replaces.clear();\n facts.replaces_unknown = false;\n}\n} // namespace\n\npsbtpolicy::Read psbtpolicy::ReadNode(interfaces::Node* node, interfaces::Chain* chain)\n{\n return [node, chain](CTransactionRef transaction, CAmount fee) {\n Facts facts;\n if (!node || !transaction) return facts;\n facts.within_fee_cap = !MoneyRange(fee) || fee <= MaxFee();\n if (chain && MoneyRange(fee)) {\n try {\n const auto tip = node->getBestBlockHash();\n int height{-1}; int64_t mtp{0}; bool active{false};\n if (chain->findBlock(tip, interfaces::FoundBlock{}.height(height).mtpTime(mtp).inActiveChain(active))\n && active && height >= 0 && height < std::numeric_limits<int>::max()) {\n std::map<COutPoint, Coin> coins;\n for (const auto& input : transaction->vin) coins.try_emplace(input.prevout);\n chain->findCoins(coins); // Includes available mempool parents.\n for (const auto& [outpoint, coin] : coins) {\n facts.missing_inputs |= coin.IsSpent();\n facts.immature_inputs |= !coin.IsSpent() && coin.IsCoinBase()\n && int64_t(height) + 1 - coin.nHeight < COINBASE_MATURITY;\n }\n facts.final = IsFinalTx(*transaction, height + 1, mtp);\n const auto minimum = std::max(chain->mempoolMinFee(), chain->relayMinFee());\n facts.sufficient_fee = fee >= minimum.GetFee(GetVirtualTransactionSize(*transaction));\n const auto limits = chain->checkChainLimits(transaction);\n facts.chain_limits = bool(limits);\n if (!limits) facts.chain_error = QString::fromStdString(util::ErrorString(limits).translated).left(4096);\n // A reorg during this collection invalidates the whole observation.\n if (node->getBestBlockHash() == tip) {\n facts.tip = QString::fromStdString(tip.ToString());\n facts.observed = true;\n } else {\n ClearChainFacts(facts);\n }\n }\n } catch (...) {\n ClearChainFacts(facts);\n }\n }\n try {\n const auto admission_tip = node->getBestBlockHash();\n if (facts.observed && facts.tip != QString::fromStdString(admission_tip.ToString())) {\n ClearChainFacts(facts);\n }\n ReadAdmission(*node, *transaction, facts);\n // Drop both observations if the active tip changed while the RPC ran.\n if (node->getBestBlockHash() != admission_tip) {\n ClearChainFacts(facts);\n ClearAdmissionFacts(facts);\n }\n } catch (...) {\n ClearAdmissionFacts(facts);\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f042e865e0c..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | A pre-commit signer exception leaves Speed Up stuck in Uncertainqml/walletbump.cpp | addressed | AssessmentThe new-head diff wraps `signBumpTransaction` in a catch and converts an exception into `Error::Sign`; this occurs before `commit_attempted` is set, so signer exceptions no longer become `Uncertain` through the outer catch. path_diff: qml/walletbump.cpp [
{
"evidence_id": "5aaf84d9aea841aa898971735443bcbb",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/walletbump.cpp",
"source_generation": 2,
"source_job_id": 2781,
"text": "diff --git a/qml/walletbump.cpp b/qml/walletbump.cpp\nindex e2065edf..bf7cd515 100644\n--- a/qml/walletbump.cpp\n+++ b/qml/walletbump.cpp\n@@ -175,7 +175,11 @@ Commit Execute(interfaces::Wallet& wallet, const Prepared& review, std::optional\n if (!wallet.unlock(*passphrase)) { relock_required = false; result.error = Error::IncorrectPassphrase; return finishAfterRelock(); }\n }\n CMutableTransaction signed_tx{review.transaction};\n- if (!wallet.signBumpTransaction(signed_tx)) { result.error = Error::Sign; return finishAfterRelock(); }\n+ // An external signer helper failure throws before any commit. It is a\n+ // definite signing failure, not an uncertain replacement outcome.\n+ bool signed_replacement{false};\n+ try { signed_replacement = wallet.signBumpTransaction(signed_tx); } catch (...) {}\n+ if (!signed_replacement) { result.error = Error::Sign; return finishAfterRelock(); }\n if (!MatchesUnsignedTransaction(review.transaction, signed_tx)) { result.error = Error::Changed; return finishAfterRelock(); }\n if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f042e865e0c..50767aca7e16 2026-11-19T03:25:57Z · gpt-6-luna |
| gui#1142 | Squatting the /tmp intent directory prevents GUI startupqml/desktopintenttransport.cpp | addressed | AssessmentInitialization now places the socket directory inside Qt's per-user RuntimeLocation and validates its type, owner, and restrictive mode. This replaces the attacker-claimable fixed directory under shared /tmp described in the finding. path_diff: qml/desktopintenttransport.cpp; new_source: qml/desktopintenttransport.cpp [
{
"evidence_id": "b45ea770940f4aa985d620e68e43e744",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/desktopintenttransport.cpp",
"source_generation": 2,
"source_job_id": 2781,
"text": "diff --git a/qml/desktopintenttransport.cpp b/qml/desktopintenttransport.cpp\nindex 7b3737ca0e..df095f879a 100644\n--- a/qml/desktopintenttransport.cpp\n+++ b/qml/desktopintenttransport.cpp\n@@ -2,7 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/desktopintenttransport.h>\n-#include <qml/retainedvalue.h>\n+#include <qml/asyncjoin.h>\n #include <util/fs.h>\n \n #include <QCoreApplication>\n@@ -17,6 +17,8 @@\n #include <QLocalSocket>\n #include <QLockFile>\n #include <QMetaObject>\n+#include <QScopeGuard>\n+#include <QStandardPaths>\n #include <QStringList>\n #include <QThread>\n #include <QTimer>\n@@ -196,25 +198,26 @@ struct Discovery {\n struct Service::Flags {\n std::atomic_bool admission_closed{false}, stopping{false}, started{false}, retired{false};\n std::mutex mutex;\n- execution::TaskId retired_task;\n- std::function<void()> completed_stop;\n+ std::vector<std::function<void()>> completed_stops;\n bool probed{false}, probe_pending{false}, probe_terminal{false}; // Protected by mutex.\n };\n struct Service::State {\n struct Native;\n- std::shared_ptr<execution::Scheduler> scope;\n std::shared_ptr<Owner> owner;\n Limits limits;\n- execution::ResourceKey key;\n const std::shared_ptr<Flags> flags{std::make_shared<Flags>()};\n- std::shared_ptr<execution::ResourceLease> native_lifetime;\n- std::mutex mutex;\n+ // The same lock protects admission, pending delivery and the receiver\n+ // used to post work to the transport thread.\n Native* native{nullptr};\n+ size_t pending_deliveries{0};\n+ bool post(std::function<void(Native&)> work);\n+ void finishDelivery();\n+ void retireWhenIdle();\n };\n \n struct Service::State::Native final : QObject {\n struct Query { QJsonArray results; QStringList keys; size_t remaining{0}; bool unknown{false}; };\n- struct Reply { std::optional<desktopintent::Admission> admission; std::optional<Receipt> receipt; };\n+ struct Reply { std::optional<desktopintent::Acceptance> admission; std::optional<Receipt> receipt; };\n struct Cell {\n std::mutex mutex;\n QObject* receiver{nullptr}; std::function<void()> notify;\n@@ -230,7 +233,7 @@ struct Service::State::Native final : QObject {\n };\n struct Pending { uint64_t connection; std::shared_ptr<Cell> cell; std::shared_ptr<Query> query{}; qsizetype index{0}; QStringList keys{}; };\n const std::shared_ptr<State> state;\n- QLocalServer server;\n+ QLocalServer server{this};\n std::unique_ptr<QLockFile> instance_lock;\n struct Client { QLocalSocket* socket; Limits::Time admitted; };\n std::map<uint64_t, Client> clients;\n@@ -306,7 +309,7 @@ struct Service::State::Native final : QObject {\n QStringList keys; for (const auto& input : inputs) keys.push_back(input.producer_key);\n const auto cell = reserve(id, {}, 0, std::move(keys)); if (!cell) { send(id, {{\"status\", \"rejected\"}}); return; }\n const auto admitted = state->owner->admit(std::move(inputs), [cell](auto result) { cell->complete({std::move(result), {}}); });\n- if (!admitted) cell->complete({desktopintent::Admission{Error::Closed, {}}, {}});\n+ if (!admitted) cell->complete({desktopintent::Acceptance{Error::Closed, {}}, {}});\n } else if (command == \"query\") {\n const auto keys = object.value(\"keys\").toArray();\n if (keys.empty() || keys.size() > static_cast<qsizetype>(Queue::MAX_PENDING) || replies.size() + static_cast<size_t>(keys.size()) > MAX_REPLIES) { socket->abort(); return; }\n@@ -351,17 +354,19 @@ struct Service::State::Native final : QObject {\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n- std::shared_ptr<execution::ResourceLease> lifetime;\n- { std::lock_guard lock{state->mutex}; state->native = nullptr; lifetime = std::move(state->native_lifetime); }\n- delete this;\n- lifetime.reset(); // Only now may the original Native event loop drain.\n+ QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n #ifndef Q_OS_WIN\n- private_directory = QDir{QStringLiteral(\"/tmp\")}.filePath(QStringLiteral(\"qml-intent-%1\").arg(getuid()));\n+ // The runtime directory belongs to this user (Qt checks its owner and\n+ // mode). A fixed name in the shared /tmp could be created first by\n+ // another user, which would block delivery for this one.\n+ const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n+ if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n+ private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n@@ -440,37 +445,83 @@ struct Service::State::Native final : QObject {\n }\n };\n \n+bool Service::State::post(std::function<void(Native&)> work)\n+{\n+ std::lock_guard lock{flags->mutex};\n+ return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n+ work(*receiver);\n+ }, Qt::QueuedConnection);\n+}\n+\n+void Service::State::finishDelivery()\n+{\n+ {\n+ std::lock_guard lock{flags->mutex};\n+ --pending_deliveries;\n+ }\n+ retireWhenIdle();\n+}\n+\n+void Service::State::retireWhenIdle()\n+{\n+ std::lock_guard lock{flags->mutex};\n+ if (!flags->stopping || pending_deliveries || !native) return;\n+ auto* receiver = std::exchange(native, nullptr);\n+ if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n+}\n+\n Service::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\n Service::~Service() { stop(); }\n-std::shared_ptr<Service> Service::Create(std::shared_ptr<execution::Scheduler> scheduler, std::shared_ptr<Owner> owner, Limits limits)\n+bool Service::post(std::function<void()> work) const\n+{\n+ const auto state = m_state.load();\n+ return state && state->post([work = std::move(work)](State::Native&) { work(); });\n+}\n+\n+std::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n {\n const auto maximum = std::chrono::seconds{30};\n- if (!scheduler || !owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n+ if (!owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n limits.connect <= std::chrono::milliseconds::zero() || limits.connect > limits.startup ||\n limits.acknowledge <= std::chrono::milliseconds::zero() || limits.acknowledge > limits.startup ||\n limits.query <= std::chrono::milliseconds::zero() || limits.query > limits.startup ||\n limits.client <= std::chrono::milliseconds::zero() || limits.client > maximum ||\n limits.slice <= std::chrono::milliseconds::zero() || limits.slice > std::chrono::milliseconds{100}) return {};\n- auto scope = scheduler->openActionScope(1024); if (!scope) return {};\n- auto state = execution::RetainValues<State>(scope, [] { return std::make_unique<State>(); }); if (!state) return {};\n- state->scope = scope; state->owner = std::move(owner); state->limits = std::move(limits); state->key = scope->allocateKey();\n- const auto retired = execution::Submit(*scope, [] {}, [state] {\n- std::function<void()> done;\n- { std::lock_guard lock{state->mutex}; state->owner.reset(); }\n- { std::lock_guard lock{state->flags->mutex}; state->flags->retired = true; done = std::move(state->flags->completed_stop); }\n- if (done) done();\n- }, {}, {execution::Lane::Cleanup, 1024, state->key}, true);\n- auto borrowed = retired ? scope->borrow(state->key) : execution::BorrowAdmission{{}, retired.rejection};\n- if (!borrowed) { if (retired) scope->activateCleanup(retired.id); return {}; }\n- state->flags->retired_task = retired.id;\n- state->native_lifetime = std::make_shared<execution::ResourceLease>(std::move(*borrowed.lease));\n- return std::shared_ptr<Service>{new Service(std::move(state))};\n+ auto* const app = QCoreApplication::instance();\n+ Q_ASSERT(app && QThread::currentThread() == app->thread());\n+ auto state = std::make_shared<State>();\n+ state->owner = std::move(owner);\n+ state->limits = std::move(limits);\n+ auto thread = std::make_unique<QThread>();\n+ thread->setObjectName(QStringLiteral(\"desktop transport\"));\n+ auto native = std::make_unique<State::Native>(state);\n+ auto service = std::shared_ptr<Service>{new Service(state)};\n+ QObject::connect(thread.get(), &QThread::finished, native.get(), &QObject::deleteLater);\n+ QObject::connect(thread.get(), &QThread::finished, app, [app, state, worker = thread.get()] {\n+ JoinThreadAsync([state, worker] {\n+ if (!worker->wait()) std::terminate();\n+ state->owner.reset();\n+ std::vector<std::function<void()>> completed;\n+ {\n+ std::lock_guard lock{state->flags->mutex};\n+ state->flags->retired = true;\n+ completed = std::move(state->flags->completed_stops);\n+ }\n+ for (const auto& done : completed) {\n+ try { done(); } catch (...) {}\n+ }\n+ }, app, [worker] { delete worker; });\n+ }, Qt::QueuedConnection);\n+ native->moveToThread(thread.get());\n+ state->native = native.release();\n+ thread.release()->start();\n+ return service;\n }\n-execution::Admission Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n+execution::SubmitResult Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n {\n return begin(std::move(directory), std::move(network), std::move(inputs), false, std::move(completed), {});\n }\n-execution::Admission Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n+execution::SubmitResult Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n {\n if (inputs.size() > Queue::MAX_PENDING) return {{}, execution::Rejection::Invalid};\n const auto callback = std::move(completed);\n@@ -487,7 +538,7 @@ execution::Admission Service::probeExisting(QString directory, QString network,\n const auto missing = [callback] { if (callback) callback({ProbeStatus::Missing, {}}); };\n return begin(std::move(directory), std::move(network), inputs, true, transfer, missing);\n }\n-execution::Admission Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n+execution::SubmitResult Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n std::function<void(StartResult)> completed, std::function<void()> missing)\n {\n const auto state = m_state.load();\n@@ -497,82 +548,82 @@ execution::Admission Service::begin(QString directory, QString network, std::vec\n return {{}, execution::Rejection::Closed};\n if (existing_only) { m_flags->probed = true; m_flags->probe_pending = true; }\n else m_flags->started = true;\n+ ++state->pending_deliveries;\n }\n- const auto reject = [flags = m_flags, existing_only](execution::Rejection reason) {\n- if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- return execution::Admission{{}, reason};\n- };\n+ auto release_rejected = qScopeGuard([&] {\n+ if (existing_only) {\n+ std::lock_guard lock{m_flags->mutex};\n+ m_flags->probe_pending = false;\n+ m_flags->probe_terminal = true;\n+ }\n+ state->finishDelivery();\n+ });\n if (directory.size() > 4096 || QString::fromUtf8(directory.toUtf8()) != directory || network.isEmpty() || network.size() > 128 || directory.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\n'}) || inputs.size() > Queue::MAX_PENDING)\n- return reject(execution::Rejection::Invalid);\n- size_t bytes{1024};\n+ return {{}, execution::Rejection::Invalid};\n for (const auto& input : inputs) {\n- if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return reject(execution::Rejection::Capacity);\n- bytes += static_cast<size_t>(input.producer_key.size() + input.value.size()) * sizeof(QChar);\n+ if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return {{}, execution::Rejection::Capacity};\n }\n- auto held = state->scope->borrow(state->key); if (!held) return reject(held.rejection);\n- auto lifetime = std::make_shared<execution::ResourceLease>(std::move(*held.lease));\n- std::shared_ptr<Owner> owner;\n- { std::lock_guard lock{state->mutex}; owner = state->owner; }\n- const auto payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(inputs)); });\n- if (!payload) return reject(execution::Rejection::Capacity);\n+ const auto owner = state->owner;\n+ const auto payload = std::make_shared<const std::vector<Input>>(std::move(inputs));\n const auto claimed = std::make_shared<std::atomic_bool>(false);\n- const auto finish = [done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n+ const auto finish = [state, done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n if (claimed->exchange(true)) return;\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- if (done) done(std::move(result));\n+ try { if (done) done(std::move(result)); } catch (...) {}\n };\n- const auto submitted = execution::Submit(*state->scope, [state, directory = std::move(directory), network = std::move(network), payload, lifetime, existing_only] {\n- if (state->flags->admission_closed || (QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))\n- return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start on its background worker.\"))};\n- auto native = std::make_unique<State::Native>(state);\n- auto discovery = native->initialize(directory, network, existing_only);\n- if (discovery.result.status == StartStatus::Primary) {\n- std::lock_guard lock{state->mutex};\n- if (!state->flags->stopping) state->native = native.release();\n- else discovery.result = Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n+ const auto submitted = state->post([state, owner, directory = std::move(directory), network = std::move(network),\n+ payload, finish, claimed, missing = std::move(missing), existing_only](State::Native& native) {\n+ if (state->flags->admission_closed) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n }\n- return discovery;\n- }, [state, owner, payload, finish, lifetime, claimed, missing = std::move(missing)](Discovery discovery) {\n+ auto discovery = [&] {\n+ try { return native.initialize(directory, network, existing_only); }\n+ catch (...) { return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start.\"))}; }\n+ }();\n if (discovery.missing) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n if (!claimed->exchange(true)) {\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n { std::lock_guard lock{state->flags->mutex}; state->flags->probe_pending = false; }\n- if (missing) missing();\n+ try { if (missing) missing(); } catch (...) {}\n }\n return;\n }\n if (!discovery.endpoint.isEmpty()) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n try {\n- const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish, lifetime](ForwardingSnapshot snapshot) {\n+ const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish](ForwardingSnapshot snapshot) {\n if (snapshot.error != Error::None || state->flags->admission_closed) {\n finish(Rejected(QStringLiteral(\"The GUI could not transfer its pending requests.\"))); return;\n }\n- const auto forward_payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(snapshot.inputs)); });\n- if (!forward_payload) { finish(Rejected(QStringLiteral(\"The GUI could not retain its pending requests.\"))); return; }\n- const auto forwarded = execution::Submit(*state->scope, [state, endpoint, forward_payload, lifetime] {\n- if (state->flags->stopping) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n- // Once a frame may have left this process, an exception\n- // is an unknown outcome, never permission to replay.\n- try { return Forward(endpoint, *forward_payload, state->limits, state->flags->stopping); }\n- catch (...) { return Unknown(); }\n- }, [finish, lifetime, forward_payload](StartResult result) {\n- if (result.producer_keys.empty()) result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- }, [finish, lifetime, forward_payload](std::exception_ptr) {\n- auto result = Unknown(); result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- },\n- {execution::Lane::Core, 1024 + Queue::MAX_PENDING_BYTES, state->key});\n- if (!forwarded) finish(Rejected(QStringLiteral(\"The GUI could not start payment delivery.\")));\n+ try {\n+ const auto forwarded = state->post([state, endpoint, inputs = std::move(snapshot.inputs), finish](State::Native&) {\n+ if (state->flags->stopping) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n+ }\n+ // An exception after sending may have left a frame\n+ // in the other process. Its outcome remains unknown.\n+ auto result = [&] {\n+ try { return Fo\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 483,
"evidence_id": "ce03920165864e4ba416da5b07b70a8a",
"finding_id": "finding:2",
"kind": "new_source",
"line": 334,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/desktopintenttransport.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 2,
"source_job_id": 2781,
"text": " connect(deadline, &QTimer::timeout, this, [this, id] {\n const auto found = clients.find(id);\n if (found == clients.end()) return;\n try { if (!Remaining(state->limits, found->second.admitted, state->limits.client, 1)) found->second.socket->abort(); }\n catch (...) { found->second.socket->abort(); }\n });\n deadline->start(); ingress(id);\n }\n }\n void ingress(uint64_t id) {\n try { receive(id); }\n catch (...) {\n // Any already admitted queue mutation keeps its original receipt.\n // An unacknowledged caller can query; no exception becomes replay.\n const auto found = clients.find(id); if (found != clients.end()) found->second.socket->abort();\n }\n }\n void retire() {\n server.close();\n while (!replies.empty()) clearReply(replies.begin()->first);\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n#ifndef Q_OS_WIN\n // The runtime directory belongs to this user (Qt checks its owner and\n // mode). A fixed name in the shared /tmp could be created first by\n // another user, which would block delivery for this one.\n const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n if (lstat(encoded.constData(), &info)) {\n if (existing_only && errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n }\n if (!S_ISDIR(info.st_mode) || info.st_uid != getuid() || (info.st_mode & 0077))\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QFileInfo{private_directory}.canonicalFilePath();\n#else\n private_directory = QDir::tempPath();\n#endif\n const QString identity = canonical + QLatin1Char('\\n') + network;\n const auto digest = QCryptographicHash::hash(identity.toUtf8(), QCryptographicHash::Sha256).toHex().first(24);\n#ifndef Q_OS_WIN\n const auto endpoint = QDir{private_directory}.filePath(QString::fromLatin1(digest));\n if (QFile::encodeName(endpoint).size() > 100) return Rejected(QStringLiteral(\"The payment-delivery path is too long.\"));\n#else\n const QString endpoint = QStringLiteral(\"qml-intent-\") + QString::fromLatin1(digest);\n#endif\n if (existing_only) {\n // Discovery grants no listener/lock authority and mutates no local\n // queue. A known absent peer leaves normal final-profile startup\n // available; only a connected same-user peer permits forwarding.\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer)) {\n if (errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The payment-delivery endpoint could not be inspected.\"));\n }\n if (!S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during lookup.\"));\n const auto began = state->limits.now();\n const auto remaining = Remaining(state->limits, began, state->limits.startup, static_cast<int>(state->limits.connect.count()));\n if (!remaining) return Rejected(QStringLiteral(\"The payment-delivery lookup expired.\"));\n QLocalSocket probe; probe.connectToServer(endpoint);\n const bool connected = probe.waitForConnected(remaining);\n if (!connected) {\n if (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError)\n return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The existing payment-delivery endpoint could not be contacted.\"));\n }\n if (state->flags->admission_closed || !Remaining(state->limits, began, state->limits.startup, 1))\n return Rejected(QStringLiteral(\"The payment-delivery lookup expired or is closing.\"));\n if (!SameUser(probe)) return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n return {StartResult{}, endpoint};\n }\n instance_lock = std::make_unique<QLockFile>(QDir{private_directory}.filePath(QString::fromLatin1(digest) + QStringLiteral(\".lock\")));\n instance_lock->setStaleLockTime(0);\n if (instance_lock->tryLock(0)) {\n QLocalSocket probe; probe.connectToServer(endpoint); const bool live = probe.waitForConnected(200);\n bool reclaimable = !live && (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError);\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat socket_info{};\n if (lstat(path.constData(), &socket_info) == 0) {\n reclaimable &= S_ISSOCK(socket_info.st_mode) && socket_info.st_uid == getuid();\n if (reclaimable) reclaimable = QLocalServer::removeServer(endpoint);\n }\n#endif\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n if (reclaimable && !state->flags->admission_closed && server.listen(endpoint)) return StartResult{StartStatus::Primary, {}, {}};\n }\n instance_lock.reset();\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer) || !S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unavailable or unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n return {StartResult{}, endpoint};\n }\n};\n\nbool Service::State::post(std::function<void(Native&)> work)\n{\n std::lock_guard lock{flags->mutex};\n return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n work(*receiver);\n }, Qt::QueuedConnection);\n}\n\nvoid Service::State::finishDelivery()\n{\n {\n std::lock_guard lock{flags->mutex};\n --pending_deliveries;\n }\n retireWhenIdle();\n}\n\nvoid Service::State::retireWhenIdle()\n{\n std::lock_guard lock{flags->mutex};\n if (!flags->stopping || pending_deliveries || !native) return;\n auto* receiver = std::exchange(native, nullptr);\n if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n}\n\nService::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\nService::~Service() { stop(); }\nbool Service::post(std::function<void()> work) const\n{\n const auto state = m_state.load();\n return state && state->post([work = std::move(work)](State::Native&) { work(); });\n}\n\nstd::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n{\n const auto maximum = std::chrono::seconds{30};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f042e865e0c..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | Backup can replace another loaded wallet's wallet.datqml/models/backuppolicyio.cpp | addressed | AssessmentThe new code screens an existing destination against loaded wallet database file identities and performs the same screen again immediately before installation while holding the coordinator mutex. This prevents replacing the unchanged loaded wallet database described in the finding. path_diff: qml/models/backuppolicyio.cpp; new_source: qml/models/backuppolicyio.cpp [
{
"evidence_id": "fa4d2d3f09fa4117906a72979708fad4",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/models/backuppolicyio.cpp",
"source_generation": 2,
"source_job_id": 2781,
"text": "diff --git a/qml/models/backuppolicyio.cpp b/qml/models/backuppolicyio.cpp\nindex 7f2a43eccc..8ce3d25dd0 100644\n--- a/qml/models/backuppolicyio.cpp\n+++ b/qml/models/backuppolicyio.cpp\n@@ -15,6 +15,7 @@\n #include <QUrl>\n \n #include <algorithm>\n+#include <system_error>\n #include <utility>\n \n namespace {\n@@ -123,8 +124,33 @@ backup::Proposal backup::InspectPng(const std::string& raw)\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n }\n \n+namespace {\n+bool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n+{\n+ if (!coordinator.wallet_files) return false;\n+ const fs::path destination{fs::PathFromString(path)};\n+ std::error_code error;\n+ for (const auto& file : coordinator.wallet_files()) {\n+ const fs::path database{fs::PathFromString(file)};\n+ // SQLite keeps a journal next to the database while it writes.\n+ for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n+ if (fs::equivalent(destination, candidate, error)) return true;\n+ }\n+ }\n+ return false;\n+}\n+} // namespace\n+\n+backup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n+{\n+ if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n+ proposal.error = Error::WalletFile;\n+ }\n+ return proposal;\n+}\n+\n backup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n- InstallCoordinator& coordinator, std::function<bool()> admission)\n+ InstallCoordinator& coordinator, std::function<bool()> submitted)\n {\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n@@ -138,12 +164,12 @@ backup::WriteResult backup::Write(const Proposal& approved, bool destination_app\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n- const auto current = ReadTarget(final_path);\n+ const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n- if (admission && !admission()) return {Error::Changed};\n+ if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 184,
"evidence_id": "edb74ea46ae34fff84f3db76042e1096",
"finding_id": "finding:1",
"kind": "new_source",
"line": 119,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "1f042e865e0c39f5148b1f82068bbd684ede9dbc",
"path": "qml/models/backuppolicyio.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 2,
"source_job_id": 2781,
"text": " if (!url.isValid() || !url.isLocalFile() || !QDir::isAbsolutePath(url.toLocalFile())) return {{}, {}, false, false, Error::InvalidPath};\n QString path = QDir::cleanPath(url.toLocalFile());\n if (path.contains(QChar{0}) || QFileInfo{path}.isDir()) return {{}, {}, false, false, Error::InvalidPath};\n const QString selected = path;\n if (!path.endsWith(QStringLiteral(\".png\"), Qt::CaseInsensitive)) path += QStringLiteral(\".png\");\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n}\n\nnamespace {\nbool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n{\n if (!coordinator.wallet_files) return false;\n const fs::path destination{fs::PathFromString(path)};\n std::error_code error;\n for (const auto& file : coordinator.wallet_files()) {\n const fs::path database{fs::PathFromString(file)};\n // SQLite keeps a journal next to the database while it writes.\n for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n if (fs::equivalent(destination, candidate, error)) return true;\n }\n }\n return false;\n}\n} // namespace\n\nbackup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n{\n if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n proposal.error = Error::WalletFile;\n }\n return proposal;\n}\n\nbackup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n InstallCoordinator& coordinator, std::function<bool()> submitted)\n{\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n const QString parent = QFileInfo{final_path}.absolutePath();\n QTemporaryDir staging{QDir{parent}.filePath(QStringLiteral(\".bitcoin-backup-XXXXXX\"))};\n if (!staging.isValid()) return {Error::Staging};\n const QString staged_path = staging.filePath(QStringLiteral(\"wallet.backup\"));\n if (!producer(Utf8(staged_path))) return {Error::CoreBackup};\n const QFileInfo staged_info{staged_path};\n if (!staged_info.isFile() || staged_info.isSymLink()) return {Error::CoreBackup};\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n } else {\n // QFile's non-replacing rename also protects against a destination\n // created after inspection; never use an overwriting rename here.\n installed = QFile::rename(staged_path, final_path);\n }\n if (!installed) return {Error::Install};\n DirectoryCommit(fs::PathFromString(Utf8(parent)));\n return {};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f042e865e0c..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | The settings editor's admission policy is replaced later in the seriesqml/models/settingseditormodel.cpp | addressed | AssessmentThis is a commit-sequencing suggestion; the new-head diff shows the size-budget implementation has been replaced rather than leaving the reported per-command reservation policy in the final tree. The requested fold into an introducing commit cannot be established from this tree comparison, but the superseded-policy issue is absent at head. path_diff: qml/models/settingseditormodel.cpp; new_source: qml/models/settingseditormodel.cpp [
{
"evidence_id": "1640a5bf457d44059f96abb9df64f607",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/models/settingseditormodel.cpp",
"source_generation": 1,
"source_job_id": 2778,
"text": "diff --git a/qml/models/settingseditormodel.cpp b/qml/models/settingseditormodel.cpp\nindex b11e013365..c4a88fc816 100644\n--- a/qml/models/settingseditormodel.cpp\n+++ b/qml/models/settingseditormodel.cpp\n@@ -2,8 +2,8 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/models/settingseditormodel.h>\n+#include <qml/execution.h>\n #include <qml/guipresentation.h>\n-#include <qml/retainedsnapshot.h>\n #include <QCoreApplication>\n #include <QPointer>\n #include <QUuid>\n@@ -13,7 +13,7 @@ namespace {\n using namespace effectivesettings;\n size_t Index(Key key){return static_cast<size_t>(key);}\n QString Source(Provenance value){switch(value){case Provenance::Default:return QStringLiteral(\"default\");case Provenance::Configuration:return QStringLiteral(\"bitcoin.conf\");case Provenance::Persistent:return QStringLiteral(\"settings.json\");case Provenance::CommandLine:return QStringLiteral(\"command line\");case Provenance::Startup:return QStringLiteral(\"startup\");}return {};}\n-QString Failure(){return QCoreApplication::translate(\"SettingsEditorModel\",\"The background operation could not complete. The original write will not be repeated.\");}\n+QString Failure(){return QCoreApplication::translate(\"SettingsEditorModel\",\"The action could not finish. It will not be repeated.\");}\n }\n struct SettingsEditorModel::Projection {\n settingsedit::Session session;\n@@ -27,12 +27,25 @@ struct SettingsEditorModel::Mailbox {\n std::shared_ptr<const Projection> latest;\n std::atomic_bool retired{false},drained{false},notice_pending{false};\n };\n-struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n- State(QString id,Ports ports,std::shared_ptr<Mailbox> mailbox,std::function<void()> notify):session({id.toStdString(),\"effective-settings\"},settingsedit::Reducer::Mask{}.set()),ports(std::move(ports)),scope(this->ports.execution.scheduler->openActionScope()),key(this->ports.execution.scheduler->allocateKey()),io(this->ports.execution.scheduler->allocateKey()),notify(std::move(notify)),mailbox(std::move(mailbox)){}\n+struct SettingsEditorModel::State : std::enable_shared_from_this<State> {\n+ struct Queues {\n+ Queues(execution::Executor& executor, execution::Lane lane)\n+ : core(executor.makeQueue(lane)), utility(executor.makeQueue(execution::Lane::Utility)) {}\n+ execution::SerialQueue core, utility;\n+ // A refused outcome dispatch falls back on Core. Serialize that\n+ // delivery with any new Utility input before touching the reducer.\n+ std::recursive_mutex reducer;\n+ };\n+\n+ State(QString id, Ports ports, std::shared_ptr<Mailbox> mailbox, std::function<void()> notify,\n+ std::shared_ptr<Queues> worker_queues)\n+ : session({id.toStdString(), \"effective-settings\"}, settingsedit::Reducer::Mask{}.set()),\n+ ports(std::move(ports)), queues(std::move(worker_queues)),\n+ notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n+\n settingsedit::Session session;\n const Ports ports;\n- std::shared_ptr<execution::Scheduler> scope;\n- const execution::ResourceKey key,io;\n+ const std::shared_ptr<Queues> queues;\n const std::function<void()> notify;\n std::array<Value,settingsedit::FIELDS> running{};\n std::array<uint64_t,settingsedit::FIELDS> inputs{};\n@@ -43,8 +56,66 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n std::optional<effectivesettings::Result> receipt;\n const std::shared_ptr<Mailbox> mailbox;\n uint64_t finished_save{0},rejection{0};\n- ~State(){mailbox->drained.store(true);if(ports.retired)ports.retired();notify();}\n- execution::Admission post(const std::shared_ptr<execution::Scheduler>& target,std::function<void(State&)> command,std::function<void(std::exception_ptr)> failed={},size_t bytes=SettingsEditorModel::COMMAND_BYTES){if(!target)return {{},execution::Rejection::Closed};const auto self=shared_from_this();return execution::Submit(*target,[self,command=std::move(command)]{if(self->mailbox->retired.load())self->retire();command(*self);},[]{},std::move(failed),{execution::Lane::Domain,bytes,key,execution::WorkClass::Action});}\n+\n+ static void acknowledge(const std::shared_ptr<Mailbox>& mailbox,\n+ const std::function<void()>& retired,\n+ const std::function<void()>& notify)\n+ {\n+ mailbox->drained = true;\n+ if (retired) retired();\n+ notify();\n+ }\n+\n+ static void destroy(State* state)\n+ {\n+ const auto queues = state->queues;\n+ const auto retire = [state, queues] {\n+ const auto mailbox = state->mailbox;\n+ const auto retired = state->ports.retired;\n+ const auto notify = state->notify;\n+ delete state;\n+ // The last State reference accounts for the whole accepted save,\n+ // including its handoffs, even if the editor has been deleted.\n+ queues->core.close();\n+ queues->core.whenDrained([queues, mailbox, retired, notify] {\n+ queues->utility.close();\n+ queues->utility.whenDrained([mailbox, retired, notify] {\n+ acknowledge(mailbox, retired, notify);\n+ });\n+ });\n+ };\n+ if (!queues->utility.post(retire)) retire();\n+ }\n+\n+ template <typename Work, typename Done>\n+ bool submit(Work work, Done done,\n+ std::function<void(std::exception_ptr)> failed, execution::Lane lane)\n+ {\n+ auto task = execution::MakeTask(std::move(work), std::move(done), std::move(failed));\n+ if (lane == execution::Lane::Utility) {\n+ return queues->utility.post([queues = queues, task = std::move(task)] {\n+ std::lock_guard lock{queues->reducer};\n+ task->execute();\n+ task->deliver();\n+ });\n+ }\n+ return queues->core.post([queues = queues, task = std::move(task)]() mutable {\n+ task->execute();\n+ const auto deliver = [queues, task = std::move(task)] {\n+ std::lock_guard lock{queues->reducer};\n+ task->deliver();\n+ };\n+ if (!queues->utility.post(deliver)) deliver();\n+ });\n+ }\n+\n+ bool post(std::function<void(State&)> command, std::function<void(std::exception_ptr)> failed = {})\n+ {\n+ return submit([self = shared_from_this(), command = std::move(command)] {\n+ if (self->mailbox->retired.load()) self->retire();\n+ command(*self);\n+ }, [] {}, std::move(failed), execution::Lane::Utility);\n+ }\n QString restartSet()const {\n QString result;\n if(!initialized)return result;\n@@ -65,28 +136,26 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n if(self->mailbox->retired.load())self->retire();\n self->reading=false;if(!self->retired)self->observe(std::move(value));\n const bool again=std::exchange(self->read_pending,false);self->publish();\n- if(again&&!self->retired){if(!self->post(self->scope,[owner](State& state){state.read(owner);})&&owner)owner(false);}\n+ if(again&&!self->retired){if(!self->post([owner](State& state){state.read(owner);})&&owner)owner(false);}\n else if(owner)owner(true);\n };\n const auto rejected=[complete](std::exception_ptr){Snapshot failed;failed.error=Failure();complete(std::move(failed));};\n- if(!ports.read||!scope||!execution::Submit(*scope,ports.read,complete,rejected,{execution::Lane::Core,1024,io,execution::WorkClass::Observation})){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n+ if(!ports.read||!submit(ports.read,complete,rejected,execution::Lane::Core)){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n publish();\n }\n- void save(std::shared_ptr<execution::Scheduler> action,std::optional<uint64_t> token,std::function<void(bool)> owner){\n+ void save(std::optional<uint64_t> token,std::function<void(bool)> owner){\n if(retired||reading){publish();owner(false);return;}\n if(token&&!session.answerClose(*token,persistentedit::CloseChoice::Save)){publish();owner(false);return;}\n auto attempt=session.check();if(!attempt){publish();owner(false);return;}attempt->batch.accept_redownload=allow_redownload;\n redownload=false;const auto self=shared_from_this();publish();\n- const auto done=[self,action,attempt=*attempt,owner](Check checked){\n+ const auto done=[self,attempt=*attempt,owner](Check checked){\n if(self->mailbox->retired.load())self->retire();\n self->redownload=checked.validation.requires_redownload;\n self->redownload_attempt=self->redownload?std::make_optional(attempt):std::nullopt;\n if(!self->session.validated(attempt.attempt.token,checked.valid,checked.error,checked.validation.errors)){self->publish();owner(false);return;}\n self->publish();\n- // The review packet remains charged until this callback returns.\n- // Continue on the original admitted scope after its budget is freed;\n- // keep the immutable accepted attempt in State rather than copying\n- // it into another queued packet or waiting for GUI publication.\n+ // Keep the immutable accepted attempt in State. Continue after\n+ // the review callback returns, independently of GUI publication.\n const auto token=attempt.attempt.token;\n const bool redownload=attempt.batch.accept_redownload;\n const auto rejected=[self,token,owner](std::exception_ptr error){\n@@ -96,20 +165,20 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n if(error)try{std::rethrow_exception(error);}catch(const execution::NotStarted&){}catch(...){result.outcome=Outcome::Uncertain;}\n self->receipt=result;self->finish(accepted,std::move(result),false,owner);\n };\n- if(!self->post(action,[action,token,redownload,owner](State& state){state.write(action,token,redownload,owner);},rejected))rejected({});\n+ if(!self->post([token,redownload,owner](State& state){state.write(token,redownload,owner);},rejected))rejected({});\n };\n const auto failed=[done](std::exception_ptr){Check checked;checked.error=Failure();done(std::move(checked));};\n- if(!ports.review||!execution::Submit(*action,[review=ports.review,attempt=*attempt]{return review(attempt);},done,failed,{execution::Lane::Core,2*1024*1024,io,execution::WorkClass::Action})){Check checked;checked.error=Failure();done(std::move(checked));}\n+ if(!ports.review||!submit([review=ports.review,attempt=*attempt]{return review(attempt);},done,failed,execution::Lane::Core)){Check checked;checked.error=Failure();done(std::move(checked));}\n }\n- void write(const std::shared_ptr<execution::Scheduler>& action,uint64_t token,bool redownload,std::function<void(bool)> owner){\n+ void write(uint64_t token,bool redownload,std::function<void(bool)> owner){\n if(!session.active()||session.active()->attempt.token!=token){publish();owner(false);return;}\n auto accepted=*session.active();accepted.batch.accept_redownload=redownload;\n const auto self=shared_from_this();\n- const auto written=[self,accepted,action,owner](Result value){(void)action;self->receipt=value;self->finish(accepted,std::move(value),false,owner);};\n+ const auto written=[self,accepted,owner](Result value){self->receipt=value;self->finish(accepted,std::move(value),false,owner);};\n const auto failed=[written](std::exception_ptr error){Result result;result.outcome=Outcome::Uncertain;result.error=Failure();\n try{std::rethrow_exception(error);}catch(const execution::NotStarted&){result.outcome=Outcome::Rejected;}catch(...){}\n written(std::move(result));};\n- if(!ports.write||!execution::Submit(*action,[write=ports.write,accepted]{return write(accepted);},written,failed,{execution::Lane::Core,2*1024*1024,io,execution::WorkClass::Action})){Result result;result.outcome=Outcome::Rejected;result.error=Failure();written(std::move(result));}\n+ if(!ports.write||!submit([write=ports.write,accepted]{return write(accepted);},written,failed,execution::Lane::Core)){Result result;result.outcome=Outcome::Rejected;result.error=Failure();written(std::move(result));}\n }\n void finish(const settingsedit::Save& attempt,Result result,bool query,std::function<void(bool)> owner={}){\n if(mailbox->retired.load())retire();\n@@ -121,26 +190,56 @@ struct SettingsEditorModel::State:std::enable_shared_from_this<State> {\n publish();\n }\n void reconcile(){if(!receipt||!session.active()||session.editor().phase()!=persistentedit::Phase::Uncertain){publish();return;}const auto original=*session.active();auto value=*receipt;value.snapshot={};finish(original,std::move(value),true);}\n- void retire(){if(std::exchange(retired,true))return;read_pending=false;session.retire();scope.reset();publish();}\n+ void retire(){if(std::exchange(retired,true))return;read_pending=false;session.retire();publish();}\n \n };\n-SettingsEditorModel::SettingsEditorModel(Ports ports,QObject* parent):QObject(parent),m_id(QUuid::createUuid().toString(QUuid::WithoutBraces)),m_execution(ports.execution){\n- Q_ASSERT(m_execution.scheduler);m_execution.post=presentation::ReliablePost(std::move(m_execution.post));ports.execution=m_execution;\n- for(size_t i=0;i<m_entries.size();++i)m_entries[i]=new SettingsEntryModel(static_cast<Key>(i),*this);\n- m_mailbox=std::make_shared<Mailbox>();const auto original_retired=ports.retired;\n+SettingsEditorModel::SettingsEditorModel(Ports ports, QObject* parent)\n+ : QObject(parent), m_id(QUuid::createUuid().toString(QUuid::WithoutBraces)), m_post(presentation::ReliablePost(std::move(ports.post)))\n+{\n+ for (size_t i = 0; i < m_entries.size(); ++i) m_entries[i] = new SettingsEntryModel(static_cast<Key>(i), *this);\n+ m_mailbox = std::make_shared<Mailbox>();\n+ const auto original_retired = ports.retired;\n const QPointer<SettingsEditorModel> observer{this};\n- m_owner=execution::RetainSnapshot<std::shared_ptr<State>>(m_execution.scheduler,[id=m_id,ports=std::move(ports),mailbox=m_mailbox,observer,post=m_execution.post]()mutable{return std::make_unique<std::shared_ptr<State>>(std::make_shared<State>(id,std::move(ports),mailbox,[mailbox,observer,post]{\n- if(mailbox->notice_pending.exchange(true))return;\n- try{post([mailbox,observer]{mailbox->notice_pending.store(false);if(observer)observer->publish();});}catch(...){mailbox->notice_pending.store(false);throw;}\n- }));});\n- if(m_owner){m_state=*m_owner;m_retire_scope=(*m_owner)->scope;refresh();}\n- else{m_immediate_error=tr(\"The settings editor could not reserve cleanup.\");m_retired=true;m_mailbox->drained.store(true);if(original_retired)original_retired();m_execution.post([observer]{if(observer)observer->publish();});}\n+ const auto notify = [mailbox = m_mailbox, observer, post = m_post] {\n+ if (mailbox->notice_pending.exchange(true)) return;\n+ try {\n+ post([mailbox, observer] {\n+ mailbox->notice_pending = false;\n+ if (observer) observer->publish();\n+ });\n+ } catch (...) {\n+ mailbox->notice_pending = false;\n+ throw;\n+ }\n+ };\n+ if (ports.executor) {\n+ const auto queues = std::make_shared<State::Queues>(*ports.executor, ports.lane);\n+ m_owner = std::shared_ptr<State>{new State{m_id, std::move(ports), m_mailbox, notify, queues}, State::destroy};\n+ m_state = m_owner;\n+ refresh();\n+ } else {\n+ m_immediate_error = tr(\"The settings editor could not open. Try again.\");\n+ m_retired = true;\n+ m_mailbox->drained = true;\n+ if (original_retired) original_retired();\n+ m_post([observer] { if (observer) observer->publish(); });\n+ }\n }\n SettingsEditorModel::~SettingsEditorModel(){retire();}\n-bool SettingsEditorModel::command(std::function<void(State&)> callback,const QString& name,size_t bytes){\n- bool admitted{false};{const auto state=m_state.lock();admitted=!m_retired&&state&&bool(state->post(m_execution.scheduler,std::move(callback),{},bytes));}\n- if(admitted){m_immediate_error={};return true;}\n- m_immediate_error=tr(\"This settings command could not be admitted.\");const QPointer<SettingsEditorModel> guard{this};Q_EMIT changed();if(guard)Q_EMIT commandRejected(name,m_immediate_error);return false;\n+bool SettingsEditorModel::command(std::function<void(State&)> callback, const QString& name)\n+{\n+ const QPointer<SettingsEditorModel> observer{this};\n+ bool admitted{false};\n+ {\n+ const auto state = m_state.lock();\n+ admitted = !m_retired && state && state->post(std::move(callback));\n+ }\n+ if (!observer) return admitted;\n+ if (admitted) { m_immediate_error = {}; return true; }\n+ m_immediate_error = tr(\"This settings change could not start. Try again.\");\n+ Q_EMIT changed();\n+ if (observer) Q_EMIT commandRejected(name, m_immediate_error);\n+ return false;\n }\n void SettingsEditorModel::publish(){\n std::shared_ptr<const Projection> value;{std::lock_guard lock{m_mailbox->mutex};value=m_mailbox->latest;}\n@@ -149,8 +248,16 @@ void SettingsEditorModel::publish(){\n if(m_projection&&m_pending_save&&m_projection->finished_save>=m_pending_save){m_pending_save=0;m_immediate_error={};}\n const bool rejected=m_projection&&m_projection->rejection>m_seen_rejection;if(rejected)m_seen_rejection=m_projection->rejection;\n const bool drained=m_retired&&m_mailbox->drained.load()&&!m_drained;if(drained)m_drained=true;\n+ if(closeQuestion()){\n+ const auto token=closeToken();\n+ if(!m_prompt||m_prompt->token()!=token){\n+ if(m_prompt)m_prompt->deleteLater();\n+ m_prompt=new TextEditClosePrompt(token,this);\n+ connect(m_prompt,&TextEditClosePrompt::answered,this,[this](const QString& token,TextEditClosePrompt::Choice choice){answerClose(token,static_cast<CloseChoice>(choice));});\n+ }\n+ }else if(m_prompt){m_prompt->deleteLater();m_prompt=nullptr;}\n const QPointer<SettingsEditorModel> guard{this};for(auto* entry:m_entries){Q_EMIT entry->changed();if(!guard)return;}Q_EMIT changed();if(!guard)return;\n- if(rejected){Q_EMIT commandRejected(QStringLiteral(\"save\"),tr(\"This settings save did not start. The original draft and any earlier receipt are retained.\"));if(!guard)return;}\n+ if(rejected){Q_EMIT commandRejected(QStringLiteral(\"save\"),tr(\"The settings were not saved. Your edits are kept.\"));if(!guard)return;}\n if(!m_closed_emitted&&phase()==Closed){m_closed_emitted=true;Q_EMIT closed();if(!guard)return;}\n if(drained)Q_EMIT shutdownFinished();\n }\n@@ -172,7 +279,6 @@ SettingsSaveResult SettingsEditorModel::saveResult()const{\n return result;\n }\n QString SettingsEditorModel::lastSaveId()const{return QString::number(m_projection?m_projection->session.result().token:0);}\n-QString SettingsEditorModel::redownloadToken()const{return QString::number(m_projection?m_projection->redownload_token:0);}\n QString SettingsEditorModel::closeToken()const{return QString::number(m_projection?m_projection->session.editor().closeToken():0);}\n bool SettingsEditorModel::closeQuestion()const{return m_projection&&m_projection->session.editor().closeQuestion();}\n bool SettingsEditorModel::lastSavePresent()const{return m_projection&&m_projection->session.result().present;}\n@@ -185,14 +291,35 @@ bool SettingsEditorModel::redownloadWarning()const{return m_projection&&m_projec\n SettingsEntryModel* SettingsEditorModel::entry(const QString& key)const{for(auto* item:m_entries)if(ite\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 166,
"evidence_id": "414d3cbeb1e34275914c7396630eb9a8",
"finding_id": "finding:5",
"kind": "new_source",
"line": 17,
"new_head": "f28230183aa967642ad79f91d506ad151c1e3d35",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/models/settingseditormodel.cpp",
"revision": "f28230183aa967642ad79f91d506ad151c1e3d35",
"source_generation": 1,
"source_job_id": 2778,
"text": "}\nstruct SettingsEditorModel::Projection {\n settingsedit::Session session;\n std::array<Value,settingsedit::FIELDS> running;\n std::array<uint64_t,settingsedit::FIELDS> inputs;\n bool reading{false},restart{false},notice{false},redownload{false};\n uint64_t redownload_token{0},finished_save{0},rejection{0};\n};\nstruct SettingsEditorModel::Mailbox {\n std::mutex mutex;\n std::shared_ptr<const Projection> latest;\n std::atomic_bool retired{false},drained{false},notice_pending{false};\n};\nstruct SettingsEditorModel::State : std::enable_shared_from_this<State> {\n struct Queues {\n Queues(execution::Executor& executor, execution::Lane lane)\n : core(executor.makeQueue(lane)), utility(executor.makeQueue(execution::Lane::Utility)) {}\n execution::SerialQueue core, utility;\n // A refused outcome dispatch falls back on Core. Serialize that\n // delivery with any new Utility input before touching the reducer.\n std::recursive_mutex reducer;\n };\n\n State(QString id, Ports ports, std::shared_ptr<Mailbox> mailbox, std::function<void()> notify,\n std::shared_ptr<Queues> worker_queues)\n : session({id.toStdString(), \"effective-settings\"}, settingsedit::Reducer::Mask{}.set()),\n ports(std::move(ports)), queues(std::move(worker_queues)),\n notify(std::move(notify)), mailbox(std::move(mailbox)) {}\n\n settingsedit::Session session;\n const Ports ports;\n const std::shared_ptr<Queues> queues;\n const std::function<void()> notify;\n std::array<Value,settingsedit::FIELDS> running{};\n std::array<uint64_t,settingsedit::FIELDS> inputs{};\n bool initialized{false},reading{false},read_pending{false},retired{false},redownload{false},allow_redownload{false};\n QString pending_restart,acknowledged_restart;\n std::optional<settingsedit::Save> redownload_attempt;\n uint64_t read_token{0};\n std::optional<effectivesettings::Result> receipt;\n const std::shared_ptr<Mailbox> mailbox;\n uint64_t finished_save{0},rejection{0};\n\n static void acknowledge(const std::shared_ptr<Mailbox>& mailbox,\n const std::function<void()>& retired,\n const std::function<void()>& notify)\n {\n mailbox->drained = true;\n if (retired) retired();\n notify();\n }\n\n static void destroy(State* state)\n {\n const auto queues = state->queues;\n const auto retire = [state, queues] {\n const auto mailbox = state->mailbox;\n const auto retired = state->ports.retired;\n const auto notify = state->notify;\n delete state;\n // The last State reference accounts for the whole accepted save,\n // including its handoffs, even if the editor has been deleted.\n queues->core.close();\n queues->core.whenDrained([queues, mailbox, retired, notify] {\n queues->utility.close();\n queues->utility.whenDrained([mailbox, retired, notify] {\n acknowledge(mailbox, retired, notify);\n });\n });\n };\n if (!queues->utility.post(retire)) retire();\n }\n\n template <typename Work, typename Done>\n bool submit(Work work, Done done,\n std::function<void(std::exception_ptr)> failed, execution::Lane lane)\n {\n auto task = execution::MakeTask(std::move(work), std::move(done), std::move(failed));\n if (lane == execution::Lane::Utility) {\n return queues->utility.post([queues = queues, task = std::move(task)] {\n std::lock_guard lock{queues->reducer};\n task->execute();\n task->deliver();\n });\n }\n return queues->core.post([queues = queues, task = std::move(task)]() mutable {\n task->execute();\n const auto deliver = [queues, task = std::move(task)] {\n std::lock_guard lock{queues->reducer};\n task->deliver();\n };\n if (!queues->utility.post(deliver)) deliver();\n });\n }\n\n bool post(std::function<void(State&)> command, std::function<void(std::exception_ptr)> failed = {})\n {\n return submit([self = shared_from_this(), command = std::move(command)] {\n if (self->mailbox->retired.load()) self->retire();\n command(*self);\n }, [] {}, std::move(failed), execution::Lane::Utility);\n }\n QString restartSet()const {\n QString result;\n if(!initialized)return result;\n for(const auto& field:session.snapshot().fields)if(field.applicability==Applicability::Restart&&field.next_start!=running[Index(field.key)])result+=Name(field.key)+QLatin1Char('=')+settingsedit::Session::Format(field.next_start)+QLatin1Char('\\n');\n return result;\n }\n void publish(){const auto changes=restartSet();if(changes!=pending_restart){pending_restart=changes;acknowledged_restart={};}auto value=std::make_shared<const Projection>(Projection{session,running,inputs,reading,!changes.isEmpty(),!changes.isEmpty()&&acknowledged_restart!=changes,redownload,redownload_attempt?redownload_attempt->attempt.token:0,finished_save,rejection});{std::lock_guard lock{mailbox->mutex};mailbox->latest=std::move(value);}notify();}\n void observe(Snapshot value){if(!initialized&&value.ready){for(const auto& field:value.fields)if(Index(field.key)<settingsedit::FIELDS)running[Index(field.key)]=field.effective;initialized=true;}session.observe(std::move(value));}\n void read(std::function<void(bool)> owner={}){\n const auto finished=[&owner](bool result){if(owner)owner(result);};\n if(retired){finished(false);return;}\n const auto phase=session.editor().phase();\n if(reading||phase==persistentedit::Phase::Checking||phase==persistentedit::Phase::Saving){read_pending=true;finished(false);return;}\n if(phase==persistentedit::Phase::Uncertain||phase==persistentedit::Phase::Closed||read_token==UINT64_MAX){finished(false);return;}\n reading=true;read_pending=false;const auto token=++read_token;const auto self=shared_from_this();\n const auto complete=[self,token,owner](Snapshot value){\n if(token!=self->read_token){if(owner)owner(false);return;}\n if(self->mailbox->retired.load())self->retire();\n self->reading=false;if(!self->retired)self->observe(std::move(value));\n const bool again=std::exchange(self->read_pending,false);self->publish();\n if(again&&!self->retired){if(!self->post([owner](State& state){state.read(owner);})&&owner)owner(false);}\n else if(owner)owner(true);\n };\n const auto rejected=[complete](std::exception_ptr){Snapshot failed;failed.error=Failure();complete(std::move(failed));};\n if(!ports.read||!submit(ports.read,complete,rejected,execution::Lane::Core)){Snapshot failed;failed.error=Failure();complete(std::move(failed));}\n publish();\n }\n void save(std::optional<uint64_t> token,std::function<void(bool)> owner){\n if(retired||reading){publish();owner(false);return;}\n if(token&&!session.answerClose(*token,persistentedit::CloseChoice::Save)){publish();owner(false);return;}\n auto attempt=session.check();if(!attempt){publish();owner(false);return;}attempt->batch.accept_redownload=allow_redownload;\n redownload=false;const auto self=shared_from_this();publish();\n const auto done=[self,attempt=*attempt,owner](Check checked){\n if(self->mailbox->retired.load())self->retire();\n self->redownload=checked.validation.requires_redownload;\n self->redownload_attempt=self->redownload?std::make_optional(attempt):std::nullopt;\n if(!self->session.validated(attempt.attempt.token,checked.valid,checked.error,checked.validation.errors)){self->publish();owner(false);return;}\n self->publish();\n // Keep the immutable accepted attempt in State. Continue after\n // the review callback returns, independently of GUI publication.\n const auto token=attempt.attempt.token;\n const bool redownload=attempt.batch.accept_redownload;\n const auto rejected=[self,token,owner](std::exception_ptr error){\n if(!self->session.active()||self->session.active()->attempt.token!=token)return;\n const auto accepted=*self->session.active();\n Result result;result.outcome=Outcome::Rejected;result.error=Failure();\n if(error)try{std::rethrow_exception(error);}catch(const execution::NotStarted&){}catch(...){result.outcome=Outcome::Uncertain;}\n self->receipt=result;self->finish(accepted,std::move(result),false,owner);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 6f70ec53c990..f28230183aa9 2026-11-26T00:58:13Z · gpt-6-luna |
| gui#1142 | Long backup paths can push confirmation buttons outside the windowqml/components/WalletBackupConfirmation.qml | unclear | AssessmentThe old confirmation component is deleted, but the supplied diff and excerpts do not show its replacement or establish whether the long-path layout issue was fixed. path_diff: qml/components/WalletBackupConfirmation.qml [
{
"evidence_id": "5e7ce2659ff5421d84fe18b40be1f891",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "97a21cf9cba76f0798b402c68b4a1fee52d7d046",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/components/WalletBackupConfirmation.qml",
"source_generation": 1,
"source_job_id": 2778,
"text": "diff --git a/qml/components/WalletBackupConfirmation.qml b/qml/components/WalletBackupConfirmation.qml\ndeleted file mode 100644\nindex f2e1c72f62..0000000000\n--- a/qml/components/WalletBackupConfirmation.qml\n+++ /dev/null\n@@ -1,78 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"walletBackupOverwritePopup\"\n- required property BackupFileOperation operation\n- readonly property string title: operation.replacing ? qsTr(\"Replace backup?\") : qsTr(\"Save backup?\")\n- parent: Overlay.overlay\n- width: parent ? Math.min(600, parent.width - 40) : 600\n- implicitHeight: content.implicitHeight + topPadding + bottomPadding\n- x: parent ? Math.round((parent.width - width) / 2) : 0\n- y: parent ? Math.round((parent.height - height) / 2) : 0\n- padding: 24\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.NoAutoClose\n- onOpened: content.forceActiveFocus()\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 10\n- border.color: Theme.color.neutral2\n- }\n- contentItem: ColumnLayout {\n- id: content\n- focus: true\n- spacing: 16\n- Keys.priority: Keys.BeforeItem\n- Keys.onEscapePressed: function(event) {\n- root.operation.refuse()\n- event.accepted = true\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.title\n- font: Theme.text.subtitle.font\n- }\n- CoreText {\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.replacing\n- ? qsTr(\"An existing file will be replaced at this final destination:\")\n- : qsTr(\"Save the backup at this final destination:\")\n- wrap: true\n- }\n- CoreText {\n- objectName: \"walletBackupFinalPathText\"\n- Layout.fillWidth: true\n- textFormat: Text.PlainText\n- text: root.operation.finalPath\n- wrapMode: Text.WrapAnywhere\n- }\n- RowLayout {\n- spacing: 12\n- NeutralButton {\n- objectName: \"walletBackupOverwriteRejectButton\"\n- text: qsTr(\"Cancel\")\n- onClicked: root.operation.refuse()\n- }\n- NeutralButton {\n- objectName: \"walletBackupOverwriteApproveButton\"\n- text: root.operation.replacing ? qsTr(\"Replace backup\") : qsTr(\"Save backup\")\n- onClicked: root.operation.approve()\n- }\n- }\n- }\n-}\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 6f70ec53c990..97a21cf9cba7 2026-11-26T02:44:06Z · gpt-6-luna |
| gui#1142 | A signer exception leaves Speed Up stuck in Uncertainqml/walletbump.cpp | addressed | AssessmentThe new code catches exceptions from `signBumpTransaction` and treats them as a signing failure (`Error::Sign`) before the commit boundary, rather than allowing them to reach the outer catch that returns `Uncertain`. path_diff: qml/walletbump.cpp [
{
"evidence_id": "9829dfc617004c69bf2ead25817d1af2",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "50767aca7e1666ae31dca294b17c852f0b1f31b9",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/walletbump.cpp",
"source_generation": 1,
"source_job_id": 2778,
"text": "diff --git a/qml/walletbump.cpp b/qml/walletbump.cpp\nindex e2065edf..bf7cd515 100644\n--- a/qml/walletbump.cpp\n+++ b/qml/walletbump.cpp\n@@ -175,7 +175,11 @@ Commit Execute(interfaces::Wallet& wallet, const Prepared& review, std::optional\n if (!wallet.unlock(*passphrase)) { relock_required = false; result.error = Error::IncorrectPassphrase; return finishAfterRelock(); }\n }\n CMutableTransaction signed_tx{review.transaction};\n- if (!wallet.signBumpTransaction(signed_tx)) { result.error = Error::Sign; return finishAfterRelock(); }\n+ // An external signer helper failure throws before any commit. It is a\n+ // definite signing failure, not an uncertain replacement outcome.\n+ bool signed_replacement{false};\n+ try { signed_replacement = wallet.signBumpTransaction(signed_tx); } catch (...) {}\n+ if (!signed_replacement) { result.error = Error::Sign; return finishAfterRelock(); }\n if (!MatchesUnsignedTransaction(review.transaction, signed_tx)) { result.error = Error::Changed; return finishAfterRelock(); }\n if (wallet.hasExternalSigner() && !walletsend::VerifyExternalTransaction(wallet, CTransaction{signed_tx})) {\n result.error = Error::InvalidSignature; return finishAfterRelock();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 6f70ec53c990..50767aca7e16 2026-11-19T03:25:57Z · gpt-6-luna |
| gui#1142 | A pre-created /tmp/qml-intent-<uid> blocks GUI startupqml/desktopintenttransport.cpp | addressed | AssessmentThe fixed /tmp/qml-intent-<uid> location is replaced with a private qml-intent subdirectory under Qt's RuntimeLocation. The shown code validates the directory's owner and permissions before using it, removing the reported cross-user squatting point in shared /tmp. path_diff: qml/desktopintenttransport.cpp; new_source: qml/desktopintenttransport.cpp [
{
"evidence_id": "834dd45798ee4fceb851a05626b35809",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/desktopintenttransport.cpp",
"source_generation": 1,
"source_job_id": 2778,
"text": "diff --git a/qml/desktopintenttransport.cpp b/qml/desktopintenttransport.cpp\nindex 7b3737ca0e..df095f879a 100644\n--- a/qml/desktopintenttransport.cpp\n+++ b/qml/desktopintenttransport.cpp\n@@ -2,7 +2,7 @@\n // Distributed under the MIT software license, see the accompanying\n // file COPYING or http://www.opensource.org/licenses/mit-license.php.\n #include <qml/desktopintenttransport.h>\n-#include <qml/retainedvalue.h>\n+#include <qml/asyncjoin.h>\n #include <util/fs.h>\n \n #include <QCoreApplication>\n@@ -17,6 +17,8 @@\n #include <QLocalSocket>\n #include <QLockFile>\n #include <QMetaObject>\n+#include <QScopeGuard>\n+#include <QStandardPaths>\n #include <QStringList>\n #include <QThread>\n #include <QTimer>\n@@ -196,25 +198,26 @@ struct Discovery {\n struct Service::Flags {\n std::atomic_bool admission_closed{false}, stopping{false}, started{false}, retired{false};\n std::mutex mutex;\n- execution::TaskId retired_task;\n- std::function<void()> completed_stop;\n+ std::vector<std::function<void()>> completed_stops;\n bool probed{false}, probe_pending{false}, probe_terminal{false}; // Protected by mutex.\n };\n struct Service::State {\n struct Native;\n- std::shared_ptr<execution::Scheduler> scope;\n std::shared_ptr<Owner> owner;\n Limits limits;\n- execution::ResourceKey key;\n const std::shared_ptr<Flags> flags{std::make_shared<Flags>()};\n- std::shared_ptr<execution::ResourceLease> native_lifetime;\n- std::mutex mutex;\n+ // The same lock protects admission, pending delivery and the receiver\n+ // used to post work to the transport thread.\n Native* native{nullptr};\n+ size_t pending_deliveries{0};\n+ bool post(std::function<void(Native&)> work);\n+ void finishDelivery();\n+ void retireWhenIdle();\n };\n \n struct Service::State::Native final : QObject {\n struct Query { QJsonArray results; QStringList keys; size_t remaining{0}; bool unknown{false}; };\n- struct Reply { std::optional<desktopintent::Admission> admission; std::optional<Receipt> receipt; };\n+ struct Reply { std::optional<desktopintent::Acceptance> admission; std::optional<Receipt> receipt; };\n struct Cell {\n std::mutex mutex;\n QObject* receiver{nullptr}; std::function<void()> notify;\n@@ -230,7 +233,7 @@ struct Service::State::Native final : QObject {\n };\n struct Pending { uint64_t connection; std::shared_ptr<Cell> cell; std::shared_ptr<Query> query{}; qsizetype index{0}; QStringList keys{}; };\n const std::shared_ptr<State> state;\n- QLocalServer server;\n+ QLocalServer server{this};\n std::unique_ptr<QLockFile> instance_lock;\n struct Client { QLocalSocket* socket; Limits::Time admitted; };\n std::map<uint64_t, Client> clients;\n@@ -306,7 +309,7 @@ struct Service::State::Native final : QObject {\n QStringList keys; for (const auto& input : inputs) keys.push_back(input.producer_key);\n const auto cell = reserve(id, {}, 0, std::move(keys)); if (!cell) { send(id, {{\"status\", \"rejected\"}}); return; }\n const auto admitted = state->owner->admit(std::move(inputs), [cell](auto result) { cell->complete({std::move(result), {}}); });\n- if (!admitted) cell->complete({desktopintent::Admission{Error::Closed, {}}, {}});\n+ if (!admitted) cell->complete({desktopintent::Acceptance{Error::Closed, {}}, {}});\n } else if (command == \"query\") {\n const auto keys = object.value(\"keys\").toArray();\n if (keys.empty() || keys.size() > static_cast<qsizetype>(Queue::MAX_PENDING) || replies.size() + static_cast<size_t>(keys.size()) > MAX_REPLIES) { socket->abort(); return; }\n@@ -351,17 +354,19 @@ struct Service::State::Native final : QObject {\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n- std::shared_ptr<execution::ResourceLease> lifetime;\n- { std::lock_guard lock{state->mutex}; state->native = nullptr; lifetime = std::move(state->native_lifetime); }\n- delete this;\n- lifetime.reset(); // Only now may the original Native event loop drain.\n+ QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n #ifndef Q_OS_WIN\n- private_directory = QDir{QStringLiteral(\"/tmp\")}.filePath(QStringLiteral(\"qml-intent-%1\").arg(getuid()));\n+ // The runtime directory belongs to this user (Qt checks its owner and\n+ // mode). A fixed name in the shared /tmp could be created first by\n+ // another user, which would block delivery for this one.\n+ const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n+ if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n+ private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n@@ -440,37 +445,83 @@ struct Service::State::Native final : QObject {\n }\n };\n \n+bool Service::State::post(std::function<void(Native&)> work)\n+{\n+ std::lock_guard lock{flags->mutex};\n+ return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n+ work(*receiver);\n+ }, Qt::QueuedConnection);\n+}\n+\n+void Service::State::finishDelivery()\n+{\n+ {\n+ std::lock_guard lock{flags->mutex};\n+ --pending_deliveries;\n+ }\n+ retireWhenIdle();\n+}\n+\n+void Service::State::retireWhenIdle()\n+{\n+ std::lock_guard lock{flags->mutex};\n+ if (!flags->stopping || pending_deliveries || !native) return;\n+ auto* receiver = std::exchange(native, nullptr);\n+ if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n+}\n+\n Service::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\n Service::~Service() { stop(); }\n-std::shared_ptr<Service> Service::Create(std::shared_ptr<execution::Scheduler> scheduler, std::shared_ptr<Owner> owner, Limits limits)\n+bool Service::post(std::function<void()> work) const\n+{\n+ const auto state = m_state.load();\n+ return state && state->post([work = std::move(work)](State::Native&) { work(); });\n+}\n+\n+std::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n {\n const auto maximum = std::chrono::seconds{30};\n- if (!scheduler || !owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n+ if (!owner || !limits.now || limits.startup <= std::chrono::milliseconds::zero() || limits.startup > maximum ||\n limits.connect <= std::chrono::milliseconds::zero() || limits.connect > limits.startup ||\n limits.acknowledge <= std::chrono::milliseconds::zero() || limits.acknowledge > limits.startup ||\n limits.query <= std::chrono::milliseconds::zero() || limits.query > limits.startup ||\n limits.client <= std::chrono::milliseconds::zero() || limits.client > maximum ||\n limits.slice <= std::chrono::milliseconds::zero() || limits.slice > std::chrono::milliseconds{100}) return {};\n- auto scope = scheduler->openActionScope(1024); if (!scope) return {};\n- auto state = execution::RetainValues<State>(scope, [] { return std::make_unique<State>(); }); if (!state) return {};\n- state->scope = scope; state->owner = std::move(owner); state->limits = std::move(limits); state->key = scope->allocateKey();\n- const auto retired = execution::Submit(*scope, [] {}, [state] {\n- std::function<void()> done;\n- { std::lock_guard lock{state->mutex}; state->owner.reset(); }\n- { std::lock_guard lock{state->flags->mutex}; state->flags->retired = true; done = std::move(state->flags->completed_stop); }\n- if (done) done();\n- }, {}, {execution::Lane::Cleanup, 1024, state->key}, true);\n- auto borrowed = retired ? scope->borrow(state->key) : execution::BorrowAdmission{{}, retired.rejection};\n- if (!borrowed) { if (retired) scope->activateCleanup(retired.id); return {}; }\n- state->flags->retired_task = retired.id;\n- state->native_lifetime = std::make_shared<execution::ResourceLease>(std::move(*borrowed.lease));\n- return std::shared_ptr<Service>{new Service(std::move(state))};\n+ auto* const app = QCoreApplication::instance();\n+ Q_ASSERT(app && QThread::currentThread() == app->thread());\n+ auto state = std::make_shared<State>();\n+ state->owner = std::move(owner);\n+ state->limits = std::move(limits);\n+ auto thread = std::make_unique<QThread>();\n+ thread->setObjectName(QStringLiteral(\"desktop transport\"));\n+ auto native = std::make_unique<State::Native>(state);\n+ auto service = std::shared_ptr<Service>{new Service(state)};\n+ QObject::connect(thread.get(), &QThread::finished, native.get(), &QObject::deleteLater);\n+ QObject::connect(thread.get(), &QThread::finished, app, [app, state, worker = thread.get()] {\n+ JoinThreadAsync([state, worker] {\n+ if (!worker->wait()) std::terminate();\n+ state->owner.reset();\n+ std::vector<std::function<void()>> completed;\n+ {\n+ std::lock_guard lock{state->flags->mutex};\n+ state->flags->retired = true;\n+ completed = std::move(state->flags->completed_stops);\n+ }\n+ for (const auto& done : completed) {\n+ try { done(); } catch (...) {}\n+ }\n+ }, app, [worker] { delete worker; });\n+ }, Qt::QueuedConnection);\n+ native->moveToThread(thread.get());\n+ state->native = native.release();\n+ thread.release()->start();\n+ return service;\n }\n-execution::Admission Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n+execution::SubmitResult Service::start(QString directory, QString network, std::vector<Input> inputs, std::function<void(StartResult)> completed)\n {\n return begin(std::move(directory), std::move(network), std::move(inputs), false, std::move(completed), {});\n }\n-execution::Admission Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n+execution::SubmitResult Service::probeExisting(QString directory, QString network, const std::vector<Input>& inputs, std::function<void(ProbeResult)> completed)\n {\n if (inputs.size() > Queue::MAX_PENDING) return {{}, execution::Rejection::Invalid};\n const auto callback = std::move(completed);\n@@ -487,7 +538,7 @@ execution::Admission Service::probeExisting(QString directory, QString network,\n const auto missing = [callback] { if (callback) callback({ProbeStatus::Missing, {}}); };\n return begin(std::move(directory), std::move(network), inputs, true, transfer, missing);\n }\n-execution::Admission Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n+execution::SubmitResult Service::begin(QString directory, QString network, std::vector<Input> inputs, bool existing_only,\n std::function<void(StartResult)> completed, std::function<void()> missing)\n {\n const auto state = m_state.load();\n@@ -497,82 +548,82 @@ execution::Admission Service::begin(QString directory, QString network, std::vec\n return {{}, execution::Rejection::Closed};\n if (existing_only) { m_flags->probed = true; m_flags->probe_pending = true; }\n else m_flags->started = true;\n+ ++state->pending_deliveries;\n }\n- const auto reject = [flags = m_flags, existing_only](execution::Rejection reason) {\n- if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- return execution::Admission{{}, reason};\n- };\n+ auto release_rejected = qScopeGuard([&] {\n+ if (existing_only) {\n+ std::lock_guard lock{m_flags->mutex};\n+ m_flags->probe_pending = false;\n+ m_flags->probe_terminal = true;\n+ }\n+ state->finishDelivery();\n+ });\n if (directory.size() > 4096 || QString::fromUtf8(directory.toUtf8()) != directory || network.isEmpty() || network.size() > 128 || directory.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\0'}) || network.contains(QChar{u'\\n'}) || inputs.size() > Queue::MAX_PENDING)\n- return reject(execution::Rejection::Invalid);\n- size_t bytes{1024};\n+ return {{}, execution::Rejection::Invalid};\n for (const auto& input : inputs) {\n- if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return reject(execution::Rejection::Capacity);\n- bytes += static_cast<size_t>(input.producer_key.size() + input.value.size()) * sizeof(QChar);\n+ if (input.producer_key.size() > Queue::MAX_KEY_CHARS || input.value.size() > Queue::MAX_INPUT_CHARS) return {{}, execution::Rejection::Capacity};\n }\n- auto held = state->scope->borrow(state->key); if (!held) return reject(held.rejection);\n- auto lifetime = std::make_shared<execution::ResourceLease>(std::move(*held.lease));\n- std::shared_ptr<Owner> owner;\n- { std::lock_guard lock{state->mutex}; owner = state->owner; }\n- const auto payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(inputs)); });\n- if (!payload) return reject(execution::Rejection::Capacity);\n+ const auto owner = state->owner;\n+ const auto payload = std::make_shared<const std::vector<Input>>(std::move(inputs));\n const auto claimed = std::make_shared<std::atomic_bool>(false);\n- const auto finish = [done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n+ const auto finish = [state, done = std::move(completed), claimed, flags = m_flags, existing_only](StartResult result) {\n if (claimed->exchange(true)) return;\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n if (existing_only) { std::lock_guard lock{flags->mutex}; flags->probe_pending = false; flags->probe_terminal = true; }\n- if (done) done(std::move(result));\n+ try { if (done) done(std::move(result)); } catch (...) {}\n };\n- const auto submitted = execution::Submit(*state->scope, [state, directory = std::move(directory), network = std::move(network), payload, lifetime, existing_only] {\n- if (state->flags->admission_closed || (QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))\n- return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start on its background worker.\"))};\n- auto native = std::make_unique<State::Native>(state);\n- auto discovery = native->initialize(directory, network, existing_only);\n- if (discovery.result.status == StartStatus::Primary) {\n- std::lock_guard lock{state->mutex};\n- if (!state->flags->stopping) state->native = native.release();\n- else discovery.result = Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n+ const auto submitted = state->post([state, owner, directory = std::move(directory), network = std::move(network),\n+ payload, finish, claimed, missing = std::move(missing), existing_only](State::Native& native) {\n+ if (state->flags->admission_closed) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n }\n- return discovery;\n- }, [state, owner, payload, finish, lifetime, claimed, missing = std::move(missing)](Discovery discovery) {\n+ auto discovery = [&] {\n+ try { return native.initialize(directory, network, existing_only); }\n+ catch (...) { return Discovery{Rejected(QStringLiteral(\"Payment delivery could not start.\"))}; }\n+ }();\n if (discovery.missing) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n if (!claimed->exchange(true)) {\n+ const auto delivery = qScopeGuard([&] { state->finishDelivery(); });\n { std::lock_guard lock{state->flags->mutex}; state->flags->probe_pending = false; }\n- if (missing) missing();\n+ try { if (missing) missing(); } catch (...) {}\n }\n return;\n }\n if (!discovery.endpoint.isEmpty()) {\n if (state->flags->admission_closed) { finish(Rejected(QStringLiteral(\"Payment delivery is closing.\"))); return; }\n try {\n- const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish, lifetime](ForwardingSnapshot snapshot) {\n+ const auto admitted = owner->prepareForwarding(*payload, [state, endpoint = std::move(discovery.endpoint), finish](ForwardingSnapshot snapshot) {\n if (snapshot.error != Error::None || state->flags->admission_closed) {\n finish(Rejected(QStringLiteral(\"The GUI could not transfer its pending requests.\"))); return;\n }\n- const auto forward_payload = execution::RetainValues<std::vector<Input>>(state->scope, [&] { return std::make_unique<std::vector<Input>>(std::move(snapshot.inputs)); });\n- if (!forward_payload) { finish(Rejected(QStringLiteral(\"The GUI could not retain its pending requests.\"))); return; }\n- const auto forwarded = execution::Submit(*state->scope, [state, endpoint, forward_payload, lifetime] {\n- if (state->flags->stopping) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n- // Once a frame may have left this process, an exception\n- // is an unknown outcome, never permission to replay.\n- try { return Forward(endpoint, *forward_payload, state->limits, state->flags->stopping); }\n- catch (...) { return Unknown(); }\n- }, [finish, lifetime, forward_payload](StartResult result) {\n- if (result.producer_keys.empty()) result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- }, [finish, lifetime, forward_payload](std::exception_ptr) {\n- auto result = Unknown(); result.producer_keys = ProducerKeys(*forward_payload);\n- finish(std::move(result));\n- },\n- {execution::Lane::Core, 1024 + Queue::MAX_PENDING_BYTES, state->key});\n- if (!forwarded) finish(Rejected(QStringLiteral(\"The GUI could not start payment delivery.\")));\n+ try {\n+ const auto forwarded = state->post([state, endpoint, inputs = std::move(snapshot.inputs), finish](State::Native&) {\n+ if (state->flags->stopping) {\n+ finish(Rejected(QStringLiteral(\"Payment delivery is closing.\")));\n+ return;\n+ }\n+ // An exception after sending may have left a frame\n+ // in the other process. Its outcome remains unknown.\n+ auto result = [&] {\n+ try { return Fo\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 483,
"evidence_id": "ea0d80d37bb94f919b4e7352bda34238",
"finding_id": "finding:2",
"kind": "new_source",
"line": 334,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/desktopintenttransport.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 1,
"source_job_id": 2778,
"text": " connect(deadline, &QTimer::timeout, this, [this, id] {\n const auto found = clients.find(id);\n if (found == clients.end()) return;\n try { if (!Remaining(state->limits, found->second.admitted, state->limits.client, 1)) found->second.socket->abort(); }\n catch (...) { found->second.socket->abort(); }\n });\n deadline->start(); ingress(id);\n }\n }\n void ingress(uint64_t id) {\n try { receive(id); }\n catch (...) {\n // Any already admitted queue mutation keeps its original receipt.\n // An unacknowledged caller can query; no exception becomes replay.\n const auto found = clients.find(id); if (found != clients.end()) found->second.socket->abort();\n }\n }\n void retire() {\n server.close();\n while (!replies.empty()) clearReply(replies.begin()->first);\n const auto sockets = std::exchange(clients, {});\n for (const auto& [id, client] : sockets) { client.socket->abort(); delete client.socket; }\n instance_lock.reset();\n QThread::currentThread()->quit();\n }\n Discovery initialize(const QString& directory, const QString& network, bool existing_only = false) {\n const auto canonical = NormalizeProfile(directory);\n if (canonical.isEmpty()) return Rejected(QStringLiteral(\"Could not resolve the payment-request data directory.\"));\n QString private_directory;\n#ifndef Q_OS_WIN\n // The runtime directory belongs to this user (Qt checks its owner and\n // mode). A fixed name in the shared /tmp could be created first by\n // another user, which would block delivery for this one.\n const auto runtime = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);\n if (runtime.isEmpty()) return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QDir{runtime}.filePath(QStringLiteral(\"qml-intent\"));\n const auto encoded = QFile::encodeName(private_directory);\n if (!existing_only) (void)mkdir(encoded.constData(), 0700);\n struct stat info{};\n if (lstat(encoded.constData(), &info)) {\n if (existing_only && errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n }\n if (!S_ISDIR(info.st_mode) || info.st_uid != getuid() || (info.st_mode & 0077))\n return Rejected(QStringLiteral(\"The private payment-delivery directory is unavailable or unsafe.\"));\n private_directory = QFileInfo{private_directory}.canonicalFilePath();\n#else\n private_directory = QDir::tempPath();\n#endif\n const QString identity = canonical + QLatin1Char('\\n') + network;\n const auto digest = QCryptographicHash::hash(identity.toUtf8(), QCryptographicHash::Sha256).toHex().first(24);\n#ifndef Q_OS_WIN\n const auto endpoint = QDir{private_directory}.filePath(QString::fromLatin1(digest));\n if (QFile::encodeName(endpoint).size() > 100) return Rejected(QStringLiteral(\"The payment-delivery path is too long.\"));\n#else\n const QString endpoint = QStringLiteral(\"qml-intent-\") + QString::fromLatin1(digest);\n#endif\n if (existing_only) {\n // Discovery grants no listener/lock authority and mutates no local\n // queue. A known absent peer leaves normal final-profile startup\n // available; only a connected same-user peer permits forwarding.\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer)) {\n if (errno == ENOENT) return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The payment-delivery endpoint could not be inspected.\"));\n }\n if (!S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during lookup.\"));\n const auto began = state->limits.now();\n const auto remaining = Remaining(state->limits, began, state->limits.startup, static_cast<int>(state->limits.connect.count()));\n if (!remaining) return Rejected(QStringLiteral(\"The payment-delivery lookup expired.\"));\n QLocalSocket probe; probe.connectToServer(endpoint);\n const bool connected = probe.waitForConnected(remaining);\n if (!connected) {\n if (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError)\n return {StartResult{}, {}, true};\n return Rejected(QStringLiteral(\"The existing payment-delivery endpoint could not be contacted.\"));\n }\n if (state->flags->admission_closed || !Remaining(state->limits, began, state->limits.startup, 1))\n return Rejected(QStringLiteral(\"The payment-delivery lookup expired or is closing.\"));\n if (!SameUser(probe)) return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unsafe.\"));\n return {StartResult{}, endpoint};\n }\n instance_lock = std::make_unique<QLockFile>(QDir{private_directory}.filePath(QString::fromLatin1(digest) + QStringLiteral(\".lock\")));\n instance_lock->setStaleLockTime(0);\n if (instance_lock->tryLock(0)) {\n QLocalSocket probe; probe.connectToServer(endpoint); const bool live = probe.waitForConnected(200);\n bool reclaimable = !live && (probe.error() == QLocalSocket::ServerNotFoundError || probe.error() == QLocalSocket::ConnectionRefusedError);\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat socket_info{};\n if (lstat(path.constData(), &socket_info) == 0) {\n reclaimable &= S_ISSOCK(socket_info.st_mode) && socket_info.st_uid == getuid();\n if (reclaimable) reclaimable = QLocalServer::removeServer(endpoint);\n }\n#endif\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n if (reclaimable && !state->flags->admission_closed && server.listen(endpoint)) return StartResult{StartStatus::Primary, {}, {}};\n }\n instance_lock.reset();\n if (NormalizeProfile(directory) != canonical) return Rejected(QStringLiteral(\"The payment-request data directory changed during startup.\"));\n#ifndef Q_OS_WIN\n const auto path = QFile::encodeName(endpoint); struct stat peer{};\n if (lstat(path.constData(), &peer) || !S_ISSOCK(peer.st_mode) || peer.st_uid != getuid())\n return Rejected(QStringLiteral(\"The running GUI's payment-delivery endpoint is unavailable or unsafe.\"));\n#endif\n if (state->flags->admission_closed) return Rejected(QStringLiteral(\"Payment delivery is closing.\"));\n return {StartResult{}, endpoint};\n }\n};\n\nbool Service::State::post(std::function<void(Native&)> work)\n{\n std::lock_guard lock{flags->mutex};\n return native && QMetaObject::invokeMethod(native, [receiver = native, work = std::move(work)] {\n work(*receiver);\n }, Qt::QueuedConnection);\n}\n\nvoid Service::State::finishDelivery()\n{\n {\n std::lock_guard lock{flags->mutex};\n --pending_deliveries;\n }\n retireWhenIdle();\n}\n\nvoid Service::State::retireWhenIdle()\n{\n std::lock_guard lock{flags->mutex};\n if (!flags->stopping || pending_deliveries || !native) return;\n auto* receiver = std::exchange(native, nullptr);\n if (!QMetaObject::invokeMethod(receiver, [receiver] { receiver->retire(); }, Qt::QueuedConnection)) std::terminate();\n}\n\nService::Service(std::shared_ptr<State> state) : m_state(state), m_flags(state->flags) {}\nService::~Service() { stop(); }\nbool Service::post(std::function<void()> work) const\n{\n const auto state = m_state.load();\n return state && state->post([work = std::move(work)](State::Native&) { work(); });\n}\n\nstd::shared_ptr<Service> Service::Create(std::shared_ptr<Owner> owner, Limits limits)\n{\n const auto maximum = std::chrono::seconds{30};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 6f70ec53c990..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1142 | Backup replacement bypasses the lock on a loaded wallet's wallet.datqml/models/backuppolicyio.cpp | addressed | AssessmentThe change adds wallet-file screening at inspection through Screen and repeats that check under the install coordinator lock immediately before replacement. IsWalletFile compares the destination with loaded wallet database paths using filesystem identity, so the reported live-wallet overwrite path is rejected at both stages. path_diff: qml/models/backuppolicyio.cpp; new_source: qml/models/backuppolicyio.cpp [
{
"evidence_id": "cf16b98325f5437c86b7cc00c3509ed3",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/models/backuppolicyio.cpp",
"source_generation": 1,
"source_job_id": 2778,
"text": "diff --git a/qml/models/backuppolicyio.cpp b/qml/models/backuppolicyio.cpp\nindex 7f2a43eccc..8ce3d25dd0 100644\n--- a/qml/models/backuppolicyio.cpp\n+++ b/qml/models/backuppolicyio.cpp\n@@ -15,6 +15,7 @@\n #include <QUrl>\n \n #include <algorithm>\n+#include <system_error>\n #include <utility>\n \n namespace {\n@@ -123,8 +124,33 @@ backup::Proposal backup::InspectPng(const std::string& raw)\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n }\n \n+namespace {\n+bool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n+{\n+ if (!coordinator.wallet_files) return false;\n+ const fs::path destination{fs::PathFromString(path)};\n+ std::error_code error;\n+ for (const auto& file : coordinator.wallet_files()) {\n+ const fs::path database{fs::PathFromString(file)};\n+ // SQLite keeps a journal next to the database while it writes.\n+ for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n+ if (fs::equivalent(destination, candidate, error)) return true;\n+ }\n+ }\n+ return false;\n+}\n+} // namespace\n+\n+backup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n+{\n+ if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n+ proposal.error = Error::WalletFile;\n+ }\n+ return proposal;\n+}\n+\n backup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n- InstallCoordinator& coordinator, std::function<bool()> admission)\n+ InstallCoordinator& coordinator, std::function<bool()> submitted)\n {\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n@@ -138,12 +164,12 @@ backup::WriteResult backup::Write(const Proposal& approved, bool destination_app\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n- const auto current = ReadTarget(final_path);\n+ const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n- if (admission && !admission()) return {Error::Changed};\n+ if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 184,
"evidence_id": "f1a89da53c3f4176b8e6e5420b4901c8",
"finding_id": "finding:1",
"kind": "new_source",
"line": 119,
"new_head": "02bca021a086a194e22977efda8720fa5f238a8a",
"old_head": "6f70ec53c990e2fe36200e71bf74d4828c06544a",
"path": "qml/models/backuppolicyio.cpp",
"revision": "02bca021a086a194e22977efda8720fa5f238a8a",
"source_generation": 1,
"source_job_id": 2778,
"text": " if (!url.isValid() || !url.isLocalFile() || !QDir::isAbsolutePath(url.toLocalFile())) return {{}, {}, false, false, Error::InvalidPath};\n QString path = QDir::cleanPath(url.toLocalFile());\n if (path.contains(QChar{0}) || QFileInfo{path}.isDir()) return {{}, {}, false, false, Error::InvalidPath};\n const QString selected = path;\n if (!path.endsWith(QStringLiteral(\".png\"), Qt::CaseInsensitive)) path += QStringLiteral(\".png\");\n auto result = ReadTarget(path); result.renamed = path != selected; return result;\n}\n\nnamespace {\nbool IsWalletFile(const std::string& path, const backup::InstallCoordinator& coordinator)\n{\n if (!coordinator.wallet_files) return false;\n const fs::path destination{fs::PathFromString(path)};\n std::error_code error;\n for (const auto& file : coordinator.wallet_files()) {\n const fs::path database{fs::PathFromString(file)};\n // SQLite keeps a journal next to the database while it writes.\n for (const fs::path& candidate : {database, fs::PathFromString(file + \"-journal\")}) {\n if (fs::equivalent(destination, candidate, error)) return true;\n }\n }\n return false;\n}\n} // namespace\n\nbackup::Proposal backup::Screen(Proposal proposal, const InstallCoordinator& coordinator)\n{\n if (proposal.error == Error::None && proposal.exists && IsWalletFile(proposal.path, coordinator)) {\n proposal.error = Error::WalletFile;\n }\n return proposal;\n}\n\nbackup::WriteResult backup::Write(const Proposal& approved, bool destination_approved, const Producer& producer,\n InstallCoordinator& coordinator, std::function<bool()> submitted)\n{\n if (approved.error != Error::None || approved.path.empty() || ((approved.exists || approved.renamed) && !destination_approved)) return {Error::Changed};\n const QString final_path = QString::fromUtf8(approved.path.data(), static_cast<qsizetype>(approved.path.size()));\n const QString parent = QFileInfo{final_path}.absolutePath();\n QTemporaryDir staging{QDir{parent}.filePath(QStringLiteral(\".bitcoin-backup-XXXXXX\"))};\n if (!staging.isValid()) return {Error::Staging};\n const QString staged_path = staging.filePath(QStringLiteral(\"wallet.backup\"));\n if (!producer(Utf8(staged_path))) return {Error::CoreBackup};\n const QFileInfo staged_info{staged_path};\n if (!staged_info.isFile() || staged_info.isSymLink()) return {Error::CoreBackup};\n // Serialize the final check/install across application wallets. Core's\n // wallet lock has already been released by its backup call at this point.\n const std::lock_guard lock{coordinator.mutex};\n const auto current = Screen(ReadTarget(final_path), coordinator);\n if (current.error != Error::None) return {current.error};\n if (current.exists != approved.exists || current.version != approved.version) return {Error::Changed};\n // Rendering/staging is not external-effect admission. Request sharing can\n // revoke a source during those stages without modifying the final file.\n if (submitted && !submitted()) return {Error::Changed};\n bool installed{false};\n if (approved.exists) {\n installed = RenameOver(fs::PathFromString(Utf8(staged_path)), fs::PathFromString(approved.path));\n } else {\n // QFile's non-replacing rename also protects against a destination\n // created after inspection; never use an overwriting rename here.\n installed = QFile::rename(staged_path, final_path);\n }\n if (!installed) return {Error::Install};\n DirectoryCommit(fs::PathFromString(Utf8(parent)));\n return {};\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 6f70ec53c990..02bca021a086 2026-11-25T00:51:34Z · gpt-6-luna |
| gui#1140 | The .5 parser test does not check its numeric fee ratetest/test_walletqmlmodel.cpp | addressed | AssessmentThe fee-estimate dataset now includes `.5` with an expected `per_kvb` of 500 and formatted fee, directly checking the numeric meaning of the leading-period input. path_diff: test/test_walletqmlmodel.cpp; new_source: test/test_walletqmlmodel.cpp [
{
"evidence_id": "fecabc68fc9a48b290ba4a967e42e5b1",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"old_head": "c10a76a1b79f1c09938d2f9e505dc73122183033",
"path": "test/test_walletqmlmodel.cpp",
"source_generation": 1,
"source_job_id": 2738,
"text": "diff --git a/test/test_walletqmlmodel.cpp b/test/test_walletqmlmodel.cpp\nindex 08def97b..bfada51e 100644\n--- a/test/test_walletqmlmodel.cpp\n+++ b/test/test_walletqmlmodel.cpp\n@@ -1221,23 +1221,31 @@ void WalletQmlModelTests::customFeeRateValid_data()\n {\n QTest::addColumn<QString>(\"rate\");\n QTest::addColumn<bool>(\"valid\");\n- QTest::newRow(\"empty\") << QString{} << false;\n- QTest::newRow(\"zero\") << QStringLiteral(\"0.000\") << false;\n- QTest::newRow(\"negative\") << QStringLiteral(\"-0.1\") << false;\n- QTest::newRow(\"below-minimum\") << QStringLiteral(\"0.099\") << false;\n- QTest::newRow(\"minimum\") << QStringLiteral(\"0.1\") << true;\n- QTest::newRow(\"minimum-padded\") << QStringLiteral(\" 0.100 \") << true;\n- QTest::newRow(\"fractional\") << QStringLiteral(\"0.123\") << true;\n- QTest::newRow(\"whole\") << QStringLiteral(\"2\") << true;\n- QTest::newRow(\"no-whole-part\") << QStringLiteral(\".5\") << true;\n- QTest::newRow(\"period-only\") << QStringLiteral(\".\") << false;\n- QTest::newRow(\"excess-precision\") << QStringLiteral(\"0.1001\") << false;\n+ QTest::addColumn<QString>(\"locale\");\n+ QTest::newRow(\"empty\") << QString{} << false << QString{};\n+ QTest::newRow(\"zero\") << QStringLiteral(\"0.000\") << false << QString{};\n+ QTest::newRow(\"negative\") << QStringLiteral(\"-0.1\") << false << QString{};\n+ QTest::newRow(\"below-minimum\") << QStringLiteral(\"0.099\") << false << QString{};\n+ QTest::newRow(\"minimum\") << QStringLiteral(\"0.1\") << true << QString{};\n+ QTest::newRow(\"minimum-padded\") << QStringLiteral(\" 0.100 \") << true << QString{};\n+ QTest::newRow(\"fractional\") << QStringLiteral(\"0.123\") << true << QString{};\n+ QTest::newRow(\"whole\") << QStringLiteral(\"2\") << true << QString{};\n+ QTest::newRow(\"no-whole-part\") << QStringLiteral(\".5\") << true << QString{};\n+ QTest::newRow(\"period-only\") << QStringLiteral(\".\") << false << QString{};\n+ QTest::newRow(\"excess-precision\") << QStringLiteral(\"0.1001\") << false << QString{};\n+ QTest::newRow(\"decimal-comma\") << QStringLiteral(\"1,5\") << true << QStringLiteral(\"de_DE\");\n+ QTest::newRow(\"decimal-comma-no-whole-part\") << QStringLiteral(\",5\") << true << QStringLiteral(\"de_DE\");\n+ QTest::newRow(\"grouping-comma\") << QStringLiteral(\"1,5\") << false << QStringLiteral(\"en_US\");\n }\n \n void WalletQmlModelTests::customFeeRateValid()\n {\n QFETCH(QString, rate);\n QFETCH(bool, valid);\n+ QFETCH(QString, locale);\n+ const QLocale previous_locale;\n+ const auto restore_locale = qScopeGuard([previous_locale] { QLocale::setDefault(previous_locale); });\n+ if (!locale.isEmpty()) QLocale::setDefault(QLocale{locale});\n auto [wallet, model] = MakeWalletModel();\n model->setCustomFeeRate(rate);\n QCOMPARE(model->customFeeRateValid(), valid);\n@@ -1301,9 +1309,12 @@ void WalletQmlModelTests::scheduleFeeEstimates_usesCustomFeeRateWhenEnabled_data\n QTest::addColumn<QString>(\"rate\");\n QTest::addColumn<qlonglong>(\"per_kvb\");\n QTest::addColumn<QString>(\"formatted_fee\");\n- QTest::newRow(\"whole\") << QStringLiteral(\"2\") << qlonglong{2000} << QStringLiteral(\"0.00000500 BTC\");\n- QTest::newRow(\"minimum\") << QStringLiteral(\"0.1\") << qlonglong{100} << QStringLiteral(\"0.00000025 BTC\");\n- QTest::newRow(\"fractional\") << QStringLiteral(\"0.123\") << qlonglong{123} << QStringLiteral(\"0.00000031 BTC\");\n+ QTest::addColumn<QString>(\"locale\");\n+ QTest::newRow(\"whole\") << QStringLiteral(\"2\") << qlonglong{2000} << QStringLiteral(\"0.00000500 BTC\") << QString{};\n+ QTest::newRow(\"minimum\") << QStringLiteral(\"0.1\") << qlonglong{100} << QStringLiteral(\"0.00000025 BTC\") << QString{};\n+ QTest::newRow(\"fractional\") << QStringLiteral(\"0.123\") << qlonglong{123} << QStringLiteral(\"0.00000031 BTC\") << QString{};\n+ QTest::newRow(\"no-whole-part\") << QStringLiteral(\".5\") << qlonglong{500} << QStringLiteral(\"0.00000125 BTC\") << QString{};\n+ QTest::newRow(\"decimal-comma\") << QStringLiteral(\"1,5\") << qlonglong{1500} << QStringLiteral(\"0.00000375 BTC\") << QStringLiteral(\"de_DE\");\n }\n \n void WalletQmlModelTests::scheduleFeeEstimates_usesCustomFeeRateWhenEnabled()\n@@ -1311,6 +1322,10 @@ void WalletQmlModelTests::scheduleFeeEstimates_usesCustomFeeRateWhenEnabled()\n QFETCH(QString, rate);\n QFETCH(qlonglong, per_kvb);\n QFETCH(QString, formatted_fee);\n+ QFETCH(QString, locale);\n+ const QLocale previous_locale;\n+ const auto restore_locale = qScopeGuard([previous_locale] { QLocale::setDefault(previous_locale); });\n+ if (!locale.isEmpty()) QLocale::setDefault(QLocale{locale});\n auto [wallet, model] = MakeWalletModel();\n SetValidRecipient(*model);\n \n@@ -1557,6 +1572,10 @@ void WalletQmlModelTests::prepareTransaction_usesCustomFeeRateWithoutRegtestOver\n {\n QFETCH(QString, rate);\n QFETCH(qlonglong, per_kvb);\n+ QFETCH(QString, locale);\n+ const QLocale previous_locale;\n+ const auto restore_locale = qScopeGuard([previous_locale] { QLocale::setDefault(previous_locale); });\n+ if (!locale.isEmpty()) QLocale::setDefault(QLocale{locale});\n ChainSelectionGuard chain_guard{ChainType::REGTEST};\n auto [wallet, model] = MakeWalletModel();\n SetValidRecipient(*model, VALID_REGTEST_ADDRESS);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1351,
"evidence_id": "3a936bf302e74f0faf839f424a641e99",
"finding_id": "finding:4",
"kind": "new_source",
"line": 1202,
"new_head": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"old_head": "c10a76a1b79f1c09938d2f9e505dc73122183033",
"path": "test/test_walletqmlmodel.cpp",
"revision": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"source_generation": 1,
"source_job_id": 2738,
"text": "\n fee = coin_control.m_feerate->GetFee(250);\n return util::Result<CTransactionRef>{MakeTransactionRef(CMutableTransaction{})};\n };\n\n model->scheduleFeeEstimates();\n\n QTRY_COMPARE_WITH_TIMEOUT(model->estimatedFeeForTarget(6), QStringLiteral(\"0.00000250 BTC\"), FEE_ESTIMATE_TIMEOUT_MS);\n QCOMPARE(model->estimatedFeeForTarget(2), QStringLiteral(\"0.00000250 BTC\"));\n QCOMPARE(model->estimatedFeeForTarget(6), QStringLiteral(\"0.00000250 BTC\"));\n QCOMPARE(model->estimatedFeeForTarget(10), QStringLiteral(\"0.00000250 BTC\"));\n CompareFeeEstimateCalls(calls.Snapshot(), {\n {0, false, false, CAmount{wallet::DEFAULT_TRANSACTION_MINFEE}, 1},\n {0, false, false, CAmount{wallet::DEFAULT_TRANSACTION_MINFEE}, 1},\n {0, false, false, CAmount{wallet::DEFAULT_TRANSACTION_MINFEE}, 1},\n });\n}\n\nvoid WalletQmlModelTests::customFeeRateValid_data()\n{\n QTest::addColumn<QString>(\"rate\");\n QTest::addColumn<bool>(\"valid\");\n QTest::addColumn<QString>(\"locale\");\n QTest::newRow(\"empty\") << QString{} << false << QString{};\n QTest::newRow(\"zero\") << QStringLiteral(\"0.000\") << false << QString{};\n QTest::newRow(\"negative\") << QStringLiteral(\"-0.1\") << false << QString{};\n QTest::newRow(\"below-minimum\") << QStringLiteral(\"0.099\") << false << QString{};\n QTest::newRow(\"minimum\") << QStringLiteral(\"0.1\") << true << QString{};\n QTest::newRow(\"minimum-padded\") << QStringLiteral(\" 0.100 \") << true << QString{};\n QTest::newRow(\"fractional\") << QStringLiteral(\"0.123\") << true << QString{};\n QTest::newRow(\"whole\") << QStringLiteral(\"2\") << true << QString{};\n QTest::newRow(\"no-whole-part\") << QStringLiteral(\".5\") << true << QString{};\n QTest::newRow(\"period-only\") << QStringLiteral(\".\") << false << QString{};\n QTest::newRow(\"excess-precision\") << QStringLiteral(\"0.1001\") << false << QString{};\n QTest::newRow(\"decimal-comma\") << QStringLiteral(\"1,5\") << true << QStringLiteral(\"de_DE\");\n QTest::newRow(\"decimal-comma-no-whole-part\") << QStringLiteral(\",5\") << true << QStringLiteral(\"de_DE\");\n QTest::newRow(\"grouping-comma\") << QStringLiteral(\"1,5\") << false << QStringLiteral(\"en_US\");\n}\n\nvoid WalletQmlModelTests::customFeeRateValid()\n{\n QFETCH(QString, rate);\n QFETCH(bool, valid);\n QFETCH(QString, locale);\n const QLocale previous_locale;\n const auto restore_locale = qScopeGuard([previous_locale] { QLocale::setDefault(previous_locale); });\n if (!locale.isEmpty()) QLocale::setDefault(QLocale{locale});\n auto [wallet, model] = MakeWalletModel();\n model->setCustomFeeRate(rate);\n QCOMPARE(model->customFeeRateValid(), valid);\n}\n\nvoid WalletQmlModelTests::customFeeRateRespectsRelayMinimum_data()\n{\n QTest::addColumn<qlonglong>(\"relay_minimum\");\n QTest::addColumn<QString>(\"rate\");\n QTest::addColumn<bool>(\"valid\");\n QTest::newRow(\"below-wallet-minimum\") << qlonglong{100} << QStringLiteral(\"0.1\") << true;\n QTest::newRow(\"below-relay-minimum\") << qlonglong{1000} << QStringLiteral(\"0.1\") << false;\n QTest::newRow(\"just-below-relay-minimum\") << qlonglong{1000} << QStringLiteral(\"0.999\") << false;\n QTest::newRow(\"at-relay-minimum\") << qlonglong{1000} << QStringLiteral(\"1\") << true;\n QTest::newRow(\"above-relay-minimum\") << qlonglong{1000} << QStringLiteral(\"1.001\") << true;\n}\n\nvoid WalletQmlModelTests::customFeeRateRespectsRelayMinimum()\n{\n QFETCH(qlonglong, relay_minimum);\n QFETCH(QString, rate);\n QFETCH(bool, valid);\n ChainSelectionGuard chain_guard{ChainType::REGTEST};\n node::NodeContext node_context;\n bilingual_str error;\n CTxMemPool::Options options;\n options.min_relay_feerate = CFeeRate{relay_minimum};\n node_context.mempool = std::make_unique<CTxMemPool>(options, error);\n auto chain = interfaces::MakeChain(node_context);\n wallet::CWallet raw_wallet{chain.get(), \"relay-fee-test\", nullptr};\n auto [wallet, model] = MakeWalletModel(nullptr, &raw_wallet);\n SetValidRecipient(*model, VALID_REGTEST_ADDRESS);\n ThreadSafeCallLog<FeeEstimateCall> calls;\n wallet->create_transaction_fn = [&](const std::vector<wallet::CRecipient>& recipients,\n const wallet::CCoinControl& coin_control, bool sign,\n int& change_pos, CAmount& fee) -> util::Result<CTransactionRef> {\n calls.Append({coin_control.m_confirm_target.value_or(0), sign, false,\n coin_control.m_feerate ? std::optional<CAmount>{coin_control.m_feerate->GetFeePerK()} : std::nullopt,\n recipients.size()});\n change_pos = -1;\n fee = coin_control.m_feerate ? coin_control.m_feerate->GetFee(250) : 250;\n return MakeTransactionRef(CMutableTransaction{});\n };\n model->setCustomFeeEnabled(true);\n model->setCustomFeeRate(rate);\n QCOMPARE(model->minimumCustomFeeRate(), static_cast<double>(relay_minimum) / 1000);\n QCOMPARE(model->customFeeRateValid(), valid);\n model->scheduleFeeEstimates();\n QTRY_VERIFY_WITH_TIMEOUT(!model->feeEstimatePending(), FEE_ESTIMATE_TIMEOUT_MS);\n QCOMPARE(!model->estimatedFee().isEmpty(), valid);\n QCOMPARE(calls.Size(), valid ? 4U : 3U);\n QCOMPARE(model->prepareTransaction(), valid);\n QCOMPARE(calls.Size(), valid ? 5U : 3U);\n for (const auto& call : calls.Snapshot()) {\n if (call.fee_rate) QVERIFY(*call.fee_rate >= relay_minimum);\n }\n}\n\nvoid WalletQmlModelTests::scheduleFeeEstimates_usesCustomFeeRateWhenEnabled_data()\n{\n QTest::addColumn<QString>(\"rate\");\n QTest::addColumn<qlonglong>(\"per_kvb\");\n QTest::addColumn<QString>(\"formatted_fee\");\n QTest::addColumn<QString>(\"locale\");\n QTest::newRow(\"whole\") << QStringLiteral(\"2\") << qlonglong{2000} << QStringLiteral(\"0.00000500 BTC\") << QString{};\n QTest::newRow(\"minimum\") << QStringLiteral(\"0.1\") << qlonglong{100} << QStringLiteral(\"0.00000025 BTC\") << QString{};\n QTest::newRow(\"fractional\") << QStringLiteral(\"0.123\") << qlonglong{123} << QStringLiteral(\"0.00000031 BTC\") << QString{};\n QTest::newRow(\"no-whole-part\") << QStringLiteral(\".5\") << qlonglong{500} << QStringLiteral(\"0.00000125 BTC\") << QString{};\n QTest::newRow(\"decimal-comma\") << QStringLiteral(\"1,5\") << qlonglong{1500} << QStringLiteral(\"0.00000375 BTC\") << QStringLiteral(\"de_DE\");\n}\n\nvoid WalletQmlModelTests::scheduleFeeEstimates_usesCustomFeeRateWhenEnabled()\n{\n QFETCH(QString, rate);\n QFETCH(qlonglong, per_kvb);\n QFETCH(QString, formatted_fee);\n QFETCH(QString, locale);\n const QLocale previous_locale;\n const auto restore_locale = qScopeGuard([previous_locale] { QLocale::setDefault(previous_locale); });\n if (!locale.isEmpty()) QLocale::setDefault(QLocale{locale});\n auto [wallet, model] = MakeWalletModel();\n SetValidRecipient(*model);\n\n ThreadSafeCallLog<FeeEstimateCall> calls;\n\n [[maybe_unused]] auto verify_wallet = wallet->VerifyOnExit();\n wallet->ExpectNoCalls(wallet->calls.getNewDestination);\n wallet->create_transaction_fn = [&](const std::vector<wallet::CRecipient>& recipients,\n const wallet::CCoinControl& coin_control,\n bool sign,\n int& change_pos,\n CAmount& fee) -> util::Result<CTransactionRef> {\n calls.Append({\n coin_control.m_confirm_target.value_or(0),\n sign,\n coin_control.HasSelected() || !coin_control.ListSelected().empty(),\n coin_control.m_feerate ? std::optional<CAmount>{coin_control.m_feerate->GetFeePerK()} : std::nullopt,\n recipients.size(),\n });\n if (coin_control.m_feerate && !coin_control.fOverrideFeeRate) {\n return util::Error{Untranslated(\"custom fee must override the wallet minimum\")};\n }\n change_pos = -1;",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c10a76a1b79f..8622eddfac9d 2026-11-20T23:40:21Z · gpt-6-luna |
| gui#1140 | The QML wallet mock still rejects .5test/qml/tst_sendfeeselection.qml | partially_addressed | AssessmentThe mock now accepts leading-period rates, and the test asserts `customFeeRateValid`. However, it does not assert that the fee row's `errorText` is empty, as requested. path_diff: test/qml/tst_sendfeeselection.qml; new_source: test/qml/tst_sendfeeselection.qml [
{
"evidence_id": "46a9301dbaf943ac90697770607fa11a",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"old_head": "c10a76a1b79f1c09938d2f9e505dc73122183033",
"path": "test/qml/tst_sendfeeselection.qml",
"source_generation": 1,
"source_job_id": 2738,
"text": "diff --git a/test/qml/tst_sendfeeselection.qml b/test/qml/tst_sendfeeselection.qml\nindex 93fa1b2a..fb86641d 100644\n--- a/test/qml/tst_sendfeeselection.qml\n+++ b/test/qml/tst_sendfeeselection.qml\n@@ -83,8 +83,8 @@ TestCase {\n }\n function test_custom_rate_keeps_a_leading_decimal_point_data() {\n return [\n- { tag: \"period\", decimalPoint: \".\", keys: [\".\", \"5\"] },\n- { tag: \"comma\", decimalPoint: \",\", keys: [\",\", \"5\"] },\n+ { tag: \"period\", decimalPoint: \".\", keys: [\".\", \"5\"], text: \".5\" },\n+ { tag: \"comma\", decimalPoint: \",\", keys: [\",\", \"5\"], text: \",5\" },\n ]\n }\n function test_custom_rate_keeps_a_leading_decimal_point(data) {\n@@ -95,8 +95,9 @@ TestCase {\n rate.forceActiveFocus()\n rate.selectAll()\n for (const key of data.keys) keyClick(key)\n- compare(rate.text, \".5\")\n- compare(testWalletModel.customFeeRate, \".5\")\n+ compare(rate.text, data.text)\n+ compare(testWalletModel.customFeeRate, data.text)\n+ verify(testWalletModel.customFeeRateValid)\n verify(rate.canUndo)\n }\n function test_custom_selection_uses_nearest_target() {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 125,
"evidence_id": "9b74ad5ed1fc4670b5e148d59735b23d",
"finding_id": "finding:3",
"kind": "new_source",
"line": 69,
"new_head": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"old_head": "c10a76a1b79f1c09938d2f9e505dc73122183033",
"path": "test/qml/tst_sendfeeselection.qml",
"revision": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"source_generation": 1,
"source_job_id": 2738,
"text": " compare(slider.to, targets.length - 1)\n for (let index = 0; index < targets.length; ++index) {\n slider.value = index\n slider.moved()\n compare(testWalletModel.targetBlocks, targets[index])\n compare(targetRow.description, targets[index] === 50 ? \"50+ blocks\" : targets[index] + \" blocks\")\n compare(findChild(control, \"feeTargetBlocksTick\" + index).text,\n targets[index] === 50 ? \"50+\" : String(targets[index]))\n }\n rate.text = \"4.125\"; rate.textEdited()\n compare(testWalletModel.customFeeRate, \"4.125\")\n selectOption(control, 1)\n compare(control.customSelected, false)\n compare(rate.visible, false)\n }\n function test_custom_rate_keeps_a_leading_decimal_point_data() {\n return [\n { tag: \"period\", decimalPoint: \".\", keys: [\".\", \"5\"], text: \".5\" },\n { tag: \"comma\", decimalPoint: \",\", keys: [\",\", \"5\"], text: \",5\" },\n ]\n }\n function test_custom_rate_keeps_a_leading_decimal_point(data) {\n const control = createTemporaryObject(factory, this)\n selectOption(control, 3)\n findChild(control, \"feeSelectionCustomRateRow\").decimalPoint = data.decimalPoint\n const rate = findChild(control, \"feeSelectionCustomRateInput\")\n rate.forceActiveFocus()\n rate.selectAll()\n for (const key of data.keys) keyClick(key)\n compare(rate.text, data.text)\n compare(testWalletModel.customFeeRate, data.text)\n verify(testWalletModel.customFeeRateValid)\n verify(rate.canUndo)\n }\n function test_custom_selection_uses_nearest_target() {\n testWalletModel.targetBlocks = 25\n const control = createTemporaryObject(factory, this)\n const slider = findChild(control, \"feeTargetBlocksSlider\")\n selectOption(control, 3)\n compare(testWalletModel.targetBlocks, 25)\n compare(slider.value, 5)\n\n selectOption(control, 1)\n testWalletModel.targetBlocks = 42\n selectOption(control, 3)\n compare(testWalletModel.targetBlocks, 50)\n compare(slider.value, 6)\n }\n function test_pending_estimate_does_not_show_stale_fee() {\n const control = createTemporaryObject(factory, this)\n const estimate = findChild(control, \"feeSelectionEstimateLabel\")\n testWalletModel.feeEstimatePending = true\n compare(estimate.value, \"—\")\n testWalletModel.feeEstimatePending = false\n verify(estimate.value.length > 0)\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c10a76a1b79f..8622eddfac9d 2026-11-20T23:40:21Z · gpt-6-luna |
| gui#1140 | Comma tests omit Send's production configuration and numeric pastetest/qml/tst_bitcoinamountinputfield.qml | partially_addressed | AssessmentThe amount tests now cover both validator and Send-style `interceptPaste` configurations, but they still use keystrokes rather than clipboard paste. The requested comma-paste scenarios, Receive and fee-consumer paste coverage, and a case exercising the default locale binding are not shown. path_diff: test/qml/tst_bitcoinamountinputfield.qml; new_source: test/qml/tst_bitcoinamountinputfield.qml [
{
"evidence_id": "54c9adcab13f41f7857b7b9c330d10b9",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"old_head": "c10a76a1b79f1c09938d2f9e505dc73122183033",
"path": "test/qml/tst_bitcoinamountinputfield.qml",
"source_generation": 1,
"source_job_id": 2738,
"text": "diff --git a/test/qml/tst_bitcoinamountinputfield.qml b/test/qml/tst_bitcoinamountinputfield.qml\nindex 829316b2..b08c4ef8 100644\n--- a/test/qml/tst_bitcoinamountinputfield.qml\n+++ b/test/qml/tst_bitcoinamountinputfield.qml\n@@ -27,16 +27,28 @@ TestCase {\n }\n }\n \n- function typeAmount(decimalPoint, keys) {\n- const field = createTemporaryObject(fieldComponent, testWindow.contentItem, { decimalPoint: decimalPoint })\n+ function typeAmount(decimalPoint, keys, interceptPaste) {\n+ const field = createTemporaryObject(fieldComponent, testWindow.contentItem, {\n+ decimalPoint: decimalPoint,\n+ interceptPaste: interceptPaste === true\n+ })\n field.field.forceActiveFocus()\n for (const key of keys) keyClick(key)\n return field\n }\n \n- function test_decimal_comma_locale_reads_comma_as_decimal_point() {\n- const field = typeAmount(\",\", [\"0\", \",\", \"0\", \"2\"])\n- compare(field.field.text, \"0.02\")\n+ function test_decimal_comma_locale_reads_comma_as_decimal_point_data() {\n+ return [\n+ { tag: \"validator\", interceptPaste: false },\n+ { tag: \"send\", interceptPaste: true },\n+ ]\n+ }\n+\n+ function test_decimal_comma_locale_reads_comma_as_decimal_point(data) {\n+ const field = typeAmount(\",\", [\"0\", \",\", \"0\", \"2\"], data.interceptPaste)\n+ compare(field.field.text, \"0,02\")\n+ compare(field.amount.satoshi, 2000000)\n+ field.field.focus = false\n compare(field.amount.satoshi, 2000000)\n }\n \n@@ -47,14 +59,18 @@ TestCase {\n input.text = \"7\"\n input.cursorPosition = 1\n for (const key of [\"1\", \"2\", \",\"]) keyClick(key)\n- compare(input.text, \"712.\")\n+ compare(input.text, \"712,\")\n verify(input.canUndo)\n input.undo()\n compare(input.text, \"7\")\n }\n \n- function test_period_locale_keeps_comma_out() {\n- const field = typeAmount(\".\", [\"1\", \",\", \"5\"])\n+ function test_period_locale_keeps_comma_out_data() {\n+ return test_decimal_comma_locale_reads_comma_as_decimal_point_data()\n+ }\n+\n+ function test_period_locale_keeps_comma_out(data) {\n+ const field = typeAmount(\".\", [\"1\", \",\", \"5\"], data.interceptPaste)\n compare(field.field.text, \"15\")\n compare(field.amount.satoshi, 1500000000)\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 83,
"evidence_id": "9d86324cf4094f34be3b53e2572eda6d",
"finding_id": "finding:2",
"kind": "new_source",
"line": 1,
"new_head": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"old_head": "c10a76a1b79f1c09938d2f9e505dc73122183033",
"path": "test/qml/tst_bitcoinamountinputfield.qml",
"revision": "8622eddfac9d26c95e881b8975c7ab263637e4d9",
"source_generation": 1,
"source_job_id": 2738,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Window 2.15\nimport QtTest 1.2\nimport org.bitcoincore.qt 1.0\nimport \"../../qml/controls\"\n\nTestCase {\n name: \"BitcoinAmountInputField\"\n when: windowShown\n\n Window {\n id: testWindow\n width: 480\n height: 200\n visible: true\n }\n\n Component {\n id: fieldComponent\n BitcoinAmountInputField {\n width: 440\n amount: BitcoinAmount { unit: BitcoinAmount.BTC }\n }\n }\n\n function typeAmount(decimalPoint, keys, interceptPaste) {\n const field = createTemporaryObject(fieldComponent, testWindow.contentItem, {\n decimalPoint: decimalPoint,\n interceptPaste: interceptPaste === true\n })\n field.field.forceActiveFocus()\n for (const key of keys) keyClick(key)\n return field\n }\n\n function test_decimal_comma_locale_reads_comma_as_decimal_point_data() {\n return [\n { tag: \"validator\", interceptPaste: false },\n { tag: \"send\", interceptPaste: true },\n ]\n }\n\n function test_decimal_comma_locale_reads_comma_as_decimal_point(data) {\n const field = typeAmount(\",\", [\"0\", \",\", \"0\", \"2\"], data.interceptPaste)\n compare(field.field.text, \"0,02\")\n compare(field.amount.satoshi, 2000000)\n field.field.focus = false\n compare(field.amount.satoshi, 2000000)\n }\n\n function test_decimal_comma_keeps_undo_history() {\n const field = createTemporaryObject(fieldComponent, testWindow.contentItem, { decimalPoint: \",\" })\n const input = field.field\n input.forceActiveFocus()\n input.text = \"7\"\n input.cursorPosition = 1\n for (const key of [\"1\", \"2\", \",\"]) keyClick(key)\n compare(input.text, \"712,\")\n verify(input.canUndo)\n input.undo()\n compare(input.text, \"7\")\n }\n\n function test_period_locale_keeps_comma_out_data() {\n return test_decimal_comma_locale_reads_comma_as_decimal_point_data()\n }\n\n function test_period_locale_keeps_comma_out(data) {\n const field = typeAmount(\".\", [\"1\", \",\", \"5\"], data.interceptPaste)\n compare(field.field.text, \"15\")\n compare(field.amount.satoshi, 1500000000)\n }\n\n function test_period_is_a_decimal_point_in_every_locale() {\n const field = typeAmount(\",\", [\"0\", \".\", \"5\"])\n compare(field.field.text, \"0.5\")\n compare(field.amount.satoshi, 50000000)\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · c10a76a1b79f..8622eddfac9d 2026-11-20T23:40:21Z · gpt-6-luna |
| gui#934 | The request review omits the wallet whose draft it changesqml/components/PaymentRequestReviewPopup.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 6a64ee145374..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#934 | Abandoning wallet opening leaves the queued request without a noticeqml/pages/MainWindow.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 6a64ee145374..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#934 | The new -h recovery advice does not display helpqml/bitcoin.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 6a64ee145374..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#934 | The availability check ignores an open coin-selection sessionqml/pages/wallet/SendCreate.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 6a64ee145374..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#934 | An accepted request can be applied after being reported interruptedqml/pages/wallet/SendCreate.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 6a64ee145374..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#934 | An interrupted payment request is not retried when Send returnsqml/pages/wallet/SendCreate.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 6a64ee145374..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#986 | New import strings lack translator contextqml/pages/MainWindow.qml | partially_addressed | AssessmentThe new head adds translator comments for the quit confirmation, result banners, and Open/Details actions, and explains the wallet-name placeholder in the quit message and result banners. However, the supplied diff only adds a comment for the Importing status; the requested context for the import-progress text and migration-refusal message is not demonstrated as added. path_diff: qml/pages/MainWindow.qml [
{
"evidence_id": "5d18bbc00a5d4f2c816499ca91f78683",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9",
"old_head": "882efdcc6d02c6a0185349dd85a30ad7a858f86c",
"path": "qml/pages/MainWindow.qml",
"source_generation": 6,
"source_job_id": 2717,
"text": "diff --git a/qml/pages/MainWindow.qml b/qml/pages/MainWindow.qml\nindex 34b74521..805f84eb 100644\n--- a/qml/pages/MainWindow.qml\n+++ b/qml/pages/MainWindow.qml\n@@ -457,18 +457,24 @@ ApplicationWindow {\n id: quitDuringImportPopup\n objectName: \"quitDuringImportPopup\"\n parent: Overlay.overlay\n+ //: Title of the confirmation shown when quitting while a wallet file is being imported.\n title: qsTr(\"Quit while importing?\")\n message: appWindow.menuWalletController\n+ //: Message of the confirmation shown when quitting while a wallet file is being imported.\n+ //: %1 is the name of the wallet being imported.\n+ //: Quitting cancels the import, so the wallet file has to be imported again later.\n ? qsTr(\"\\\"%1\\\" is still being imported. Quitting stops the import, and the wallet will not be available until it is imported again.\")\n .arg(appWindow.menuWalletController.importingWalletName)\n : \"\"\n messageObjectName: \"quitDuringImportMessage\"\n AlertAction {\n+ //: Button in the quit confirmation that keeps the app running so the wallet import can finish.\n text: qsTr(\"Keep importing\")\n role: AlertAction.Cancel\n buttonObjectName: \"quitDuringImportCancelButton\"\n }\n AlertAction {\n+ //: Button in the quit confirmation that quits the app and cancels the wallet import.\n text: qsTr(\"Quit\")\n role: AlertAction.Destructive\n buttonObjectName: \"quitDuringImportConfirmButton\"\n@@ -488,9 +494,12 @@ ApplicationWindow {\n width: Math.min(480, parent.width - 32)\n tone: ToastBanner.Error\n text: walletName.length > 0\n+ //: Banner shown when a wallet import running in the background fails. %1 is the name of the wallet.\n ? qsTr(\"Wallet \\\"%1\\\" could not be imported.\").arg(walletName)\n+ //: Banner shown when a wallet import running in the background fails and the wallet name is unknown.\n : qsTr(\"The wallet could not be imported.\")\n textObjectName: \"walletImportFailedToastText\"\n+ //: Action in the failed import banner. It opens the page that explains why the import failed.\n actionText: qsTr(\"Details\")\n showsCloseButton: true\n onActionTriggered: {\n@@ -511,9 +520,12 @@ ApplicationWindow {\n anchors.bottomMargin: 24\n width: Math.min(480, parent.width - 32)\n tone: ToastBanner.Success\n+ //: Banner shown when a wallet import running in the background finishes. %1 is the name of the wallet.\n text: qsTr(\"Wallet \\\"%1\\\" was imported.\").arg(walletName)\n textObjectName: \"walletImportSucceededToastText\"\n+ //: Action in the finished import banner. It switches to the imported wallet.\n actionText: qsTr(\"Open\")\n+ actionEnabled: !!appWindow.menuWalletController && !appWindow.menuWalletController.walletLoadInProgress\n showsCloseButton: true\n function clear() {\n wallet = null\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 882efdcc6d02..4cadb820ca0d 2026-11-16T21:58:39Z · gpt-6-luna |
| gui#986 | The import banner can clear another wallet load's busy flagqml/pages/MainWindow.qml | addressed | AssessmentThe new head disables the success banner's Open action whenever walletLoadInProgress is true, preventing the described click route while another wallet is loading. The diff also adds a test checking the action is disabled during a load. path_diff: qml/pages/MainWindow.qml; new_source: qml/pages/MainWindow.qml [
{
"evidence_id": "1a2988f0b2ea461e92a9938d82e523e8",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9",
"old_head": "882efdcc6d02c6a0185349dd85a30ad7a858f86c",
"path": "qml/pages/MainWindow.qml",
"source_generation": 6,
"source_job_id": 2717,
"text": "diff --git a/qml/pages/MainWindow.qml b/qml/pages/MainWindow.qml\nindex 34b74521..805f84eb 100644\n--- a/qml/pages/MainWindow.qml\n+++ b/qml/pages/MainWindow.qml\n@@ -457,18 +457,24 @@ ApplicationWindow {\n id: quitDuringImportPopup\n objectName: \"quitDuringImportPopup\"\n parent: Overlay.overlay\n+ //: Title of the confirmation shown when quitting while a wallet file is being imported.\n title: qsTr(\"Quit while importing?\")\n message: appWindow.menuWalletController\n+ //: Message of the confirmation shown when quitting while a wallet file is being imported.\n+ //: %1 is the name of the wallet being imported.\n+ //: Quitting cancels the import, so the wallet file has to be imported again later.\n ? qsTr(\"\\\"%1\\\" is still being imported. Quitting stops the import, and the wallet will not be available until it is imported again.\")\n .arg(appWindow.menuWalletController.importingWalletName)\n : \"\"\n messageObjectName: \"quitDuringImportMessage\"\n AlertAction {\n+ //: Button in the quit confirmation that keeps the app running so the wallet import can finish.\n text: qsTr(\"Keep importing\")\n role: AlertAction.Cancel\n buttonObjectName: \"quitDuringImportCancelButton\"\n }\n AlertAction {\n+ //: Button in the quit confirmation that quits the app and cancels the wallet import.\n text: qsTr(\"Quit\")\n role: AlertAction.Destructive\n buttonObjectName: \"quitDuringImportConfirmButton\"\n@@ -488,9 +494,12 @@ ApplicationWindow {\n width: Math.min(480, parent.width - 32)\n tone: ToastBanner.Error\n text: walletName.length > 0\n+ //: Banner shown when a wallet import running in the background fails. %1 is the name of the wallet.\n ? qsTr(\"Wallet \\\"%1\\\" could not be imported.\").arg(walletName)\n+ //: Banner shown when a wallet import running in the background fails and the wallet name is unknown.\n : qsTr(\"The wallet could not be imported.\")\n textObjectName: \"walletImportFailedToastText\"\n+ //: Action in the failed import banner. It opens the page that explains why the import failed.\n actionText: qsTr(\"Details\")\n showsCloseButton: true\n onActionTriggered: {\n@@ -511,9 +520,12 @@ ApplicationWindow {\n anchors.bottomMargin: 24\n width: Math.min(480, parent.width - 32)\n tone: ToastBanner.Success\n+ //: Banner shown when a wallet import running in the background finishes. %1 is the name of the wallet.\n text: qsTr(\"Wallet \\\"%1\\\" was imported.\").arg(walletName)\n textObjectName: \"walletImportSucceededToastText\"\n+ //: Action in the finished import banner. It switches to the imported wallet.\n actionText: qsTr(\"Open\")\n+ actionEnabled: !!appWindow.menuWalletController && !appWindow.menuWalletController.walletLoadInProgress\n showsCloseButton: true\n function clear() {\n wallet = null\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 641,
"evidence_id": "443de623fa964cb680e7cd68751f94d5",
"finding_id": "finding:1",
"kind": "new_source",
"line": 492,
"new_head": "4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9",
"old_head": "882efdcc6d02c6a0185349dd85a30ad7a858f86c",
"path": "qml/pages/MainWindow.qml",
"revision": "4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9",
"source_generation": 6,
"source_job_id": 2717,
"text": " anchors.bottom: parent.bottom\n anchors.bottomMargin: 24\n width: Math.min(480, parent.width - 32)\n tone: ToastBanner.Error\n text: walletName.length > 0\n //: Banner shown when a wallet import running in the background fails. %1 is the name of the wallet.\n ? qsTr(\"Wallet \\\"%1\\\" could not be imported.\").arg(walletName)\n //: Banner shown when a wallet import running in the background fails and the wallet name is unknown.\n : qsTr(\"The wallet could not be imported.\")\n textObjectName: \"walletImportFailedToastText\"\n //: Action in the failed import banner. It opens the page that explains why the import failed.\n actionText: qsTr(\"Details\")\n showsCloseButton: true\n onActionTriggered: {\n shown = false\n walletCreationModal.openForImportError()\n }\n onDismissed: shown = false\n }\n\n ToastBanner {\n id: walletImportToast\n objectName: \"walletImportSucceededToast\"\n property string walletName: \"\"\n property var wallet: null\n visible: walletName.length > 0 && !appWindow.shutdownInProgress\n anchors.horizontalCenter: parent.horizontalCenter\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 24\n width: Math.min(480, parent.width - 32)\n tone: ToastBanner.Success\n //: Banner shown when a wallet import running in the background finishes. %1 is the name of the wallet.\n text: qsTr(\"Wallet \\\"%1\\\" was imported.\").arg(walletName)\n textObjectName: \"walletImportSucceededToastText\"\n //: Action in the finished import banner. It switches to the imported wallet.\n actionText: qsTr(\"Open\")\n actionEnabled: !!appWindow.menuWalletController && !appWindow.menuWalletController.walletLoadInProgress\n showsCloseButton: true\n function clear() {\n wallet = null\n walletName = \"\"\n }\n onActionTriggered: {\n appWindow.routeToShell(\"openWallet\", wallet)\n clear()\n }\n onDismissed: clear()\n }\n\n Component {\n id: shutdown\n Shutdown {}\n }\n\n Component.onCompleted: {\n // Apply the saved geometry once, while the window is still hidden, then\n // show it. Sizing before the first expose lays the scene out a single\n // time at the final size: there is no live size binding to oscillate and\n // no resize of an already-laid-out scene (which crashes Qt 6.4 Quick\n // Layouts). Position is restored imperatively; moving a window does not\n // relayout its contents.\n if (windowSettings.windowWidth > 0) {\n width = windowSettings.windowWidth\n }\n if (windowSettings.windowHeight > 0) {\n height = windowSettings.windowHeight\n }\n if (windowSettings.windowWidth > 0 && windowSettings.windowHeight > 0) {\n x = windowSettings.windowX\n y = windowSettings.windowY\n }\n visible = true\n if (appWindow.desktopWalletMode) {\n nodeModel.startNodeInitializionThread()\n if (appWindow.waitForPostOnboardingWalletRoute) {\n Qt.callLater(appWindow.resolvePostOnboardingWalletRoute)\n }\n }\n }\n\n Component {\n id: node\n PageStack {\n id: nodeStack\n vertical: true\n initialItem: node\n\n function resetToRoot() {\n peerTableModel.stopAutoRefresh()\n if (nodeStack.depth > 1) {\n nodeStack.pop(null, StackView.Immediate)\n }\n }\n\n function openSettings(section) {\n nodeStack.resetToRoot()\n const page = nodeStack.push(settingsPage, {}, StackView.Immediate)\n if (section && page) {\n page.selectSection(section)\n }\n }\n\n function openNode() {\n nodeStack.resetToRoot()\n }\n\n function openPeers() {\n nodeStack.resetToRoot()\n peerTableModel.startAutoRefresh()\n nodeStack.push(peersPage, {}, StackView.Immediate)\n }\n\n function openConsole() {\n nodeStack.openSettings(\"rpc-console\")\n }\n\n function openNetworkTraffic() {\n nodeStack.openSettings(\"network-traffic\")\n }\n Component {\n id: node\n NodeRunner {\n onSettingsClicked: {\n nodeStack.push(settingsPage)\n }\n onPeersClicked: {\n peerTableModel.startAutoRefresh()\n nodeStack.push(peersPage)\n }\n }\n }\n Component {\n id: settingsPage\n SettingsView {\n wallet: typeof walletController !== \"undefined\" && walletController.isWalletLoaded\n ? walletController.selectedWallet : null\n activeWalletName: wallet ? wallet.name : \"\"\n onDoneClicked: nodeStack.pop()\n }\n }\n Component {\n id: peersPage\n PeersView {\n onBack: {\n nodeStack.pop()\n peerTableModel.stopAutoRefresh()\n }\n }\n }\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 882efdcc6d02..4cadb820ca0d 2026-11-16T21:58:39Z · gpt-6-luna |
| gui#1123 | Calendar header drops the locale's scriptqml/controls/ActivityCalendar.qml | addressed | AssessmentThe header no longer reconstructs a locale from Qt.locale().name. The new binding formats the month using root.dateLocale, which is set to DateLocale.gregorian; this avoids the reported script-losing locale reconstruction. The diff also shows the old Qt.locale(Qt.locale().name) binding replaced directly. path_diff: qml/controls/ActivityCalendar.qml; new_source: qml/controls/ActivityCalendar.qml [
{
"evidence_id": "a8381a5be6334113873ee10167aad686",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "08aafcd0c9c972ea184cbd67633b57e1117e8a13",
"old_head": "6f020bc3a701363a0555800bf557abb8f2d7751c",
"path": "qml/controls/ActivityCalendar.qml",
"source_generation": 1,
"source_job_id": 2617,
"text": "diff --git a/qml/controls/ActivityCalendar.qml b/qml/controls/ActivityCalendar.qml\nindex b46b43ee..3c97b5f1 100644\n--- a/qml/controls/ActivityCalendar.qml\n+++ b/qml/controls/ActivityCalendar.qml\n@@ -15,7 +15,14 @@ import org.bitcoincore.qt 1.0\n // applying or clearing the filter is left to the caller.\n ColumnLayout {\n id: root\n- spacing: 8\n+ readonly property real calendarCellWidth: {\n+ let width = 36\n+ for (let day = 1; day <= 7; ++day)\n+ width = Math.max(width, weekdayMetrics.advanceWidth(Qt.locale().dayName(day, Locale.ShortFormat)) + Theme.space.m)\n+ return Math.ceil(width)\n+ }\n+ property FontMetrics weekdayMetrics: FontMetrics { font: Theme.text.caption.font }\n+ spacing: Theme.space.m\n \n // Public interface ------------------------------------------------------\n \n@@ -78,6 +85,11 @@ ColumnLayout {\n // the weekday header maps it onto JS getDay()'s 0 = Sunday .. 6 = Saturday\n // numbering (7 % 7 == 0).\n readonly property int weekStart: Qt.locale().firstDayOfWeek\n+ // Locale for dates with month names. The system locale can name months\n+ // from the user's calendar while the grid is Gregorian, so this one comes\n+ // from C++, like the Activity list. The week start and weekday names stay\n+ // on the system locale.\n+ property var dateLocale: DateLocale.gregorian\n property var todayDate: new Date()\n // Day the keyboard focus ring is on while the day grid has active focus;\n // null until the grid is first focused after opening.\n@@ -89,7 +101,7 @@ ColumnLayout {\n if (!date || isNaN(date.getTime())) {\n return \"\"\n }\n- return date.toLocaleDateString(Qt.locale(), Locale.ShortFormat)\n+ return date.toLocaleDateString(root.dateLocale, Locale.ShortFormat)\n }\n \n function isoDate(date) {\n@@ -227,7 +239,7 @@ ColumnLayout {\n // selection state, so the state is announced to a screen reader and not\n // conveyed by color alone.\n function dayCellAccessibleName(cell) {\n- var base = cell.modelData.toLocaleDateString(Qt.locale(), Locale.LongFormat)\n+ var base = cell.modelData.toLocaleDateString(root.dateLocale, Locale.LongFormat)\n if (cell.endpoint) {\n //: Screen reader label for a chosen start or end day in the Activity custom date range calendar. %1 is the date.\n return qsTr(\"%1, selected range endpoint\").arg(base)\n@@ -249,7 +261,7 @@ ColumnLayout {\n // click will set.\n RowLayout {\n Layout.fillWidth: true\n- spacing: 8\n+ spacing: Theme.space.m\n \n DateRangeChip {\n objectName: \"activityDateFromChip\"\n@@ -277,7 +289,7 @@ ColumnLayout {\n // jump a year (to reach distant dates fast).\n RowLayout {\n Layout.fillWidth: true\n- spacing: 2\n+ spacing: Theme.space.xxs\n \n CalNavButton {\n objectName: \"calendarPrevYear\"\n@@ -301,13 +313,11 @@ ColumnLayout {\n // The one place a pattern is unavoidable: Locale has no month-and-year\n // format to ask for. toLocaleDateString still localizes the month name\n // here (a Qt.formatDate format string would render C-locale English),\n- // so only the field order is fixed. Qt.locale(name) drops the system\n- // calendar, whose month names would not match the Gregorian grid.\n- text: (new Date(root.calYear, root.calMonth, 1)).toLocaleDateString(Qt.locale(Qt.locale().name), \"MMMM yyyy\")\n+ // so only the field order is fixed.\n+ text: (new Date(root.calYear, root.calMonth, 1)).toLocaleDateString(root.dateLocale, \"MMMM yyyy\")\n horizontalAlignment: Text.AlignHCenter\n color: Theme.color.neutral9\n- font.pixelSize: 15\n- bold: true\n+ textStyle: Theme.text.subheading\n }\n \n CalNavButton {\n@@ -341,13 +351,13 @@ ColumnLayout {\n delegate: CoreText {\n required property int index\n readonly property int jsDay: (root.weekStart + index) % 7\n- width: 36\n- height: 22\n+ width: root.calendarCellWidth\n+ height: Math.max(22, implicitHeight)\n text: Qt.locale().dayName(jsDay === 0 ? 7 : jsDay, Locale.ShortFormat)\n horizontalAlignment: Text.AlignHCenter\n verticalAlignment: Text.AlignVCenter\n color: Theme.color.neutral6\n- font.pixelSize: 12\n+ textStyle: Theme.text.caption\n }\n }\n }\n@@ -360,12 +370,17 @@ ColumnLayout {\n Layout.alignment: Qt.AlignHCenter\n columns: 7\n columnSpacing: 0\n- rowSpacing: 2\n+ rowSpacing: Theme.space.xxs\n \n // The grid is a single tab stop; arrows move the focus ring between\n // days, PageUp/PageDown step a month (with Ctrl, a year), Enter or Space\n // picks the day.\n activeFocusOnTab: true\n+ Accessible.role: Accessible.Table\n+ //: Screen reader name of the day grid in the Activity custom date range calendar.\n+ Accessible.name: qsTr(\"Calendar\")\n+ Accessible.description: root.calendarFocusDate\n+ ? root.calendarFocusDate.toLocaleDateString(root.dateLocale, Locale.LongFormat) : \"\"\n onActiveFocusChanged: {\n if (activeFocus) {\n root.ensureCalendarFocusDate()\n@@ -406,8 +421,8 @@ ColumnLayout {\n delegate: ItemDelegate {\n id: dayCell\n required property var modelData\n- width: 36\n- height: 32\n+ width: root.calendarCellWidth\n+ height: Math.max(32, implicitContentHeight + Theme.space.s)\n padding: 0\n enabled: modelData !== null\n objectName: modelData ? \"calendarDay_\" + root.isoDate(modelData) : \"\"\n@@ -438,33 +453,36 @@ ColumnLayout {\n // Hover and press tints mark the day as clickable; the\n // range tint wins so the preview stays readable.\n color: dayCell.endpoint\n- ? Theme.color.orange\n+ ? Theme.color.accent\n : dayCell.ranged\n- ? Theme.color.neutral3\n+ ? Theme.color.surfaceSelected\n : dayCell.down\n- ? Theme.color.neutral4\n+ ? Theme.color.surfacePressed\n : dayCell.hovered\n- ? Theme.color.neutral2\n+ ? Theme.color.surfaceHover\n : \"transparent\"\n- // The 2px neutral keyboard focus ring wins over the 1px\n- // orange today ring, so the focused day is always\n- // identifiable.\n- border.width: dayCell.keyFocused ? 2 : 1\n- border.color: dayCell.keyFocused\n- ? Theme.color.neutral9\n- : dayCell.isToday && !dayCell.endpoint\n- ? Theme.color.orange\n- : \"transparent\"\n+ border.width: 1\n+ border.color: dayCell.isToday && !dayCell.endpoint ? Theme.color.accent : \"transparent\"\n+\n+ // The keyboard focus ring covers the 1px orange today\n+ // ring, so the focused day is always identifiable.\n+ FocusBorder {\n+ visible: dayCell.keyFocused\n+ topMargin: 0\n+ bottomMargin: 0\n+ leftMargin: 0\n+ rightMargin: 0\n+ targetRadius: parent.radius\n+ }\n }\n \n contentItem: CoreText {\n text: dayCell.modelData ? dayCell.modelData.getDate() : \"\"\n horizontalAlignment: Text.AlignHCenter\n verticalAlignment: Text.AlignVCenter\n- color: dayCell.endpoint ? Theme.color.white : Theme.color.neutral9\n- font.pixelSize: 13\n+ color: dayCell.endpoint ? Theme.color.accentForeground : Theme.color.neutral9\n // Mark today by weight too, so it does not rely on the ring color alone.\n- bold: dayCell.isToday\n+ textStyle: dayCell.isToday ? Theme.text.captionStrong : Theme.text.caption\n }\n }\n }\n@@ -479,10 +497,10 @@ ColumnLayout {\n property bool highlighted: false\n //: Read for an Activity date range endpoint that has no date picked yet.\n readonly property string accessibleValue: chip.value !== \"\" ? chip.value : qsTr(\"no date selected\")\n- implicitHeight: 46\n- radius: 5\n- color: Theme.color.neutral2\n- border.color: chip.highlighted ? Theme.color.orange : \"transparent\"\n+ implicitHeight: Math.max(Theme.size.controlLarge, chipColumn.implicitHeight + 2 * Theme.space.s)\n+ radius: Theme.radius.s\n+ color: Theme.color.surface2\n+ border.color: chip.highlighted ? Theme.color.accent : \"transparent\"\n border.width: 1\n Accessible.role: Accessible.StaticText\n Accessible.name: chip.highlighted\n@@ -491,28 +509,30 @@ ColumnLayout {\n //: Accessibility name of an inactive Activity date range endpoint. %1 is \"From\" or \"To\", %2 the picked date or \"no date selected\".\n : qsTr(\"%1, %2\").arg(chip.label).arg(chip.accessibleValue)\n ColumnLayout {\n+ id: chipColumn\n anchors.fill: parent\n anchors.leftMargin: 10\n anchors.rightMargin: 10\n- anchors.topMargin: 6\n- anchors.bottomMargin: 6\n+ anchors.topMargin: Theme.space.s\n+ anchors.bottomMargin: Theme.space.s\n spacing: 1\n CoreText {\n Layout.fillWidth: true\n text: chip.label\n color: Theme.color.neutral7\n- font.pixelSize: 11\n // Weight marks the active endpoint too, so the state does not\n // rely on the border color alone.\n- bold: chip.highlighted\n+ textStyle: chip.highlighted ? Theme.text.captionStrong : Theme.text.caption\n horizontalAlignment: Text.AlignLeft\n+ wrap: false\n+ elide: Text.ElideRight\n }\n CoreText {\n Layout.fillWidth: true\n //: Placeholder in the Activity date range From/To field before a date is picked.\n text: chip.value !== \"\" ? chip.value : qsTr(\"Select date\")\n color: chip.value !== \"\" ? Theme.color.neutral9 : Theme.color.neutral6\n- font.pixelSize: 14\n+ textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n // CoreText wraps by default, which would defeat the elide and\n // overflow the fixed-height chip on long dates.\n@@ -530,11 +550,22 @@ ColumnLayout {\n property url iconSource\n property bool doubled: false\n property string accessibleName: \"\"\n- implicitWidth: 28\n- implicitHeight: 28\n+ implicitWidth: Theme.size.iconButtonSmall\n+ implicitHeight: Theme.size.iconButtonSmall\n padding: 0\n+ focusPolicy: Qt.StrongFocus\n+ hoverEnabled: AppMode.isDesktop\n Accessible.role: Accessible.Button\n Accessible.name: navButton.accessibleName\n+ background: Rectangle {\n+ radius: Theme.radius.s\n+ color: navButton.down ? Theme.color.surfacePressed : navButton.hovered ? Theme.color.surfaceHover : \"transparent\"\n+\n+ FocusBorder {\n+ visible: navButton.visualFocus\n+ targetRadius: parent.radius\n+ }\n+ }\n contentItem: Item {\n // Two plain Icons rather than a Repeater over a 1-or-2 model: a\n // delegate inside an inline component is not wrapped in an implicit\n@@ -546,14 +577,14 @@ ColumnLayout {\n spacing: -5\n Icon {\n source: navButton.iconSource\n- color: Theme.color.orange\n- size: 14\n+ color: Theme.color.neutral9\n+ size: Theme.size.icon.s\n }\n Icon {\n visible: navButton.doubled\n source: navButton.iconSource\n- color: Theme.color.orange\n- size: 14\n+ color: Theme.color.neutral9\n+ size: Theme.size.icon.s\n }\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 425,
"evidence_id": "3ff3cd804cb0468aac5b48a859b1ccc4",
"finding_id": "finding:1",
"kind": "new_source",
"line": 276,
"new_head": "08aafcd0c9c972ea184cbd67633b57e1117e8a13",
"old_head": "6f020bc3a701363a0555800bf557abb8f2d7751c",
"path": "qml/controls/ActivityCalendar.qml",
"revision": "08aafcd0c9c972ea184cbd67633b57e1117e8a13",
"source_generation": 1,
"source_job_id": 2617,
"text": " }\n\n DateRangeChip {\n objectName: \"activityDateToChip\"\n Layout.fillWidth: true\n //: Label for the end date of the Activity custom date range.\n label: qsTr(\"To\")\n value: root.formatRangeDate(root.customTo)\n highlighted: root.pickingEnd\n }\n }\n\n // Month / year navigation: single chevrons step a month, double chevrons\n // jump a year (to reach distant dates fast).\n RowLayout {\n Layout.fillWidth: true\n spacing: Theme.space.xxs\n\n CalNavButton {\n objectName: \"calendarPrevYear\"\n iconSource: \"image://images/caret-left\"\n doubled: true\n //: Accessibility label for the Activity calendar control that jumps back one year.\n accessibleName: qsTr(\"Previous year\")\n onClicked: root.stepCalendarMonth(-12)\n }\n CalNavButton {\n objectName: \"calendarPrev\"\n iconSource: \"image://images/caret-left\"\n //: Accessibility label for the Activity calendar control that steps back one month.\n accessibleName: qsTr(\"Previous month\")\n onClicked: root.stepCalendarMonth(-1)\n }\n\n CoreText {\n objectName: \"calendarMonthLabel\"\n Layout.fillWidth: true\n // The one place a pattern is unavoidable: Locale has no month-and-year\n // format to ask for. toLocaleDateString still localizes the month name\n // here (a Qt.formatDate format string would render C-locale English),\n // so only the field order is fixed.\n text: (new Date(root.calYear, root.calMonth, 1)).toLocaleDateString(root.dateLocale, \"MMMM yyyy\")\n horizontalAlignment: Text.AlignHCenter\n color: Theme.color.neutral9\n textStyle: Theme.text.subheading\n }\n\n CalNavButton {\n objectName: \"calendarNext\"\n iconSource: \"image://images/caret-right\"\n //: Accessibility label for the Activity calendar control that steps forward one month.\n accessibleName: qsTr(\"Next month\")\n onClicked: root.stepCalendarMonth(1)\n }\n CalNavButton {\n objectName: \"calendarNextYear\"\n iconSource: \"image://images/caret-right\"\n doubled: true\n //: Accessibility label for the Activity calendar control that jumps forward one year.\n accessibleName: qsTr(\"Next year\")\n onClicked: root.stepCalendarMonth(12)\n }\n }\n\n // Weekday header, ordered by the locale's first day of week to match the day\n // grid. Use a Grid positioner, never a Quick Layout: a Repeater inside a\n // RowLayout/ColumnLayout/GridLayout hits a Qt 6.4 use-after-free that\n // SIGSEGVs only headed.\n Grid {\n Layout.alignment: Qt.AlignHCenter\n columns: 7\n spacing: 0\n\n Repeater {\n model: 7\n delegate: CoreText {\n required property int index\n readonly property int jsDay: (root.weekStart + index) % 7\n width: root.calendarCellWidth\n height: Math.max(22, implicitHeight)\n text: Qt.locale().dayName(jsDay === 0 ? 7 : jsDay, Locale.ShortFormat)\n horizontalAlignment: Text.AlignHCenter\n verticalAlignment: Text.AlignVCenter\n color: Theme.color.neutral6\n textStyle: Theme.text.caption\n }\n }\n }\n\n // Day grid: one ItemDelegate per cell so each day is independently clickable\n // (and reachable by the test bridge).\n Grid {\n id: dayGrid\n objectName: \"activityCalendarGrid\"\n Layout.alignment: Qt.AlignHCenter\n columns: 7\n columnSpacing: 0\n rowSpacing: Theme.space.xxs\n\n // The grid is a single tab stop; arrows move the focus ring between\n // days, PageUp/PageDown step a month (with Ctrl, a year), Enter or Space\n // picks the day.\n activeFocusOnTab: true\n Accessible.role: Accessible.Table\n //: Screen reader name of the day grid in the Activity custom date range calendar.\n Accessible.name: qsTr(\"Calendar\")\n Accessible.description: root.calendarFocusDate\n ? root.calendarFocusDate.toLocaleDateString(root.dateLocale, Locale.LongFormat) : \"\"\n onActiveFocusChanged: {\n if (activeFocus) {\n root.ensureCalendarFocusDate()\n }\n }\n Keys.onPressed: function(event) {\n switch (event.key) {\n case Qt.Key_Left: root.moveCalendarFocus(-1); break\n case Qt.Key_Right: root.moveCalendarFocus(1); break\n case Qt.Key_Up: root.moveCalendarFocus(-7); break\n case Qt.Key_Down: root.moveCalendarFocus(7); break\n case Qt.Key_PageUp:\n root.stepCalendarFocusMonth(event.modifiers & Qt.ControlModifier ? -12 : -1)\n break\n case Qt.Key_PageDown:\n root.stepCalendarFocusMonth(event.modifiers & Qt.ControlModifier ? 12 : 1)\n break\n case Qt.Key_Return:\n case Qt.Key_Enter:\n case Qt.Key_Space:\n root.ensureCalendarFocusDate()\n root.selectCalendarDate(root.calendarFocusDate)\n break\n default:\n return\n }\n event.accepted = true\n }\n\n // Clear the hover preview when the pointer leaves the grid.\n HoverHandler {\n enabled: AppMode.isDesktop\n onHoveredChanged: if (!hovered) root.hoverDate = null\n }\n\n Repeater {\n model: root.calendarCells()\n delegate: ItemDelegate {\n id: dayCell\n required property var modelData\n width: root.calendarCellWidth\n height: Math.max(32, implicitContentHeight + Theme.space.s)",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 6f020bc3a701..08aafcd0c9c9 2026-11-21T06:06:37Z · gpt-6-luna |
| gui#1090 | SystemExit(None) logs PASS but makes the scenario suite exit 1test/functional/qml_scenarios.py | still_present | AssessmentThe new-head excerpt leaves the exception branch unchanged: it assigns error.code to status and classifies None as a failure, while the formatter prints PASS for None. The diff and excerpt therefore do not show the requested normalization or test addition. new_source: test/functional/qml_scenarios.py [
{
"bounded": true,
"end_line": 92,
"evidence_id": "1c5adb83dc424253a691e1ae340fd975",
"finding_id": "finding:1",
"kind": "new_source",
"line": 51,
"new_head": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"old_head": "1137c33186d24cabdd33813e94d039bedbf51b0c",
"path": "test/functional/qml_scenarios.py",
"revision": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"source_generation": 6,
"source_job_id": 2559,
"text": " parser = argparse.ArgumentParser(description=description)\n parser.add_argument(\"--list\", action=\"store_true\", help=\"List selected scenario names and stages as JSON without starting the GUI\")\n parser.add_argument(\"--case\", action=\"append\", default=[], metavar=\"PATTERN\", help=\"Select a scenario name or wildcard; may be repeated\")\n parser.add_argument(\"--stage\", action=\"append\", type=int, choices=range(1, 10), help=\"Select scenarios introduced in this stage; may be repeated\")\n parser.add_argument(\"--save-screenshots\", action=\"store_true\")\n options = parser.parse_args()\n names = [case.name for case in scenarios]\n if len(names) != len(set(names)) or any(case.stage not in range(1, 10) for case in scenarios):\n parser.error(\"Scenario names must be unique and stages must be between 1 and 9\")\n for pattern in options.case:\n if not any(fnmatchcase(name, pattern) for name in names):\n parser.error(f\"No scenario matches {pattern!r}\")\n selected = [case for case in scenarios\n if (not options.stage or case.stage in options.stage)\n and (not options.case or any(fnmatchcase(case.name, pattern) for pattern in options.case))]\n if not selected:\n parser.error(\"No scenarios match the selected cases and stages\")\n if options.list:\n print(json.dumps([{\"name\": case.name, \"stage\": case.stage} for case in selected]))\n return 0\n\n failed = False\n skipped = False\n for case in selected:\n print(f\"[RUN] stage={case.stage} case={case.name}\", flush=True)\n started = time.monotonic()\n try:\n status = case.action(options)\n if status not in (None, 0, 77):\n raise AssertionError(f\"Scenario returned status {status}\")\n except SystemExit as error:\n status = error.code\n if status not in (0, 77):\n failed = True\n except Exception:\n traceback.print_exc()\n status = 1\n failed = True\n skipped = skipped or status == 77\n result = \"SKIP\" if status == 77 else \"PASS\" if status in (None, 0) else \"FAIL\"\n print(f\"[{result}] stage={case.stage} case={case.name} seconds={time.monotonic() - started:.3f}\", flush=True)\n return 1 if failed else 77 if skipped else 0",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1137c33186d2..51ea5d406a92 2026-11-18T00:24:28Z · gpt-6-luna |
| gui#1090 | Retried clicks still pass integration tests with only a warningtest/integration/fixture/test_util.h | still_present | AssessmentThe requested default behavior was not changed: Click(QObject*) still delegates to ClickWithRetries, and Click(app, name) calls that default. Retry counts are based on polling attempts and only produce qWarning output; retries are not an explicit opt-in and do not make the default click fail. path_diff: test/integration/fixture/test_util.h; new_source: test/integration/fixture/test_util.h [
{
"evidence_id": "90cb1b2200c74414a2f5fb46868b5276",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"old_head": "baee452eec1c73bd070cffe09e4471bfa04f2c5f",
"path": "test/integration/fixture/test_util.h",
"source_generation": 5,
"source_job_id": 2557,
"text": "diff --git a/test/integration/fixture/test_util.h b/test/integration/fixture/test_util.h\nindex af0a25c9..854f3630 100644\n--- a/test/integration/fixture/test_util.h\n+++ b/test/integration/fixture/test_util.h\n@@ -135,7 +135,9 @@ inline bool TransitionsFinished(QObject* root)\n QList<QObject*> pending{root};\n while (!pending.isEmpty()) {\n auto* object = pending.takeLast();\n- if (object->property(\"busy\").toBool()) return false;\n+ // Only a StackView's busy means a running transition; dialogs use busy\n+ // to refuse closing while they work.\n+ if (object->inherits(\"QQuickStackView\") && object->property(\"busy\").toBool()) return false;\n if (object->inherits(\"QQuickPopup\") && object->property(\"visible\").toBool() && !object->property(\"opened\").toBool()) return false;\n pending.append(object->children());\n }\n@@ -169,18 +171,21 @@ inline bool ClickWithRetries(QObject* object)\n if (item->metaObject()->indexOfSignal(\"clicked()\") < 0) return click();\n QSignalSpy clicked{item, SIGNAL(clicked())};\n const auto pressed = item->metaObject()->indexOfSignal(\"pressed()\") < 0 ? nullptr : std::make_unique<QSignalSpy>(item, SIGNAL(pressed()));\n- const auto delivered = [&] { return (pressed && !pressed->isEmpty()) || !clicked.isEmpty(); };\n+ const auto delivered = [&] { return !clicked.isEmpty(); };\n // Modal exit can consume a gesture. Keep retries visible in the report so\n // a successful test does not silently conceal swallowed input.\n const QString target = item->objectName();\n int attempts{0};\n const bool success = QTest::qWaitFor([&] {\n if (delivered()) return true;\n+ // A press reached the target but was canceled (for example by becoming\n+ // disabled). Do not retry a delivered gesture or report it as a click.\n+ if (pressed && !pressed->isEmpty()) return true;\n ++attempts;\n- return click() && delivered();\n+ return click() && (delivered() || (pressed && !pressed->isEmpty()));\n }, 10'000);\n- if (attempts > 1) qWarning() << \"Click retries for\" << target << \"attempts:\" << attempts << \"delivered:\" << success;\n- return success;\n+ if (attempts > 1) qWarning() << \"Click retries for\" << target << \"attempts:\" << attempts << \"delivered:\" << delivered();\n+ return success && delivered();\n }\n \n // Existing journeys tolerate modal-exit retries, but each retry is reported.\n@@ -211,16 +216,28 @@ inline bool Click(BitcoinQmlApplication& app, const char* name)\n auto* object = WaitForVisible(app, name);\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !WaitForPolish(item) || !item) return false;\n- for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n- if (!parent->inherits(\"QQuickFlickable\")) continue;\n- const auto rect = item->mapRectToItem(parent, item->boundingRect());\n- const auto offset = rect.top() < 0 ? rect.top() : std::max(0.0, rect.bottom() - parent->height());\n- if (offset != 0) parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n- }\n- QCoreApplication::processEvents();\n const bool ready = QTest::qWaitFor([&] {\n- return item && item->isEnabled() && item->width() > 0 && item->height() > 0 &&\n- app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), item->boundingRect().center()));\n+ if (!item || !WaitForPolish(item) || !item) return false;\n+ bool scrolled{false};\n+ for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n+ if (!parent->inherits(\"QQuickFlickable\")) continue;\n+ const auto rect = item->mapRectToItem(parent, item->boundingRect());\n+ // Leave a pixel of room: QPoint rounding must not put the gesture\n+ // on the exclusive bottom edge of a clipped viewport.\n+ const auto offset = rect.height() > parent->height() - 2\n+ ? rect.center().y() - parent->height() / 2\n+ : rect.top() < 1 ? rect.top() - 1 : std::max(0.0, rect.bottom() - parent->height() + 1);\n+ if (offset != 0) {\n+ parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n+ scrolled = true;\n+ }\n+ }\n+ if (scrolled || !item->isEnabled() || item->width() <= 0 || item->height() <= 0) return false;\n+ const auto center = item->boundingRect().center();\n+ for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n+ if (parent->clip() && !parent->contains(item->mapToItem(parent, center))) return false;\n+ }\n+ return app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), center));\n });\n if (!ready) qWarning() << \"Cannot click\" << name;\n return ready && item && Click(item.data());\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 282,
"evidence_id": "bfbeffcbbe664630bc9739b71736a113",
"finding_id": "finding:1",
"kind": "new_source",
"line": 152,
"new_head": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"old_head": "baee452eec1c73bd070cffe09e4471bfa04f2c5f",
"path": "test/integration/fixture/test_util.h",
"revision": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"source_generation": 5,
"source_job_id": 2557,
"text": "#else\n for (QPointer<QQuickItem> current{item}; current; current = current->parentItem()) {\n if (!QQuickTest::qWaitForItemPolished(current)) return false;\n }\n return true;\n#endif\n}\n\ninline bool ClickWithRetries(QObject* object)\n{\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !item->isVisible() || !item->isEnabled() || !WaitForPolish(item) || !item ||\n item->width() <= 0 || item->height() <= 0) return false;\n const auto click = [&] {\n if (!item || !item->isVisible() || !item->isEnabled() || !item->window()) return false;\n QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier,\n item->mapToScene(item->boundingRect().center()).toPoint());\n return true;\n };\n if (item->metaObject()->indexOfSignal(\"clicked()\") < 0) return click();\n QSignalSpy clicked{item, SIGNAL(clicked())};\n const auto pressed = item->metaObject()->indexOfSignal(\"pressed()\") < 0 ? nullptr : std::make_unique<QSignalSpy>(item, SIGNAL(pressed()));\n const auto delivered = [&] { return !clicked.isEmpty(); };\n // Modal exit can consume a gesture. Keep retries visible in the report so\n // a successful test does not silently conceal swallowed input.\n const QString target = item->objectName();\n int attempts{0};\n const bool success = QTest::qWaitFor([&] {\n if (delivered()) return true;\n // A press reached the target but was canceled (for example by becoming\n // disabled). Do not retry a delivered gesture or report it as a click.\n if (pressed && !pressed->isEmpty()) return true;\n ++attempts;\n return click() && (delivered() || (pressed && !pressed->isEmpty()));\n }, 10'000);\n if (attempts > 1) qWarning() << \"Click retries for\" << target << \"attempts:\" << attempts << \"delivered:\" << delivered();\n return success && delivered();\n}\n\n// Existing journeys tolerate modal-exit retries, but each retry is reported.\ninline bool Click(QObject* object)\n{\n return ClickWithRetries(object);\n}\n\ninline bool OpenSettings(BitcoinQmlApplication& app)\n{\n return Click(Find(app, app.window()->property(\"desktopWalletMode\").toBool()\n ? \"desktopWalletSettingsTabButton\" : \"nodeSettingsButton\"));\n}\n\ninline QObject* WaitForVisible(BitcoinQmlApplication& app, const char* name)\n{\n QObject* object{nullptr};\n const bool ready = QTest::qWaitFor([&] {\n object = Find(app, name);\n return object && object->property(\"visible\").toBool() && TransitionsFinished(app.window());\n }, 10'000);\n if (!ready) qWarning() << \"Control did not become ready:\" << name << object << \"visible:\" << (object && object->property(\"visible\").toBool()) << \"transitions finished:\" << TransitionsFinished(app.window());\n return ready ? object : nullptr;\n}\n\ninline bool Click(BitcoinQmlApplication& app, const char* name)\n{\n auto* object = WaitForVisible(app, name);\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !WaitForPolish(item) || !item) return false;\n const bool ready = QTest::qWaitFor([&] {\n if (!item || !WaitForPolish(item) || !item) return false;\n bool scrolled{false};\n for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n if (!parent->inherits(\"QQuickFlickable\")) continue;\n const auto rect = item->mapRectToItem(parent, item->boundingRect());\n // Leave a pixel of room: QPoint rounding must not put the gesture\n // on the exclusive bottom edge of a clipped viewport.\n const auto offset = rect.height() > parent->height() - 2\n ? rect.center().y() - parent->height() / 2\n : rect.top() < 1 ? rect.top() - 1 : std::max(0.0, rect.bottom() - parent->height() + 1);\n if (offset != 0) {\n parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n scrolled = true;\n }\n }\n if (scrolled || !item->isEnabled() || item->width() <= 0 || item->height() <= 0) return false;\n const auto center = item->boundingRect().center();\n for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n if (parent->clip() && !parent->contains(item->mapToItem(parent, center))) return false;\n }\n return app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), center));\n });\n if (!ready) qWarning() << \"Cannot click\" << name;\n return ready && item && Click(item.data());\n}\n\ninline bool SetText(BitcoinQmlApplication& app, const char* name, const QString& text)\n{\n auto* item = qobject_cast<QQuickItem*>(WaitForVisible(app, name));\n if (!item) return false;\n item->forceActiveFocus();\n if (!QMetaObject::invokeMethod(item, \"selectAll\")) return false;\n QTest::keyClick(item->window(), Qt::Key_Backspace, Qt::NoModifier, 1);\n QInputMethodEvent edit;\n edit.setCommitString(text);\n QCoreApplication::sendEvent(item, &edit);\n return edit.isAccepted();\n}\n\ninline bool SelectSettings(BitcoinQmlApplication& app, const char* section)\n{\n auto* settings = qobject_cast<QQuickItem*>(Find(app, \"settingsView\"));\n if ((!settings || !settings->isVisible()) && !OpenSettings(app)) return false;\n if (!WaitForVisible(app, \"settingsView\")) return false;\n auto* sidebar = qobject_cast<QQuickItem*>(Find(app, \"settingsSidebarList\"));\n auto* button = qobject_cast<QQuickItem*>(Find(app, qPrintable(QStringLiteral(\"settingsSidebar_%1\").arg(section))));\n if (!sidebar || !button) return false;\n const auto position_mode = sidebar->metaObject()->enumerator(sidebar->metaObject()->indexOfEnumerator(\"PositionMode\"));\n const int contain = position_mode.keyToValue(\"Contain\");\n const int index = button->parentItem()->property(\"index\").toInt();\n if (contain < 0 || !QMetaObject::invokeMethod(sidebar, \"positionViewAtIndex\", Q_ARG(int, index), Q_ARG(int, contain))) return false;\n return QTest::qWaitFor([&] { return sidebar->contains(button->mapToItem(sidebar, button->boundingRect().center())); }) && Click(button);\n}\n\ninline bool ReturnToNode(BitcoinQmlApplication& app)\n{\n if (app.window()->property(\"desktopWalletMode\").toBool()) return Click(Find(app, \"blockClockTabButton\"));\n auto* settings = Find(app, \"settingsView\");\n return !settings || !settings->property(\"visible\").toBool() || Click(Find(app, \"settingsDoneButton\"));\n}\n} // namespace qmltest\n\n#endif // BITCOIN_QML_TEST_INTEGRATION_FIXTURE_TEST_UTIL_H",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · baee452eec1c..51ea5d406a92 2026-11-18T00:24:28Z · gpt-6-luna |
| gui#986 | Import success banner keeps offering Open after the imported wallet closesqml/pages/MainWindow.qml | addressed | AssessmentThe success banner is now cleared when its wallet is no longer present in the controller's open-wallet list. `MainWindow.qml` adds `onOpenWalletsChanged()` and calls `walletImportToast.clear()` when the toast's wallet is absent from `menuWalletController.openWallets` (lines 448–452). Source report · a9b2ea2c99ac..882efdcc6d02 2026-11-16T17:31:21Z · gpt-6-luna |
| gui#986 | Quit-during-import warning treats the backup-derived wallet name as markupqml/pages/MainWindow.qml | still_present | AssessmentThe new-head confirmation still formats the wallet name into AlertPopup.message with .arg(), and the cited diff adds no plain-text option or markup-looking-name test. The reported filename can therefore still affect message formatting. path_diff: qml/pages/MainWindow.qml [
{
"evidence_id": "8f68d836d7d94fd894add036e0210d1c",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9",
"old_head": "a9b2ea2c99acb9be537ce5f83e306086a6995572",
"path": "qml/pages/MainWindow.qml",
"source_generation": 5,
"source_job_id": 2551,
"text": "diff --git a/qml/pages/MainWindow.qml b/qml/pages/MainWindow.qml\nindex 1bb1343e..805f84eb 100644\n--- a/qml/pages/MainWindow.qml\n+++ b/qml/pages/MainWindow.qml\n@@ -15,18 +15,20 @@ ApplicationWindow {\n id: appWindow\n objectName: \"appWindow\"\n title: qsTr(\"Bitcoin Core App\")\n- minimumWidth: 800\n+ minimumWidth: SizeClass.windowMinimumWidth\n minimumHeight: 665\n color: Theme.color.background\n- palette.window: Theme.color.neutral1 // Context menu background\n+ palette.window: Theme.color.surface1 // Context menu background\n palette.windowText: Theme.color.neutral8 // Menu item text and icons\n- palette.dark: Theme.dark ? Theme.color.neutral2 : Theme.color.neutral3 // Menu border\n- palette.mid: Theme.dark ? Theme.color.neutral2 : Theme.color.neutral3 // Menu separators\n- palette.light: Theme.color.neutral3 // Highlighted menu item background\n- palette.midlight: Theme.color.neutral3 // Pressed menu item background\n- palette.disabled.windowText: Theme.color.neutral4 // Disabled item text and icons\n- palette.disabled.light: Theme.color.neutral1 // Disabled item highlight background\n- palette.disabled.midlight: Theme.color.neutral1 // Disabled item pressed background\n+ palette.dark: Theme.color.menuBorder // Menu border\n+ palette.mid: Theme.color.menuDivider // Menu separators\n+ palette.light: Theme.color.surface3 // Highlighted menu item background\n+ palette.midlight: Theme.color.surface3 // Pressed menu item background\n+ palette.disabled.windowText: Theme.color.disabledContent // Disabled item text and icons\n+ palette.disabled.light: Theme.color.surface1 // Disabled item highlight background\n+ palette.disabled.midlight: Theme.color.surface1 // Disabled item pressed background\n+ palette.highlight: Theme.color.selection // Text selection in fields\n+ palette.highlightedText: Theme.color.selectedText\n \n // The window starts hidden and is shown at the end of Component.onCompleted,\n // after the saved size has been applied (below). Applying the size while\n@@ -149,7 +151,8 @@ ApplicationWindow {\n \n \n Behavior on color {\n- ColorAnimation { duration: 150 }\n+ enabled: Theme.motion.animated\n+ ColorAnimation { duration: Theme.motion.normal }\n }\n \n Loader {\n@@ -183,6 +186,10 @@ ApplicationWindow {\n walletImportBusy: appWindow.menuWalletController\n ? appWindow.menuWalletController.walletImportInProgress\n : false\n+ selectedWalletImporting: !!appWindow.menuWalletController\n+ && appWindow.menuWalletController.walletImportInProgress\n+ && appWindow.menuWalletController.selectedWallet !== null\n+ && appWindow.menuWalletController.selectedWallet.name === appWindow.menuWalletController.importingWalletName\n canUndo: appWindow.menuEditTarget\n && typeof appWindow.menuEditTarget.undo === \"function\"\n && appWindow.menuEditTarget.canUndo === true\n@@ -201,6 +208,7 @@ ApplicationWindow {\n shuttingDown: appWindow.shutdownInProgress || nodeModel.fatalException\n fatalException: nodeModel.fatalException\n isMacOs: Qt.platform.os === \"osx\"\n+ amountsHidden: optionsModel.hideAmounts\n \n onCreateWalletRequested: appWindow.openWalletCreation()\n onCloseWalletRequested: appWindow.routeToShell(\"requestCloseWallet\")\n@@ -217,6 +225,7 @@ ApplicationWindow {\n onPasteRequested: appWindow.invokeEditCommand(\"paste\")\n onToggleDisplayUnitRequested: optionsModel.displayUnit = optionsModel.displayUnit === BitcoinAmount.SAT\n ? BitcoinAmount.BTC : BitcoinAmount.SAT\n+ onToggleHideAmountsRequested: optionsModel.hideAmounts = !optionsModel.hideAmounts\n onMinimizeRequested: appWindow.showMinimized()\n onZoomRequested: {\n if (appWindow.visibility === Window.Maximized) {\n@@ -230,11 +239,11 @@ ApplicationWindow {\n onActivityRequested: appWindow.routeToShell(\"openActivity\")\n onSendRequested: appWindow.routeToShell(\"openSend\")\n onReceiveRequested: appWindow.routeToShell(\"openReceive\")\n- onInformationRequested: menuInformationPopup.open()\n+ onInformationRequested: appWindow.openNodeInformation()\n onConsoleRequested: appWindow.routeToShell(\"openConsole\")\n onNetworkTrafficRequested: appWindow.routeToShell(\"openNetworkTraffic\")\n onPeersRequested: appWindow.routeToShell(\"openPeers\")\n- onRpcDocumentationRequested: Qt.openUrlExternally(\"https://bitcoincore.org/en/doc/\")\n+ onRpcDocumentationRequested: rpcDocumentationLinkPopup.openLink(\"https://bitcoincore.org/en/doc/\")\n onAboutRequested: appWindow.openSettings(\"about\")\n }\n \n@@ -353,11 +362,32 @@ ApplicationWindow {\n parent: Overlay.overlay\n }\n \n+ // One of each for the whole window: the menu bar and every\n+ // NodeStatusActions open these.\n NodeInformationPopup {\n- id: menuInformationPopup\n+ id: nodeInformationPopup\n parent: Overlay.overlay\n }\n \n+ NodeWarningsPopup {\n+ id: nodeWarningsPopup\n+ parent: Overlay.overlay\n+ }\n+\n+ ExternalPopup {\n+ id: rpcDocumentationLinkPopup\n+ objectName: \"rpcDocumentationLinkPopup\"\n+ parent: Overlay.overlay\n+ }\n+\n+ function openNodeInformation() {\n+ nodeInformationPopup.open()\n+ }\n+\n+ function openNodeWarnings() {\n+ nodeWarningsPopup.open()\n+ }\n+\n Connections {\n target: appWindow.desktopWalletMode ? walletController : null\n function onInitializedChanged() {\n@@ -385,6 +415,7 @@ ApplicationWindow {\n \n WalletCreationModal {\n id: walletCreationModal\n+ parent: Overlay.overlay\n onFinished: function(openActivity, wallet) {\n if (openActivity) appWindow.routeToShell(\"openWallet\", wallet)\n }\n@@ -399,6 +430,7 @@ ApplicationWindow {\n if (!appWindow.menuWalletController.walletImportInProgress) quitDuringImportPopup.close()\n }\n function onWalletImportFailed() {\n+ walletImportToast.clear()\n if (walletCreationModal.opened) return\n walletImportErrorToast.walletName = appWindow.lastImportingWalletName\n walletImportErrorToast.shown = true\n@@ -413,24 +445,36 @@ ApplicationWindow {\n walletImportToast.wallet = wallet\n walletImportToast.walletName = appWindow.menuWalletController.lastImportedWalletName\n }\n+ function onOpenWalletsChanged() {\n+ if (walletImportToast.wallet\n+ && appWindow.menuWalletController.openWallets.indexOf(walletImportToast.wallet) < 0) {\n+ walletImportToast.clear()\n+ }\n+ }\n }\n \n AlertPopup {\n id: quitDuringImportPopup\n objectName: \"quitDuringImportPopup\"\n parent: Overlay.overlay\n+ //: Title of the confirmation shown when quitting while a wallet file is being imported.\n title: qsTr(\"Quit while importing?\")\n message: appWindow.menuWalletController\n+ //: Message of the confirmation shown when quitting while a wallet file is being imported.\n+ //: %1 is the name of the wallet being imported.\n+ //: Quitting cancels the import, so the wallet file has to be imported again later.\n ? qsTr(\"\\\"%1\\\" is still being imported. Quitting stops the import, and the wallet will not be available until it is imported again.\")\n .arg(appWindow.menuWalletController.importingWalletName)\n : \"\"\n messageObjectName: \"quitDuringImportMessage\"\n AlertAction {\n+ //: Button in the quit confirmation that keeps the app running so the wallet import can finish.\n text: qsTr(\"Keep importing\")\n role: AlertAction.Cancel\n buttonObjectName: \"quitDuringImportCancelButton\"\n }\n AlertAction {\n+ //: Button in the quit confirmation that quits the app and cancels the wallet import.\n text: qsTr(\"Quit\")\n role: AlertAction.Destructive\n buttonObjectName: \"quitDuringImportConfirmButton\"\n@@ -448,12 +492,14 @@ ApplicationWindow {\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 24\n width: Math.min(480, parent.width - 32)\n- tintColor: Theme.color.red\n- iconSource: \"image://images/alert-filled\"\n+ tone: ToastBanner.Error\n text: walletName.length > 0\n+ //: Banner shown when a wallet import running in the background fails. %1 is the name of the wallet.\n ? qsTr(\"Wallet \\\"%1\\\" could not be imported.\").arg(walletName)\n+ //: Banner shown when a wallet import running in the background fails and the wallet name is unknown.\n : qsTr(\"The wallet could not be imported.\")\n textObjectName: \"walletImportFailedToastText\"\n+ //: Action in the failed import banner. It opens the page that explains why the import failed.\n actionText: qsTr(\"Details\")\n showsCloseButton: true\n onActionTriggered: {\n@@ -473,21 +519,23 @@ ApplicationWindow {\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 24\n width: Math.min(480, parent.width - 32)\n- tintColor: Theme.color.green\n- iconSource: \"image://images/check\"\n+ tone: ToastBanner.Success\n+ //: Banner shown when a wallet import running in the background finishes. %1 is the name of the wallet.\n text: qsTr(\"Wallet \\\"%1\\\" was imported.\").arg(walletName)\n textObjectName: \"walletImportSucceededToastText\"\n+ //: Action in the finished import banner. It switches to the imported wallet.\n actionText: qsTr(\"Open\")\n+ actionEnabled: !!appWindow.menuWalletController && !appWindow.menuWalletController.walletLoadInProgress\n showsCloseButton: true\n- onActionTriggered: {\n- appWindow.routeToShell(\"openWallet\", wallet)\n+ function clear() {\n wallet = null\n walletName = \"\"\n }\n- onDismissed: {\n- wallet = null\n- walletName = \"\"\n+ onActionTriggered: {\n+ appWindow.routeToShell(\"openWallet\", wallet)\n+ clear()\n }\n+ onDismissed: clear()\n }\n \n Component {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · a9b2ea2c99ac..4cadb820ca0d 2026-11-16T21:58:39Z · gpt-6-luna |
| gui#986 | Closing the importing wallet before the restore result arrives brings it back as openqml/walletqmlcontroller.cpp | addressed | Assessment`closeWallet()` now refuses to close the wallet currently being imported while the import is in progress, blocking the described notification-to-result race. The diff adds a guard in `qml/walletqmlcontroller.cpp`: when `walletImportInProgress()` and the requested path matches `m_importing_wallet_name`, the function returns before proceeding with closure. Source report · a9b2ea2c99ac..882efdcc6d02 2026-11-16T17:31:21Z · gpt-6-luna |
| gui#986 | A later background import failure appears under an earlier success bannerqml/pages/MainWindow.qml | addressed | AssessmentThe failure handler now clears the success toast before showing the error, removing the stale banner's copied wallet reference and name. In `MainWindow.qml`, `onWalletImportFailed()` calls `walletImportToast.clear()` (diff around lines 430–437); `clear()` sets both `wallet = null` and `walletName = ""` (lines 518–521). Source report · a9b2ea2c99ac..882efdcc6d02 2026-11-16T17:31:21Z · gpt-6-luna |
| gui#1051 | Calendar script test assumes a month-first host localetest/qml/tst_activitylist.qml | addressed | AssessmentThe Serbian calendar test now checks that the appropriate Latin or Cyrillic month name occurs in the label instead of asserting a fixed month/year order, so it no longer depends on the host's regional date ordering. path_diff: test/qml/tst_activitylist.qml; new_source: test/qml/tst_activitylist.qml [
{
"evidence_id": "427f2978cdea4f1fb972521e3d7fda87",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "85fc1d06318944c6b33702736cbb44946b37453a",
"old_head": "1f6c58c1a018a35009878f6b074544e5d1a6aba6",
"path": "test/qml/tst_activitylist.qml",
"source_generation": 3,
"source_job_id": 2549,
"text": "diff --git a/test/qml/tst_activitylist.qml b/test/qml/tst_activitylist.qml\nindex a46ce519..b48130e9 100644\n--- a/test/qml/tst_activitylist.qml\n+++ b/test/qml/tst_activitylist.qml\n@@ -31,7 +31,7 @@ TestCase {\n function test_activity_svg_resources_load_data() {\n return [\"activity-send\", \"activity-receive\", \"activity-multiple\", \"activity-payment-request\",\n \"activity-consolidation\", \"activity-split\", \"activity-internal\", \"activity-invoice\",\n- \"check\", \"coinbase\", \"file\"].map(function(name) { return { tag: name, name: name } })\n+ \"coinbase\", \"file\"].map(function(name) { return { tag: name, name: name } })\n }\n \n function test_activity_svg_resources_load(data) {\n@@ -94,8 +94,14 @@ TestCase {\n timestamp: new Date(2026, 6, 12, 17, 40).getTime() / 1000})\n ]\n }\n+ property string motionMode: \"\"\n+\n+ function cleanup() {\n+ Theme.motion.mode = motionMode\n+ }\n function init() {\n- Theme.dark = true\n+ motionMode = Theme.motion.mode\n+ Theme.paletteId = \"core-dark\"\n walletController.reset()\n walletController.initialized = true\n walletController.setSelectedWalletObject(testWalletModel)\n@@ -155,17 +161,26 @@ TestCase {\n verify(item !== null)\n const target = data.child ? findChild(item, \"activityAction_robert\") : item\n mouseClick(target, target.width / 2, target.height / 2, Qt.RightButton)\n- const menu = findChild(page, \"activityRowContextMenu\")\n+ // Transactions and payment requests each have their shared actions menu.\n+ const menu = findChild(page, data.request ? \"activityRequestContextMenu\" : \"activityRowContextMenu\")\n tryCompare(menu, \"opened\", true)\n+ // With motion off the menu opens before its rows are laid out.\n+ verify(waitForItemPolished(menu.contentItem))\n compare(page.depth, 1)\n const copyId = findChild(menu.contentItem, \"activityCopyTransactionId\")\n const copyRaw = findChild(menu.contentItem, \"activityCopyRawTransaction\")\n const copyRequest = findChild(menu.contentItem, \"activityCopyPaymentRequest\")\n- compare(copyId.visible, !data.request)\n- compare(copyRaw.visible, !data.request)\n- compare(copyRequest.visible, data.request)\n- compare(findChild(menu.contentItem, \"activityDeletePaymentRequest\").visible, data.request)\n- compare(findChild(menu.contentItem, \"activityDeletePaymentRequestDivider\").visible, data.request)\n+ compare(copyId !== null, !data.request)\n+ compare(copyRaw !== null, !data.request)\n+ compare(copyRequest !== null, data.request)\n+ if (data.request) {\n+ verify(copyRequest.visible)\n+ verify(findChild(menu.contentItem, \"activityDeletePaymentRequest\").visible)\n+ verify(findChild(menu.contentItem, \"activityDeletePaymentRequestDivider\").visible)\n+ } else {\n+ verify(copyId.visible)\n+ verify(copyRaw.visible)\n+ }\n if (data.request) {\n mouseClick(copyRequest)\n compare(Clipboard.text(), \"bitcoin:bc1qexample?amount=0.0001&label=Invoice\")\n@@ -188,7 +203,7 @@ TestCase {\n const page = createPage()\n const item = findChild(page, \"activityRequest_invoice\")\n mouseClick(item, item.width / 2, item.height / 2, Qt.RightButton)\n- const menu = findChild(page, \"activityRowContextMenu\")\n+ const menu = findChild(page, \"activityRequestContextMenu\")\n tryCompare(menu, \"opened\", true)\n const copy = findChild(menu.contentItem, \"activityCopyPaymentRequest\")\n verify(!copy.enabled)\n@@ -204,18 +219,25 @@ TestCase {\n const page = createPage()\n const item = findChild(page, \"activityRequest_invoice\")\n mouseClick(item, item.width / 2, item.height / 2, Qt.RightButton)\n- const menu = findChild(page, \"activityRowContextMenu\")\n+ const menu = findChild(page, \"activityRequestContextMenu\")\n tryCompare(menu, \"opened\", true)\n const button = findChild(menu.contentItem, \"activityDeletePaymentRequest\")\n compare(button.role, ContextMenuButton.Destructive)\n mouseClick(button)\n+ tryCompare(menu, \"visible\", false)\n+ // Nothing is deleted until the user confirms.\n+ compare(testWalletModel.lastRemovedRequestId, \"\")\n+ const confirmation = findChild(page, \"activityDeletePaymentRequestConfirmation\")\n+ tryCompare(confirmation, \"opened\", true)\n+ findChild(confirmation.contentItem, \"deletePaymentRequestConfirmButton\").clicked()\n+ tryCompare(confirmation, \"opened\", false)\n+ const error = findChild(page, \"activityDeletePaymentRequestConfirmationError\")\n if (data.succeeds) {\n- tryCompare(menu, \"visible\", false)\n compare(testWalletModel.lastRemovedRequestId, \"invoice\")\n+ compare(error.opened, false)\n } else {\n- verify(menu.opened)\n compare(testWalletModel.lastRemovedRequestId, \"\")\n- verify(findChild(menu.contentItem, \"activityDeletePaymentRequestError\").visible)\n+ tryCompare(error, \"opened\", true)\n }\n compare(page.depth, 1)\n }\n@@ -233,7 +255,7 @@ TestCase {\n verify(findChild(batch, \"activityAction_elisabeth\") !== null)\n const icon = findChild(batch, \"activityRowIcon\")\n compare(icon.iconSource.toString(), \"qrc:/icons/activity-send.svg\")\n- compare(icon.accent, Theme.color.orange)\n+ compare(icon.accent, Theme.color.txOutgoing)\n const children = findChild(batch, \"activityRowChildren\")\n verify(children.height >= findChild(batch, \"activityAction_robert\").height\n + findChild(batch, \"activityAction_elisabeth\").height)\n@@ -247,7 +269,46 @@ TestCase {\n testTransactionActivityModel.setRows(updated)\n const incomingIcon = findChild(findRow(page, \"batch\"), \"activityRowIcon\")\n compare(incomingIcon.iconSource.toString(), \"qrc:/icons/activity-receive.svg\")\n- compare(incomingIcon.accent, Theme.color.green)\n+ compare(incomingIcon.accent, Theme.color.txIncoming)\n+ }\n+\n+ function test_amounts_follow_privacy_setting_data() {\n+ return [\n+ {tag: \"regular\", width: 1180, hidden: false},\n+ {tag: \"compact\", width: 390, hidden: false},\n+ {tag: \"initially_hidden\", width: 1180, hidden: true},\n+ {tag: \"compact_initially_hidden\", width: 390, hidden: true}\n+ ]\n+ }\n+\n+ function test_amounts_follow_privacy_setting(data) {\n+ const original = optionsModel.hideAmounts\n+ testAccessibility.activate()\n+ try {\n+ optionsModel.hideAmounts = data.hidden\n+ const fixture = [rows()[0], rows()[3], rows()[6]]\n+ testTransactionActivityModel.setRows(fixture)\n+ const page = createPage({width: data.width})\n+ for (const hidden of [data.hidden, !data.hidden, data.hidden]) {\n+ optionsModel.hideAmounts = hidden\n+ for (const entry of fixture) {\n+ const item = findRow(page, entry.txid)\n+ const parent = testAccessibility.info(findChild(item, \"activityRowOpenButton\"))\n+ verify(parent.description.includes(hidden ? \"Hidden amount\" : entry.amount))\n+ if (hidden) verify(!parent.description.includes(entry.amount))\n+ for (const action of entry.actions) {\n+ const child = findChild(item, \"activityAction_\" + action.actionId)\n+ verify(child !== null)\n+ const info = testAccessibility.info(child)\n+ compare(info.name, action.label || action.address || \"Wallet contribution\")\n+ compare(info.description, action.address + \". \" + (hidden ? \"Hidden amount\" : action.amount))\n+ }\n+ }\n+ }\n+ } finally {\n+ optionsModel.hideAmounts = original\n+ testAccessibility.deactivate()\n+ }\n }\n \n function test_whole_row_highlights_and_opens_transaction_data() {\n@@ -282,7 +343,7 @@ TestCase {\n const x = target.width / 2\n const y = data.target.length > 0 ? target.height / 2 : row.height - 3\n mouseMove(target, x, y)\n- tryCompare(findChild(row, \"activityRowBackground\"), \"color\", Theme.color.neutral2)\n+ tryCompare(findChild(row, \"activityRowBackground\"), \"color\", Qt.tint(Theme.color.surface1, Theme.color.surfaceHover))\n compare(findChild(row, \"activityRowLabel\").color, Theme.color.neutral9)\n \n mouseClick(target, x, y)\n@@ -348,14 +409,14 @@ TestCase {\n verify(findChild(receive, \"activityRowMetadata\").text.endsWith(\"5 confirmations\"))\n compare(findChild(receive, \"activityRowIcon\").iconSource.toString(), \"qrc:/icons/activity-receive.svg\")\n verify(!findChild(receive, \"activityPendingRing\").visible)\n- compare(findChild(receive, \"activityRowAmount\").color, Theme.color.green)\n+ compare(findChild(receive, \"activityRowAmount\").color, Theme.color.txIncoming)\n verify(findChild(receive, \"activityRowRequestBadge\").visible)\n const request = findChild(page, \"activityRequest_invoice\")\n verify(request !== null)\n verify(findChild(request, \"activityRowMetadata\").text.includes(\"Payment request · Awaiting payment\"))\n compare(findChild(request, \"activityRowAmount\").color, Theme.color.neutral7)\n compare(findChild(request, \"activityRowIcon\").iconSource.toString(), \"qrc:/icons/activity-payment-request.svg\")\n- compare(findChild(request, \"activityRowIcon\").accent, Theme.color.lavender)\n+ compare(findChild(request, \"activityRowIcon\").accent, Theme.color.paymentRequest)\n verify(findChild(request, \"activityPendingRing\").visible)\n mouseClick(findChild(request, \"activityRowOpenButton\"))\n tryCompare(findChild(page, \"paymentRequestModal\"), \"opened\", true)\n@@ -379,9 +440,16 @@ TestCase {\n verify(total !== null)\n compare(proxy.pendingBalanceSat, 10000)\n compare(total.text, \"+10000 sats\")\n- compare(total.color, Theme.color.green)\n+ optionsModel.hideAmounts = true\n+ try {\n+ compare(total.shownText, total.maskText)\n+ compare(total.Accessible.name, \"Hidden amount\")\n+ } finally {\n+ optionsModel.hideAmounts = false\n+ }\n+ compare(total.color, Theme.color.txIncoming)\n verify(waitForRendering(page))\n- fuzzyCompare(total.mapToItem(page, total.width, 0).x, page.width - page.currentItem.activitySideInset, 0.1)\n+ fuzzyCompare(total.mapToItem(page, total.width, 0).x, page.width - page.currentItem.activitySideInset - Theme.space.xs, 0.1)\n compare(findChild(findChild(page, \"activityRequest_invoice\"), \"activityRowAmount\").color, Theme.color.neutral7)\n \n findChild(page, \"activitySearchField\").text = \"Robert\"\n@@ -439,7 +507,7 @@ TestCase {\n tryCompare(menu, \"visible\", false)\n tryCompare(single, \"isCompact\", true)\n tryVerify(function() { return single.height < comfortableHeight && batch.height < comfortableBatchHeight })\n- compare(findChild(single, \"activityRowIcon\").width, 32)\n+ tryCompare(findChild(single, \"activityRowIcon\"), \"width\", 32)\n verify(findChild(single, \"activityRowLabel\").visible)\n verify(!findChild(single, \"activityRowAddress\").visible)\n verify(findChild(findRow(page, \"no-note\"), \"activityRowAddress\").visible)\n@@ -516,7 +584,7 @@ TestCase {\n fixture[3].depth = 3\n testTransactionActivityModel.setRows(fixture)\n tryCompare(page.currentItem, \"depth\", 3)\n- verify(!findChild(page.currentItem, \"transactionDetailsError\").visible)\n+ tryVerify(function() { return !findChild(page.currentItem, \"transactionDetailsError\").visible })\n }\n \n function test_request_modal_preserves_activity_and_transaction_navigation() {\n@@ -593,9 +661,8 @@ TestCase {\n compare(selfSend.displayLabel, \"Sent to yourself\")\n compare(selfSend.hasChildren, false)\n compare(findChild(selfSend, \"activityRowIcon\").iconSource.toString(), \"qrc:/icons/activity-internal.svg\")\n- compare(findChild(selfSend, \"activityRowIcon\").accent, Theme.color.purple)\n- const purple = Theme.color.purple\n- compare(findChild(selfSend, \"activityRowIcon\").color, Qt.rgba(purple.r, purple.g, purple.b, 64 / 255))\n+ compare(findChild(selfSend, \"activityRowIcon\").accent, Theme.color.txInternal)\n+ compare(findChild(selfSend, \"activityRowIcon\").color, Theme.color.tint(Theme.color.txInternal))\n fixture.label = \"Personal savings\"\n testTransactionActivityModel.setRows([fixture])\n compare(findRow(page, \"self\").displayLabel, \"Personal savings\")\n@@ -717,6 +784,7 @@ TestCase {\n }\n \n function test_filter_button_animates_and_reserves_space() {\n+ Theme.motion.mode = \"full\"\n const page = createPage()\n const proxy = findChild(page, \"activityFilterProxyModel\")\n const button = findChild(page, \"activityTypeFilterButton\")\n@@ -761,9 +829,9 @@ TestCase {\n verify(sent.selected && sentToSelf.selected && !all.selected)\n compare(proxy.typeFilters.length, 2)\n compare(badge.count, 1)\n- compare(button.background.color, Theme.color.orange)\n- compare(findChild(button, \"dropdownButtonCaret\").color, Theme.color.neutral9)\n- compare(badge.background.color, Theme.color.orange)\n+ compare(button.background.color, Theme.color.activeFill)\n+ compare(findChild(button, \"dropdownButtonCaret\").color, Theme.color.activeForeground)\n+ compare(badge.background.color, Theme.color.activeFill)\n verify(findRow(page, \"batch\") !== null)\n verify(findRow(page, \"consolidation\") !== null)\n verify(findRow(page, \"split\") !== null)\n@@ -790,7 +858,7 @@ TestCase {\n const clearMenu = findChild(page, \"activityClearFiltersMenu\")\n tryCompare(clearMenu, \"opened\", true)\n const clear = findChild(clearMenu.contentItem, \"activityClearFiltersAction\")\n- compare(clear.role, ContextMenuButton.Destructive)\n+ compare(clear.role, ContextMenuButton.Normal)\n mouseClick(clear)\n tryCompare(badge, \"visible\", false)\n compare(proxy.typeFilters.length, 0)\n@@ -846,10 +914,11 @@ TestCase {\n const label = findChild(calendar, \"calendarMonthLabel\")\n const previous = Qt.uiLanguage\n try {\n+ // The month and year order follows the host's regional format.\n Qt.uiLanguage = \"sr_Latn_RS\"\n- compare(label.text, \"januar 2026\")\n+ verify(label.text.indexOf(\"januar\") >= 0, label.text)\n Qt.uiLanguage = \"sr_Cyrl_RS\"\n- compare(label.text, \"јануар 2026\")\n+ verify(label.text.indexOf(\"јануар\") >= 0, label.text)\n } finally {\n Qt.uiLanguage = previous\n }\n@@ -863,6 +932,14 @@ TestCase {\n const menu = findChild(page, \"activityAmountFilterPopup\")\n tryCompare(menu, \"opened\", true)\n const slider = findChild(page, \"activityAmountRangeSlider\")\n+ optionsModel.hideAmounts = true\n+ try {\n+ compare(findChild(page, \"activityAmountRangeLabel\").Accessible.name, \"Hidden amount\")\n+ compare(slider.first.handle.value, undefined)\n+ compare(slider.second.handle.maximumValue, undefined)\n+ } finally {\n+ optionsModel.hideAmounts = false\n+ }\n const handle = slider.second.handle\n const start = handle.mapToItem(slider, handle.width / 2, handle.height / 2)\n mousePress(slider, start.x, start.y)\n@@ -954,11 +1031,11 @@ TestCase {\n const metadata = findChild(receive, \"activityRowMetadata\")\n verify(amount.y >= metadata.y + metadata.height)\n verify(receive.width <= page.width)\n- Theme.dark = false\n+ Theme.paletteId = \"core-light\"\n page.width = 1180\n tryCompare(receive, \"compact\", false)\n- tryCompare(findChild(receive, \"activityRowAmount\"), \"color\", Theme.color.green)\n- compare(page.currentItem.background.color, Theme.color.neutral0)\n- Theme.dark = true\n+ tryCompare(findChild(receive, \"activityRowAmount\"), \"color\", Theme.color.txIncoming)\n+ compare(page.currentItem.background.color, Theme.color.background)\n+ Theme.paletteId = \"core-dark\"\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 969,
"evidence_id": "e9c638f741a74a828dc222bbfb82f143",
"finding_id": "finding:3",
"kind": "new_source",
"line": 820,
"new_head": "85fc1d06318944c6b33702736cbb44946b37453a",
"old_head": "1f6c58c1a018a35009878f6b074544e5d1a6aba6",
"path": "test/qml/tst_activitylist.qml",
"revision": "85fc1d06318944c6b33702736cbb44946b37453a",
"source_generation": 3,
"source_job_id": 2549,
"text": " tryCompare(menu, \"opened\", true)\n const all = findChild(menu.contentItem, \"activityTypeAll\")\n const sent = findChild(menu.contentItem, \"activityTypeSent\")\n const sentToSelf = findChild(menu.contentItem, \"activityTypeSentToSelf\")\n verify(all.selected)\n compare(all.text, \"All activity\")\n mouseClick(sent)\n mouseClick(sentToSelf)\n compare(menu.opened, true)\n verify(sent.selected && sentToSelf.selected && !all.selected)\n compare(proxy.typeFilters.length, 2)\n compare(badge.count, 1)\n compare(button.background.color, Theme.color.activeFill)\n compare(findChild(button, \"dropdownButtonCaret\").color, Theme.color.activeForeground)\n compare(badge.background.color, Theme.color.activeFill)\n verify(findRow(page, \"batch\") !== null)\n verify(findRow(page, \"consolidation\") !== null)\n verify(findRow(page, \"split\") !== null)\n mouseClick(sent)\n mouseClick(sentToSelf)\n verify(all.selected)\n compare(button.active, false)\n tryCompare(badge, \"visible\", false)\n mouseClick(sent)\n mouseClick(sentToSelf)\n mouseClick(all)\n compare(proxy.typeFilters.length, 0)\n verify(!sent.selected && !sentToSelf.selected)\n mouseClick(sent)\n menu.close()\n tryCompare(menu, \"visible\", false)\n proxy.dateFilter = ActivityFilterProxyModel.ThisYear\n proxy.setAmountRange(0, 200000)\n compare(badge.count, 3)\n findChild(page, \"activitySearchField\").text = \"Robert\"\n compare(badge.count, 3) // Search is independent of the three filter categories.\n waitForRendering(page)\n mouseClick(badge)\n const clearMenu = findChild(page, \"activityClearFiltersMenu\")\n tryCompare(clearMenu, \"opened\", true)\n const clear = findChild(clearMenu.contentItem, \"activityClearFiltersAction\")\n compare(clear.role, ContextMenuButton.Normal)\n mouseClick(clear)\n tryCompare(badge, \"visible\", false)\n compare(proxy.typeFilters.length, 0)\n compare(proxy.dateFilter, ActivityFilterProxyModel.DateAll)\n compare(proxy.minAmount, -1)\n compare(proxy.maxAmount, -1)\n compare(proxy.searchText, \"Robert\")\n }\n\n function test_date_presets_are_single_selection_and_custom_range_activates() {\n const page = createPage()\n const proxy = findChild(page, \"activityFilterProxyModel\")\n const button = findChild(page, \"activityDateFilterButton\")\n mouseClick(button)\n const menu = findChild(page, \"activityDateFilterPopup\")\n tryCompare(menu, \"opened\", true)\n compare(findChild(menu.contentItem, \"activityDateAll\"), null)\n mouseClick(findChild(menu.contentItem, \"activityDateToday\"))\n tryCompare(menu, \"visible\", false)\n verify(button.active)\n mouseClick(button)\n tryCompare(menu, \"opened\", true)\n verify(findChild(menu.contentItem, \"activityDateToday\").selected)\n mouseClick(findChild(menu.contentItem, \"activityDateThisYear\"))\n tryCompare(menu, \"visible\", false)\n mouseClick(button)\n tryCompare(menu, \"opened\", true)\n verify(!findChild(menu.contentItem, \"activityDateToday\").selected)\n verify(findChild(menu.contentItem, \"activityDateThisYear\").selected)\n mouseClick(findChild(menu.contentItem, \"activityDateCustomRange\"))\n const calendar = findChild(page, \"activityCalendar\")\n tryCompare(calendar, \"visible\", true)\n verify(waitForItemPolished(calendar))\n calendar.seed(new Date(2026, 8, 1), new Date(2026, 8, 15))\n const apply = findChild(page, \"activityDateRangeApply\")\n tryCompare(apply, \"enabled\", true)\n verify(waitForItemPolished(apply))\n apply.clicked()\n tryCompare(proxy, \"dateFilter\", ActivityFilterProxyModel.CustomRange)\n verify(button.active)\n compare(button.text, \"Date\")\n }\n\n function test_calendar_names_follow_ui_language_script() {\n const page = createPage()\n mouseClick(findChild(page, \"activityDateFilterButton\"))\n const menu = findChild(page, \"activityDateFilterPopup\")\n tryCompare(menu, \"opened\", true)\n mouseClick(findChild(menu.contentItem, \"activityDateCustomRange\"))\n const calendar = findChild(page, \"activityCalendar\")\n tryCompare(calendar, \"visible\", true)\n calendar.seed(new Date(2026, 0, 1), new Date(2026, 0, 15))\n const label = findChild(calendar, \"calendarMonthLabel\")\n const previous = Qt.uiLanguage\n try {\n // The month and year order follows the host's regional format.\n Qt.uiLanguage = \"sr_Latn_RS\"\n verify(label.text.indexOf(\"januar\") >= 0, label.text)\n Qt.uiLanguage = \"sr_Cyrl_RS\"\n verify(label.text.indexOf(\"јануар\") >= 0, label.text)\n } finally {\n Qt.uiLanguage = previous\n }\n }\n\n function test_amount_slider_updates_live_and_resets() {\n const page = createPage({width: 390})\n const proxy = findChild(page, \"activityFilterProxyModel\")\n const button = findChild(page, \"activityAmountFilterButton\")\n mouseClick(button)\n const menu = findChild(page, \"activityAmountFilterPopup\")\n tryCompare(menu, \"opened\", true)\n const slider = findChild(page, \"activityAmountRangeSlider\")\n optionsModel.hideAmounts = true\n try {\n compare(findChild(page, \"activityAmountRangeLabel\").Accessible.name, \"Hidden amount\")\n compare(slider.first.handle.value, undefined)\n compare(slider.second.handle.maximumValue, undefined)\n } finally {\n optionsModel.hideAmounts = false\n }\n const handle = slider.second.handle\n const start = handle.mapToItem(slider, handle.width / 2, handle.height / 2)\n mousePress(slider, start.x, start.y)\n mouseMove(slider, slider.width * 0.6, start.y, 100)\n mouseRelease(slider, slider.width * 0.6, start.y)\n verify(proxy.maxAmount > 0 && proxy.maxAmount < 312500000)\n verify(button.active)\n compare(findChild(page, \"activityActiveFiltersButton\").count, 1)\n compare(slider.maxValue, 312500000) // Filtering must not shrink the available range.\n const maximum = proxy.maxAmount\n menu.close()\n tryCompare(menu, \"visible\", false)\n mouseClick(button)\n tryCompare(menu, \"opened\", true)\n compare(Math.round(slider.upperValue), maximum)\n compare(findChild(page, \"activityAmountReset\"), null)\n slider.setValues(0, slider.maxValue)\n slider.second.moved()\n compare(button.active, false)\n compare(slider.lowerValue, 0)\n compare(slider.upperValue, slider.maxValue)\n testTransactionActivityModel.setRows([])\n tryCompare(slider, \"maxValue\", 0)\n compare(slider.enabled, false)\n menu.close()\n testTransactionActivityModel.setRows(rows())\n proxy.setAmountRange(100, 500)",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f6c58c1a018..85fc1d063189 2026-11-16T23:01:31Z · gpt-6-luna |
| gui#1051 | Same-language long-date variants lose their literal wordsqml/applocale.cpp | addressed | AssessmentThe new WordsInNamesScripts check accepts customized long-date patterns when their letters are in the names locale's scripts, in addition to the exact built-in-pattern match. Thus a same-language Spanish pattern with quoted literal words is retained rather than stripped merely because its full pattern differs. path_diff: qml/applocale.cpp; new_source: qml/applocale.cpp [
{
"evidence_id": "2e419446c6ce4aef8fb4328d06a125bd",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "85fc1d06318944c6b33702736cbb44946b37453a",
"old_head": "1f6c58c1a018a35009878f6b074544e5d1a6aba6",
"path": "qml/applocale.cpp",
"source_generation": 3,
"source_job_id": 2549,
"text": "diff --git a/qml/applocale.cpp b/qml/applocale.cpp\nindex dad86bdf..ca979115 100644\n--- a/qml/applocale.cpp\n+++ b/qml/applocale.cpp\n@@ -6,6 +6,7 @@\n \n #include <QCoreApplication>\n #include <QRegularExpression>\n+#include <QSet>\n \n namespace {\n QStringList ScriptModifiers(QLocale::Script script)\n@@ -15,19 +16,16 @@ QStringList ScriptModifiers(QLocale::Script script)\n return {};\n }\n \n-bool LoadSystemLanguage(QTranslator& translator, const QStringList& ui_languages, const QString& name)\n+bool LoadSystemLanguage(QTranslator& translator, const QString& ui_language, const QString& name)\n {\n const QString directory = QStringLiteral(\":/translations\");\n- for (const QString& ui_language : ui_languages) {\n- const QLocale locale(ui_language);\n- // Bundled files name the script after '@', such as sr@latin, which QTranslator's lookup never tries.\n- for (const QString& modifier : ScriptModifiers(locale.script())) {\n- const QString file = QStringLiteral(\"%1/%2_%3@%4.qm\").arg(directory, name, QLocale::languageToCode(locale.language()), modifier);\n- if (translator.load(file)) return true;\n- }\n- if (translator.load(locale, name, QStringLiteral(\"_\"), directory)) return true;\n+ const QLocale locale(ui_language);\n+ // Bundled files name the script after '@', such as sr@latin, which QTranslator's lookup never tries.\n+ for (const QString& modifier : ScriptModifiers(locale.script())) {\n+ const QString file = QStringLiteral(\"%1/%2_%3@%4.qm\").arg(directory, name, QLocale::languageToCode(locale.language()), modifier);\n+ if (translator.load(file)) return true;\n }\n- return false;\n+ return translator.load(locale, name, QStringLiteral(\"_\"), directory);\n }\n \n // Only the GUI thread reads or writes it, unlike QLocale::setDefault().\n@@ -80,6 +78,29 @@ QString WithoutWords(const QString& pattern)\n return result;\n }\n \n+bool WordsInNamesScripts(const QString& pattern, const QLocale& names)\n+{\n+ QSet<QChar::Script> scripts;\n+ const auto add = [&](const QString& name) {\n+ for (const QChar c : name) {\n+ if (c.isLetter()) scripts.insert(c.script());\n+ }\n+ };\n+ for (int month = 1; month <= 12; ++month) add(names.monthName(month));\n+ for (int day = 1; day <= 7; ++day) add(names.dayName(day));\n+\n+ bool quoted = false;\n+ for (const QChar c : pattern) {\n+ if (c == QLatin1Char('\\'')) {\n+ quoted = !quoted;\n+ continue;\n+ }\n+ const bool field = !quoted && (c == QLatin1Char('d') || c == QLatin1Char('M') || c == QLatin1Char('y'));\n+ if (!field && c.isLetter() && !scripts.contains(c.script())) return false;\n+ }\n+ return true;\n+}\n+\n QLocale SystemNamesLocale(const QLocale& system_locale, const QTranslator* translator)\n {\n // Untranslated text is English, so dates match it.\n@@ -112,9 +133,12 @@ QString QmlWordDateFormat(QmlWordDate kind, const QLocale& names, const QLocale&\n const QString fields = WithoutWords(regional_format);\n if (kind == QmlWordDate::Long) {\n // The system can report one language and take its date pattern from another, such as\n- // LANG=es_ES with LC_TIME=ja_JP, so keep the words only when the pattern is the names language's own.\n+ // LANG=es_ES with LC_TIME=ja_JP, so a customized pattern keeps its words only when they\n+ // are written in the script of the names language.\n const QLocale names_in_region(names.language(), names.script(), regional.territory());\n- return regional_format == names_in_region.dateFormat(QLocale::LongFormat) ? regional_format : fields;\n+ const bool own_pattern = regional_format == names_in_region.dateFormat(QLocale::LongFormat)\n+ || (regional.language() == names.language() && WordsInNamesScripts(regional_format, names));\n+ return own_pattern ? regional_format : fields;\n }\n return fields.indexOf(QLatin1Char('y')) < fields.indexOf(QLatin1Char('M'))\n ? QStringLiteral(\"yyyy MMMM\")\n@@ -134,18 +158,30 @@ void QmlTranslations::install(const QString& language, const QLocale& system_loc\n \n void QmlTranslations::install(const QString& language, const QLocale& system_locale, const QStringList& ui_languages)\n {\n- const auto load = [&](const QString& name) -> std::unique_ptr<QTranslator> {\n+ const auto load = [&](const QString& name, const QString& ui_language) -> std::unique_ptr<QTranslator> {\n auto translator = std::make_unique<QTranslator>();\n const bool loaded = language.isEmpty()\n- ? LoadSystemLanguage(*translator, ui_languages, name)\n+ ? LoadSystemLanguage(*translator, ui_language, name)\n : translator->load(QStringLiteral(\":/translations/%1_%2.qm\").arg(name, language));\n return loaded ? std::move(translator) : nullptr;\n };\n- auto app_translator = load(QStringLiteral(\"bitcoin\"));\n- auto qml_translator = load(QStringLiteral(\"bitcoin_qml\"));\n+ std::unique_ptr<QTranslator> app_translator;\n+ std::unique_ptr<QTranslator> qml_translator;\n+ if (language.isEmpty()) {\n+ // Both catalogs take the first preferred language either one has, so a\n+ // language missing from one of them does not mix two languages.\n+ for (const QString& ui_language : ui_languages) {\n+ app_translator = load(QStringLiteral(\"bitcoin\"), ui_language);\n+ qml_translator = load(QStringLiteral(\"bitcoin_qml\"), ui_language);\n+ if (app_translator || qml_translator) break;\n+ }\n+ } else {\n+ app_translator = load(QStringLiteral(\"bitcoin\"), language);\n+ qml_translator = load(QStringLiteral(\"bitcoin_qml\"), language);\n+ }\n \n // Set first so the translators' LanguageChange events see the new names.\n- NamesLocale() = language.isEmpty() ? SystemNamesLocale(system_locale, app_translator.get())\n+ NamesLocale() = language.isEmpty() ? SystemNamesLocale(system_locale, app_translator ? app_translator.get() : qml_translator.get())\n : (app_translator || qml_translator) ? LanguageLocale(language) : QLocale(QLocale::English);\n \n const auto replace = [](std::unique_ptr<QTranslator>& slot, std::unique_ptr<QTranslator> translator) {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 194,
"evidence_id": "074333ab55eb44729c602e8ba69b4089",
"finding_id": "finding:2",
"kind": "new_source",
"line": 87,
"new_head": "85fc1d06318944c6b33702736cbb44946b37453a",
"old_head": "1f6c58c1a018a35009878f6b074544e5d1a6aba6",
"path": "qml/applocale.cpp",
"revision": "85fc1d06318944c6b33702736cbb44946b37453a",
"source_generation": 3,
"source_job_id": 2549,
"text": " }\n };\n for (int month = 1; month <= 12; ++month) add(names.monthName(month));\n for (int day = 1; day <= 7; ++day) add(names.dayName(day));\n\n bool quoted = false;\n for (const QChar c : pattern) {\n if (c == QLatin1Char('\\'')) {\n quoted = !quoted;\n continue;\n }\n const bool field = !quoted && (c == QLatin1Char('d') || c == QLatin1Char('M') || c == QLatin1Char('y'));\n if (!field && c.isLetter() && !scripts.contains(c.script())) return false;\n }\n return true;\n}\n\nQLocale SystemNamesLocale(const QLocale& system_locale, const QTranslator* translator)\n{\n // Untranslated text is English, so dates match it.\n if (!translator) return QLocale(QLocale::English);\n const QLocale translated = LanguageLocale(translator->language());\n const bool same_language = translated.language() == system_locale.language() && translated.script() == system_locale.script();\n return same_language ? system_locale : translated;\n}\n} // namespace\n\nQLocale QmlNamesLocale()\n{\n return NamesLocale();\n}\n\nQString QmlLocaleName(const QLocale& locale)\n{\n return QStringLiteral(\"%1_%2_%3\").arg(QLocale::languageToCode(locale.language()),\n QLocale::scriptToCode(locale.script()),\n QLocale::territoryToCode(locale.territory()));\n}\n\nQString QmlWordDateFormat(QmlWordDate kind, const QLocale& names, const QLocale& regional)\n{\n return QmlWordDateFormat(kind, names, regional, regional.dateFormat(QLocale::LongFormat));\n}\n\nQString QmlWordDateFormat(QmlWordDate kind, const QLocale& names, const QLocale& regional, const QString& regional_format)\n{\n const QString fields = WithoutWords(regional_format);\n if (kind == QmlWordDate::Long) {\n // The system can report one language and take its date pattern from another, such as\n // LANG=es_ES with LC_TIME=ja_JP, so a customized pattern keeps its words only when they\n // are written in the script of the names language.\n const QLocale names_in_region(names.language(), names.script(), regional.territory());\n const bool own_pattern = regional_format == names_in_region.dateFormat(QLocale::LongFormat)\n || (regional.language() == names.language() && WordsInNamesScripts(regional_format, names));\n return own_pattern ? regional_format : fields;\n }\n return fields.indexOf(QLatin1Char('y')) < fields.indexOf(QLatin1Char('M'))\n ? QStringLiteral(\"yyyy MMMM\")\n : QStringLiteral(\"MMMM yyyy\");\n}\n\nQString QmlAppLocale::wordDateFormat(const QString& names_locale, bool month_year) const\n{\n return QmlWordDateFormat(month_year ? QmlWordDate::MonthYear : QmlWordDate::Long,\n names_locale.isEmpty() ? QLocale() : QLocale(names_locale));\n}\n\nvoid QmlTranslations::install(const QString& language, const QLocale& system_locale)\n{\n install(language, system_locale, system_locale.uiLanguages());\n}\n\nvoid QmlTranslations::install(const QString& language, const QLocale& system_locale, const QStringList& ui_languages)\n{\n const auto load = [&](const QString& name, const QString& ui_language) -> std::unique_ptr<QTranslator> {\n auto translator = std::make_unique<QTranslator>();\n const bool loaded = language.isEmpty()\n ? LoadSystemLanguage(*translator, ui_language, name)\n : translator->load(QStringLiteral(\":/translations/%1_%2.qm\").arg(name, language));\n return loaded ? std::move(translator) : nullptr;\n };\n std::unique_ptr<QTranslator> app_translator;\n std::unique_ptr<QTranslator> qml_translator;\n if (language.isEmpty()) {\n // Both catalogs take the first preferred language either one has, so a\n // language missing from one of them does not mix two languages.\n for (const QString& ui_language : ui_languages) {\n app_translator = load(QStringLiteral(\"bitcoin\"), ui_language);\n qml_translator = load(QStringLiteral(\"bitcoin_qml\"), ui_language);\n if (app_translator || qml_translator) break;\n }\n } else {\n app_translator = load(QStringLiteral(\"bitcoin\"), language);\n qml_translator = load(QStringLiteral(\"bitcoin_qml\"), language);\n }\n\n // Set first so the translators' LanguageChange events see the new names.\n NamesLocale() = language.isEmpty() ? SystemNamesLocale(system_locale, app_translator ? app_translator.get() : qml_translator.get())\n : (app_translator || qml_translator) ? LanguageLocale(language) : QLocale(QLocale::English);\n\n const auto replace = [](std::unique_ptr<QTranslator>& slot, std::unique_ptr<QTranslator> translator) {\n if (slot) QCoreApplication::removeTranslator(slot.get());\n slot = std::move(translator);\n if (slot) QCoreApplication::installTranslator(slot.get());\n };\n replace(m_app_translator, std::move(app_translator));\n replace(m_qml_translator, std::move(qml_translator));\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f6c58c1a018..85fc1d063189 2026-11-16T23:01:31Z · gpt-6-luna |
| gui#1051 | System default can select different languages for Core and QMLqml/applocale.cpp | addressed | AssessmentSystem-default loading now iterates preferred languages once and tries both catalogs for each preference, stopping when either catalog loads. With en-US first, the English Core catalog loads and no Spanish QML catalog is selected later, avoiding the reported mismatch. path_diff: qml/applocale.cpp; new_source: qml/applocale.cpp [
{
"evidence_id": "eee1181cd2d940a5ab2ba58a8b6b60f6",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "85fc1d06318944c6b33702736cbb44946b37453a",
"old_head": "1f6c58c1a018a35009878f6b074544e5d1a6aba6",
"path": "qml/applocale.cpp",
"source_generation": 3,
"source_job_id": 2549,
"text": "diff --git a/qml/applocale.cpp b/qml/applocale.cpp\nindex dad86bdf..ca979115 100644\n--- a/qml/applocale.cpp\n+++ b/qml/applocale.cpp\n@@ -6,6 +6,7 @@\n \n #include <QCoreApplication>\n #include <QRegularExpression>\n+#include <QSet>\n \n namespace {\n QStringList ScriptModifiers(QLocale::Script script)\n@@ -15,19 +16,16 @@ QStringList ScriptModifiers(QLocale::Script script)\n return {};\n }\n \n-bool LoadSystemLanguage(QTranslator& translator, const QStringList& ui_languages, const QString& name)\n+bool LoadSystemLanguage(QTranslator& translator, const QString& ui_language, const QString& name)\n {\n const QString directory = QStringLiteral(\":/translations\");\n- for (const QString& ui_language : ui_languages) {\n- const QLocale locale(ui_language);\n- // Bundled files name the script after '@', such as sr@latin, which QTranslator's lookup never tries.\n- for (const QString& modifier : ScriptModifiers(locale.script())) {\n- const QString file = QStringLiteral(\"%1/%2_%3@%4.qm\").arg(directory, name, QLocale::languageToCode(locale.language()), modifier);\n- if (translator.load(file)) return true;\n- }\n- if (translator.load(locale, name, QStringLiteral(\"_\"), directory)) return true;\n+ const QLocale locale(ui_language);\n+ // Bundled files name the script after '@', such as sr@latin, which QTranslator's lookup never tries.\n+ for (const QString& modifier : ScriptModifiers(locale.script())) {\n+ const QString file = QStringLiteral(\"%1/%2_%3@%4.qm\").arg(directory, name, QLocale::languageToCode(locale.language()), modifier);\n+ if (translator.load(file)) return true;\n }\n- return false;\n+ return translator.load(locale, name, QStringLiteral(\"_\"), directory);\n }\n \n // Only the GUI thread reads or writes it, unlike QLocale::setDefault().\n@@ -80,6 +78,29 @@ QString WithoutWords(const QString& pattern)\n return result;\n }\n \n+bool WordsInNamesScripts(const QString& pattern, const QLocale& names)\n+{\n+ QSet<QChar::Script> scripts;\n+ const auto add = [&](const QString& name) {\n+ for (const QChar c : name) {\n+ if (c.isLetter()) scripts.insert(c.script());\n+ }\n+ };\n+ for (int month = 1; month <= 12; ++month) add(names.monthName(month));\n+ for (int day = 1; day <= 7; ++day) add(names.dayName(day));\n+\n+ bool quoted = false;\n+ for (const QChar c : pattern) {\n+ if (c == QLatin1Char('\\'')) {\n+ quoted = !quoted;\n+ continue;\n+ }\n+ const bool field = !quoted && (c == QLatin1Char('d') || c == QLatin1Char('M') || c == QLatin1Char('y'));\n+ if (!field && c.isLetter() && !scripts.contains(c.script())) return false;\n+ }\n+ return true;\n+}\n+\n QLocale SystemNamesLocale(const QLocale& system_locale, const QTranslator* translator)\n {\n // Untranslated text is English, so dates match it.\n@@ -112,9 +133,12 @@ QString QmlWordDateFormat(QmlWordDate kind, const QLocale& names, const QLocale&\n const QString fields = WithoutWords(regional_format);\n if (kind == QmlWordDate::Long) {\n // The system can report one language and take its date pattern from another, such as\n- // LANG=es_ES with LC_TIME=ja_JP, so keep the words only when the pattern is the names language's own.\n+ // LANG=es_ES with LC_TIME=ja_JP, so a customized pattern keeps its words only when they\n+ // are written in the script of the names language.\n const QLocale names_in_region(names.language(), names.script(), regional.territory());\n- return regional_format == names_in_region.dateFormat(QLocale::LongFormat) ? regional_format : fields;\n+ const bool own_pattern = regional_format == names_in_region.dateFormat(QLocale::LongFormat)\n+ || (regional.language() == names.language() && WordsInNamesScripts(regional_format, names));\n+ return own_pattern ? regional_format : fields;\n }\n return fields.indexOf(QLatin1Char('y')) < fields.indexOf(QLatin1Char('M'))\n ? QStringLiteral(\"yyyy MMMM\")\n@@ -134,18 +158,30 @@ void QmlTranslations::install(const QString& language, const QLocale& system_loc\n \n void QmlTranslations::install(const QString& language, const QLocale& system_locale, const QStringList& ui_languages)\n {\n- const auto load = [&](const QString& name) -> std::unique_ptr<QTranslator> {\n+ const auto load = [&](const QString& name, const QString& ui_language) -> std::unique_ptr<QTranslator> {\n auto translator = std::make_unique<QTranslator>();\n const bool loaded = language.isEmpty()\n- ? LoadSystemLanguage(*translator, ui_languages, name)\n+ ? LoadSystemLanguage(*translator, ui_language, name)\n : translator->load(QStringLiteral(\":/translations/%1_%2.qm\").arg(name, language));\n return loaded ? std::move(translator) : nullptr;\n };\n- auto app_translator = load(QStringLiteral(\"bitcoin\"));\n- auto qml_translator = load(QStringLiteral(\"bitcoin_qml\"));\n+ std::unique_ptr<QTranslator> app_translator;\n+ std::unique_ptr<QTranslator> qml_translator;\n+ if (language.isEmpty()) {\n+ // Both catalogs take the first preferred language either one has, so a\n+ // language missing from one of them does not mix two languages.\n+ for (const QString& ui_language : ui_languages) {\n+ app_translator = load(QStringLiteral(\"bitcoin\"), ui_language);\n+ qml_translator = load(QStringLiteral(\"bitcoin_qml\"), ui_language);\n+ if (app_translator || qml_translator) break;\n+ }\n+ } else {\n+ app_translator = load(QStringLiteral(\"bitcoin\"), language);\n+ qml_translator = load(QStringLiteral(\"bitcoin_qml\"), language);\n+ }\n \n // Set first so the translators' LanguageChange events see the new names.\n- NamesLocale() = language.isEmpty() ? SystemNamesLocale(system_locale, app_translator.get())\n+ NamesLocale() = language.isEmpty() ? SystemNamesLocale(system_locale, app_translator ? app_translator.get() : qml_translator.get())\n : (app_translator || qml_translator) ? LanguageLocale(language) : QLocale(QLocale::English);\n \n const auto replace = [](std::unique_ptr<QTranslator>& slot, std::unique_ptr<QTranslator> translator) {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 194,
"evidence_id": "2fd53a5fd07844b0b481d8d73153413b",
"finding_id": "finding:1",
"kind": "new_source",
"line": 114,
"new_head": "85fc1d06318944c6b33702736cbb44946b37453a",
"old_head": "1f6c58c1a018a35009878f6b074544e5d1a6aba6",
"path": "qml/applocale.cpp",
"revision": "85fc1d06318944c6b33702736cbb44946b37453a",
"source_generation": 3,
"source_job_id": 2549,
"text": "QLocale QmlNamesLocale()\n{\n return NamesLocale();\n}\n\nQString QmlLocaleName(const QLocale& locale)\n{\n return QStringLiteral(\"%1_%2_%3\").arg(QLocale::languageToCode(locale.language()),\n QLocale::scriptToCode(locale.script()),\n QLocale::territoryToCode(locale.territory()));\n}\n\nQString QmlWordDateFormat(QmlWordDate kind, const QLocale& names, const QLocale& regional)\n{\n return QmlWordDateFormat(kind, names, regional, regional.dateFormat(QLocale::LongFormat));\n}\n\nQString QmlWordDateFormat(QmlWordDate kind, const QLocale& names, const QLocale& regional, const QString& regional_format)\n{\n const QString fields = WithoutWords(regional_format);\n if (kind == QmlWordDate::Long) {\n // The system can report one language and take its date pattern from another, such as\n // LANG=es_ES with LC_TIME=ja_JP, so a customized pattern keeps its words only when they\n // are written in the script of the names language.\n const QLocale names_in_region(names.language(), names.script(), regional.territory());\n const bool own_pattern = regional_format == names_in_region.dateFormat(QLocale::LongFormat)\n || (regional.language() == names.language() && WordsInNamesScripts(regional_format, names));\n return own_pattern ? regional_format : fields;\n }\n return fields.indexOf(QLatin1Char('y')) < fields.indexOf(QLatin1Char('M'))\n ? QStringLiteral(\"yyyy MMMM\")\n : QStringLiteral(\"MMMM yyyy\");\n}\n\nQString QmlAppLocale::wordDateFormat(const QString& names_locale, bool month_year) const\n{\n return QmlWordDateFormat(month_year ? QmlWordDate::MonthYear : QmlWordDate::Long,\n names_locale.isEmpty() ? QLocale() : QLocale(names_locale));\n}\n\nvoid QmlTranslations::install(const QString& language, const QLocale& system_locale)\n{\n install(language, system_locale, system_locale.uiLanguages());\n}\n\nvoid QmlTranslations::install(const QString& language, const QLocale& system_locale, const QStringList& ui_languages)\n{\n const auto load = [&](const QString& name, const QString& ui_language) -> std::unique_ptr<QTranslator> {\n auto translator = std::make_unique<QTranslator>();\n const bool loaded = language.isEmpty()\n ? LoadSystemLanguage(*translator, ui_language, name)\n : translator->load(QStringLiteral(\":/translations/%1_%2.qm\").arg(name, language));\n return loaded ? std::move(translator) : nullptr;\n };\n std::unique_ptr<QTranslator> app_translator;\n std::unique_ptr<QTranslator> qml_translator;\n if (language.isEmpty()) {\n // Both catalogs take the first preferred language either one has, so a\n // language missing from one of them does not mix two languages.\n for (const QString& ui_language : ui_languages) {\n app_translator = load(QStringLiteral(\"bitcoin\"), ui_language);\n qml_translator = load(QStringLiteral(\"bitcoin_qml\"), ui_language);\n if (app_translator || qml_translator) break;\n }\n } else {\n app_translator = load(QStringLiteral(\"bitcoin\"), language);\n qml_translator = load(QStringLiteral(\"bitcoin_qml\"), language);\n }\n\n // Set first so the translators' LanguageChange events see the new names.\n NamesLocale() = language.isEmpty() ? SystemNamesLocale(system_locale, app_translator ? app_translator.get() : qml_translator.get())\n : (app_translator || qml_translator) ? LanguageLocale(language) : QLocale(QLocale::English);\n\n const auto replace = [](std::unique_ptr<QTranslator>& slot, std::unique_ptr<QTranslator> translator) {\n if (slot) QCoreApplication::removeTranslator(slot.get());\n slot = std::move(translator);\n if (slot) QCoreApplication::installTranslator(slot.get());\n };\n replace(m_app_translator, std::move(app_translator));\n replace(m_qml_translator, std::move(qml_translator));\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 1f6c58c1a018..85fc1d063189 2026-11-16T23:01:31Z · gpt-6-luna |
| gui#988 | Review does not warn that an explicit amount will turn off Use maximumqml/pages/wallet/SendCreate.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 92221c1c7fb2..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#988 | Incoming payment requests ignore open native file choosersqml/pages/MainWindow.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 92221c1c7fb2..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#934 | Payment request review omits the target walletqml/components/PaymentRequestReviewPopup.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 28684117fa87..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#934 | Cancelling wallet selection or creation hides the pending requestqml/pages/MainWindow.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 28684117fa87..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#988 | Unconfirmed hand-offs are reported as definite failuresqml/bitcoin.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · d76c75c17525..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#988 | A request delivered while the PSBT chooser is open is dropped after Applyqml/pages/wallet/SendCreate.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · d76c75c17525..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#988 | Incoming payment requests cancel native file choosers on other wallet pagesqml/pages/MainWindow.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · d76c75c17525..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#934 | Rejected command-line requests show unattributed errors under valid recipientsqml/pages/wallet/SendCreate.qml | addressed | AssessmentIncoming parse failures now set a status that explicitly names the source and includes the parse error, rather than routing through the source-ignoring failure branch of applyParsedPaymentRequest. A focused test checks the command-line attribution. SendCreate.qml lines 609-615 assign `Payment request from %1 rejected: %2` using source and result.error, then mark it as an error. The added test `test_rejected_incoming_request_names_its_source` asserts the status begins with the command-line attribution and contains the URI. Source report · 199f6ce3de22..28684117fa87 2026-11-11T23:49:42Z · gpt-6-luna |
| gui#934 | Abandoning wallet opening or creation hides the pending requestqml/pages/MainWindow.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 199f6ce3de22..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#988 | PSBT import leaves a payment review that consumes its request without applying itqml/pages/wallet/SendCreate.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 8e7fa9d614cb..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#988 | Handed-over requests cancel dialogs on other wallet pagesqml/pages/wallet/DesktopWallets.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 8e7fa9d614cb..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#988 | The shared-temp fallback trusts another account's receiverqml/paymenturiserver.cpp | addressed | AssessmentThe shared-temp fallback is removed for non-Darwin Unix, and an unavailable private runtime directory now yields an empty endpoint that cannot be used for sending or listening. `ServerName()` returns an empty string when RuntimeLocation is empty (lines 64–68); `SendRequests()` treats an empty name as NoReceiver and `listen()` rejects it (lines 143–144 and 223–226). The added test covers the empty-runtime case. Source report · 8e7fa9d614cb..d76c75c17525 2026-11-11T23:02:39Z · gpt-6-luna |
| gui#883 | The early directory lock runs before the blocks directory is validatedqml/bitcoin.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · a952c1616a12..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | An onboarded default data directory now needs a writable parentqml/onboarding_settings.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · a952c1616a12..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#988 | Payment-request review freezes an amount that Use maximum can changeqml/pages/wallet/SendCreate.qml | addressed | AssessmentThe review now detects when an amount-less request retains the maximum recipient and displays a maximum-specific explanation instead of the captured fixed amount. The amount row is also kept visible in that case. `handleIncomingPaymentUri()` sets `keepsMaximum` when there is no URI amount and the recipient is `root.wallet.maximumRecipient` (SendCreate.qml lines 627–630). PaymentRequestReviewPopup displays “Not specified, keeps the maximum amount” and shows the row when `keepsMaximum` is true (old-to-new diff). A test verifies this text and visibility. Source report · 380fe4e4153e..d76c75c17525 2026-11-11T23:02:39Z · gpt-6-luna |
| gui#988 | Incoming requests cancel dialogs on other wallet tabsqml/pages/wallet/DesktopWallets.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 380fe4e4153e..e9081b8364b8 2026-11-17T00:14:38Z · gpt-6-luna |
| gui#1057 | Used inactive descriptors are unreachable without a supported active descriptorqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new head makes `canShowDescriptors()` true when either active or inactive descriptor exports are present. The reported inaccessible-previous-keys gate is removed; evidence does not separately show `openDescriptors()`, but the stated row visibility condition is fixed and the list page already displays inactive entries. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "67b44f6d37f24f3d9c504279df1069fd",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 4,
"source_job_id": 2506,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex cc3d4a74bb..371d57b2f6 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1341,7 +1341,7 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n \n bool WalletQmlModel::canShowDescriptors() const\n {\n- return !descriptorExports().isEmpty();\n+ return !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n }\n \n QVariantList WalletQmlModel::descriptorExports() const\n@@ -1354,12 +1354,23 @@ QVariantList WalletQmlModel::descriptorExports() const\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n- const auto change = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true));\n+ const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n+ const auto change = ParseSingleKeyDescriptor(change_man);\n+ // A change chain in another form is listed as it is, and no single key covers it.\n+ const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- const WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ if (change_unreadable) {\n+ std::string change_text;\n+ const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n+ descriptor = {.text = change_text.empty() ? receive->descriptor\n+ : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n+ .parts = {}};\n+ }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n@@ -1367,8 +1378,8 @@ QVariantList WalletQmlModel::descriptorExports() const\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n- const bool key_covers_both{receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -1432,19 +1443,64 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n return exports;\n }\n \n+namespace {\n+\n+// Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+// needs the private key, so importdescriptors rejects the public form.\n+bool ExpandsFromPublicKeys(const std::string& descriptor)\n+{\n+ FlatSigningProvider keys;\n+ std::string error;\n+ const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return false;\n+ return std::ranges::all_of(parsed, [&](const auto& desc) {\n+ std::vector<CScript> scripts;\n+ FlatSigningProvider out;\n+ return desc->Expand(0, keys, scripts, out);\n+ });\n+}\n+\n+std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n+{\n+ omitted = 0;\n+ LOCK(wallet.cs_wallet);\n+ auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n+ if (!exported) return {};\n+ std::vector<wallet::WalletDescInfo> importable;\n+ for (wallet::WalletDescInfo& info : *exported) {\n+ if (ExpandsFromPublicKeys(info.descriptor)) {\n+ importable.push_back(std::move(info));\n+ } else {\n+ ++omitted;\n+ }\n+ }\n+ std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n+ return importable;\n+}\n+\n+} // namespace\n+\n+int WalletQmlModel::descriptorImportOmittedCount() const\n+{\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return 0;\n+ size_t omitted{0};\n+ ImportableDescriptors(*raw_wallet, omitted);\n+ return int(omitted);\n+}\n+\n // Every descriptor in the same form as listdescriptors, ready for importdescriptors.\n QString WalletQmlModel::descriptorImportJson() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n \n- LOCK(raw_wallet->cs_wallet);\n- auto exported{wallet::ExportDescriptors(*raw_wallet, /*export_private=*/false)};\n- if (!exported) return {};\n- std::ranges::sort(*exported, {}, &wallet::WalletDescInfo::descriptor);\n+ size_t omitted{0};\n+ const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n+ if (exported.empty()) return {};\n \n UniValue descriptors{UniValue::VARR};\n- for (const wallet::WalletDescInfo& info : *exported) {\n+ for (const wallet::WalletDescInfo& info : exported) {\n UniValue item{UniValue::VOBJ};\n item.pushKV(\"desc\", info.descriptor);\n // The import rescans from here, so \"now\" would miss older transactions.\n@@ -3566,6 +3622,8 @@ void WalletQmlModel::subscribeToWalletSignals()\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n+ // A payment to a previous key can make it count as used.\n+ Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1463,
"evidence_id": "12577a1496a94314a8b9d16545df58b3",
"finding_id": "finding:9",
"kind": "new_source",
"line": 1314,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 4,
"source_job_id": 2506,
"text": "}\n\nvoid WalletQmlModel::setDefaultReceiveAddressType(const QString& address_type)\n{\n for (const QVariant& item : availableReceiveAddressTypes()) {\n const QVariantMap type{item.toMap()};\n if (type.value(QStringLiteral(\"id\")).toString() == address_type) {\n if (!m_node) return;\n auto preferences = m_node->getPersistentSetting(\"qml_receive_address_types\");\n if (!preferences.isObject()) preferences = common::SettingsValue{UniValue::VOBJ};\n preferences.pushKV(name().toStdString(), address_type.toStdString());\n m_node->updateRwSetting(\"qml_receive_address_types\", preferences);\n return;\n }\n }\n}\n\nQString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) const\n{\n for (const QVariant& item : availableReceiveAddressTypes()) {\n const QVariantMap type{item.toMap()};\n if (type.value(QStringLiteral(\"id\")).toString() == address_type) {\n return type.value(QStringLiteral(\"label\")).toString();\n }\n }\n return {};\n}\n\nbool WalletQmlModel::canShowDescriptors() const\n{\n return !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n}\n\nQVariantList WalletQmlModel::descriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n QVariantList exports;\n LOCK(raw_wallet->cs_wallet);\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n const auto change = ParseSingleKeyDescriptor(change_man);\n // A change chain in another form is listed as it is, and no single key covers it.\n const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n if (change_unreadable) {\n std::string change_text;\n const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n descriptor = {.text = change_text.empty() ? receive->descriptor\n : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n .parts = {}};\n }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n exports.append(item);\n }\n return exports;\n}\n\nQVariantList WalletQmlModel::inactiveDescriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n struct Inactive {\n SingleKeyDescriptor descriptor;\n OutputType type;\n bool used;\n };\n std::vector<Inactive> found;\n LOCK(raw_wallet->cs_wallet);\n for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n if (raw_wallet->IsActiveScriptPubKeyMan(*spk_man)) continue;\n const auto descriptor = ParseSingleKeyDescriptor(spk_man);\n const auto type = descriptor ? SingleKeyOutputType(descriptor->script) : std::nullopt;\n if (!type) continue;\n const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n LOCK(desc_man.cs_desc_man);\n found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n }\n std::ranges::sort(found, {}, [](const Inactive& item) {\n return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n\n QVariantList exports;\n const auto append = [&](const Inactive& receive, const std::optional<SingleKeyDescriptor>& change) {\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(receive.type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n };\n for (auto it = found.begin(); it != found.end();) {\n const auto end = std::find_if(it, found.end(), [&](const Inactive& item) {\n return item.type != it->type || item.descriptor.origin != it->descriptor.origin ||\n item.descriptor.xpub != it->descriptor.xpub;\n });\n // next_index only moves once an address is handed out or seen in a transaction.\n if (std::any_of(it, end, [](const Inactive& item) { return item.used; })) {\n if (end - it == 2) {\n append(*it, std::next(it)->descriptor);\n } else {\n std::for_each(it, end, [&](const Inactive& item) { append(item, std::nullopt); });\n }\n }\n it = end;\n }\n return exports;\n}\n\nnamespace {\n\n// Hardened derivation after the key, as in a migrated wallet's old HD chain,\n// needs the private key, so importdescriptors rejects the public form.\nbool ExpandsFromPublicKeys(const std::string& descriptor)\n{\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) return false;\n return std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n });\n}\n\nstd::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · fc657610b860..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | The backup sheet has no scrolling recovery for tall contentqml/components/BackupWalletPopup.qml | addressed | AssessmentThe backup popup now uses a ScrollView for its growing body while keeping Save outside the scroll area, so long paths and errors do not push the action out of reach. The excerpt explicitly documents this layout intent. path_diff: qml/components/BackupWalletPopup.qml; new_source: qml/components/BackupWalletPopup.qml [
{
"evidence_id": "951a2085eb75451b87ab05c56194558a",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/components/BackupWalletPopup.qml",
"source_generation": 4,
"source_job_id": 2506,
"text": "diff --git a/qml/components/BackupWalletPopup.qml b/qml/components/BackupWalletPopup.qml\nindex cc562c1404..94f356b001 100644\n--- a/qml/components/BackupWalletPopup.qml\n+++ b/qml/components/BackupWalletPopup.qml\n@@ -9,7 +9,7 @@ import org.bitcoincore.qt 1.0\n \n import \"../controls\"\n \n-Popup {\n+DialogPopup {\n id: root\n objectName: \"backupWalletPopup\"\n \n@@ -18,182 +18,156 @@ Popup {\n property bool encrypted: false\n property string destinationPath: \"\"\n property bool pending: false\n+ property bool privateKeys: true\n property string errorText: \"\"\n \n signal locationChangeRequested()\n signal saveRequested()\n \n- parent: Overlay.overlay\n- width: Math.min(460, parent ? parent.width - 32 : 460)\n- x: parent ? (parent.width - width) / 2 : 0\n- y: parent ? Math.max(20, (parent.height - height) / 2) : 0\n- padding: 0\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside\n- background: null\n-\n- Overlay.modal: Rectangle {\n- color: Qt.rgba(0, 0, 0, 0.6)\n- Behavior on opacity { NumberAnimation { duration: 180 } }\n- }\n- enter: Transition { NumberAnimation { property: \"opacity\"; from: 0; to: 1; duration: 180 } }\n- exit: Transition { NumberAnimation { property: \"opacity\"; from: 1; to: 0; duration: 150 } }\n-\n- contentItem: Pane {\n- padding: root.width < 400 ? 16 : 20\n- background: Rectangle {\n- radius: 16\n- color: Theme.color.neutral1\n- border.width: 1\n- border.color: Theme.color.neutral3\n- SurfaceGradientBorder {\n- anchors.fill: parent\n- surfaceColor: parent.color\n- cornerRadius: parent.radius\n- }\n- }\n+ title: canChooseType ? qsTr(\"Back up or export wallet\") : qsTr(\"Back up wallet\")\n+ implicitWidth: 520\n+ // The export holds the wallet lock, so other wallet actions would wait on it.\n+ busy: pending\n \n- contentItem: ColumnLayout {\n- spacing: 16\n+ contentItem: ColumnLayout {\n+ spacing: Theme.space.xl\n \n- RowLayout {\n- Layout.fillWidth: true\n- spacing: 10\n-\n- CoreText {\n- Layout.fillWidth: true\n- text: root.canChooseType ? qsTr(\"Back up or export wallet\") : qsTr(\"Back up wallet\")\n- font: Theme.text.title.font\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n+ DialogHeader {\n+ Layout.fillWidth: true\n+ title: root.title\n+ closeButtonObjectName: \"backupWalletClose\"\n+ closeEnabled: !root.pending\n+ onCloseRequested: root.close()\n+ }\n \n- CloseButton {\n- objectName: \"backupWalletClose\"\n- iconColor: Theme.color.neutral7\n- Accessible.name: qsTr(\"Close\")\n- onClicked: root.close()\n- }\n- }\n+ // Long paths, errors or translations scroll here, so Save stays in reach.\n+ ScrollView {\n+ id: bodyScroll\n+ objectName: \"backupWalletBody\"\n+ Layout.fillWidth: true\n+ Layout.fillHeight: true\n+ Layout.minimumHeight: Theme.size.controlLarge * 2\n+ Layout.preferredHeight: body.implicitHeight\n+ contentWidth: availableWidth\n+ contentHeight: body.implicitHeight\n+ clip: true\n+ ScrollBar.horizontal.policy: ScrollBar.AlwaysOff\n \n ColumnLayout {\n- visible: root.canChooseType\n- Layout.fillWidth: true\n- spacing: 10\n+ id: body\n+ width: bodyScroll.availableWidth\n+ spacing: Theme.space.l\n \n- OptionButton {\n- objectName: \"backupTypeFull\"\n+ ColumnLayout {\n+ visible: root.canChooseType\n Layout.fillWidth: true\n- checkable: false\n- checked: !root.watchOnly\n- enabled: !root.pending\n- surfaceSelectionStyle: true\n- text: qsTr(\"Full backup\")\n- description: qsTr(\"Includes private keys. Restores a wallet that can spend.\")\n- onClicked: root.watchOnly = false\n+ spacing: Theme.space.m\n+\n+ OptionButton {\n+ objectName: \"backupTypeFull\"\n+ Layout.fillWidth: true\n+ selected: !root.watchOnly\n+ enabled: !root.pending\n+ surfaceSelectionStyle: true\n+ text: qsTr(\"Full backup\")\n+ description: qsTr(\"Includes private keys. Restores a wallet that can spend.\")\n+ onClicked: root.watchOnly = false\n+ }\n+\n+ OptionButton {\n+ objectName: \"backupTypeWatchOnly\"\n+ Layout.fillWidth: true\n+ selected: root.watchOnly\n+ enabled: !root.pending\n+ surfaceSelectionStyle: true\n+ text: qsTr(\"Watch-only copy\")\n+ //: Describes a watch-only wallet file for restoring on another Bitcoin Core node.\n+ description: qsTr(\"No private keys. Shows balance and history, but cannot spend.\")\n+ onClicked: root.watchOnly = true\n+ }\n }\n \n- OptionButton {\n- objectName: \"backupTypeWatchOnly\"\n+ CoreText {\n+ objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n- checkable: false\n- checked: root.watchOnly\n- enabled: !root.pending\n- surfaceSelectionStyle: true\n- text: qsTr(\"Watch-only copy\")\n- //: Describes a watch-only wallet file for restoring on another Bitcoin Core node.\n- description: qsTr(\"No private keys. Shows balance and history, but cannot spend.\")\n- onClicked: root.watchOnly = true\n+ text: root.watchOnly || !root.privateKeys\n+ ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n+ : root.encrypted\n+ ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n+ : qsTr(\"Anyone with this file can spend your bitcoin. Keep it somewhere safe.\")\n+ textStyle: Theme.text.description\n+ color: Theme.color.neutral8\n+ horizontalAlignment: Text.AlignLeft\n }\n- }\n-\n- CoreText {\n- objectName: \"backupWalletWarning\"\n- Layout.fillWidth: true\n- text: root.watchOnly\n- ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n- : root.encrypted\n- ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n- : qsTr(\"Anyone with this file can spend your bitcoin. Keep it somewhere safe.\")\n- font: Theme.text.caption.font\n- lineHeight: Theme.text.caption.lineHeight\n- lineHeightMode: Text.FixedHeight\n- color: Theme.color.neutral8\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n \n- RowLayout {\n- Layout.fillWidth: true\n- spacing: 12\n-\n- ColumnLayout {\n+ RowLayout {\n Layout.fillWidth: true\n- spacing: 2\n+ spacing: Theme.space.ml\n \n- CoreText {\n+ ColumnLayout {\n Layout.fillWidth: true\n- text: qsTr(\"Save to\")\n- font: Theme.text.caption.font\n- color: Theme.color.neutral7\n- horizontalAlignment: Text.AlignLeft\n+ spacing: Theme.space.xxs\n+\n+ CoreText {\n+ Layout.fillWidth: true\n+ text: qsTr(\"Save to\")\n+ textStyle: Theme.text.caption\n+ color: Theme.color.neutral7\n+ horizontalAlignment: Text.AlignLeft\n+ }\n+\n+ CoreText {\n+ objectName: \"backupDestinationPath\"\n+ Layout.fillWidth: true\n+ text: root.destinationPath\n+ textFormat: Text.PlainText\n+ textStyle: Theme.text.monoCaption\n+ color: Theme.color.neutral9\n+ horizontalAlignment: Text.AlignLeft\n+ // A cut path could hide the part that tells two folders apart.\n+ wrapMode: Text.WrapAnywhere\n+ }\n }\n \n- CoreText {\n- objectName: \"backupDestinationPath\"\n- Layout.fillWidth: true\n- text: root.destinationPath\n- font: Theme.text.monoCaption.font\n- color: Theme.color.neutral9\n- horizontalAlignment: Text.AlignLeft\n- // A cut path could hide the part that tells two folders apart.\n- wrapMode: Text.WrapAnywhere\n+ NeutralButton {\n+ objectName: \"backupChangeLocation\"\n+ Layout.alignment: Qt.AlignVCenter\n+ enabled: !root.pending\n+ text: qsTr(\"Change…\")\n+ onClicked: root.locationChangeRequested()\n }\n }\n \n- OutlineButton {\n- objectName: \"backupChangeLocation\"\n- Layout.alignment: Qt.AlignVCenter\n- enabled: !root.pending\n- text: qsTr(\"Change\")\n- onClicked: root.locationChangeRequested()\n+ CoreText {\n+ objectName: \"backupWalletErrorText\"\n+ visible: root.errorText.length > 0\n+ Layout.fillWidth: true\n+ text: root.errorText\n+ textFormat: Text.PlainText\n+ textStyle: Theme.text.caption\n+ color: Theme.color.dangerText\n+ horizontalAlignment: Text.AlignLeft\n }\n }\n+ }\n \n- CoreText {\n- objectName: \"backupWalletErrorText\"\n- visible: root.errorText.length > 0\n- Layout.fillWidth: true\n- text: root.errorText\n- font: Theme.text.caption.font\n- color: Theme.color.red\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n-\n- ContinueButton {\n- objectName: \"backupSaveButton\"\n- Layout.fillWidth: true\n- enabled: !root.pending && root.destinationPath.length > 0\n- busy: root.pending\n- text: root.pending ? qsTr(\"Saving...\")\n- : root.watchOnly ? qsTr(\"Save watch-only copy\")\n- : qsTr(\"Save backup\")\n- onClicked: root.saveRequested()\n- }\n+ PrimaryButton {\n+ objectName: \"backupSaveButton\"\n+ Layout.fillWidth: true\n+ enabled: !root.pending && root.destinationPath.length > 0\n+ busy: root.pending\n+ text: root.pending ? qsTr(\"Saving…\")\n+ : root.watchOnly ? qsTr(\"Save watch-only copy\")\n+ : qsTr(\"Save backup\")\n+ onClicked: root.saveRequested()\n+ }\n \n- CoreText {\n- Layout.fillWidth: true\n- text: root.canChooseType ? qsTr(\"Restore either file with Import wallet.\") : qsTr(\"Restore it with Import wallet.\")\n- font: Theme.text.caption.font\n- lineHeight: Theme.text.caption.lineHeight\n- lineHeightMode: Text.FixedHeight\n- color: Theme.color.neutral7\n- horizontalAlignment: Text.AlignHCenter\n- wrap: true\n- }\n+ CoreText {\n+ Layout.fillWidth: true\n+ text: root.canChooseType ? qsTr(\"Restore either file with Import wallet.\") : qsTr(\"Restore it with Import wallet.\")\n+ textStyle: Theme.text.caption\n+ color: Theme.color.neutral7\n+ horizontalAlignment: Text.AlignHCenter\n }\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 150,
"evidence_id": "1de53fa202c14bc2802bc5aee291ad6a",
"finding_id": "finding:7",
"kind": "new_source",
"line": 1,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/components/BackupWalletPopup.qml",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 4,
"source_job_id": 2506,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\nimport org.bitcoincore.qt 1.0\n\nimport \"../controls\"\n\nDialogPopup {\n id: root\n objectName: \"backupWalletPopup\"\n\n property bool canChooseType: true\n property bool watchOnly: false\n property bool encrypted: false\n property string destinationPath: \"\"\n property bool pending: false\n property bool privateKeys: true\n property string errorText: \"\"\n\n signal locationChangeRequested()\n signal saveRequested()\n\n title: canChooseType ? qsTr(\"Back up or export wallet\") : qsTr(\"Back up wallet\")\n implicitWidth: 520\n // The export holds the wallet lock, so other wallet actions would wait on it.\n busy: pending\n\n contentItem: ColumnLayout {\n spacing: Theme.space.xl\n\n DialogHeader {\n Layout.fillWidth: true\n title: root.title\n closeButtonObjectName: \"backupWalletClose\"\n closeEnabled: !root.pending\n onCloseRequested: root.close()\n }\n\n // Long paths, errors or translations scroll here, so Save stays in reach.\n ScrollView {\n id: bodyScroll\n objectName: \"backupWalletBody\"\n Layout.fillWidth: true\n Layout.fillHeight: true\n Layout.minimumHeight: Theme.size.controlLarge * 2\n Layout.preferredHeight: body.implicitHeight\n contentWidth: availableWidth\n contentHeight: body.implicitHeight\n clip: true\n ScrollBar.horizontal.policy: ScrollBar.AlwaysOff\n\n ColumnLayout {\n id: body\n width: bodyScroll.availableWidth\n spacing: Theme.space.l\n\n ColumnLayout {\n visible: root.canChooseType\n Layout.fillWidth: true\n spacing: Theme.space.m\n\n OptionButton {\n objectName: \"backupTypeFull\"\n Layout.fillWidth: true\n selected: !root.watchOnly\n enabled: !root.pending\n surfaceSelectionStyle: true\n text: qsTr(\"Full backup\")\n description: qsTr(\"Includes private keys. Restores a wallet that can spend.\")\n onClicked: root.watchOnly = false\n }\n\n OptionButton {\n objectName: \"backupTypeWatchOnly\"\n Layout.fillWidth: true\n selected: root.watchOnly\n enabled: !root.pending\n surfaceSelectionStyle: true\n text: qsTr(\"Watch-only copy\")\n //: Describes a watch-only wallet file for restoring on another Bitcoin Core node.\n description: qsTr(\"No private keys. Shows balance and history, but cannot spend.\")\n onClicked: root.watchOnly = true\n }\n }\n\n CoreText {\n objectName: \"backupWalletWarning\"\n Layout.fillWidth: true\n text: root.watchOnly || !root.privateKeys\n ? qsTr(\"Anyone with this file can see your balance and every transaction.\")\n : root.encrypted\n ? qsTr(\"Anyone with this file and your password can spend your bitcoin. Keep it somewhere safe.\")\n : qsTr(\"Anyone with this file can spend your bitcoin. Keep it somewhere safe.\")\n textStyle: Theme.text.description\n color: Theme.color.neutral8\n horizontalAlignment: Text.AlignLeft\n }\n\n RowLayout {\n Layout.fillWidth: true\n spacing: Theme.space.ml\n\n ColumnLayout {\n Layout.fillWidth: true\n spacing: Theme.space.xxs\n\n CoreText {\n Layout.fillWidth: true\n text: qsTr(\"Save to\")\n textStyle: Theme.text.caption\n color: Theme.color.neutral7\n horizontalAlignment: Text.AlignLeft\n }\n\n CoreText {\n objectName: \"backupDestinationPath\"\n Layout.fillWidth: true\n text: root.destinationPath\n textFormat: Text.PlainText\n textStyle: Theme.text.monoCaption\n color: Theme.color.neutral9\n horizontalAlignment: Text.AlignLeft\n // A cut path could hide the part that tells two folders apart.\n wrapMode: Text.WrapAnywhere\n }\n }\n\n NeutralButton {\n objectName: \"backupChangeLocation\"\n Layout.alignment: Qt.AlignVCenter\n enabled: !root.pending\n text: qsTr(\"Change…\")\n onClicked: root.locationChangeRequested()\n }\n }\n\n CoreText {\n objectName: \"backupWalletErrorText\"\n visible: root.errorText.length > 0\n Layout.fillWidth: true\n text: root.errorText\n textFormat: Text.PlainText\n textStyle: Theme.text.caption\n color: Theme.color.dangerText\n horizontalAlignment: Text.AlignLeft\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · fc657610b860..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Descriptor actions can block the GUI during watch-only exportqml/models/walletqmlmodel.cpp | unclear | AssessmentThe supplied new-head excerpt does not show the backup/export sheet’s dismissibility or whether synchronous wallet actions are disabled while an export is pending. The model excerpt shows no resolution of the lock-contention path. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "697b4d7e079f45249245f71b06c13e35",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 4,
"source_job_id": 2506,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex cc3d4a74bb..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1341,7 +1341,34 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n \n bool WalletQmlModel::canShowDescriptors() const\n {\n- return !descriptorExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n QVariantList WalletQmlModel::descriptorExports() const\n@@ -1354,21 +1381,33 @@ QVariantList WalletQmlModel::descriptorExports() const\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n- const auto change = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true));\n+ const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n+ const auto change = ParseSingleKeyDescriptor(change_man);\n+ // A change chain in another form is listed as it is, and no single key covers it.\n+ const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- const WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ if (change_unreadable) {\n+ std::string change_text;\n+ const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n+ descriptor = {.text = change_text.empty() ? receive->descriptor\n+ : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n+ .parts = {}};\n+ }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n- const bool key_covers_both{receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -1410,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1432,19 +1472,77 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n return exports;\n }\n \n+namespace {\n+\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n+{\n+ FlatSigningProvider keys;\n+ std::string error;\n+ const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n+ std::vector<CScript> scripts;\n+ FlatSigningProvider out;\n+ return desc->Expand(0, keys, scripts, out);\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n+}\n+\n+std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n+{\n+ omitted = 0;\n+ LOCK(wallet.cs_wallet);\n+ auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n+ if (!exported) return {};\n+ std::vector<wallet::WalletDescInfo> importable;\n+ for (wallet::WalletDescInfo& info : *exported) {\n+ switch (ClassifyPublicImport(info.descriptor)) {\n+ case PublicImport::Importable:\n+ importable.push_back(std::move(info));\n+ break;\n+ case PublicImport::NeedsPrivateKeys:\n+ ++omitted;\n+ break;\n+ case PublicImport::NoScripts:\n+ break;\n+ }\n+ }\n+ std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n+ return importable;\n+}\n+\n+} // namespace\n+\n+int WalletQmlModel::descriptorImportOmittedCount() const\n+{\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return 0;\n+ size_t omitted{0};\n+ ImportableDescriptors(*raw_wallet, omitted);\n+ return int(omitted);\n+}\n+\n // Every descriptor in the same form as listdescriptors, ready for importdescriptors.\n QString WalletQmlModel::descriptorImportJson() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n \n- LOCK(raw_wallet->cs_wallet);\n- auto exported{wallet::ExportDescriptors(*raw_wallet, /*export_private=*/false)};\n- if (!exported) return {};\n- std::ranges::sort(*exported, {}, &wallet::WalletDescInfo::descriptor);\n+ size_t omitted{0};\n+ const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n+ if (exported.empty()) return {};\n \n UniValue descriptors{UniValue::VARR};\n- for (const wallet::WalletDescInfo& info : *exported) {\n+ for (const wallet::WalletDescInfo& info : exported) {\n UniValue item{UniValue::VOBJ};\n item.pushKV(\"desc\", info.descriptor);\n // The import rescans from here, so \"now\" would miss older transactions.\n@@ -1454,7 +1552,8 @@ QString WalletQmlModel::descriptorImportJson() const\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n- range.push_back(info.range->second - 1);\n+ // A used-up range ends before next_index, which importdescriptors rejects.\n+ range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n@@ -3566,6 +3665,8 @@ void WalletQmlModel::subscribeToWalletSignals()\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n+ // A payment to a previous key can make it count as used.\n+ Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · fc657610b860..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Keep both inherits the existing file's backup-type labelqml/walletfiledestination.cpp | addressed | AssessmentKeepBothPath now removes any old watch-only label and then adds it only for watch-only output; it also chooses .dat for watch-only and .bak for full backups when replacing a known wallet-file suffix. path_diff: qml/walletfiledestination.cpp; new_source: qml/walletfiledestination.cpp [
{
"evidence_id": "04a426fa8f6547d9a847ac7542df5b07",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/walletfiledestination.cpp",
"source_generation": 4,
"source_job_id": 2506,
"text": "diff --git a/qml/walletfiledestination.cpp b/qml/walletfiledestination.cpp\nindex c90d4973b5..434ba4bf90 100644\n--- a/qml/walletfiledestination.cpp\n+++ b/qml/walletfiledestination.cpp\n@@ -77,16 +77,23 @@ QString DefaultWalletFileName(const QString& wallet_name, bool watch_only, const\n : QStringLiteral(\"%1-%2.bak\").arg(name, stamp);\n }\n \n-QString KeepBothPath(const QString& path, const QDateTime& now)\n+QString KeepBothPath(const QString& path, bool watch_only, const QDateTime& now)\n {\n // A stamp left by an earlier save is replaced, not appended to.\n static const QRegularExpression old_stamp{QStringLiteral(\"-\\\\d{4}-\\\\d{2}-\\\\d{2}(-\\\\d{4})?(-\\\\d+)?$\")};\n+ static const QRegularExpression watch_only_label{QStringLiteral(\"-watchonly$\"), QRegularExpression::CaseInsensitiveOption};\n const QFileInfo info{path};\n QString base{info.completeBaseName()};\n base.remove(old_stamp);\n+ // The existing file can be the other type, so its label and suffix are not kept.\n+ base.remove(watch_only_label);\n if (base.isEmpty()) base = QStringLiteral(\"wallet\");\n+ if (watch_only) base += QStringLiteral(\"-watchonly\");\n const QString stem{base + '-' + now.toString(QStringLiteral(\"yyyy-MM-dd-HHmm\"))};\n- const QString suffix{info.suffix().isEmpty() ? QString{} : '.' + info.suffix()};\n+ const bool known_suffix{info.suffix().compare(QStringLiteral(\"bak\"), Qt::CaseInsensitive) == 0 ||\n+ info.suffix().compare(QStringLiteral(\"dat\"), Qt::CaseInsensitive) == 0};\n+ const QString suffix{known_suffix ? (watch_only ? QStringLiteral(\".dat\") : QStringLiteral(\".bak\"))\n+ : info.suffix().isEmpty() ? QString{} : '.' + info.suffix()};\n const QDir dir{info.absoluteDir()};\n \n for (int count{1};; ++count) {\n@@ -140,7 +147,7 @@ QVariantMap DescribeWalletFileDestination(const QString& path,\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"available\"));\n return result;\n }\n- const QFileInfo keep_both{KeepBothPath(local, now)};\n+ const QFileInfo keep_both{KeepBothPath(local, watch_only, now)};\n result.insert(QStringLiteral(\"status\"), IsWalletDatabaseFile(local) ? QStringLiteral(\"walletFile\") : QStringLiteral(\"otherFile\"));\n result.insert(QStringLiteral(\"keepBothPath\"), QDir::toNativeSeparators(keep_both.absoluteFilePath()));\n result.insert(QStringLiteral(\"keepBothFileName\"), keep_both.fileName());\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 155,
"evidence_id": "b532325d3d824d669bf33deb897d9ce6",
"finding_id": "finding:5",
"kind": "new_source",
"line": 113,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/walletfiledestination.cpp",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 4,
"source_job_id": 2506,
"text": " if (trimmed.isEmpty()) return Blocked(Tr(\"Choose where to save the file.\"));\n\n const QUrl url{trimmed};\n QString local{QFileInfo{url.isLocalFile() ? url.toLocalFile() : trimmed}.absoluteFilePath()};\n if (QFileInfo{local}.isDir()) {\n local = QDir{local}.filePath(DefaultWalletFileName(wallet_name, watch_only, now.date()));\n } else {\n static const QRegularExpression known_suffix{QStringLiteral(\"\\\\.(bak|dat)$\"),\n QRegularExpression::CaseInsensitiveOption};\n if (!known_suffix.match(local).hasMatch()) local += watch_only ? QStringLiteral(\".dat\") : QStringLiteral(\".bak\");\n }\n\n const QFileInfo info{local};\n const QString folder{QDir::toNativeSeparators(info.absolutePath())};\n if (!QFileInfo{info.absolutePath()}.isDir()) {\n //: %1 is a folder path.\n return Blocked(Tr(\"The folder %1 does not exist.\").arg(folder));\n }\n if (info.isDir()) return Blocked(Tr(\"A folder with this name already exists.\"));\n\n const QString resolved{CleanPath(info.absolutePath()) + '/' + info.fileName()};\n for (const QString& protected_path : protected_paths) {\n if (!protected_path.isEmpty() && IsSameOrInside(resolved, CleanPath(protected_path))) {\n return Blocked(Tr(\"Wallet files can't be saved in the wallets folder. Choose another location.\"));\n }\n }\n\n QVariantMap result{\n {QStringLiteral(\"path\"), QDir::toNativeSeparators(local)},\n {QStringLiteral(\"folder\"), folder},\n {QStringLiteral(\"fileName\"), info.fileName()},\n {QStringLiteral(\"error\"), QString{}},\n };\n if (!info.exists()) {\n result.insert(QStringLiteral(\"status\"), QStringLiteral(\"available\"));\n return result;\n }\n const QFileInfo keep_both{KeepBothPath(local, watch_only, now)};\n result.insert(QStringLiteral(\"status\"), IsWalletDatabaseFile(local) ? QStringLiteral(\"walletFile\") : QStringLiteral(\"otherFile\"));\n result.insert(QStringLiteral(\"keepBothPath\"), QDir::toNativeSeparators(keep_both.absoluteFilePath()));\n result.insert(QStringLiteral(\"keepBothFileName\"), keep_both.fileName());\n return result;\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · fc657610b860..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#1057 | Copy-all JSON cannot import a migrated wallet's old HD chainsqml/models/walletqmlmodel.cpp | unclear | AssessmentThe supplied current changes classify descriptors that cannot expand using public keys as omitted from Core import JSON, but the relevant UI behavior that disables Copy all for that wallet and directs users to the watch-only file export is not shown for this finding’s revisions. The code excerpt alone does not establish that the requested guard and direction are present. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "d420c1ee914e4ce29afe15897e68600e",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 4,
"source_job_id": 2506,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex cc3d4a74bb..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1341,7 +1341,34 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n \n bool WalletQmlModel::canShowDescriptors() const\n {\n- return !descriptorExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n QVariantList WalletQmlModel::descriptorExports() const\n@@ -1354,21 +1381,33 @@ QVariantList WalletQmlModel::descriptorExports() const\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n- const auto change = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true));\n+ const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n+ const auto change = ParseSingleKeyDescriptor(change_man);\n+ // A change chain in another form is listed as it is, and no single key covers it.\n+ const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- const WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ if (change_unreadable) {\n+ std::string change_text;\n+ const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n+ descriptor = {.text = change_text.empty() ? receive->descriptor\n+ : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n+ .parts = {}};\n+ }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n- const bool key_covers_both{receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -1410,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1432,19 +1472,77 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n return exports;\n }\n \n+namespace {\n+\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n+{\n+ FlatSigningProvider keys;\n+ std::string error;\n+ const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n+ std::vector<CScript> scripts;\n+ FlatSigningProvider out;\n+ return desc->Expand(0, keys, scripts, out);\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n+}\n+\n+std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n+{\n+ omitted = 0;\n+ LOCK(wallet.cs_wallet);\n+ auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n+ if (!exported) return {};\n+ std::vector<wallet::WalletDescInfo> importable;\n+ for (wallet::WalletDescInfo& info : *exported) {\n+ switch (ClassifyPublicImport(info.descriptor)) {\n+ case PublicImport::Importable:\n+ importable.push_back(std::move(info));\n+ break;\n+ case PublicImport::NeedsPrivateKeys:\n+ ++omitted;\n+ break;\n+ case PublicImport::NoScripts:\n+ break;\n+ }\n+ }\n+ std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n+ return importable;\n+}\n+\n+} // namespace\n+\n+int WalletQmlModel::descriptorImportOmittedCount() const\n+{\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return 0;\n+ size_t omitted{0};\n+ ImportableDescriptors(*raw_wallet, omitted);\n+ return int(omitted);\n+}\n+\n // Every descriptor in the same form as listdescriptors, ready for importdescriptors.\n QString WalletQmlModel::descriptorImportJson() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n \n- LOCK(raw_wallet->cs_wallet);\n- auto exported{wallet::ExportDescriptors(*raw_wallet, /*export_private=*/false)};\n- if (!exported) return {};\n- std::ranges::sort(*exported, {}, &wallet::WalletDescInfo::descriptor);\n+ size_t omitted{0};\n+ const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n+ if (exported.empty()) return {};\n \n UniValue descriptors{UniValue::VARR};\n- for (const wallet::WalletDescInfo& info : *exported) {\n+ for (const wallet::WalletDescInfo& info : exported) {\n UniValue item{UniValue::VOBJ};\n item.pushKV(\"desc\", info.descriptor);\n // The import rescans from here, so \"now\" would miss older transactions.\n@@ -1454,7 +1552,8 @@ QString WalletQmlModel::descriptorImportJson() const\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n- range.push_back(info.range->second - 1);\n+ // A used-up range ends before next_index, which importdescriptors rejects.\n+ range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n@@ -3566,6 +3665,8 @@ void WalletQmlModel::subscribeToWalletSignals()\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n+ // A payment to a previous key can make it count as used.\n+ Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1561,
"evidence_id": "a546903b263546e2b7e6298f894e218f",
"finding_id": "finding:3",
"kind": "new_source",
"line": 1412,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 4,
"source_job_id": 2506,
"text": " item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n exports.append(item);\n }\n return exports;\n}\n\nQVariantList WalletQmlModel::inactiveDescriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n struct Inactive {\n SingleKeyDescriptor descriptor;\n OutputType type;\n bool used;\n };\n std::vector<Inactive> found;\n LOCK(raw_wallet->cs_wallet);\n for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n if (raw_wallet->IsActiveScriptPubKeyMan(*spk_man)) continue;\n const auto descriptor = ParseSingleKeyDescriptor(spk_man);\n const auto type = descriptor ? SingleKeyOutputType(descriptor->script) : std::nullopt;\n if (!type) continue;\n const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n LOCK(desc_man.cs_desc_man);\n found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n }\n std::ranges::sort(found, {}, [](const Inactive& item) {\n return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n\n QVariantList exports;\n const auto append = [&](const Inactive& receive, const std::optional<SingleKeyDescriptor>& change) {\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(receive.type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n };\n for (auto it = found.begin(); it != found.end();) {\n const auto end = std::find_if(it, found.end(), [&](const Inactive& item) {\n return item.type != it->type || item.descriptor.origin != it->descriptor.origin ||\n item.descriptor.xpub != it->descriptor.xpub;\n });\n // next_index only moves once an address is handed out or seen in a transaction.\n if (std::any_of(it, end, [](const Inactive& item) { return item.used; })) {\n if (end - it == 2) {\n append(*it, std::next(it)->descriptor);\n } else {\n std::for_each(it, end, [&](const Inactive& item) { append(item, std::nullopt); });\n }\n }\n it = end;\n }\n return exports;\n}\n\nnamespace {\n\nenum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n\nPublicImport ClassifyPublicImport(const std::string& descriptor)\n{\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n // unused(), as addhdkey adds, has no addresses, and a wallet without\n // private keys rejects it.\n if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n return PublicImport::NoScripts;\n }\n // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n // needs the private key, so importdescriptors rejects the public form.\n const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n std::vector<CScript> scripts;\n FlatSigningProvider out;\n return desc->Expand(0, keys, scripts, out);\n })};\n return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n}\n\nstd::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n{\n omitted = 0;\n LOCK(wallet.cs_wallet);\n auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n if (!exported) return {};\n std::vector<wallet::WalletDescInfo> importable;\n for (wallet::WalletDescInfo& info : *exported) {\n switch (ClassifyPublicImport(info.descriptor)) {\n case PublicImport::Importable:\n importable.push_back(std::move(info));\n break;\n case PublicImport::NeedsPrivateKeys:\n ++omitted;\n break;\n case PublicImport::NoScripts:\n break;\n }\n }\n std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n return importable;\n}\n\n} // namespace\n\nint WalletQmlModel::descriptorImportOmittedCount() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return 0;\n size_t omitted{0};\n ImportableDescriptors(*raw_wallet, omitted);\n return int(omitted);\n}\n\n// Every descriptor in the same form as listdescriptors, ready for importdescriptors.\nQString WalletQmlModel::descriptorImportJson() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n size_t omitted{0};\n const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n if (exported.empty()) return {};\n\n UniValue descriptors{UniValue::VARR};\n for (const wallet::WalletDescInfo& info : exported) {\n UniValue item{UniValue::VOBJ};\n item.pushKV(\"desc\", info.descriptor);\n // The import rescans from here, so \"now\" would miss older transactions.\n item.pushKV(\"timestamp\", info.creation_time);\n item.pushKV(\"active\", info.active);\n if (info.internal) item.pushKV(\"internal\", *info.internal);\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n // A used-up range ends before next_index, which importdescriptors rejects.\n range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n descriptors.push_back(std::move(item));\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · fc657610b860..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Taproot extended keys round-trip as P2WPKH in this appqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new-head source adds a warning explaining that a bare Taproot key lacks script-type information and can lead to addresses the wallet does not watch. It also tightens bare-key eligibility to require an actual matching change descriptor, so a missing change manager no longer qualifies. The broader warning covers the described risk even though Taproot’s extended key remains offered. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "5a2527c3ba83485db0e1e9e036ef880a",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 4,
"source_job_id": 2506,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex cc3d4a74bb..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -1341,7 +1341,34 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n \n bool WalletQmlModel::canShowDescriptors() const\n {\n- return !descriptorExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n QVariantList WalletQmlModel::descriptorExports() const\n@@ -1354,21 +1381,33 @@ QVariantList WalletQmlModel::descriptorExports() const\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n- const auto change = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true));\n+ const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n+ const auto change = ParseSingleKeyDescriptor(change_man);\n+ // A change chain in another form is listed as it is, and no single key covers it.\n+ const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- const WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ if (change_unreadable) {\n+ std::string change_text;\n+ const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n+ descriptor = {.text = change_text.empty() ? receive->descriptor\n+ : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n+ .parts = {}};\n+ }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n- const bool key_covers_both{receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -1410,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1432,19 +1472,77 @@ QVariantList WalletQmlModel::inactiveDescriptorExports() const\n return exports;\n }\n \n+namespace {\n+\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n+{\n+ FlatSigningProvider keys;\n+ std::string error;\n+ const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n+ std::vector<CScript> scripts;\n+ FlatSigningProvider out;\n+ return desc->Expand(0, keys, scripts, out);\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n+}\n+\n+std::vector<wallet::WalletDescInfo> ImportableDescriptors(const wallet::CWallet& wallet, size_t& omitted)\n+{\n+ omitted = 0;\n+ LOCK(wallet.cs_wallet);\n+ auto exported{wallet::ExportDescriptors(wallet, /*export_private=*/false)};\n+ if (!exported) return {};\n+ std::vector<wallet::WalletDescInfo> importable;\n+ for (wallet::WalletDescInfo& info : *exported) {\n+ switch (ClassifyPublicImport(info.descriptor)) {\n+ case PublicImport::Importable:\n+ importable.push_back(std::move(info));\n+ break;\n+ case PublicImport::NeedsPrivateKeys:\n+ ++omitted;\n+ break;\n+ case PublicImport::NoScripts:\n+ break;\n+ }\n+ }\n+ std::ranges::sort(importable, {}, &wallet::WalletDescInfo::descriptor);\n+ return importable;\n+}\n+\n+} // namespace\n+\n+int WalletQmlModel::descriptorImportOmittedCount() const\n+{\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return 0;\n+ size_t omitted{0};\n+ ImportableDescriptors(*raw_wallet, omitted);\n+ return int(omitted);\n+}\n+\n // Every descriptor in the same form as listdescriptors, ready for importdescriptors.\n QString WalletQmlModel::descriptorImportJson() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n \n- LOCK(raw_wallet->cs_wallet);\n- auto exported{wallet::ExportDescriptors(*raw_wallet, /*export_private=*/false)};\n- if (!exported) return {};\n- std::ranges::sort(*exported, {}, &wallet::WalletDescInfo::descriptor);\n+ size_t omitted{0};\n+ const std::vector<wallet::WalletDescInfo> exported{ImportableDescriptors(*raw_wallet, omitted)};\n+ if (exported.empty()) return {};\n \n UniValue descriptors{UniValue::VARR};\n- for (const wallet::WalletDescInfo& info : *exported) {\n+ for (const wallet::WalletDescInfo& info : exported) {\n UniValue item{UniValue::VOBJ};\n item.pushKV(\"desc\", info.descriptor);\n // The import rescans from here, so \"now\" would miss older transactions.\n@@ -1454,7 +1552,8 @@ QString WalletQmlModel::descriptorImportJson() const\n if (info.range) {\n UniValue range{UniValue::VARR};\n range.push_back(info.range->first);\n- range.push_back(info.range->second - 1);\n+ // A used-up range ends before next_index, which importdescriptors rejects.\n+ range.push_back(std::max(info.range->second - 1, info.next_index));\n item.pushKV(\"range\", std::move(range));\n item.pushKV(\"next_index\", info.next_index);\n }\n@@ -3566,6 +3665,8 @@ void WalletQmlModel::subscribeToWalletSignals()\n Q_EMIT guard->transactionChanged(QString::fromStdString(txid.ToString()), change);\n Q_EMIT guard->balanceChanged();\n Q_EMIT guard->sendAmountExhaustsBalanceChanged();\n+ // A payment to a previous key can make it count as used.\n+ Q_EMIT guard->descriptorExportsChanged();\n }\n pending->fetch_sub(1);\n }, Qt::QueuedConnection);\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1491,
"evidence_id": "cf08b9bca4184c0c82ca9097e3919387",
"finding_id": "finding:2",
"kind": "new_source",
"line": 1342,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 4,
"source_job_id": 2506,
"text": "bool WalletQmlModel::canShowDescriptors() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return false;\n\n // Keypool and transaction notifications mostly leave the descriptors as\n // they were, so rebuild the lists only once one is added, activated or used.\n std::vector<std::pair<uint256, bool>> state;\n {\n LOCK(raw_wallet->cs_wallet);\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n for (const bool internal : {false, true}) {\n const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n }\n }\n const auto active_end{state.size()};\n for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n LOCK(desc_man->cs_desc_man);\n state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n }\n std::sort(state.begin() + active_end, state.end());\n }\n if (state != m_descriptor_state) {\n m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n m_descriptor_state = std::move(state);\n }\n return m_can_show_descriptors;\n}\n\nQVariantList WalletQmlModel::descriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n QVariantList exports;\n LOCK(raw_wallet->cs_wallet);\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n const auto change = ParseSingleKeyDescriptor(change_man);\n // A change chain in another form is listed as it is, and no single key covers it.\n const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n if (change_unreadable) {\n std::string change_text;\n const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n descriptor = {.text = change_text.empty() ? receive->descriptor\n : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n .parts = {}};\n }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n exports.append(item);\n }\n return exports;\n}\n\nQVariantList WalletQmlModel::inactiveDescriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n struct Inactive {\n SingleKeyDescriptor descriptor;\n OutputType type;\n bool used;\n };\n std::vector<Inactive> found;\n LOCK(raw_wallet->cs_wallet);\n for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n if (raw_wallet->IsActiveScriptPubKeyMan(*spk_man)) continue;\n const auto descriptor = ParseSingleKeyDescriptor(spk_man);\n const auto type = descriptor ? SingleKeyOutputType(descriptor->script) : std::nullopt;\n if (!type) continue;\n const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n LOCK(desc_man.cs_desc_man);\n found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n }\n std::ranges::sort(found, {}, [](const Inactive& item) {\n return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n\n QVariantList exports;\n const auto append = [&](const Inactive& receive, const std::optional<SingleKeyDescriptor>& change) {\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(receive.type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n };\n for (auto it = found.begin(); it != found.end();) {\n const auto end = std::find_if(it, found.end(), [&](const Inactive& item) {\n return item.type != it->type || item.descriptor.origin != it->descriptor.origin ||\n item.descriptor.xpub != it->descriptor.xpub;\n });\n // next_index only moves once an address is handed out or seen in a transaction.\n if (std::any_of(it, end, [](const Inactive& item) { return item.used; })) {\n if (end - it == 2) {\n append(*it, std::next(it)->descriptor);\n } else {\n std::for_each(it, end, [&](const Inactive& item) { append(item, std::nullopt); });\n }\n }\n it = end;\n }\n return exports;\n}\n\nnamespace {\n\nenum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n\nPublicImport ClassifyPublicImport(const std::string& descriptor)\n{\n FlatSigningProvider keys;\n std::string error;\n const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n // unused(), as addhdkey adds, has no addresses, and a wallet without\n // private keys rejects it.\n if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n return PublicImport::NoScripts;\n }\n // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n // needs the private key, so importdescriptors rejects the public form.",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · fc657610b860..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Replace can overwrite another open wallet's live databaseqml/walletqmlcontroller.cpp | addressed | AssessmentThe controller now adds the selected wallet, all loaded wallets, and retiring wallets to protected paths before allowing a destination, covering replacement of another loaded wallet's database outside the wallets directory. path_diff: qml/walletqmlcontroller.cpp; new_source: qml/walletqmlcontroller.cpp [
{
"evidence_id": "0c53a373054448cfb01851c4cabdf47e",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/walletqmlcontroller.cpp",
"source_generation": 4,
"source_job_id": 2506,
"text": "diff --git a/qml/walletqmlcontroller.cpp b/qml/walletqmlcontroller.cpp\nindex d65fe7bbb7..3cf3c9a5cb 100644\n--- a/qml/walletqmlcontroller.cpp\n+++ b/qml/walletqmlcontroller.cpp\n@@ -210,9 +210,20 @@ QString WalletQmlController::defaultWalletFilePath(WalletQmlModel* wallet, bool\n \n QVariantMap WalletQmlController::walletFileDestination(WalletQmlModel* wallet, const QString& path, bool watch_only) const\n {\n+ // The exact name: a trimmed one can name a different folder.\n+ const auto location = [this](const WalletQmlModel* model) {\n+ return model && model != m_empty_wallet ? walletLocationPath(model->name()) : QString{};\n+ };\n QStringList protected_paths{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n- // A wallet loaded by path can live outside the wallets folder.\n- protected_paths.append(walletLocationPath(wallet));\n+ // A wallet loaded by path can live outside the wallets folder. Replacing\n+ // any loaded wallet's file would bypass its database lock.\n+ protected_paths.append(location(wallet));\n+ {\n+ QMutexLocker locker(&m_wallets_mutex);\n+ for (const WalletQmlModel* loaded : m_wallets) protected_paths.append(location(loaded));\n+ }\n+ // A closing wallet keeps its database open until it finishes.\n+ for (const QString& retiring : m_retiring_wallet_names) protected_paths.append(walletLocationPath(retiring));\n const QString name{wallet && wallet != m_empty_wallet ? wallet->name() : QString{}};\n return DescribeWalletFileDestination(path, watch_only, name, protected_paths, QDateTime::currentDateTime());\n }\n@@ -222,16 +233,19 @@ QString WalletQmlController::walletLocationPath(const WalletQmlModel* wallet) co\n if (!wallet || wallet == m_empty_wallet) {\n return {};\n }\n+ return walletLocationPath(wallet->name().trimmed());\n+}\n \n- const QString wallet_name{wallet->name().trimmed()};\n- if (wallet_name.isEmpty()) {\n+QString WalletQmlController::walletLocationPath(const QString& name) const\n+{\n+ if (name.isEmpty()) {\n return {};\n }\n \n- QFileInfo wallet_path{wallet_name};\n+ QFileInfo wallet_path{name};\n if (!wallet_path.isAbsolute()) {\n const QDir wallet_dir{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n- wallet_path = QFileInfo{wallet_dir.filePath(wallet_name)};\n+ wallet_path = QFileInfo{wallet_dir.filePath(name)};\n }\n \n return wallet_path.absoluteFilePath();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 334,
"evidence_id": "58f7aee6acdf4b66967b8668944f674e",
"finding_id": "finding:1",
"kind": "new_source",
"line": 185,
"new_head": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"old_head": "fc657610b860654e914e140f6a54fc16bf0ecc83",
"path": "qml/walletqmlcontroller.cpp",
"revision": "598abdbeb3a5abc2db4083646cf609590e5f955c",
"source_generation": 4,
"source_job_id": 2506,
"text": " if (!wallet_model) return;\n // Sender is the wallet model, so Qt auto-disconnects when the model is\n // destroyed in closeWallet/unloadWallets.\n QObject::connect(wallet_model, &WalletQmlModel::balanceChanged,\n this, [this, wallet_model]() {\n publishWalletInfo(wallet_model);\n });\n}\n\nQString WalletQmlController::homePath() const\n{\n return QDir::homePath();\n}\n\nQUrl WalletQmlController::homeFileUrl(const QString& file_name) const\n{\n return QUrl::fromLocalFile(file_name.isEmpty() ? QDir::homePath() : QDir::home().filePath(file_name));\n}\n\nQString WalletQmlController::defaultWalletFilePath(WalletQmlModel* wallet, bool watch_only, const QString& folder) const\n{\n const QString name{wallet && wallet != m_empty_wallet ? wallet->name() : QString{}};\n const QDir dir{folder.isEmpty() ? QDir::homePath() : normalizeWalletPath(folder)};\n return QDir::toNativeSeparators(dir.filePath(DefaultWalletFileName(name, watch_only, QDate::currentDate())));\n}\n\nQVariantMap WalletQmlController::walletFileDestination(WalletQmlModel* wallet, const QString& path, bool watch_only) const\n{\n // The exact name: a trimmed one can name a different folder.\n const auto location = [this](const WalletQmlModel* model) {\n return model && model != m_empty_wallet ? walletLocationPath(model->name()) : QString{};\n };\n QStringList protected_paths{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n // A wallet loaded by path can live outside the wallets folder. Replacing\n // any loaded wallet's file would bypass its database lock.\n protected_paths.append(location(wallet));\n {\n QMutexLocker locker(&m_wallets_mutex);\n for (const WalletQmlModel* loaded : m_wallets) protected_paths.append(location(loaded));\n }\n // A closing wallet keeps its database open until it finishes.\n for (const QString& retiring : m_retiring_wallet_names) protected_paths.append(walletLocationPath(retiring));\n const QString name{wallet && wallet != m_empty_wallet ? wallet->name() : QString{}};\n return DescribeWalletFileDestination(path, watch_only, name, protected_paths, QDateTime::currentDateTime());\n}\n\nQString WalletQmlController::walletLocationPath(const WalletQmlModel* wallet) const\n{\n if (!wallet || wallet == m_empty_wallet) {\n return {};\n }\n return walletLocationPath(wallet->name().trimmed());\n}\n\nQString WalletQmlController::walletLocationPath(const QString& name) const\n{\n if (name.isEmpty()) {\n return {};\n }\n\n QFileInfo wallet_path{name};\n if (!wallet_path.isAbsolute()) {\n const QDir wallet_dir{QString::fromStdString(m_node.walletLoader().getWalletDir())};\n wallet_path = QFileInfo{wallet_dir.filePath(name)};\n }\n\n return wallet_path.absoluteFilePath();\n}\n\nbool WalletQmlController::openWalletLocation(WalletQmlModel* wallet)\n{\n clearWalletLocationOpenError();\n\n const QString wallet_path{walletLocationPath(wallet)};\n if (wallet_path.isEmpty()) {\n setWalletLocationOpenError(tr(\"No wallet file is available to view.\"));\n return false;\n }\n\n const QFileInfo wallet_location{wallet_path};\n if (!wallet_location.exists()) {\n setWalletLocationOpenError(tr(\"Wallet file not found: %1\").arg(wallet_path));\n return false;\n }\n\n const QString open_path = wallet_location.isDir()\n ? wallet_location.absoluteFilePath()\n : wallet_location.absolutePath();\n if (!m_open_local_path_fn(open_path)) {\n setWalletLocationOpenError(tr(\"Could not open wallet file location.\"));\n return false;\n }\n\n return true;\n}\n\nvoid WalletQmlController::clearWalletLocationOpenError()\n{\n setWalletLocationOpenError({});\n}\n\nvoid WalletQmlController::closeWallet(const QString& path)\n{\n if (!m_initialized) {\n setWalletLoadError(tr(\"Wallets are still loading. Try again in a moment.\"));\n return;\n }\n\n if (path.trimmed().isEmpty()) {\n return;\n }\n\n clearWalletLoadStatus();\n clearWalletMigrationStatus();\n\n WalletQmlModel* wallet_to_close{nullptr};\n\n {\n QMutexLocker locker(&m_wallets_mutex);\n const auto wallet_it = std::find_if(m_wallets.begin(), m_wallets.end(), [&](WalletQmlModel* wallet) {\n return wallet->name() == path;\n });\n if (wallet_it == m_wallets.end()) {\n return;\n }\n\n wallet_to_close = *wallet_it;\n }\n\n removeWalletModel(wallet_to_close, true);\n}\n\nQString WalletQmlController::walletDisplayName(const QString& path) const\n{\n const QString trimmed_path = path.trimmed();\n if (trimmed_path.isEmpty()) {\n return {};\n }\n\n QSettings settings;\n const QString display_name = settings.value(walletDisplayNameKey(trimmed_path)).toString().trimmed();\n return display_name.isEmpty() ? trimmed_path : display_name;\n}\n\nbool WalletQmlController::setWalletDisplayName(const QString& path, const QString& display_name)\n{\n const QString trimmed_path = path.trimmed();\n if (trimmed_path.isEmpty()) {\n return false;\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · fc657610b860..598abdbeb3a5 2026-11-25T01:22:15Z · gpt-6-luna |
| gui#988 | Wire limits abort startup even when no receiver existsqml/paymenturiserver.cpp | addressed | AssessmentThe sender now checks for a receiver before encoding against the IPC limits. With no receiver, an oversized batch returns `NoReceiver`, allowing the local startup path to proceed; with a receiver, the batch is still rejected as too large for the protocol. `SendRequests()` now connects and handles `ServerNotFoundError`/`ConnectionRefusedError` before calling `EncodeRequest()`. Added tests verify an oversized batch without a receiver returns `NoReceiver` and that the same batch with a receiver fails. Source report · 6621d073019e..380fe4e4153e 2026-11-11T17:23:06Z · gpt-6-luna |
| gui#988 | Incoming requests interrupt password entry and manual URI importqml/pages/wallet/SendCreate.qml | addressed | AssessmentIncoming payment requests are now held while either password entry or manual URI entry is visible, and closing either popup signals that queued requests may be accepted again. Tests cover both blocked states and resumption notification. `canAcceptPaymentRequest()` now includes `!reviewPassphrasePopup.visible` and `!sendUriImportPopup.visible`. The diff adds `onClosed: root.paymentRequestAcceptable()` to both popups, and adds tests that assert requests are not acceptable while each popup is open and that the signal fires on close. Source report · 6621d073019e..380fe4e4153e 2026-11-11T17:23:06Z · gpt-6-luna |
| gui#988 | Later payment links give no notice after backing out of wallet openingqml/pages/MainWindow.qml | addressed | AssessmentEvery queued request now emits a distinct notification, and MainWindow clears the announcement flag and schedules delivery for that signal. This handles requests appended behind the current queue front and permits a fresh notice after backing out of the no-wallet notice. The diff adds `Q_EMIT requestQueued()` in `PaymentUriHandler::queueRequest()` and connects `onRequestQueued()` in MainWindow to set `paymentUriAnnounced = false` and call `Qt.callLater(appWindow.deliverPendingPaymentUri)`. The added routing test queues a second URI after closing the notice and verifies the popup opens again. Source report · 6621d073019e..380fe4e4153e 2026-11-11T17:23:06Z · gpt-6-luna |
| gui#988 | Payment URI hand-off trusts a predictable shared-temp endpointqml/paymenturiserver.cpp | addressed | AssessmentOn non-Darwin Unix, the endpoint is now placed under RuntimeLocation and returns empty if that location is unavailable; the sender and listener both fail closed for an empty endpoint. This removes the shared-temporary-directory bare-name fallback described in the finding. `ServerName()` returns `runtime_dir.isEmpty() ? QString() : QDir(runtime_dir).filePath(name)` on Unix (lines 64–68). `SendRequests()` returns NoReceiver for an empty name (lines 143–144), and `listen()` rejects it with an error (lines 223–226). The new `noPrivateRuntimeDirectoryDisablesTheHandOff()` test asserts all three behaviors. Source report · 6621d073019e..d76c75c17525 2026-11-11T23:02:39Z · gpt-6-luna |
| gui#986 | Background import success banner disappears after eight secondsqml/pages/MainWindow.qml | addressed | AssessmentThe success toast no longer has an automatic dismissal timeout, so it remains available until the user dismisses it or chooses Open. The new MainWindow.qml excerpt retains the success toast's close and Open actions but has no `dismissAfter` property. The diff removes `dismissAfter: 8`, and the routing test verifies `toast.dismissAfter` is `0`. Source report · a5f9e6896b4b..a9b2ea2c99ac 2026-11-12T01:44:42Z · gpt-6-luna |
| gui#986 | Quit and close no longer exit after a fatal error during shutdownqml/pages/MainWindow.qml | addressed | AssessmentThe fatal-exception case now bypasses the duplicate-shutdown guard, allowing `requestQuit()` to call `nodeModel.requestShutdown()` and reach its fatal-exit handling. `requestQuit()` now returns for an in-progress shutdown only when `!nodeModel.fatalException` (MainWindow.qml lines 96–99); the subsequent unconditional `nodeModel.requestShutdown()` remains. The routing test also sets `fatalException` during shutdown and verifies a further quit request increments the shutdown spy. Source report · a5f9e6896b4b..a9b2ea2c99ac 2026-11-12T01:44:42Z · gpt-6-luna |
| gui#934 | Retrying an interrupted payment request pulls the user back to Sendqml/pages/wallet/DesktopWallets.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · d6afae24d093..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#1052 | Reduced motion reads the OS setting only at startupqml/motionpreference.h | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · 9749ee4ade1b..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Return confirms “Send all available funds?” without focusing its buttonqml/controls/AlertPopup.qml | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · 9749ee4ade1b..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1050 | Clicking Custom after Default fails to restore the remembered directoryqml/components/StorageLocations.qml | addressed | AssessmentThe Custom handler now submits the remembered directory directly, so a validator result stating that the inactive path has not been checked no longer prevents a preview from being started. In StorageLocations.qml, the handler clears validationError, invokes selectCustomDataDir(root.settingsModel.customDataDir), and reports an error only if the call returns false. The test mock reproduces the not-checked result for the inactive path and verifies that clicking Custom still selects the remembered directory. Source report · e6aea2543d81..f68f5bf24c50 2026-11-12T03:03:39Z · gpt-6-luna |
| gui#883 | New-folder preview can falsely report profile drift with external settingsqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · b4ec1efcec60..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | The settings-recovery dialog ignores application quit requestsqml/bitcoin.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · b4ec1efcec60..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Chooser requests are ignored when settings.json is unreadableqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · b4ec1efcec60..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Settings-recovery Reset can discard a legacy-only data-directory selectionqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · b4ec1efcec60..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Pre-creating the settings parent skips first-use wallets/ initializationqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · b4ec1efcec60..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#863 | Canonical formatter's minimum-integer fix lacks regression coverageqml/bitcoinunits.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · e47e4a58a07d..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Cache smoke test does not confirm that preinit.qml loadedtest/functional/qml_test_cache_policy.py | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · e47e4a58a07d..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Linux stale-cache read monitoring misses the Qt ≥ 6.6 policy in CI.github/workflows/artifacts.yml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · e47e4a58a07d..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#1092 | Estimator recovery with fallback disabled lacks a regression testtest/test_walletqmlmodel.cpp | addressed | AssessmentThe test adds the requested fallback-disabled recovery phase: it keeps fallback disabled, reports FEE_RATE_ESTIMATOR, supplies a successful transaction result, and checks that unavailability clears, the estimate is populated, and estimatedFeeChanged is emitted. In test_walletqmlmodel.cpp, raw_wallet.m_allow_fallback_fee remains false when get_fee_reason_fn is changed to FEE_RATE_ESTIMATOR; the test then asserts `!model->feeEstimationUnavailable()`, estimatedFeeSatoshi() is 250, and estimate_changed.count() is greater than zero. Source report · e22379e6f358..ca075b1df770 2026-11-12T00:37:03Z · gpt-6-luna |
| gui#1092 | Block retries can leave Review disabled after estimates recoverqml/pages/wallet/SendCreate.qml | addressed | AssessmentThe new code records block-tip notifications that arrive during a pending estimate and retries once the request completes, while preserving the pending guard. Switching to a target cached as unavailable also schedules a refresh in setFeeTargetBlocks(). SendCreate.qml now sets feeRetryAfterPendingEstimate on a block tip while feeEstimatePending is true, then calls retryUnavailableFeeEstimate() when pending becomes false. The old-to-new diff also adds `if (m_unavailable_fee_targets.contains(target_blocks)) scheduleFeeEstimates();` to setFeeTargetBlocks(). Source report · e22379e6f358..ca075b1df770 2026-11-12T00:37:03Z · gpt-6-luna |
| gui#1096 | Onboarding defaults and mocks disagree about model availabilityqml/applicationmodels.h | addressed | AssessmentShared onboarding and settings components now declare settingsModel as required, removing the unusable ApplicationModels.optionsModel fallback. The onboarding fixtures explicitly inject optionsModel, and the test mock can model preinit availability separately: in preinit mode optionsModel is null while onboardingOptionsModel resolves the model. A new test verifies the injected model remains usable under that configuration. The diff changes settingsModel to `required property var` in OnboardingWizard.qml, its onboarding pages, and shared storage/connection settings components. In tst_onboarding_datadir.qml, fixtures now bind `settingsModel: optionsModel`; init asserts `ApplicationModels.optionsModel` is null and `onboardingOptionsModel` is the fixture model, and `test_onboarding_uses_injected_model` verifies the wizard uses the injected model. MockApplicationModels.setPreInitForTest toggles the accessors to reflect those distinct production roles. Source report · 730314610393..828d54a4a7e9 2026-11-12T04:13:19Z · gpt-6-luna |
| gui#1092 | The Custom slider still clears an entered rate when estimates are absentqml/components/SendFeeSelection.qml | addressed | AssessmentThe fee-target setter now retains the existing custom rate when the lookup has no positive estimate, while still replacing it when a positive rate is available. In walletqmlmodel.cpp, `setCustomFeeTarget()` changes the unconditional assignment to `if (rate > 0) setCustomFeeRate(...)`, with a comment that an unavailable estimate should keep the entered rate. Source report · c2efed1684b9..e22379e6f358 2026-11-10T15:05:42Z · gpt-6-luna |
| gui#1092 | Rapid block retries can keep the Custom-fee guidance hiddenqml/pages/wallet/SendCreate.qml | addressed | AssessmentThe block-tip retry now checks that no fee estimate is already pending before calling scheduleFeeEstimates(), preventing incoming tips from repeatedly restarting an in-flight recheck. The footer also prioritizes the unavailable-fee guidance over “Estimating…”. In SendCreate.qml, the block-tip condition adds `&& !root.wallet.feeEstimatePending`, and the footer places the unavailable-guidance branch before the pending-estimate branch. The added QML test verifies that a block-tip change while pending does not increase scheduleFeeEstimatesCalls and that the Custom guidance remains visible. Source report · c2efed1684b9..e22379e6f358 2026-11-10T15:05:42Z · gpt-6-luna |
| gui#1090 | Cumulative-stage wording obscures exact test selectiondoc/integration-testing.md | addressed | AssessmentThe wording now distinguishes exact stage filtering from the steps needed to validate cumulative coverage. The documentation says to pass each applicable `--stage` to functional scripts, or run each earlier stage's integration CTest entry, and notes the integration runner accepts `--stage` only once. Source report · 02bbdb7711f8..baee452eec1c 2026-11-12T04:07:32Z · gpt-6-luna |
| gui#1090 | Click helper silently retries swallowed inputtest/integration/fixture/test_util.h | still_present | AssessmentThe helper still retries after an undelivered first gesture; Click(QObject*) continues to call ClickWithRetries. Retry reporting was added, but the default path can still pass after a later gesture reaches the target. path_diff: test/integration/fixture/test_util.h; new_source: test/integration/fixture/test_util.h [
{
"evidence_id": "064ac15ddcc04716b7309fb1f622f385",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"old_head": "02bbdb7711f8b85685e63aa18873e25968aeb848",
"path": "test/integration/fixture/test_util.h",
"source_generation": 3,
"source_job_id": 2398,
"text": "diff --git a/test/integration/fixture/test_util.h b/test/integration/fixture/test_util.h\nindex 8440887a..854f3630 100644\n--- a/test/integration/fixture/test_util.h\n+++ b/test/integration/fixture/test_util.h\n@@ -105,12 +105,39 @@ inline QObject* Find(BitcoinQmlApplication& app, const char* name)\n return Find(app.window(), object_name);\n }\n \n+// Check visual and QObject children, including popup overlays and retained pages.\n+// Return locations only, never the secret itself, in failure diagnostics.\n+inline QStringList SecretTextLocations(QObject* root, const QString& secret)\n+{\n+ QStringList leaks;\n+ QList<QObject*> pending{root};\n+ QSet<QObject*> visited;\n+ while (!pending.isEmpty()) {\n+ auto* object = pending.takeLast();\n+ if (!object || visited.contains(object)) continue;\n+ visited.insert(object);\n+ for (const char* property : {\"text\", \"errorText\", \"message\"}) {\n+ if (!secret.isEmpty() && object->property(property).toString().contains(secret)) {\n+ leaks.append(QStringLiteral(\"%1.%2\").arg(object->objectName(), QString::fromLatin1(property)));\n+ }\n+ }\n+ pending.append(object->children());\n+ if (auto* window = qobject_cast<QQuickWindow*>(object)) pending.append(window->contentItem());\n+ if (auto* item = qobject_cast<QQuickItem*>(object)) {\n+ for (auto* child : item->childItems()) pending.append(child);\n+ }\n+ }\n+ return leaks;\n+}\n+\n inline bool TransitionsFinished(QObject* root)\n {\n QList<QObject*> pending{root};\n while (!pending.isEmpty()) {\n auto* object = pending.takeLast();\n- if (object->property(\"busy\").toBool()) return false;\n+ // Only a StackView's busy means a running transition; dialogs use busy\n+ // to refuse closing while they work.\n+ if (object->inherits(\"QQuickStackView\") && object->property(\"busy\").toBool()) return false;\n if (object->inherits(\"QQuickPopup\") && object->property(\"visible\").toBool() && !object->property(\"opened\").toBool()) return false;\n pending.append(object->children());\n }\n@@ -130,7 +157,7 @@ inline bool WaitForPolish(QQuickItem* item)\n #endif\n }\n \n-inline bool Click(QObject* object)\n+inline bool ClickWithRetries(QObject* object)\n {\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !item->isVisible() || !item->isEnabled() || !WaitForPolish(item) || !item ||\n@@ -144,13 +171,27 @@ inline bool Click(QObject* object)\n if (item->metaObject()->indexOfSignal(\"clicked()\") < 0) return click();\n QSignalSpy clicked{item, SIGNAL(clicked())};\n const auto pressed = item->metaObject()->indexOfSignal(\"pressed()\") < 0 ? nullptr : std::make_unique<QSignalSpy>(item, SIGNAL(pressed()));\n- const auto delivered = [&] { return (pressed && !pressed->isEmpty()) || !clicked.isEmpty(); };\n- // A modal exit can consume input on the next control. Observe the press\n- // before its click handler can remove the control or close its dialog.\n- return QTest::qWaitFor([&] {\n+ const auto delivered = [&] { return !clicked.isEmpty(); };\n+ // Modal exit can consume a gesture. Keep retries visible in the report so\n+ // a successful test does not silently conceal swallowed input.\n+ const QString target = item->objectName();\n+ int attempts{0};\n+ const bool success = QTest::qWaitFor([&] {\n if (delivered()) return true;\n- return click() && delivered();\n+ // A press reached the target but was canceled (for example by becoming\n+ // disabled). Do not retry a delivered gesture or report it as a click.\n+ if (pressed && !pressed->isEmpty()) return true;\n+ ++attempts;\n+ return click() && (delivered() || (pressed && !pressed->isEmpty()));\n }, 10'000);\n+ if (attempts > 1) qWarning() << \"Click retries for\" << target << \"attempts:\" << attempts << \"delivered:\" << delivered();\n+ return success && delivered();\n+}\n+\n+// Existing journeys tolerate modal-exit retries, but each retry is reported.\n+inline bool Click(QObject* object)\n+{\n+ return ClickWithRetries(object);\n }\n \n inline bool OpenSettings(BitcoinQmlApplication& app)\n@@ -175,16 +216,28 @@ inline bool Click(BitcoinQmlApplication& app, const char* name)\n auto* object = WaitForVisible(app, name);\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !WaitForPolish(item) || !item) return false;\n- for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n- if (!parent->inherits(\"QQuickFlickable\")) continue;\n- const auto rect = item->mapRectToItem(parent, item->boundingRect());\n- const auto offset = rect.top() < 0 ? rect.top() : std::max(0.0, rect.bottom() - parent->height());\n- if (offset != 0) parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n- }\n- QCoreApplication::processEvents();\n const bool ready = QTest::qWaitFor([&] {\n- return item && item->isEnabled() && item->width() > 0 && item->height() > 0 &&\n- app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), item->boundingRect().center()));\n+ if (!item || !WaitForPolish(item) || !item) return false;\n+ bool scrolled{false};\n+ for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n+ if (!parent->inherits(\"QQuickFlickable\")) continue;\n+ const auto rect = item->mapRectToItem(parent, item->boundingRect());\n+ // Leave a pixel of room: QPoint rounding must not put the gesture\n+ // on the exclusive bottom edge of a clipped viewport.\n+ const auto offset = rect.height() > parent->height() - 2\n+ ? rect.center().y() - parent->height() / 2\n+ : rect.top() < 1 ? rect.top() - 1 : std::max(0.0, rect.bottom() - parent->height() + 1);\n+ if (offset != 0) {\n+ parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n+ scrolled = true;\n+ }\n+ }\n+ if (scrolled || !item->isEnabled() || item->width() <= 0 || item->height() <= 0) return false;\n+ const auto center = item->boundingRect().center();\n+ for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n+ if (parent->clip() && !parent->contains(item->mapToItem(parent, center))) return false;\n+ }\n+ return app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), center));\n });\n if (!ready) qWarning() << \"Cannot click\" << name;\n return ready && item && Click(item.data());\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 269,
"evidence_id": "54519056c82d46fd85851914d385e71b",
"finding_id": "finding:3",
"kind": "new_source",
"line": 120,
"new_head": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"old_head": "02bbdb7711f8b85685e63aa18873e25968aeb848",
"path": "test/integration/fixture/test_util.h",
"revision": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"source_generation": 3,
"source_job_id": 2398,
"text": " if (!secret.isEmpty() && object->property(property).toString().contains(secret)) {\n leaks.append(QStringLiteral(\"%1.%2\").arg(object->objectName(), QString::fromLatin1(property)));\n }\n }\n pending.append(object->children());\n if (auto* window = qobject_cast<QQuickWindow*>(object)) pending.append(window->contentItem());\n if (auto* item = qobject_cast<QQuickItem*>(object)) {\n for (auto* child : item->childItems()) pending.append(child);\n }\n }\n return leaks;\n}\n\ninline bool TransitionsFinished(QObject* root)\n{\n QList<QObject*> pending{root};\n while (!pending.isEmpty()) {\n auto* object = pending.takeLast();\n // Only a StackView's busy means a running transition; dialogs use busy\n // to refuse closing while they work.\n if (object->inherits(\"QQuickStackView\") && object->property(\"busy\").toBool()) return false;\n if (object->inherits(\"QQuickPopup\") && object->property(\"visible\").toBool() && !object->property(\"opened\").toBool()) return false;\n pending.append(object->children());\n }\n return true;\n}\n\ninline bool WaitForPolish(QQuickItem* item)\n{\n if (!item || !item->window()) return false;\n#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)\n return QQuickTest::qWaitForPolish(item->window());\n#else\n for (QPointer<QQuickItem> current{item}; current; current = current->parentItem()) {\n if (!QQuickTest::qWaitForItemPolished(current)) return false;\n }\n return true;\n#endif\n}\n\ninline bool ClickWithRetries(QObject* object)\n{\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !item->isVisible() || !item->isEnabled() || !WaitForPolish(item) || !item ||\n item->width() <= 0 || item->height() <= 0) return false;\n const auto click = [&] {\n if (!item || !item->isVisible() || !item->isEnabled() || !item->window()) return false;\n QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier,\n item->mapToScene(item->boundingRect().center()).toPoint());\n return true;\n };\n if (item->metaObject()->indexOfSignal(\"clicked()\") < 0) return click();\n QSignalSpy clicked{item, SIGNAL(clicked())};\n const auto pressed = item->metaObject()->indexOfSignal(\"pressed()\") < 0 ? nullptr : std::make_unique<QSignalSpy>(item, SIGNAL(pressed()));\n const auto delivered = [&] { return !clicked.isEmpty(); };\n // Modal exit can consume a gesture. Keep retries visible in the report so\n // a successful test does not silently conceal swallowed input.\n const QString target = item->objectName();\n int attempts{0};\n const bool success = QTest::qWaitFor([&] {\n if (delivered()) return true;\n // A press reached the target but was canceled (for example by becoming\n // disabled). Do not retry a delivered gesture or report it as a click.\n if (pressed && !pressed->isEmpty()) return true;\n ++attempts;\n return click() && (delivered() || (pressed && !pressed->isEmpty()));\n }, 10'000);\n if (attempts > 1) qWarning() << \"Click retries for\" << target << \"attempts:\" << attempts << \"delivered:\" << delivered();\n return success && delivered();\n}\n\n// Existing journeys tolerate modal-exit retries, but each retry is reported.\ninline bool Click(QObject* object)\n{\n return ClickWithRetries(object);\n}\n\ninline bool OpenSettings(BitcoinQmlApplication& app)\n{\n return Click(Find(app, app.window()->property(\"desktopWalletMode\").toBool()\n ? \"desktopWalletSettingsTabButton\" : \"nodeSettingsButton\"));\n}\n\ninline QObject* WaitForVisible(BitcoinQmlApplication& app, const char* name)\n{\n QObject* object{nullptr};\n const bool ready = QTest::qWaitFor([&] {\n object = Find(app, name);\n return object && object->property(\"visible\").toBool() && TransitionsFinished(app.window());\n }, 10'000);\n if (!ready) qWarning() << \"Control did not become ready:\" << name << object << \"visible:\" << (object && object->property(\"visible\").toBool()) << \"transitions finished:\" << TransitionsFinished(app.window());\n return ready ? object : nullptr;\n}\n\ninline bool Click(BitcoinQmlApplication& app, const char* name)\n{\n auto* object = WaitForVisible(app, name);\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !WaitForPolish(item) || !item) return false;\n const bool ready = QTest::qWaitFor([&] {\n if (!item || !WaitForPolish(item) || !item) return false;\n bool scrolled{false};\n for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n if (!parent->inherits(\"QQuickFlickable\")) continue;\n const auto rect = item->mapRectToItem(parent, item->boundingRect());\n // Leave a pixel of room: QPoint rounding must not put the gesture\n // on the exclusive bottom edge of a clipped viewport.\n const auto offset = rect.height() > parent->height() - 2\n ? rect.center().y() - parent->height() / 2\n : rect.top() < 1 ? rect.top() - 1 : std::max(0.0, rect.bottom() - parent->height() + 1);\n if (offset != 0) {\n parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n scrolled = true;\n }\n }\n if (scrolled || !item->isEnabled() || item->width() <= 0 || item->height() <= 0) return false;\n const auto center = item->boundingRect().center();\n for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n if (parent->clip() && !parent->contains(item->mapToItem(parent, center))) return false;\n }\n return app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), center));\n });\n if (!ready) qWarning() << \"Cannot click\" << name;\n return ready && item && Click(item.data());\n}\n\ninline bool SetText(BitcoinQmlApplication& app, const char* name, const QString& text)\n{\n auto* item = qobject_cast<QQuickItem*>(WaitForVisible(app, name));\n if (!item) return false;\n item->forceActiveFocus();\n if (!QMetaObject::invokeMethod(item, \"selectAll\")) return false;\n QTest::keyClick(item->window(), Qt::Key_Backspace, Qt::NoModifier, 1);\n QInputMethodEvent edit;\n edit.setCommitString(text);\n QCoreApplication::sendEvent(item, &edit);\n return edit.isAccepted();\n}\n\ninline bool SelectSettings(BitcoinQmlApplication& app, const char* section)\n{\n auto* settings = qobject_cast<QQuickItem*>(Find(app, \"settingsView\"));\n if ((!settings || !settings->isVisible()) && !OpenSettings(app)) return false;\n if (!WaitForVisible(app, \"settingsView\")) return false;\n auto* sidebar = qobject_cast<QQuickItem*>(Find(app, \"settingsSidebarList\"));\n auto* button = qobject_cast<QQuickItem*>(Find(app, qPrintable(QStringLiteral(\"settingsSidebar_%1\").arg(section))));\n if (!sidebar || !button) return false;\n const auto position_mode = sidebar->metaObject()->enumerator(sidebar->metaObject()->indexOfEnumerator(\"PositionMode\"));\n const int contain = position_mode.keyToValue(\"Contain\");\n const int index = button->parentItem()->property(\"index\").toInt();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 02bbdb7711f8..51ea5d406a92 2026-11-18T00:24:28Z · gpt-6-luna |
| gui#1090 | Watch-only integration coverage bypasses the live review controlstest/integration/signers/test_watchonly.cpp | addressed | AssessmentThe test now exercises a real watch-only draft through the Send UI, opens the review popup, verifies Send is hidden and Save is visible, then exports and decodes the PSBT while retaining the empty-mempool assertions. test_watchonly.cpp lines 50–75 enter recipient and amount in the UI, click sendReviewButton, verify review-page and popup state plus Send/Save visibility, and click sendTransactionReviewSaveButton to save the PSBT. Source report · 02bbdb7711f8..1137c33186d2 2026-11-12T05:20:44Z · gpt-6-luna |
| gui#1090 | Replacement send coverage omits the password text sweeptest/functional/interface_qml_wallet_sending.py | addressed | AssessmentThe integration coverage now includes a reusable sweep across visual and QObject children for password text and uses it after review-password confirmation in the send cases. `SecretTextLocations` checks `text`, `errorText`, and `message` properties, traversing QObject and visual children. `test_send.cpp` asserts no occurrence of both `review password` and `fallback password` after review unlock. Source report · 02bbdb7711f8..baee452eec1c 2026-11-12T04:07:32Z · gpt-6-luna |
| gui#1090 | Click helper silently retries swallowed clicks for up to ten secondstest/integration/fixture/test_util.h | still_present | AssessmentRetries remain in the helper used by default: Click(QObject*) delegates to ClickWithRetries, which continues sending gestures until clicked() is observed. It now logs retries, but a swallowed first gesture followed by a successful retry can still make the test pass, the reported issue. path_diff: test/integration/fixture/test_util.h; new_source: test/integration/fixture/test_util.h [
{
"evidence_id": "6bf2e5e049814be7a0d0166c395d4b8f",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"old_head": "abcf31ef8ea860937b15c0d7ab9f17e1212ca031",
"path": "test/integration/fixture/test_util.h",
"source_generation": 1,
"source_job_id": 2393,
"text": "diff --git a/test/integration/fixture/test_util.h b/test/integration/fixture/test_util.h\nindex 8440887a..854f3630 100644\n--- a/test/integration/fixture/test_util.h\n+++ b/test/integration/fixture/test_util.h\n@@ -105,12 +105,39 @@ inline QObject* Find(BitcoinQmlApplication& app, const char* name)\n return Find(app.window(), object_name);\n }\n \n+// Check visual and QObject children, including popup overlays and retained pages.\n+// Return locations only, never the secret itself, in failure diagnostics.\n+inline QStringList SecretTextLocations(QObject* root, const QString& secret)\n+{\n+ QStringList leaks;\n+ QList<QObject*> pending{root};\n+ QSet<QObject*> visited;\n+ while (!pending.isEmpty()) {\n+ auto* object = pending.takeLast();\n+ if (!object || visited.contains(object)) continue;\n+ visited.insert(object);\n+ for (const char* property : {\"text\", \"errorText\", \"message\"}) {\n+ if (!secret.isEmpty() && object->property(property).toString().contains(secret)) {\n+ leaks.append(QStringLiteral(\"%1.%2\").arg(object->objectName(), QString::fromLatin1(property)));\n+ }\n+ }\n+ pending.append(object->children());\n+ if (auto* window = qobject_cast<QQuickWindow*>(object)) pending.append(window->contentItem());\n+ if (auto* item = qobject_cast<QQuickItem*>(object)) {\n+ for (auto* child : item->childItems()) pending.append(child);\n+ }\n+ }\n+ return leaks;\n+}\n+\n inline bool TransitionsFinished(QObject* root)\n {\n QList<QObject*> pending{root};\n while (!pending.isEmpty()) {\n auto* object = pending.takeLast();\n- if (object->property(\"busy\").toBool()) return false;\n+ // Only a StackView's busy means a running transition; dialogs use busy\n+ // to refuse closing while they work.\n+ if (object->inherits(\"QQuickStackView\") && object->property(\"busy\").toBool()) return false;\n if (object->inherits(\"QQuickPopup\") && object->property(\"visible\").toBool() && !object->property(\"opened\").toBool()) return false;\n pending.append(object->children());\n }\n@@ -130,7 +157,7 @@ inline bool WaitForPolish(QQuickItem* item)\n #endif\n }\n \n-inline bool Click(QObject* object)\n+inline bool ClickWithRetries(QObject* object)\n {\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !item->isVisible() || !item->isEnabled() || !WaitForPolish(item) || !item ||\n@@ -144,13 +171,27 @@ inline bool Click(QObject* object)\n if (item->metaObject()->indexOfSignal(\"clicked()\") < 0) return click();\n QSignalSpy clicked{item, SIGNAL(clicked())};\n const auto pressed = item->metaObject()->indexOfSignal(\"pressed()\") < 0 ? nullptr : std::make_unique<QSignalSpy>(item, SIGNAL(pressed()));\n- const auto delivered = [&] { return (pressed && !pressed->isEmpty()) || !clicked.isEmpty(); };\n- // A modal exit can consume input on the next control. Observe the press\n- // before its click handler can remove the control or close its dialog.\n- return QTest::qWaitFor([&] {\n+ const auto delivered = [&] { return !clicked.isEmpty(); };\n+ // Modal exit can consume a gesture. Keep retries visible in the report so\n+ // a successful test does not silently conceal swallowed input.\n+ const QString target = item->objectName();\n+ int attempts{0};\n+ const bool success = QTest::qWaitFor([&] {\n if (delivered()) return true;\n- return click() && delivered();\n+ // A press reached the target but was canceled (for example by becoming\n+ // disabled). Do not retry a delivered gesture or report it as a click.\n+ if (pressed && !pressed->isEmpty()) return true;\n+ ++attempts;\n+ return click() && (delivered() || (pressed && !pressed->isEmpty()));\n }, 10'000);\n+ if (attempts > 1) qWarning() << \"Click retries for\" << target << \"attempts:\" << attempts << \"delivered:\" << delivered();\n+ return success && delivered();\n+}\n+\n+// Existing journeys tolerate modal-exit retries, but each retry is reported.\n+inline bool Click(QObject* object)\n+{\n+ return ClickWithRetries(object);\n }\n \n inline bool OpenSettings(BitcoinQmlApplication& app)\n@@ -175,16 +216,28 @@ inline bool Click(BitcoinQmlApplication& app, const char* name)\n auto* object = WaitForVisible(app, name);\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !WaitForPolish(item) || !item) return false;\n- for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n- if (!parent->inherits(\"QQuickFlickable\")) continue;\n- const auto rect = item->mapRectToItem(parent, item->boundingRect());\n- const auto offset = rect.top() < 0 ? rect.top() : std::max(0.0, rect.bottom() - parent->height());\n- if (offset != 0) parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n- }\n- QCoreApplication::processEvents();\n const bool ready = QTest::qWaitFor([&] {\n- return item && item->isEnabled() && item->width() > 0 && item->height() > 0 &&\n- app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), item->boundingRect().center()));\n+ if (!item || !WaitForPolish(item) || !item) return false;\n+ bool scrolled{false};\n+ for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n+ if (!parent->inherits(\"QQuickFlickable\")) continue;\n+ const auto rect = item->mapRectToItem(parent, item->boundingRect());\n+ // Leave a pixel of room: QPoint rounding must not put the gesture\n+ // on the exclusive bottom edge of a clipped viewport.\n+ const auto offset = rect.height() > parent->height() - 2\n+ ? rect.center().y() - parent->height() / 2\n+ : rect.top() < 1 ? rect.top() - 1 : std::max(0.0, rect.bottom() - parent->height() + 1);\n+ if (offset != 0) {\n+ parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n+ scrolled = true;\n+ }\n+ }\n+ if (scrolled || !item->isEnabled() || item->width() <= 0 || item->height() <= 0) return false;\n+ const auto center = item->boundingRect().center();\n+ for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n+ if (parent->clip() && !parent->contains(item->mapToItem(parent, center))) return false;\n+ }\n+ return app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), center));\n });\n if (!ready) qWarning() << \"Cannot click\" << name;\n return ready && item && Click(item.data());\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 269,
"evidence_id": "e77610fa89bf41aabc6c0d56811447e9",
"finding_id": "finding:4",
"kind": "new_source",
"line": 120,
"new_head": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"old_head": "abcf31ef8ea860937b15c0d7ab9f17e1212ca031",
"path": "test/integration/fixture/test_util.h",
"revision": "51ea5d406a92f18ab3abc7142bae77c273deb8a7",
"source_generation": 1,
"source_job_id": 2393,
"text": " if (!secret.isEmpty() && object->property(property).toString().contains(secret)) {\n leaks.append(QStringLiteral(\"%1.%2\").arg(object->objectName(), QString::fromLatin1(property)));\n }\n }\n pending.append(object->children());\n if (auto* window = qobject_cast<QQuickWindow*>(object)) pending.append(window->contentItem());\n if (auto* item = qobject_cast<QQuickItem*>(object)) {\n for (auto* child : item->childItems()) pending.append(child);\n }\n }\n return leaks;\n}\n\ninline bool TransitionsFinished(QObject* root)\n{\n QList<QObject*> pending{root};\n while (!pending.isEmpty()) {\n auto* object = pending.takeLast();\n // Only a StackView's busy means a running transition; dialogs use busy\n // to refuse closing while they work.\n if (object->inherits(\"QQuickStackView\") && object->property(\"busy\").toBool()) return false;\n if (object->inherits(\"QQuickPopup\") && object->property(\"visible\").toBool() && !object->property(\"opened\").toBool()) return false;\n pending.append(object->children());\n }\n return true;\n}\n\ninline bool WaitForPolish(QQuickItem* item)\n{\n if (!item || !item->window()) return false;\n#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)\n return QQuickTest::qWaitForPolish(item->window());\n#else\n for (QPointer<QQuickItem> current{item}; current; current = current->parentItem()) {\n if (!QQuickTest::qWaitForItemPolished(current)) return false;\n }\n return true;\n#endif\n}\n\ninline bool ClickWithRetries(QObject* object)\n{\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !item->isVisible() || !item->isEnabled() || !WaitForPolish(item) || !item ||\n item->width() <= 0 || item->height() <= 0) return false;\n const auto click = [&] {\n if (!item || !item->isVisible() || !item->isEnabled() || !item->window()) return false;\n QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier,\n item->mapToScene(item->boundingRect().center()).toPoint());\n return true;\n };\n if (item->metaObject()->indexOfSignal(\"clicked()\") < 0) return click();\n QSignalSpy clicked{item, SIGNAL(clicked())};\n const auto pressed = item->metaObject()->indexOfSignal(\"pressed()\") < 0 ? nullptr : std::make_unique<QSignalSpy>(item, SIGNAL(pressed()));\n const auto delivered = [&] { return !clicked.isEmpty(); };\n // Modal exit can consume a gesture. Keep retries visible in the report so\n // a successful test does not silently conceal swallowed input.\n const QString target = item->objectName();\n int attempts{0};\n const bool success = QTest::qWaitFor([&] {\n if (delivered()) return true;\n // A press reached the target but was canceled (for example by becoming\n // disabled). Do not retry a delivered gesture or report it as a click.\n if (pressed && !pressed->isEmpty()) return true;\n ++attempts;\n return click() && (delivered() || (pressed && !pressed->isEmpty()));\n }, 10'000);\n if (attempts > 1) qWarning() << \"Click retries for\" << target << \"attempts:\" << attempts << \"delivered:\" << delivered();\n return success && delivered();\n}\n\n// Existing journeys tolerate modal-exit retries, but each retry is reported.\ninline bool Click(QObject* object)\n{\n return ClickWithRetries(object);\n}\n\ninline bool OpenSettings(BitcoinQmlApplication& app)\n{\n return Click(Find(app, app.window()->property(\"desktopWalletMode\").toBool()\n ? \"desktopWalletSettingsTabButton\" : \"nodeSettingsButton\"));\n}\n\ninline QObject* WaitForVisible(BitcoinQmlApplication& app, const char* name)\n{\n QObject* object{nullptr};\n const bool ready = QTest::qWaitFor([&] {\n object = Find(app, name);\n return object && object->property(\"visible\").toBool() && TransitionsFinished(app.window());\n }, 10'000);\n if (!ready) qWarning() << \"Control did not become ready:\" << name << object << \"visible:\" << (object && object->property(\"visible\").toBool()) << \"transitions finished:\" << TransitionsFinished(app.window());\n return ready ? object : nullptr;\n}\n\ninline bool Click(BitcoinQmlApplication& app, const char* name)\n{\n auto* object = WaitForVisible(app, name);\n QPointer<QQuickItem> item = qobject_cast<QQuickItem*>(object);\n if (!item || !WaitForPolish(item) || !item) return false;\n const bool ready = QTest::qWaitFor([&] {\n if (!item || !WaitForPolish(item) || !item) return false;\n bool scrolled{false};\n for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n if (!parent->inherits(\"QQuickFlickable\")) continue;\n const auto rect = item->mapRectToItem(parent, item->boundingRect());\n // Leave a pixel of room: QPoint rounding must not put the gesture\n // on the exclusive bottom edge of a clipped viewport.\n const auto offset = rect.height() > parent->height() - 2\n ? rect.center().y() - parent->height() / 2\n : rect.top() < 1 ? rect.top() - 1 : std::max(0.0, rect.bottom() - parent->height() + 1);\n if (offset != 0) {\n parent->setProperty(\"contentY\", parent->property(\"contentY\").toDouble() + offset);\n scrolled = true;\n }\n }\n if (scrolled || !item->isEnabled() || item->width() <= 0 || item->height() <= 0) return false;\n const auto center = item->boundingRect().center();\n for (auto* parent = item->parentItem(); parent; parent = parent->parentItem()) {\n if (parent->clip() && !parent->contains(item->mapToItem(parent, center))) return false;\n }\n return app.window()->contentItem()->contains(item->mapToItem(app.window()->contentItem(), center));\n });\n if (!ready) qWarning() << \"Cannot click\" << name;\n return ready && item && Click(item.data());\n}\n\ninline bool SetText(BitcoinQmlApplication& app, const char* name, const QString& text)\n{\n auto* item = qobject_cast<QQuickItem*>(WaitForVisible(app, name));\n if (!item) return false;\n item->forceActiveFocus();\n if (!QMetaObject::invokeMethod(item, \"selectAll\")) return false;\n QTest::keyClick(item->window(), Qt::Key_Backspace, Qt::NoModifier, 1);\n QInputMethodEvent edit;\n edit.setCommitString(text);\n QCoreApplication::sendEvent(item, &edit);\n return edit.isAccepted();\n}\n\ninline bool SelectSettings(BitcoinQmlApplication& app, const char* section)\n{\n auto* settings = qobject_cast<QQuickItem*>(Find(app, \"settingsView\"));\n if ((!settings || !settings->isVisible()) && !OpenSettings(app)) return false;\n if (!WaitForVisible(app, \"settingsView\")) return false;\n auto* sidebar = qobject_cast<QQuickItem*>(Find(app, \"settingsSidebarList\"));\n auto* button = qobject_cast<QQuickItem*>(Find(app, qPrintable(QStringLiteral(\"settingsSidebar_%1\").arg(section))));\n if (!sidebar || !button) return false;\n const auto position_mode = sidebar->metaObject()->enumerator(sidebar->metaObject()->indexOfEnumerator(\"PositionMode\"));\n const int contain = position_mode.keyToValue(\"Contain\");\n const int index = button->parentItem()->property(\"index\").toInt();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · abcf31ef8ea8..51ea5d406a92 2026-11-18T00:24:28Z · gpt-6-luna |
| gui#1090 | Foreign-PSBT coverage no longer checks the production review popuptest/integration/psbt/test_psbt.cpp | addressed | AssessmentThe foreign-PSBT integration case now exercises the production Send UI and verifies the requested review and dismissal behavior. The test imports via the Send options UI, checks the cannot-sign warning and hidden Send/visible Save controls, then closes review and asserts the address and amount fields are empty; model rejection and empty mempool checks remain. Source report · abcf31ef8ea8..baee452eec1c 2026-11-12T04:07:32Z · gpt-6-luna |
| gui#1090 | Mixed passed and skipped scenarios now produce a successful suite exittest/functional/qml_scenarios.py | addressed | AssessmentThe runner now returns skip status 77 if any selected scenario skips and no scenario fails, even when another scenario passes. `qml_scenarios.py` tracks `skipped` across cases and returns `1 if failed else 77 if skipped else 0`; the added regression test checks mixed pass/skip orders and a `SystemExit(77)` case. Source report · abcf31ef8ea8..baee452eec1c 2026-11-12T04:07:32Z · gpt-6-luna |
| gui#1090 | README names integration labels and paths that the build does not createREADME.md | addressed | AssessmentREADME now documents the feature-group CTest label and matching group-based report filename and directory layout. The diff changes the filter to `-L '^wallet_sending$'`, documents `integration-<group>.xml` with `integration-wallet_sending.xml` as an example, and replaces `stageN_*` directories with feature directories such as `test/integration/wallet_sending/`. Source report · abcf31ef8ea8..baee452eec1c 2026-11-12T04:07:32Z · gpt-6-luna |
| gui#1080 | Expected engine warnings still fail the runnertest/qml/qml_tests_main.cpp | partially_addressed | AssessmentThe README now documents using ignoreWarning() for an explicitly expected warning and describes engine warnings as failing during loading and teardown, but it does not state that the engine hook applies in every phase or that ignoreWarning() cannot suppress engine warnings. The hook comment says active test functions are routed through Qt Test and honors ignoreWarning, without clarifying the remaining strict behavior. README.md documents ignoreWarning() and engine warnings during loading and teardown. In qml_tests_main.cpp, the hook routes active test functions through Qt Test and only sets m_had_warnings for warnings outside test functions; neither excerpt explicitly documents the finding's stated limitation. Source report · 055fcbf89ec5..16262c7b4333 2026-11-12T03:51:38Z · gpt-6-luna |
| gui#1080 | Warning probes never exercise per-test re-armingtest/qml/test_warnings.py | addressed | AssessmentThe probes now run a clean function before each warning case in the same process, including the native Qt warning case, and assert its expected diagnostic and Qt-version-dependent exit status. test_warnings.py constructs functions with test_00_clean followed by each case; the qt case verifies diagnostic ordering, and the common assertions require nonzero exit on Qt 6.3+ and zero on Qt 6.2. Source report · 055fcbf89ec5..16262c7b4333 2026-11-12T03:51:38Z · gpt-6-luna |
| gui#1080 | New component tests can silently omit warning enforcementtest/qml/qml_tests_main.cpp | addressed | AssessmentThe warning regression script now checks each component QML test file, including the probe, for a first-in-init failOnWarnings call for every TestCase. check_warning_setup() scans sorted tst_*.qml files and warning_probe.qml, compares TestCase counts with init() matches beginning with testSetup.failOnWarnings(), and is called from main(). Source report · 055fcbf89ec5..16262c7b4333 2026-11-12T03:51:38Z · gpt-6-luna |
| gui#1080 | Warning probes resolve CTest through PATHtest/qml/test_warnings.py | addressed | AssessmentBoth nested CTest calls now use the CTest executable supplied by CMake rather than resolving the bare name through PATH. test/CMakeLists.txt passes "${CMAKE_CTEST_COMMAND}"; test_warnings.py receives it as ctest and uses it in the discovery and console-probe subprocess commands. Source report · 055fcbf89ec5..16262c7b4333 2026-11-12T03:51:38Z · gpt-6-luna |
| gui#1080 | Nested CTest discovery ignores the active build configurationtest/qml/test_warnings.py | addressed | AssessmentThe active configuration is now passed from CMake and used for both nested CTest discovery and probe execution, while an empty configuration yields no extra argument. test/CMakeLists.txt appends "$<CONFIG>" to the script arguments; test_warnings.py builds configuration as ["--build-config", config] only when config is nonempty and adds it to both nested CTest command lines. Source report · 055fcbf89ec5..16262c7b4333 2026-11-12T03:51:38Z · gpt-6-luna |
| gui#986 | Tray Quit can leave the import confirmation minimizedqml/pages/MainWindow.qml | addressed | AssessmentThe hidden-window path now checks minimized visibility independently after showing the window, so it can restore a minimized window before opening the quit confirmation. In `requestQuit()`, the old `else if` is replaced by a separate `if (appWindow.visibility === Window.Minimized) appWindow.showNormal()` after the hidden-window `showMainWindow()` call. Thus a hidden-but-minimized window proceeds through `showNormal()`. Source report · a974a48da76d..a5f9e6896b4b 2026-11-11T00:21:30Z · gpt-6-luna |
| gui#986 | Import retries during a wallet load are silently discardedqml/walletqmlcontroller.cpp | addressed | AssessmentThe retry flow now checks worker busy state before marking the flow as importing or calling the controller, and disables the secondary retry button while the worker is busy. That removes the reported path where the retry sets a stuck importing flag during another wallet load. WalletCreationFlow.qml defines `walletWorkerBusy` as load or import in progress; `importFile()` returns when that is true before setting `importingWallet`. The import error page binds `secondaryButtonEnabled` to `!root.importingWallet && !root.walletWorkerBusy`. The added `test_import_retry_waits_while_a_wallet_loads` checks the button is disabled and retry does not set importing or call importWallet. Source report · a974a48da76d..a5f9e6896b4b 2026-11-11T00:21:30Z · gpt-6-luna |
| gui#986 | Quit confirmation survives shutdown and import completionqml/pages/MainWindow.qml | addressed | AssessmentQuit requests now return immediately after shutdown has started, the shutdown handler closes the confirmation, and import completion closes it as well. Routing tests cover both repeated quit after confirmation and completion while the prompt is open. MainWindow.qml adds `if (appWindow.shutdownInProgress) return`, closes `quitDuringImportPopup` in `onRequestedShutdown`, and closes it when `walletImportInProgress` becomes false. `tst_mainrouting.qml` adds `test_quit_confirmation_closes_when_the_import_ends` and `test_quit_during_shutdown_does_not_ask_again`. Source report · a974a48da76d..a5f9e6896b4b 2026-11-11T00:21:30Z · gpt-6-luna |
| gui#934 | Replacement warning omits overwritten request labels and messagesqml/pages/wallet/SendCreate.qml | addressed | AssessmentThe conflict predicate now accounts for changes and clearing of existing payment-request labels and messages, including same-address requests. A focused test covers label replacement, message replacement, and omission that clears prior message metadata. SendCreate.qml's paymentUriConflicts() adds requestLabelConflict and requestMessageConflict comparisons against the incoming label/message (using empty strings when absent). tst_sendcreate.qml's test_review_warns_before_replacing_an_earlier_request checks these cases and expects replacesValues to be true when appropriate. Source report · 67ace0024aea..d6afae24d093 2026-11-10T23:28:49Z · gpt-6-luna |
| gui#934 | Clicking outside payment review discards the queued requestqml/components/PaymentRequestReviewPopup.qml | addressed | AssessmentThe review popup now allows Escape to close it but disallows outside-click dismissal, so a stray click cannot close the review and consume the queued request. PaymentRequestReviewPopup.qml sets `closePolicy: Popup.CloseOnEscape`; tst_sendcreate.qml's test_press_outside_review_keeps_the_request verifies that an outside click leaves the review open. Source report · 67ace0024aea..d6afae24d093 2026-11-10T23:28:49Z · gpt-6-luna |
| gui#934 | Payment review can show a stale retained amount after manual URI importqml/pages/wallet/SendCreate.qml | addressed | AssessmentThe manual URI-import route now returns without opening the importer while the payment review popup is visible, preventing the reviewed draft and retained amount from being changed through that route. A test checks that the importer stays closed during review. SendCreate.qml's openPaymentRequestImport() begins with `if (paymentRequestReviewPopup.visible) return`. tst_sendcreate.qml adds test_uri_import_does_not_open_during_review, verifying the importer remains invisible and the review remains open. Source report · 67ace0024aea..d6afae24d093 2026-11-10T23:28:49Z · gpt-6-luna |
| gui#934 | Native-menu navigation silently removes the reviewed payment requestqml/pages/wallet/WalletView.qml | addressed | AssessmentWhen Send is hidden, its visibility handler now routes through pageHidden(), which interrupts the pending payment request. A SendCreate test verifies that hiding the page during review reports "interrupted" and does not report a second outcome when the popup later closes. WalletView.qml's new onVisibleChanged handler calls root.pageHidden(sendPage) without the old active-state-only interruption check. SendCreate.qml adds root.interruptPaymentRequest() in the page-hidden path, and tst_sendcreate.qml's test_hiding_send_during_review_reports_the_request_as_interrupted checks the interruption outcome. Source report · 67ace0024aea..d6afae24d093 2026-11-10T23:28:49Z · gpt-6-luna |
| gui#1051 | Unavailable explicit translations still change date namesqml/applocale.cpp | addressed | AssessmentWhen an explicit language is requested, the code now uses its locale only if at least one translator loaded; if both catalog loads fail, it sets the names locale to English. This removes the reported mismatch for untranslated languages while preserving the existing language/script handling when a catalog loads. In qml/applocale.cpp, the prior unconditional `: LanguageLocale(language)` is now `: (app_translator || qml_translator) ? LanguageLocale(language) : QLocale(QLocale::English)`. The added test `untranslatedLanguageNamesFallBackToEnglish()` verifies both Afrikaans catalogs are absent and that installing `af_ZA` yields English names locale. Source report · b55322b8c146..1f6c58c1a018 2026-11-12T01:03:04Z · gpt-6-luna |
| gui#986 | An import test failure can strand the worker on destroyed semaphorestest/test_walletqmlcontroller.cpp | addressed | AssessmentThe blocked test's semaphores now outlive controller draining, and a scope guard releases the blocked restore worker on early return. The guarded sibling tests also have synchronization state declared before their draining controllers. importWalletLeavesLoadedWalletsSelectable declares both semaphores before DrainingWalletController and installs a qScopeGuard after controller construction. The diff moves semaphore declarations before the controller in importWalletStaysInProgressUntilRestoreReturns and migrateWalletDuringImportIsRefused as well. Source report · 9eb5f34bee3f..a974a48da76d 2026-11-07T22:12:53Z · gpt-6-luna |
| gui#986 | A routine wallet switch discards the import failure detailsqml/pages/MainWindow.qml | addressed | AssessmentImport failure details are now held in a separate import-specific property, so clearing the shared load error during wallet selection does not discard the details; the failure toast is no longer hidden by load-error changes. The controller adds m_wallet_import_error and makes walletImportErrorTitle/Description/HelpText read it, while setWalletImportError updates it separately from the shared load error. MainWindow listens for walletImportErrorChanged rather than walletLoadErrorChanged. The QML test wallet_switch_keeps_import_failure_details clears walletLoadError and verifies the toast and import description remain. Source report · 9eb5f34bee3f..a974a48da76d 2026-11-07T22:12:53Z · gpt-6-luna |
| gui#986 | Tray Quit leaves the import confirmation inside a hidden windowqml/pages/MainWindow.qml | addressed | AssessmentThe import-in-progress quit path restores a hidden or minimized window, raises and activates it, then opens the confirmation. A routing test exercises tray quit from a hidden window. MainWindow.qml requestQuit() calls showMainWindow() when hidden, showNormal() when minimized, then raise() and requestActivate() before opening quitDuringImportPopup. test_tray_quit_during_import_shows_the_hidden_window hides the window, requests tray quit, and checks showMainWindowCalls and popup state. Source report · 9eb5f34bee3f..a974a48da76d 2026-11-07T22:12:53Z · gpt-6-luna |
| gui#986 | Failed import can leave a closed wallet row stuck as “Importing…”qml/models/walletlistmodel.cpp | addressed | AssessmentThe unchanged-listing branch now emits dataChanged for the affected load and importing roles after refreshing the directory, and a test checks the role notification for a closed wallet with the same name. In setImportingWallet(), after listWalletDir(), the diff emits dataChanged across existing rows with {LoadStateRole, ImportingRole}. setImportingWalletClearsRowOfClosedWalletWithSameName verifies one dataChanged emission and that its roles include ImportingRole. Source report · 9eb5f34bee3f..a974a48da76d 2026-11-07T22:12:53Z · gpt-6-luna |
| gui#1056 | The GCC 12 warning downgrade has no documented removal condition.github/workflows/ci.yml | still_present | AssessmentThe CI excerpt is unchanged and still lacks a comment explaining the maybe-uninitialized warning exception or a condition for removing it. The new .github/workflows/ci.yml excerpt shows the Jammy `cmake_env` including `-Wno-error=maybe-uninitialized` on line 24, with no accompanying rationale or removal condition; its diff is empty. Source report · 9ede9a5c8ee4..8245ad4fec8f 2026-11-09T16:23:37Z · gpt-6-luna |
| gui#1056 | Maximum sends can report success despite exceeding Core's fee-rate capqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new head adds the requested fee-rate cap check to the maximum-send helper before signing, eliminating the specific preparation bypass described. The diff adds a comparison of `fee` against `wallet->m_max_tx_fee_rate.GetFee(size.vsize)` in qml/models/walletqmlmodel.cpp, before the subsequent transaction construction and signing code. Source report · 9ede9a5c8ee4..8245ad4fec8f 2026-11-09T16:23:37Z · gpt-6-luna |
| gui#1056 | Passphrase-change storage errors appear as an incorrect passwordtest/test_walletqmlmodel.cpp | still_present | AssessmentThe supplied diff and new excerpts show no change to passphrase-change handling; the mock excerpt is unchanged and there is no evidence that backend error details are now forwarded. The `source_to_new_path_diff` for test/test_walletqmlmodel.cpp is empty, and the excerpt still shows the fake passphrase-change method returning success or PassphraseIncorrect only. No new-head excerpt or diff demonstrates the requested Expected-result handling or GenericError test. Source report · 7dd2788036c1..8245ad4fec8f 2026-11-09T16:23:37Z · gpt-6-luna |
| gui#1056 | Maximum sends can report success despite Core's new fee-rate rejectionqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new head adds the missing maximum-fee-rate guard during maximum-send preparation, before transaction signing, addressing the reported bypass. In qml/models/walletqmlmodel.cpp, immediately after the existing absolute-fee check, the diff adds `if (fee > wallet->m_max_tx_fee_rate.GetFee(size.vsize))` and returns a fee-rate error. The old excerpt had no such check. Source report · 7dd2788036c1..8245ad4fec8f 2026-11-09T16:23:37Z · gpt-6-luna |
| gui#1057 | An open export remains stale after same-wallet descriptor changesqml/components/WatchOnlyExportModal.qml | unclear | AssessmentThe old modal is deleted, but there is no supplied new-head evidence for how the replacement pages respond when descriptor managers change while open. A deletion alone does not establish that the stale-snapshot behavior is fixed. path_diff: qml/components/WatchOnlyExportModal.qml [
{
"evidence_id": "ceb07b8edc45468b8f7a02280886b553",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "a0908d244531dd3e0000b47c146937fbf2c20091",
"path": "qml/components/WatchOnlyExportModal.qml",
"source_generation": 3,
"source_job_id": 2273,
"text": "diff --git a/qml/components/WatchOnlyExportModal.qml b/qml/components/WatchOnlyExportModal.qml\ndeleted file mode 100644\nindex d265b5d107..0000000000\n--- a/qml/components/WatchOnlyExportModal.qml\n+++ /dev/null\n@@ -1,439 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"watchOnlyExportModal\"\n-\n- property var wallet: walletController.selectedWallet\n- property var exports: []\n- // Descriptors that no longer give out addresses but may still hold funds.\n- property var inactiveExports: []\n- property bool extendedKeyFormat: false\n- // Empty means all address types, which only the descriptor format supports.\n- property string addressType: \"\"\n- property string errorText: \"\"\n- property var clipboard: Clipboard\n- readonly property bool allTypes: !extendedKeyFormat && addressType === \"\"\n- readonly property var completeExports: exports.concat(inactiveExports)\n- readonly property bool extendedKeyAvailable: exports.some(item => item.extendedKey !== \"\")\n- readonly property var currentExport: {\n- for (const item of exports) {\n- if (item.id === addressType) return item\n- }\n- return null\n- }\n- readonly property string payload: allTypes ? completeExports.map(item => item.descriptor).join(\"\\n\")\n- : !currentExport ? \"\" : extendedKeyFormat ? currentExport.extendedKey : currentExport.descriptor\n- readonly property string sharedFingerprint: {\n- const fingerprints = new Set(completeExports.map(item => item.fingerprint))\n- return fingerprints.size === 1 ? completeExports[0].fingerprint : \"\"\n- }\n- readonly property var typeOptions: {\n- const options = exports.filter(item => !extendedKeyFormat || item.extendedKey !== \"\").map(item => ({\n- id: item.id,\n- label: item.label,\n- description: item.description,\n- objectName: \"watchOnlyExportAddressType_\" + item.id\n- }))\n- if (extendedKeyFormat || completeExports.length < 2) return options\n- return [{\n- id: \"\",\n- label: qsTr(\"All address types\"),\n- description: qsTr(\"Complete watch-only wallet\"),\n- objectName: \"watchOnlyExportAddressType_all\"\n- }].concat(options)\n- }\n-\n- function preferredAddressType() {\n- const preferred = wallet ? wallet.defaultReceiveAddressType() : \"\"\n- const candidates = extendedKeyFormat ? exports.filter(item => item.extendedKey !== \"\") : exports\n- return candidates.some(item => item.id === preferred) ? preferred : candidates[0].id\n- }\n-\n- function openForWallet() {\n- exports = wallet ? wallet.watchOnlyExports() : []\n- if (exports.length === 0) return false\n- inactiveExports = wallet.inactiveWatchOnlyExports()\n- extendedKeyFormat = false\n- addressType = completeExports.length > 1 ? \"\" : exports[0].id\n- errorText = \"\"\n- open()\n- return true\n- }\n-\n- function setExtendedKeyFormat(enabled) {\n- if (enabled && !extendedKeyAvailable) return\n- extendedKeyFormat = enabled\n- if (enabled && (!currentExport || currentExport.extendedKey === \"\")) addressType = preferredAddressType()\n- }\n-\n- function shortKey(key) {\n- return key.length > 17 ? key.substring(0, 8) + \"...\" + key.substring(key.length - 8) : key\n- }\n-\n- // \"sh(wpkh)\" and a key become \"sh(wpkh(tpubDDen...WQTz))\".\n- function shortDescriptor(item) {\n- const scripts = item.scriptName.replace(/\\)/g, \"\").split(\"(\")\n- return scripts.join(\"(\") + \"(\" + shortKey(item.xpub) + \")\".repeat(scripts.length)\n- }\n-\n- function copy() {\n- if (payload === \"\") return\n- clipboard.setText(payload)\n- copiedTimer.restart()\n- }\n-\n- function save(fileUrl) {\n- if (!wallet || payload === \"\") return\n- errorText = wallet.saveWatchOnlyExport(fileUrl.toString(), payload)\n- }\n-\n- function openSaveDialog() {\n- const name = wallet && wallet.name.length > 0 ? wallet.name.replace(/[\\\\/]/g, \"_\") : \"wallet\"\n- saveDialog.currentFolder = walletController.homeFileUrl()\n- saveDialog.currentFile = walletController.homeFileUrl(name + \"-watch-only.txt\")\n- saveDialog.open()\n- }\n-\n- parent: Overlay.overlay\n- width: Math.min(440, parent ? parent.width - 32 : 440)\n- height: Math.min(card.implicitHeight, parent ? parent.height - 40 : card.implicitHeight)\n- x: parent ? (parent.width - width) / 2 : 0\n- y: parent ? Math.max(20, (parent.height - height) / 2) : 0\n- padding: 0\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside\n- background: null\n-\n- // opened stays false during the enter transition.\n- onWalletChanged: {\n- if (saveDialog.visible) saveDialog.close()\n- if (visible) close()\n- }\n- onClosed: {\n- exports = []\n- inactiveExports = []\n- addressType = \"\"\n- errorText = \"\"\n- }\n-\n- Overlay.modal: Rectangle {\n- color: Qt.rgba(0, 0, 0, 0.6)\n- Behavior on opacity { NumberAnimation { duration: 180 } }\n- }\n- enter: Transition { NumberAnimation { property: \"opacity\"; from: 0; to: 1; duration: 180 } }\n- exit: Transition { NumberAnimation { property: \"opacity\"; from: 1; to: 0; duration: 150 } }\n-\n- Timer {\n- id: copiedTimer\n- interval: 1000\n- }\n-\n- AppFileDialog {\n- id: saveDialog\n- objectName: \"watchOnlyExportSaveDialog\"\n- fileMode: AppFileDialog.SaveFile\n- nameFilters: [qsTr(\"Text files (*.txt)\"), qsTr(\"All files (*)\")]\n- defaultSuffix: \"txt\"\n- onAccepted: root.save(selectedFile)\n- }\n-\n- contentItem: ScrollView {\n- id: scroll\n- clip: true\n- contentWidth: availableWidth\n- contentHeight: card.implicitHeight\n- ScrollBar.horizontal.policy: ScrollBar.AlwaysOff\n-\n- Pane {\n- id: card\n- width: scroll.availableWidth\n- padding: width < 400 ? 16 : 20\n- implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding\n- background: Rectangle {\n- radius: 16\n- color: Theme.color.neutral1\n- border.width: 1\n- border.color: Theme.color.neutral3\n- SurfaceGradientBorder {\n- anchors.fill: parent\n- surfaceColor: parent.color\n- cornerRadius: parent.radius\n- }\n- }\n-\n- contentItem: ColumnLayout {\n- spacing: 16\n-\n- RowLayout {\n- Layout.fillWidth: true\n- spacing: 10\n-\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"Export watch-only wallet\")\n- font: Theme.text.title.font\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n-\n- OverflowMenuButton {\n- id: moreButton\n- objectName: \"watchOnlyExportMoreButton\"\n- circular: true\n- size: 30\n- iconSize: 24\n- Accessible.name: qsTr(\"More options\")\n- checked: moreMenu.opened\n- onClicked: moreMenu.opened ? moreMenu.close() : moreMenu.open()\n-\n- ContextMenu {\n- id: moreMenu\n- x: moreButton.width - width\n- y: moreButton.height + 8\n-\n- ContextMenuButton {\n- objectName: \"watchOnlyExportSaveMenuButton\"\n- enabled: root.payload !== \"\"\n- text: qsTr(\"Save to file\")\n- onTriggered: root.openSaveDialog()\n- }\n- }\n- }\n-\n- CloseButton {\n- objectName: \"watchOnlyExportClose\"\n- iconColor: Theme.color.neutral7\n- Accessible.name: qsTr(\"Close watch-only export\")\n- onClicked: root.close()\n- }\n- }\n-\n- SegmentedPicker {\n- objectName: \"watchOnlyExportFormatPicker\"\n- Layout.fillWidth: true\n- implicitHeight: 36\n- //: Export formats: an output descriptor, or a bare xpub/ypub/zpub key for wallets that only accept those.\n- model: [qsTr(\"Descriptor\"), {text: qsTr(\"Extended key\"), enabled: root.extendedKeyAvailable}]\n- currentIndex: root.extendedKeyFormat ? 1 : 0\n- onSelected: index => root.setExtendedKeyFormat(index === 1)\n- }\n-\n- Rectangle {\n- readonly property real side: Math.min(parent.width, root.allTypes ? 280 : 220)\n- Layout.preferredWidth: side\n- Layout.preferredHeight: side\n- Layout.alignment: Qt.AlignHCenter\n- radius: 10\n- color: \"white\"\n-\n- QRImage {\n- objectName: \"watchOnlyExportQRImage\"\n- anchors.fill: parent\n- anchors.margins: 14\n- code: root.payload\n- backgroundColor: \"white\"\n- foregroundColor: \"black\"\n- }\n- }\n-\n- AddressLabel {\n- objectName: \"watchOnlyExportKeyText\"\n- visible: root.extendedKeyFormat\n- Layout.fillWidth: true\n- address: visible && root.currentExport ? root.currentExport.extendedKey : \"\"\n- textStyle: Theme.text.monoDescription\n- clipboard: root.clipboard\n- embedded: true\n- }\n-\n- DescriptorText {\n- objectName: \"watchOnlyExportDescriptor\"\n- visible: !root.extendedKeyFormat && !root.allTypes && !!root.currentExport\n- Layout.fillWidth: true\n- parts: visible ? root.currentExport.descriptorParts : ({})\n- descriptor: visible ? root.currentExport.descriptor : \"\"\n- clipboard: root.clipboard\n- }\n-\n- FormSection {\n- objectName: \"watchOnlyExportTypeList\"\n- visible: root.allTypes\n- Layout.fillWidth: true\n- isOnSurface: true\n- showGradientBorder: false\n- title: qsTr(\"All address types\")\n- footerText: root.sharedFingerprint !== \"\"\n- //: %1 is the wallet's BIP32 master key fingerprint.\n- ? qsTr(\"Fingerprint %1. Each descriptor covers receive and change addresses.\").arg(root.sharedFingerprint)\n- : qsTr(\"Each descriptor covers receive and change addresses.\")\n-\n- Repeater {\n- model: root.allTypes ? root.completeExports : []\n-\n- ListRow {\n- required property var modelData\n- required property int index\n- readonly property bool inactive: index >= root.exports.length\n- readonly property string rowId: inactive ? \"inactive\" + (index - root.exports.length) : modelData.id\n- objectName: \"watchOnlyExportType_\" + rowId\n- Layout.fillWidth: true\n- title: modelData.label\n- description: inactive\n- //: Shown under an address type in the watch-only export list for keys that no longer give out new addresses, such as keys from before a password was set. %1 is a shortened descriptor.\n- ? qsTr(\"Previous key %1\").arg(root.shortDescriptor(modelData))\n- : root.shortDescriptor(modelData)\n- showDivider: index < root.completeExports.length - 1\n- showsDisclosureIndicator: !inactive\n- onClicked: if (!inactive) root.addressType = modelData.id\n- trailingItem: CopyButton {\n- objectName: \"watchOnlyExportTypeCopy_\" + rowId\n- displayMode: CopyButton.IconOnly\n- Accessible.name: qsTr(\"Copy %1 descriptor\").arg(modelData.label)\n- onCopyRequested: root.clipboard.setText(modelData.descriptor)\n- }\n- }\n- }\n- }\n-\n- FormSection {\n- visible: !root.allTypes\n- Layout.fillWidth: true\n- isOnSurface: true\n- showGradientBorder: false\n-\n- ListRow {\n- id: addressTypeRow\n- objectName: \"watchOnlyExportAddressType\"\n- Layout.fillWidth: true\n- title: qsTr(\"Address type\")\n- showsDisclosureIndicator: root.typeOptions.length > 1\n- trailingItem: CoreText {\n- objectName: \"watchOnlyExportAddressTypeValue\"\n- text: root.currentExport ? root.currentExport.label : \"\"\n- font: Theme.text.description.font\n- color: Theme.color.neutral9\n- wrap: false\n- }\n- onClicked: {\n- if (root.typeOptions.length < 2) return\n- addressTypeMenu.opened ? addressTypeMenu.close() : addressTypeMenu.open()\n- }\n-\n- ContextMenu {\n- id: addressTypeMenu\n- x: addressTypeRow.width - width\n- y: addressTypeRow.height\n- minMenuWidth: 320\n-\n- ContextMenuPicker {\n- objectName: \"watchOnlyExportAddressTypePicker\"\n- title: qsTr(\"Address Type\")\n- textRole: \"label\"\n- valueRole: \"id\"\n- subtitleRole: \"description\"\n- objectNameRole: \"objectName\"\n- model: root.typeOptions\n- currentValue: root.addressType\n- onActivated: function(value) {\n- addressTypeMenu.close()\n- root.addressType = value\n- }\n- }\n- }\n- }\n-\n- ValueRow {\n- objectName: \"watchOnlyExportFingerprint\"\n- visible: !!root.currentExport && root.currentExport.fingerprint !== \"\"\n- Layout.fillWidth: true\n- //: BIP32 fingerprint of the wallet's master key.\n- title: qsTr(\"Master fingerprint\")\n- value: root.currentExport ? root.currentExport.fingerprint : \"\"\n- valueTextStyle: Theme.text.monoDescription\n- }\n-\n- ValueRow {\n- objectName: \"watchOnlyExportDerivationPath\"\n- visible: !!root.currentExport && root.currentExport.derivationPath !== \"\"\n- Layout.fillWidth: true\n- title: qsTr(\"Derivation path\")\n- value: root.currentExport ? root.currentExport.derivationPath : \"\"\n- valueTextStyle: Theme.text.monoDescription\n- showDivider: !root.extendedKeyFormat\n- }\n-\n- ValueRow {\n- objectName: \"watchOnlyExportChains\"\n- visible: !root.extendedKeyFormat && !!root.currentExport\n- Layout.fillWidth: true\n- //: Derivation branches the descriptor covers: receiving addresses and change addresses.\n- title: qsTr(\"Chains\")\n- value: !root.currentExport ? \"\"\n- : root.currentExport.changeChain === \"\" ? qsTr(\"Receive %1\").arg(root.currentExport.receiveChain)\n- : qsTr(\"Receive %1, change %2\").arg(root.currentExport.receiveChain).arg(root.currentExport.changeChain)\n- showDivider: false\n- }\n- }\n-\n- CoreText {\n- objectName: \"watchOnlyExportNote\"\n- Layout.fillWidth: true\n- text: {\n- if (root.allTypes || !root.currentExport) {\n- return qsTr(\"Anyone with this export can see all of this wallet's addresses and transactions, but cannot spend from it.\")\n- }\n- let note = qsTr(\"Only includes funds on %1 addresses.\").arg(root.currentExport.label)\n- if (root.inactiveExports.some(item => item.id === root.currentExport.id)) {\n- //: Added to the watch-only export note when this address type also has keys from before, such as from before a password was set. The complete export is the \"All address types\" option.\n- note += \" \" + qsTr(\"Addresses from previous keys are only in the complete export.\")\n- }\n- if (root.extendedKeyFormat && root.currentExport.id === \"bech32m\") {\n- note += \" \" + qsTr(\"Most wallets need the descriptor format to import Taproot keys.\")\n- }\n- return note\n- }\n- font: Theme.text.caption.font\n- lineHeight: Theme.text.caption.lineHeight\n- lineHeightMode: Text.FixedHeight\n- color: Theme.color.neutral7\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n-\n- CoreText {\n- objectName: \"watchOnlyExportError\"\n- visible: root.errorText !== \"\"\n- Layout.fillWidth: true\n- text: root.errorText\n- color: Theme.color.red\n- font: Theme.text.caption.font\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n-\n- OutlineButton {\n- objectName: \"watchOnlyExportCopyButton\"\n- Layout.fillWidth: true\n- enabled: root.payload !== \"\"\n- text: copiedTimer.running ? qsTr(\"Copied\")\n- : root.allTypes ? qsTr(\"Copy all descriptors\")\n- : root.\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · a0908d244531..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | An oversized complete export has no QR failure feedbackqml/components/WatchOnlyExportModal.qml | unclear | AssessmentThe old modal is deleted, but the supplied evidence does not include the replacement UI or QR provider status behavior, so it cannot establish whether oversized QR failures now show a copy/save fallback message. path_diff: qml/components/WatchOnlyExportModal.qml [
{
"evidence_id": "694c64c2cf8b4b82be45f5328747b560",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "a0908d244531dd3e0000b47c146937fbf2c20091",
"path": "qml/components/WatchOnlyExportModal.qml",
"source_generation": 3,
"source_job_id": 2273,
"text": "diff --git a/qml/components/WatchOnlyExportModal.qml b/qml/components/WatchOnlyExportModal.qml\ndeleted file mode 100644\nindex d265b5d107..0000000000\n--- a/qml/components/WatchOnlyExportModal.qml\n+++ /dev/null\n@@ -1,439 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-\n-import \"../controls\"\n-\n-Popup {\n- id: root\n- objectName: \"watchOnlyExportModal\"\n-\n- property var wallet: walletController.selectedWallet\n- property var exports: []\n- // Descriptors that no longer give out addresses but may still hold funds.\n- property var inactiveExports: []\n- property bool extendedKeyFormat: false\n- // Empty means all address types, which only the descriptor format supports.\n- property string addressType: \"\"\n- property string errorText: \"\"\n- property var clipboard: Clipboard\n- readonly property bool allTypes: !extendedKeyFormat && addressType === \"\"\n- readonly property var completeExports: exports.concat(inactiveExports)\n- readonly property bool extendedKeyAvailable: exports.some(item => item.extendedKey !== \"\")\n- readonly property var currentExport: {\n- for (const item of exports) {\n- if (item.id === addressType) return item\n- }\n- return null\n- }\n- readonly property string payload: allTypes ? completeExports.map(item => item.descriptor).join(\"\\n\")\n- : !currentExport ? \"\" : extendedKeyFormat ? currentExport.extendedKey : currentExport.descriptor\n- readonly property string sharedFingerprint: {\n- const fingerprints = new Set(completeExports.map(item => item.fingerprint))\n- return fingerprints.size === 1 ? completeExports[0].fingerprint : \"\"\n- }\n- readonly property var typeOptions: {\n- const options = exports.filter(item => !extendedKeyFormat || item.extendedKey !== \"\").map(item => ({\n- id: item.id,\n- label: item.label,\n- description: item.description,\n- objectName: \"watchOnlyExportAddressType_\" + item.id\n- }))\n- if (extendedKeyFormat || completeExports.length < 2) return options\n- return [{\n- id: \"\",\n- label: qsTr(\"All address types\"),\n- description: qsTr(\"Complete watch-only wallet\"),\n- objectName: \"watchOnlyExportAddressType_all\"\n- }].concat(options)\n- }\n-\n- function preferredAddressType() {\n- const preferred = wallet ? wallet.defaultReceiveAddressType() : \"\"\n- const candidates = extendedKeyFormat ? exports.filter(item => item.extendedKey !== \"\") : exports\n- return candidates.some(item => item.id === preferred) ? preferred : candidates[0].id\n- }\n-\n- function openForWallet() {\n- exports = wallet ? wallet.watchOnlyExports() : []\n- if (exports.length === 0) return false\n- inactiveExports = wallet.inactiveWatchOnlyExports()\n- extendedKeyFormat = false\n- addressType = completeExports.length > 1 ? \"\" : exports[0].id\n- errorText = \"\"\n- open()\n- return true\n- }\n-\n- function setExtendedKeyFormat(enabled) {\n- if (enabled && !extendedKeyAvailable) return\n- extendedKeyFormat = enabled\n- if (enabled && (!currentExport || currentExport.extendedKey === \"\")) addressType = preferredAddressType()\n- }\n-\n- function shortKey(key) {\n- return key.length > 17 ? key.substring(0, 8) + \"...\" + key.substring(key.length - 8) : key\n- }\n-\n- // \"sh(wpkh)\" and a key become \"sh(wpkh(tpubDDen...WQTz))\".\n- function shortDescriptor(item) {\n- const scripts = item.scriptName.replace(/\\)/g, \"\").split(\"(\")\n- return scripts.join(\"(\") + \"(\" + shortKey(item.xpub) + \")\".repeat(scripts.length)\n- }\n-\n- function copy() {\n- if (payload === \"\") return\n- clipboard.setText(payload)\n- copiedTimer.restart()\n- }\n-\n- function save(fileUrl) {\n- if (!wallet || payload === \"\") return\n- errorText = wallet.saveWatchOnlyExport(fileUrl.toString(), payload)\n- }\n-\n- function openSaveDialog() {\n- const name = wallet && wallet.name.length > 0 ? wallet.name.replace(/[\\\\/]/g, \"_\") : \"wallet\"\n- saveDialog.currentFolder = walletController.homeFileUrl()\n- saveDialog.currentFile = walletController.homeFileUrl(name + \"-watch-only.txt\")\n- saveDialog.open()\n- }\n-\n- parent: Overlay.overlay\n- width: Math.min(440, parent ? parent.width - 32 : 440)\n- height: Math.min(card.implicitHeight, parent ? parent.height - 40 : card.implicitHeight)\n- x: parent ? (parent.width - width) / 2 : 0\n- y: parent ? Math.max(20, (parent.height - height) / 2) : 0\n- padding: 0\n- modal: true\n- dim: true\n- focus: true\n- closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside\n- background: null\n-\n- // opened stays false during the enter transition.\n- onWalletChanged: {\n- if (saveDialog.visible) saveDialog.close()\n- if (visible) close()\n- }\n- onClosed: {\n- exports = []\n- inactiveExports = []\n- addressType = \"\"\n- errorText = \"\"\n- }\n-\n- Overlay.modal: Rectangle {\n- color: Qt.rgba(0, 0, 0, 0.6)\n- Behavior on opacity { NumberAnimation { duration: 180 } }\n- }\n- enter: Transition { NumberAnimation { property: \"opacity\"; from: 0; to: 1; duration: 180 } }\n- exit: Transition { NumberAnimation { property: \"opacity\"; from: 1; to: 0; duration: 150 } }\n-\n- Timer {\n- id: copiedTimer\n- interval: 1000\n- }\n-\n- AppFileDialog {\n- id: saveDialog\n- objectName: \"watchOnlyExportSaveDialog\"\n- fileMode: AppFileDialog.SaveFile\n- nameFilters: [qsTr(\"Text files (*.txt)\"), qsTr(\"All files (*)\")]\n- defaultSuffix: \"txt\"\n- onAccepted: root.save(selectedFile)\n- }\n-\n- contentItem: ScrollView {\n- id: scroll\n- clip: true\n- contentWidth: availableWidth\n- contentHeight: card.implicitHeight\n- ScrollBar.horizontal.policy: ScrollBar.AlwaysOff\n-\n- Pane {\n- id: card\n- width: scroll.availableWidth\n- padding: width < 400 ? 16 : 20\n- implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding\n- background: Rectangle {\n- radius: 16\n- color: Theme.color.neutral1\n- border.width: 1\n- border.color: Theme.color.neutral3\n- SurfaceGradientBorder {\n- anchors.fill: parent\n- surfaceColor: parent.color\n- cornerRadius: parent.radius\n- }\n- }\n-\n- contentItem: ColumnLayout {\n- spacing: 16\n-\n- RowLayout {\n- Layout.fillWidth: true\n- spacing: 10\n-\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"Export watch-only wallet\")\n- font: Theme.text.title.font\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n-\n- OverflowMenuButton {\n- id: moreButton\n- objectName: \"watchOnlyExportMoreButton\"\n- circular: true\n- size: 30\n- iconSize: 24\n- Accessible.name: qsTr(\"More options\")\n- checked: moreMenu.opened\n- onClicked: moreMenu.opened ? moreMenu.close() : moreMenu.open()\n-\n- ContextMenu {\n- id: moreMenu\n- x: moreButton.width - width\n- y: moreButton.height + 8\n-\n- ContextMenuButton {\n- objectName: \"watchOnlyExportSaveMenuButton\"\n- enabled: root.payload !== \"\"\n- text: qsTr(\"Save to file\")\n- onTriggered: root.openSaveDialog()\n- }\n- }\n- }\n-\n- CloseButton {\n- objectName: \"watchOnlyExportClose\"\n- iconColor: Theme.color.neutral7\n- Accessible.name: qsTr(\"Close watch-only export\")\n- onClicked: root.close()\n- }\n- }\n-\n- SegmentedPicker {\n- objectName: \"watchOnlyExportFormatPicker\"\n- Layout.fillWidth: true\n- implicitHeight: 36\n- //: Export formats: an output descriptor, or a bare xpub/ypub/zpub key for wallets that only accept those.\n- model: [qsTr(\"Descriptor\"), {text: qsTr(\"Extended key\"), enabled: root.extendedKeyAvailable}]\n- currentIndex: root.extendedKeyFormat ? 1 : 0\n- onSelected: index => root.setExtendedKeyFormat(index === 1)\n- }\n-\n- Rectangle {\n- readonly property real side: Math.min(parent.width, root.allTypes ? 280 : 220)\n- Layout.preferredWidth: side\n- Layout.preferredHeight: side\n- Layout.alignment: Qt.AlignHCenter\n- radius: 10\n- color: \"white\"\n-\n- QRImage {\n- objectName: \"watchOnlyExportQRImage\"\n- anchors.fill: parent\n- anchors.margins: 14\n- code: root.payload\n- backgroundColor: \"white\"\n- foregroundColor: \"black\"\n- }\n- }\n-\n- AddressLabel {\n- objectName: \"watchOnlyExportKeyText\"\n- visible: root.extendedKeyFormat\n- Layout.fillWidth: true\n- address: visible && root.currentExport ? root.currentExport.extendedKey : \"\"\n- textStyle: Theme.text.monoDescription\n- clipboard: root.clipboard\n- embedded: true\n- }\n-\n- DescriptorText {\n- objectName: \"watchOnlyExportDescriptor\"\n- visible: !root.extendedKeyFormat && !root.allTypes && !!root.currentExport\n- Layout.fillWidth: true\n- parts: visible ? root.currentExport.descriptorParts : ({})\n- descriptor: visible ? root.currentExport.descriptor : \"\"\n- clipboard: root.clipboard\n- }\n-\n- FormSection {\n- objectName: \"watchOnlyExportTypeList\"\n- visible: root.allTypes\n- Layout.fillWidth: true\n- isOnSurface: true\n- showGradientBorder: false\n- title: qsTr(\"All address types\")\n- footerText: root.sharedFingerprint !== \"\"\n- //: %1 is the wallet's BIP32 master key fingerprint.\n- ? qsTr(\"Fingerprint %1. Each descriptor covers receive and change addresses.\").arg(root.sharedFingerprint)\n- : qsTr(\"Each descriptor covers receive and change addresses.\")\n-\n- Repeater {\n- model: root.allTypes ? root.completeExports : []\n-\n- ListRow {\n- required property var modelData\n- required property int index\n- readonly property bool inactive: index >= root.exports.length\n- readonly property string rowId: inactive ? \"inactive\" + (index - root.exports.length) : modelData.id\n- objectName: \"watchOnlyExportType_\" + rowId\n- Layout.fillWidth: true\n- title: modelData.label\n- description: inactive\n- //: Shown under an address type in the watch-only export list for keys that no longer give out new addresses, such as keys from before a password was set. %1 is a shortened descriptor.\n- ? qsTr(\"Previous key %1\").arg(root.shortDescriptor(modelData))\n- : root.shortDescriptor(modelData)\n- showDivider: index < root.completeExports.length - 1\n- showsDisclosureIndicator: !inactive\n- onClicked: if (!inactive) root.addressType = modelData.id\n- trailingItem: CopyButton {\n- objectName: \"watchOnlyExportTypeCopy_\" + rowId\n- displayMode: CopyButton.IconOnly\n- Accessible.name: qsTr(\"Copy %1 descriptor\").arg(modelData.label)\n- onCopyRequested: root.clipboard.setText(modelData.descriptor)\n- }\n- }\n- }\n- }\n-\n- FormSection {\n- visible: !root.allTypes\n- Layout.fillWidth: true\n- isOnSurface: true\n- showGradientBorder: false\n-\n- ListRow {\n- id: addressTypeRow\n- objectName: \"watchOnlyExportAddressType\"\n- Layout.fillWidth: true\n- title: qsTr(\"Address type\")\n- showsDisclosureIndicator: root.typeOptions.length > 1\n- trailingItem: CoreText {\n- objectName: \"watchOnlyExportAddressTypeValue\"\n- text: root.currentExport ? root.currentExport.label : \"\"\n- font: Theme.text.description.font\n- color: Theme.color.neutral9\n- wrap: false\n- }\n- onClicked: {\n- if (root.typeOptions.length < 2) return\n- addressTypeMenu.opened ? addressTypeMenu.close() : addressTypeMenu.open()\n- }\n-\n- ContextMenu {\n- id: addressTypeMenu\n- x: addressTypeRow.width - width\n- y: addressTypeRow.height\n- minMenuWidth: 320\n-\n- ContextMenuPicker {\n- objectName: \"watchOnlyExportAddressTypePicker\"\n- title: qsTr(\"Address Type\")\n- textRole: \"label\"\n- valueRole: \"id\"\n- subtitleRole: \"description\"\n- objectNameRole: \"objectName\"\n- model: root.typeOptions\n- currentValue: root.addressType\n- onActivated: function(value) {\n- addressTypeMenu.close()\n- root.addressType = value\n- }\n- }\n- }\n- }\n-\n- ValueRow {\n- objectName: \"watchOnlyExportFingerprint\"\n- visible: !!root.currentExport && root.currentExport.fingerprint !== \"\"\n- Layout.fillWidth: true\n- //: BIP32 fingerprint of the wallet's master key.\n- title: qsTr(\"Master fingerprint\")\n- value: root.currentExport ? root.currentExport.fingerprint : \"\"\n- valueTextStyle: Theme.text.monoDescription\n- }\n-\n- ValueRow {\n- objectName: \"watchOnlyExportDerivationPath\"\n- visible: !!root.currentExport && root.currentExport.derivationPath !== \"\"\n- Layout.fillWidth: true\n- title: qsTr(\"Derivation path\")\n- value: root.currentExport ? root.currentExport.derivationPath : \"\"\n- valueTextStyle: Theme.text.monoDescription\n- showDivider: !root.extendedKeyFormat\n- }\n-\n- ValueRow {\n- objectName: \"watchOnlyExportChains\"\n- visible: !root.extendedKeyFormat && !!root.currentExport\n- Layout.fillWidth: true\n- //: Derivation branches the descriptor covers: receiving addresses and change addresses.\n- title: qsTr(\"Chains\")\n- value: !root.currentExport ? \"\"\n- : root.currentExport.changeChain === \"\" ? qsTr(\"Receive %1\").arg(root.currentExport.receiveChain)\n- : qsTr(\"Receive %1, change %2\").arg(root.currentExport.receiveChain).arg(root.currentExport.changeChain)\n- showDivider: false\n- }\n- }\n-\n- CoreText {\n- objectName: \"watchOnlyExportNote\"\n- Layout.fillWidth: true\n- text: {\n- if (root.allTypes || !root.currentExport) {\n- return qsTr(\"Anyone with this export can see all of this wallet's addresses and transactions, but cannot spend from it.\")\n- }\n- let note = qsTr(\"Only includes funds on %1 addresses.\").arg(root.currentExport.label)\n- if (root.inactiveExports.some(item => item.id === root.currentExport.id)) {\n- //: Added to the watch-only export note when this address type also has keys from before, such as from before a password was set. The complete export is the \"All address types\" option.\n- note += \" \" + qsTr(\"Addresses from previous keys are only in the complete export.\")\n- }\n- if (root.extendedKeyFormat && root.currentExport.id === \"bech32m\") {\n- note += \" \" + qsTr(\"Most wallets need the descriptor format to import Taproot keys.\")\n- }\n- return note\n- }\n- font: Theme.text.caption.font\n- lineHeight: Theme.text.caption.lineHeight\n- lineHeightMode: Text.FixedHeight\n- color: Theme.color.neutral7\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n-\n- CoreText {\n- objectName: \"watchOnlyExportError\"\n- visible: root.errorText !== \"\"\n- Layout.fillWidth: true\n- text: root.errorText\n- color: Theme.color.red\n- font: Theme.text.caption.font\n- horizontalAlignment: Text.AlignLeft\n- wrap: true\n- }\n-\n- OutlineButton {\n- objectName: \"watchOnlyExportCopyButton\"\n- Layout.fillWidth: true\n- enabled: root.payload !== \"\"\n- text: copiedTimer.running ? qsTr(\"Copied\")\n- : root.allTypes ? qsTr(\"Copy all descriptors\")\n- : root.\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · a0908d244531..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Ordinary keypool notifications rebuild the export just to determine visibilityqml/models/walletqmlmodel.cpp | addressed | AssessmentAvailability is now cached against descriptor-manager IDs and inactive usage metadata; recomputation occurs only when that state changes, rather than serializing exports on every availability query. The updated code also comments on the broad nature of the Core signal and the keypool/transaction notifications. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "04435fb8d4454b4b8d5e007dc16f9f01",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "a0908d244531dd3e0000b47c146937fbf2c20091",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 3,
"source_job_id": 2273,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 58b9cdd5c4..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -8,6 +8,7 @@\n \n #include <common/messages.h>\n #include <qml/bitcoinamount.h>\n+#include <qml/datadir.h>\n #include <qml/models/addresslistmodel.h>\n #include <qml/models/paymentrequest.h>\n #include <qml/models/psbtqmlmodel.h>\n@@ -50,15 +51,16 @@\n #include <util/threadnames.h>\n #include <util/translation.h>\n #include <wallet/coincontrol.h>\n+#include <wallet/export.h>\n #include <wallet/fees.h>\n #include <wallet/scriptpubkeyman.h>\n #include <wallet/spend.h>\n+#include <wallet/types.h>\n #include <wallet/wallet.h>\n \n #include <QDateTime>\n #include <QMetaObject>\n #include <QRegularExpression>\n-#include <QSaveFile>\n #include <QScopedValueRollback>\n #include <QSettings>\n #include <QVariantList>\n@@ -116,12 +118,12 @@ std::map<QString, CAmount> ScanReceiveRequestTransaction(const interfaces::Walle\n if (received.empty()) return received;\n \n interfaces::WalletTxStatus status{};\n- interfaces::WalletOrderForm order_form;\n+ std::vector<std::string> messages;\n+ std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int num_blocks{0};\n- wallet.getWalletTxDetails(tx.tx->GetHash(), status, order_form, in_mempool, num_blocks);\n- const auto replacement = tx.value_map.find(\"replaced_by_txid\");\n- const bool replaced = replacement != tx.value_map.end() && !replacement->second.empty();\n+ wallet.getWalletTxDetails(tx.tx->GetHash(), status, messages, payment_requests, in_mempool, num_blocks);\n+ const bool replaced{tx.replaced_by_txid.has_value()};\n // The receiver's wallet has no replacement marker on the original tx.\n // An unconfirmed transaction that left the mempool must not add to the\n // received total, but its address remains locked against reuse.\n@@ -291,12 +293,11 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n return util::Error{Untranslated(\"Unable to prepare a send-all transaction.\")};\n }\n LOCK(wallet->cs_wallet);\n- FeeCalculation fee_calc;\n- const CFeeRate rate = wallet::GetMinimumFeeRate(*wallet, control, &fee_calc);\n- if (control.m_feerate && rate > *control.m_feerate) {\n+ const wallet::MinimumFeeRateResult min_fee_rate_result{wallet::GetMinimumFeeRate(*wallet, control)};\n+ if (control.m_feerate && min_fee_rate_result.fee_rate > *control.m_feerate) {\n return util::Error{Untranslated(\"Fee rate is below the minimum fee rate.\")};\n }\n- if (fee_calc.reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee) {\n+ if (min_fee_rate_result.fee_reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee) {\n return util::Error{Untranslated(\"Fee estimation failed. Fallbackfee is disabled.\")};\n }\n // Explicit selections restrict sendall; otherwise use all available coins\n@@ -313,14 +314,14 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n CAmount total{0};\n for (const auto& input : inputs) {\n const auto* source = wallet->GetWalletTx(input.hash);\n- if (!source || input.n >= source->tx->vout.size() || wallet->IsSpent(input)\n- || !wallet->IsMine(source->tx->vout[input.n])) {\n+ if (!source || input.n >= source->GetTx()->vout.size() || wallet->IsSpent(input)\n+ || !wallet->IsMine(source->GetTx()->vout[input.n])) {\n return util::Error{Untranslated(\"A selected input is no longer available.\")};\n }\n- if (wallet->GetTxDepthInMainChain(*source) == 0 && source->tx->version == TRUC_VERSION) {\n+ if (wallet->GetTxDepthInMainChain(*source) == 0 && source->GetTx()->version == TRUC_VERSION) {\n return util::Error{Untranslated(\"Cannot spend an unconfirmed version 3 input in this transaction.\")};\n }\n- total += source->tx->vout[input.n].nValue;\n+ total += source->GetTx()->vout[input.n].nValue;\n const uint32_t sequence = wallet->m_signal_rbf ? MAX_BIP125_RBF_SEQUENCE : CTxIn::MAX_SEQUENCE_NONFINAL;\n tx.vin.emplace_back(input, CScript{}, sequence);\n }\n@@ -338,9 +339,12 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n const auto size = wallet::CalculateMaximumSignedTxSize(CTransaction(tx), wallet);\n if (size.vsize < 0) return util::Error{Untranslated(\"Unable to determine the transaction size.\")};\n if (size.weight > MAX_STANDARD_TX_WEIGHT) return util::Error{Untranslated(\"Transaction too large.\")};\n- const CAmount fee = rate.GetFee(size.vsize)\n- + wallet->chain().calculateCombinedBumpFee(inputs, rate).value_or(0);\n- if (fee > wallet->m_default_max_tx_fee) return util::Error{Untranslated(\"Transaction fee exceeds the maximum configured fee.\")};\n+ const CAmount fee = min_fee_rate_result.fee_rate.GetFee(size.vsize)\n+ + wallet->chain().calculateCombinedBumpFee(inputs, min_fee_rate_result.fee_rate).value_or(0);\n+ if (fee > wallet->m_max_tx_fee) return util::Error{Untranslated(\"Transaction fee exceeds the maximum configured fee.\")};\n+ if (fee > wallet->m_max_tx_fee_rate.GetFee(size.vsize)) {\n+ return util::Error{Untranslated(\"Transaction fee rate exceeds the maximum configured fee rate.\")};\n+ }\n if (total <= fee || fixed_amount > total - fee) {\n return util::Error{Untranslated(\"Selected inputs do not cover the amount plus fee\")};\n }\n@@ -353,7 +357,7 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n FastRandomContext rng;\n wallet::DiscourageFeeSniping(tx, rng, wallet->chain(), wallet->GetLastBlockHash(), wallet->GetLastBlockHeight());\n if (sign && !wallet->SignTransaction(tx)) return util::Error{Untranslated(\"Signing transaction failed.\")};\n- return wallet::CreatedTransactionResult{MakeTransactionRef(std::move(tx)), fee, std::nullopt, fee_calc};\n+ return wallet::CreatedTransactionResult{MakeTransactionRef(std::move(tx)), fee, std::nullopt, min_fee_rate_result.fee_reason};\n }\n \n // A failed fixed-amount preview can still report the fee needed to spend\n@@ -366,10 +370,10 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n if (!wallet || !control.HasSelected() || control.m_allow_other_inputs) return std::nullopt;\n \n LOCK(wallet->cs_wallet);\n- FeeCalculation fee_calc;\n- const CFeeRate rate = wallet::GetMinimumFeeRate(*wallet, control, &fee_calc);\n- if (rate.GetFeePerK() <= 0 || (control.m_feerate && rate > *control.m_feerate)\n- || (fee_calc.reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee)) {\n+ const wallet::MinimumFeeRateResult min_fee_rate_result{wallet::GetMinimumFeeRate(*wallet, control)};\n+ if (min_fee_rate_result.fee_rate.GetFeePerK() <= 0\n+ || (control.m_feerate && min_fee_rate_result.fee_rate > *control.m_feerate)\n+ || (min_fee_rate_result.fee_reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee)) {\n return std::nullopt;\n }\n \n@@ -379,11 +383,11 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n const auto inputs = control.ListSelected();\n for (const auto& input : inputs) {\n const auto* source = wallet->GetWalletTx(input.hash);\n- if (!source || input.n >= source->tx->vout.size() || wallet->IsSpent(input)\n- || !wallet->IsMine(source->tx->vout[input.n])) {\n+ if (!source || input.n >= source->GetTx()->vout.size() || wallet->IsSpent(input)\n+ || !wallet->IsMine(source->GetTx()->vout[input.n])) {\n return std::nullopt;\n }\n- input_amount += source->tx->vout[input.n].nValue;\n+ input_amount += source->GetTx()->vout[input.n].nValue;\n tx.vin.emplace_back(input);\n }\n \n@@ -394,10 +398,10 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n }\n const auto size = wallet::CalculateMaximumSignedTxSize(CTransaction(tx), wallet, &control);\n if (size.vsize < 0) return std::nullopt;\n- const CAmount fee = rate.GetFee(size.vsize)\n- + wallet->chain().calculateCombinedBumpFee(inputs, rate).value_or(0);\n+ const CAmount fee = min_fee_rate_result.fee_rate.GetFee(size.vsize)\n+ + wallet->chain().calculateCombinedBumpFee(inputs, min_fee_rate_result.fee_rate).value_or(0);\n if (!AmountPlusFeeExceedsBalance(send_amount, fee, input_amount)) return std::nullopt;\n- return SendFeePreview{fee, static_cast<int>(inputs.size()), rate.GetFeePerK(), std::nullopt, false};\n+ return SendFeePreview{fee, static_cast<int>(inputs.size()), min_fee_rate_result.fee_rate.GetFeePerK(), std::nullopt, false};\n }\n \n std::optional<SendFeePreview> TryPreviewFee(interfaces::Wallet& wallet,\n@@ -601,7 +605,7 @@ WatchOnlyDescriptor MakeWatchOnlyDescriptor(const SingleKeyDescriptor& receive,\n return {.text = text, .parts = parts};\n }\n \n-constexpr std::array WATCH_ONLY_EXPORT_TYPES{OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY};\n+constexpr std::array DESCRIPTOR_EXPORT_TYPES{OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY};\n \n std::optional<OutputType> SingleKeyOutputType(const QString& script)\n {\n@@ -664,6 +668,36 @@ QString LocalizedString(const bilingual_str& value)\n return QString::fromStdString(value.translated.empty() ? value.original : value.translated);\n }\n \n+// An existing file is only replaced once the new one is written next to it,\n+// so a failed write never loses it.\n+QString WriteWalletFile(const fs::path& destination, bool replace, const std::function<QString(const fs::path&)>& write)\n+{\n+ std::error_code error;\n+ if (!std::filesystem::exists(destination, error)) return write(destination);\n+ if (!replace) {\n+ //: %1 is the path of a file that is kept as it is.\n+ return QObject::tr(\"A file already exists at %1.\").arg(QString::fromStdString(fs::PathToString(destination)));\n+ }\n+\n+ fs::path partial{fs::PathFromString(fs::PathToString(destination) + \".partial\")};\n+ for (int suffix{1}; std::filesystem::exists(partial, error); ++suffix) {\n+ partial = fs::PathFromString(fs::PathToString(destination) + strprintf(\".partial%d\", suffix));\n+ }\n+ const QString write_error{write(partial)};\n+ if (!write_error.isEmpty()) {\n+ std::error_code ignored;\n+ fs::remove(partial, ignored);\n+ return write_error;\n+ }\n+ fs::rename(partial, destination, error);\n+ if (error) {\n+ std::error_code ignored;\n+ fs::remove(partial, ignored);\n+ return QObject::tr(\"The existing file could not be replaced: %1\").arg(QString::fromStdString(error.message()));\n+ }\n+ return {};\n+}\n+\n QString OutputTypeId(OutputType type)\n {\n return QString::fromStdString(FormatOutputType(type));\n@@ -1198,7 +1232,7 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return true;\n }\n \n-bool WalletQmlModel::backupWallet(const QString& path)\n+bool WalletQmlModel::backupWallet(const QString& path, bool replace)\n {\n clearSettingsError();\n if (!m_wallet) {\n@@ -1214,8 +1248,11 @@ bool WalletQmlModel::backupWallet(const QString& path)\n return false;\n }\n \n- if (!m_wallet->backupWallet(path.toStdString())) {\n- setSettingsError(tr(\"The wallet could not be backed up.\"));\n+ const QString error{WriteWalletFile(QmlDataDir::QStringToPath(PsbtQmlModel::LocalFilePath(path)), replace, [this](const fs::path& destination) {\n+ return m_wallet->backupWallet(fs::PathToString(destination)) ? QString{} : tr(\"The wallet could not be backed up.\");\n+ })};\n+ if (!error.isEmpty()) {\n+ setSettingsError(error);\n return false;\n }\n \n@@ -1302,36 +1339,75 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n return {};\n }\n \n-bool WalletQmlModel::canExportWatchOnly() const\n+bool WalletQmlModel::canShowDescriptors() const\n {\n- return !watchOnlyExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n-QVariantList WalletQmlModel::watchOnlyExports() const\n+QVariantList WalletQmlModel::descriptorExports() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n \n QVariantList exports;\n LOCK(raw_wallet->cs_wallet);\n- for (const OutputType type : WATCH_ONLY_EXPORT_TYPES) {\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n- const auto change = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true));\n+ const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n+ const auto change = ParseSingleKeyDescriptor(change_man);\n+ // A change chain in another form is listed as it is, and no single key covers it.\n+ const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- const WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ if (change_unreadable) {\n+ std::string change_text;\n+ const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n+ descriptor = {.text = change_text.empty() ? receive->descriptor\n+ : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n+ .parts = {}};\n+ }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n- const bool key_covers_both{receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -1340,7 +1416,7 @@ QVariantList WalletQmlModel::watchOnlyExports() const\n return exports;\n }\n \n-QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n+QVariantList WalletQmlModel::inactiveDescriptorExports() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n@@ -1359,10 +1435,10 @@ QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n if (!type) continue;\n const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n LOCK(desc_man.cs_desc_man);\n- found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().next_index > 0});\n+ found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n }\n std::ranges::sort(found, {}, [](const Inactive& item) {\n- return std::tuple{std::ranges::find(WATCH_ONLY_EXPORT_TYPES, item.type) - WATCH_ONLY_EXPORT_TYPES.begin(),\n+ return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n \n@@ -1373,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1395,14 +1472,130 @@ QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n return exports;\n }\n \n-QString WalletQmlModel::saveWatchOnlyExport(const QString& path, const QString& contents) const\n+namespace {\n+\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n+{\n+ FlatSigningProvider keys;\n+ std::string error;\n+ const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n+ std::vector<CScript> scripts;\n+ FlatSigningProvider out;\n+ return desc->Expand(0, keys, scripts, out);\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n+}\n+\n+std::ve\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 3597,
"evidence_id": "346a62d5badd4a9ba773efb83b463fd3",
"finding_id": "finding:3",
"kind": "new_source",
"line": 3448,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "a0908d244531dd3e0000b47c146937fbf2c20091",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 3,
"source_job_id": 2273,
"text": "\nbool WalletQmlModel::canBumpTransaction(const uint256& txid) const\n{\n if (!m_wallet) {\n return false;\n }\n return m_wallet->transactionCanBeBumped(Txid::FromUint256(txid));\n}\n\ninterfaces::Wallet::CoinsList WalletQmlModel::listCoins() const\n{\n if (!m_wallet) {\n return {};\n }\n return m_wallet->listCoins();\n}\n\nbool WalletQmlModel::lockCoin(const COutPoint& output)\n{\n if (!m_wallet) {\n return false;\n }\n return m_wallet->lockCoin(output, true);\n}\n\nbool WalletQmlModel::unlockCoin(const COutPoint& output)\n{\n if (!m_wallet) {\n return false;\n }\n return m_wallet->unlockCoin(output);\n}\n\nbool WalletQmlModel::isLockedCoin(const COutPoint& output)\n{\n if (!m_wallet) {\n return false;\n }\n return m_wallet->isLockedCoin(output);\n}\n\nvoid WalletQmlModel::listLockedCoins(std::vector<COutPoint>& outputs)\n{\n if (!m_wallet) {\n return;\n }\n m_wallet->listLockedCoins(outputs);\n}\n\nvoid WalletQmlModel::selectCoin(const COutPoint& output)\n{\n const bool was_selected{m_coin_control.IsSelected(output)};\n m_coin_control.Select(output);\n if (!was_selected) {\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n scheduleFeeEstimates();\n}\n\nvoid WalletQmlModel::unselectCoin(const COutPoint& output)\n{\n const bool was_selected{m_coin_control.IsSelected(output)};\n m_coin_control.UnSelect(output);\n if (was_selected) {\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n scheduleFeeEstimates();\n}\n\nbool WalletQmlModel::isSelectedCoin(const COutPoint& output)\n{\n return m_coin_control.IsSelected(output);\n}\n\nstd::vector<COutPoint> WalletQmlModel::listSelectedCoins() const\n{\n return m_coin_control.ListSelected();\n}\n\nvoid WalletQmlModel::clearSelectedCoins()\n{\n setMaximumRecipient(nullptr);\n if (m_coin_control.HasSelected()) setSelectedCoins({});\n}\n\nvoid WalletQmlModel::setSelectedCoins(const std::vector<COutPoint>& outputs)\n{\n // Restoring a cancelled coin-picker edit preserves the maximum recipient.\n m_coin_control.UnSelectAll();\n for (const auto& output : outputs) m_coin_control.Select(output);\n if (m_coins_list_model) m_coins_list_model->refreshSelection();\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n}\n\nunsigned int WalletQmlModel::feeTargetBlocks() const\n{\n return m_coin_control.m_confirm_target.value_or(DEFAULT_STANDARD_FEE_TARGET);\n}\n\nvoid WalletQmlModel::setFeeTargetBlocks(unsigned int target_blocks)\n{\n if (m_coin_control.m_confirm_target != target_blocks) {\n m_coin_control.m_confirm_target = target_blocks;\n updateMaximumAmount();\n Q_EMIT feeTargetBlocksChanged();\n Q_EMIT estimatedFeeChanged();\n Q_EMIT sendAmountExhaustsBalanceChanged();\n }\n}\n\nvoid WalletQmlModel::setCustomFeeEnabled(const bool enabled)\n{\n if (m_custom_fee_enabled != enabled) {\n m_custom_fee_enabled = enabled;\n Q_EMIT customFeeEnabledChanged();\n Q_EMIT estimatedFeeChanged();\n Q_EMIT sendAmountExhaustsBalanceChanged();\n scheduleFeeEstimates();\n }\n}\n\nvoid WalletQmlModel::setCustomFeeRate(const QString& fee_rate)\n{\n const QString trimmed_fee_rate = fee_rate.trimmed();\n const bool was_valid = customFeeRateValid();\n\n if (m_custom_fee_rate == trimmed_fee_rate) {\n return;\n }\n\n m_custom_fee_rate = trimmed_fee_rate;\n m_custom_fee_estimate.reset();\n\n if (m_wallet) {\n if (const auto requested_rate = ParseCustomFeeRatePerKvB(m_custom_fee_rate, MinimumCustomFeeRatePerKvB(m_wallet.get()))) {\n std::array<CAmount, CUSTOM_FEE_TARGETS.size()> target_rates{};\n for (size_t i = 0; i < CUSTOM_FEE_TARGETS.size(); ++i) {\n wallet::CCoinControl control{m_coin_control};\n control.m_feerate.reset();\n control.m_confirm_target = CUSTOM_FEE_TARGETS[i];\n target_rates[i] = m_wallet->getMinimumFee(FEE_RATE_BASIS_VBYTES, control, nullptr, nullptr);\n }\n\n // When the estimator has no target-specific data, moving the thumb\n // would imply a confirmation estimate we do not actually have.\n if (std::any_of(target_rates.begin() + 1, target_rates.end(), [&](CAmount rate) {\n return rate != target_rates.front();\n })) {\n unsigned int inferred_target = CUSTOM_FEE_TARGETS.back();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · a0908d244531..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | Extended-key mode automatically selects a script-ambiguous Taproot xpubqml/models/walletqmlmodel.cpp | unclear | AssessmentThe follow-up assessment was invalid: follow-up evidence belongs to another finding or comparison. invalid_assessment Source report · a0908d244531..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | The complete export silently omits migrated legacy fundsqml/models/walletqmlmodel.cpp | unclear | AssessmentThe new code detects public descriptors that require private keys and filters them from Core import JSON, but the supplied excerpts do not show whether the UI reports skipped relevant managers or removes the complete-coverage wording. The part about disabling bare extended keys for unsupported change managers is addressed by requiring a recognized change descriptor before setting extendedKey; the main completeness concern remains unverified. path_diff: qml/models/walletqmlmodel.cpp; new_source: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "1aaedc1f5fdd45b6a44657a749306d3e",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "a0908d244531dd3e0000b47c146937fbf2c20091",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 3,
"source_job_id": 2273,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex 58b9cdd5c4..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -8,6 +8,7 @@\n \n #include <common/messages.h>\n #include <qml/bitcoinamount.h>\n+#include <qml/datadir.h>\n #include <qml/models/addresslistmodel.h>\n #include <qml/models/paymentrequest.h>\n #include <qml/models/psbtqmlmodel.h>\n@@ -50,15 +51,16 @@\n #include <util/threadnames.h>\n #include <util/translation.h>\n #include <wallet/coincontrol.h>\n+#include <wallet/export.h>\n #include <wallet/fees.h>\n #include <wallet/scriptpubkeyman.h>\n #include <wallet/spend.h>\n+#include <wallet/types.h>\n #include <wallet/wallet.h>\n \n #include <QDateTime>\n #include <QMetaObject>\n #include <QRegularExpression>\n-#include <QSaveFile>\n #include <QScopedValueRollback>\n #include <QSettings>\n #include <QVariantList>\n@@ -116,12 +118,12 @@ std::map<QString, CAmount> ScanReceiveRequestTransaction(const interfaces::Walle\n if (received.empty()) return received;\n \n interfaces::WalletTxStatus status{};\n- interfaces::WalletOrderForm order_form;\n+ std::vector<std::string> messages;\n+ std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int num_blocks{0};\n- wallet.getWalletTxDetails(tx.tx->GetHash(), status, order_form, in_mempool, num_blocks);\n- const auto replacement = tx.value_map.find(\"replaced_by_txid\");\n- const bool replaced = replacement != tx.value_map.end() && !replacement->second.empty();\n+ wallet.getWalletTxDetails(tx.tx->GetHash(), status, messages, payment_requests, in_mempool, num_blocks);\n+ const bool replaced{tx.replaced_by_txid.has_value()};\n // The receiver's wallet has no replacement marker on the original tx.\n // An unconfirmed transaction that left the mempool must not add to the\n // received total, but its address remains locked against reuse.\n@@ -291,12 +293,11 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n return util::Error{Untranslated(\"Unable to prepare a send-all transaction.\")};\n }\n LOCK(wallet->cs_wallet);\n- FeeCalculation fee_calc;\n- const CFeeRate rate = wallet::GetMinimumFeeRate(*wallet, control, &fee_calc);\n- if (control.m_feerate && rate > *control.m_feerate) {\n+ const wallet::MinimumFeeRateResult min_fee_rate_result{wallet::GetMinimumFeeRate(*wallet, control)};\n+ if (control.m_feerate && min_fee_rate_result.fee_rate > *control.m_feerate) {\n return util::Error{Untranslated(\"Fee rate is below the minimum fee rate.\")};\n }\n- if (fee_calc.reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee) {\n+ if (min_fee_rate_result.fee_reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee) {\n return util::Error{Untranslated(\"Fee estimation failed. Fallbackfee is disabled.\")};\n }\n // Explicit selections restrict sendall; otherwise use all available coins\n@@ -313,14 +314,14 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n CAmount total{0};\n for (const auto& input : inputs) {\n const auto* source = wallet->GetWalletTx(input.hash);\n- if (!source || input.n >= source->tx->vout.size() || wallet->IsSpent(input)\n- || !wallet->IsMine(source->tx->vout[input.n])) {\n+ if (!source || input.n >= source->GetTx()->vout.size() || wallet->IsSpent(input)\n+ || !wallet->IsMine(source->GetTx()->vout[input.n])) {\n return util::Error{Untranslated(\"A selected input is no longer available.\")};\n }\n- if (wallet->GetTxDepthInMainChain(*source) == 0 && source->tx->version == TRUC_VERSION) {\n+ if (wallet->GetTxDepthInMainChain(*source) == 0 && source->GetTx()->version == TRUC_VERSION) {\n return util::Error{Untranslated(\"Cannot spend an unconfirmed version 3 input in this transaction.\")};\n }\n- total += source->tx->vout[input.n].nValue;\n+ total += source->GetTx()->vout[input.n].nValue;\n const uint32_t sequence = wallet->m_signal_rbf ? MAX_BIP125_RBF_SEQUENCE : CTxIn::MAX_SEQUENCE_NONFINAL;\n tx.vin.emplace_back(input, CScript{}, sequence);\n }\n@@ -338,9 +339,12 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n const auto size = wallet::CalculateMaximumSignedTxSize(CTransaction(tx), wallet);\n if (size.vsize < 0) return util::Error{Untranslated(\"Unable to determine the transaction size.\")};\n if (size.weight > MAX_STANDARD_TX_WEIGHT) return util::Error{Untranslated(\"Transaction too large.\")};\n- const CAmount fee = rate.GetFee(size.vsize)\n- + wallet->chain().calculateCombinedBumpFee(inputs, rate).value_or(0);\n- if (fee > wallet->m_default_max_tx_fee) return util::Error{Untranslated(\"Transaction fee exceeds the maximum configured fee.\")};\n+ const CAmount fee = min_fee_rate_result.fee_rate.GetFee(size.vsize)\n+ + wallet->chain().calculateCombinedBumpFee(inputs, min_fee_rate_result.fee_rate).value_or(0);\n+ if (fee > wallet->m_max_tx_fee) return util::Error{Untranslated(\"Transaction fee exceeds the maximum configured fee.\")};\n+ if (fee > wallet->m_max_tx_fee_rate.GetFee(size.vsize)) {\n+ return util::Error{Untranslated(\"Transaction fee rate exceeds the maximum configured fee rate.\")};\n+ }\n if (total <= fee || fixed_amount > total - fee) {\n return util::Error{Untranslated(\"Selected inputs do not cover the amount plus fee\")};\n }\n@@ -353,7 +357,7 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n FastRandomContext rng;\n wallet::DiscourageFeeSniping(tx, rng, wallet->chain(), wallet->GetLastBlockHash(), wallet->GetLastBlockHeight());\n if (sign && !wallet->SignTransaction(tx)) return util::Error{Untranslated(\"Signing transaction failed.\")};\n- return wallet::CreatedTransactionResult{MakeTransactionRef(std::move(tx)), fee, std::nullopt, fee_calc};\n+ return wallet::CreatedTransactionResult{MakeTransactionRef(std::move(tx)), fee, std::nullopt, min_fee_rate_result.fee_reason};\n }\n \n // A failed fixed-amount preview can still report the fee needed to spend\n@@ -366,10 +370,10 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n if (!wallet || !control.HasSelected() || control.m_allow_other_inputs) return std::nullopt;\n \n LOCK(wallet->cs_wallet);\n- FeeCalculation fee_calc;\n- const CFeeRate rate = wallet::GetMinimumFeeRate(*wallet, control, &fee_calc);\n- if (rate.GetFeePerK() <= 0 || (control.m_feerate && rate > *control.m_feerate)\n- || (fee_calc.reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee)) {\n+ const wallet::MinimumFeeRateResult min_fee_rate_result{wallet::GetMinimumFeeRate(*wallet, control)};\n+ if (min_fee_rate_result.fee_rate.GetFeePerK() <= 0\n+ || (control.m_feerate && min_fee_rate_result.fee_rate > *control.m_feerate)\n+ || (min_fee_rate_result.fee_reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee)) {\n return std::nullopt;\n }\n \n@@ -379,11 +383,11 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n const auto inputs = control.ListSelected();\n for (const auto& input : inputs) {\n const auto* source = wallet->GetWalletTx(input.hash);\n- if (!source || input.n >= source->tx->vout.size() || wallet->IsSpent(input)\n- || !wallet->IsMine(source->tx->vout[input.n])) {\n+ if (!source || input.n >= source->GetTx()->vout.size() || wallet->IsSpent(input)\n+ || !wallet->IsMine(source->GetTx()->vout[input.n])) {\n return std::nullopt;\n }\n- input_amount += source->tx->vout[input.n].nValue;\n+ input_amount += source->GetTx()->vout[input.n].nValue;\n tx.vin.emplace_back(input);\n }\n \n@@ -394,10 +398,10 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n }\n const auto size = wallet::CalculateMaximumSignedTxSize(CTransaction(tx), wallet, &control);\n if (size.vsize < 0) return std::nullopt;\n- const CAmount fee = rate.GetFee(size.vsize)\n- + wallet->chain().calculateCombinedBumpFee(inputs, rate).value_or(0);\n+ const CAmount fee = min_fee_rate_result.fee_rate.GetFee(size.vsize)\n+ + wallet->chain().calculateCombinedBumpFee(inputs, min_fee_rate_result.fee_rate).value_or(0);\n if (!AmountPlusFeeExceedsBalance(send_amount, fee, input_amount)) return std::nullopt;\n- return SendFeePreview{fee, static_cast<int>(inputs.size()), rate.GetFeePerK(), std::nullopt, false};\n+ return SendFeePreview{fee, static_cast<int>(inputs.size()), min_fee_rate_result.fee_rate.GetFeePerK(), std::nullopt, false};\n }\n \n std::optional<SendFeePreview> TryPreviewFee(interfaces::Wallet& wallet,\n@@ -601,7 +605,7 @@ WatchOnlyDescriptor MakeWatchOnlyDescriptor(const SingleKeyDescriptor& receive,\n return {.text = text, .parts = parts};\n }\n \n-constexpr std::array WATCH_ONLY_EXPORT_TYPES{OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY};\n+constexpr std::array DESCRIPTOR_EXPORT_TYPES{OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY};\n \n std::optional<OutputType> SingleKeyOutputType(const QString& script)\n {\n@@ -664,6 +668,36 @@ QString LocalizedString(const bilingual_str& value)\n return QString::fromStdString(value.translated.empty() ? value.original : value.translated);\n }\n \n+// An existing file is only replaced once the new one is written next to it,\n+// so a failed write never loses it.\n+QString WriteWalletFile(const fs::path& destination, bool replace, const std::function<QString(const fs::path&)>& write)\n+{\n+ std::error_code error;\n+ if (!std::filesystem::exists(destination, error)) return write(destination);\n+ if (!replace) {\n+ //: %1 is the path of a file that is kept as it is.\n+ return QObject::tr(\"A file already exists at %1.\").arg(QString::fromStdString(fs::PathToString(destination)));\n+ }\n+\n+ fs::path partial{fs::PathFromString(fs::PathToString(destination) + \".partial\")};\n+ for (int suffix{1}; std::filesystem::exists(partial, error); ++suffix) {\n+ partial = fs::PathFromString(fs::PathToString(destination) + strprintf(\".partial%d\", suffix));\n+ }\n+ const QString write_error{write(partial)};\n+ if (!write_error.isEmpty()) {\n+ std::error_code ignored;\n+ fs::remove(partial, ignored);\n+ return write_error;\n+ }\n+ fs::rename(partial, destination, error);\n+ if (error) {\n+ std::error_code ignored;\n+ fs::remove(partial, ignored);\n+ return QObject::tr(\"The existing file could not be replaced: %1\").arg(QString::fromStdString(error.message()));\n+ }\n+ return {};\n+}\n+\n QString OutputTypeId(OutputType type)\n {\n return QString::fromStdString(FormatOutputType(type));\n@@ -1198,7 +1232,7 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return true;\n }\n \n-bool WalletQmlModel::backupWallet(const QString& path)\n+bool WalletQmlModel::backupWallet(const QString& path, bool replace)\n {\n clearSettingsError();\n if (!m_wallet) {\n@@ -1214,8 +1248,11 @@ bool WalletQmlModel::backupWallet(const QString& path)\n return false;\n }\n \n- if (!m_wallet->backupWallet(path.toStdString())) {\n- setSettingsError(tr(\"The wallet could not be backed up.\"));\n+ const QString error{WriteWalletFile(QmlDataDir::QStringToPath(PsbtQmlModel::LocalFilePath(path)), replace, [this](const fs::path& destination) {\n+ return m_wallet->backupWallet(fs::PathToString(destination)) ? QString{} : tr(\"The wallet could not be backed up.\");\n+ })};\n+ if (!error.isEmpty()) {\n+ setSettingsError(error);\n return false;\n }\n \n@@ -1302,36 +1339,75 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n return {};\n }\n \n-bool WalletQmlModel::canExportWatchOnly() const\n+bool WalletQmlModel::canShowDescriptors() const\n {\n- return !watchOnlyExports().isEmpty();\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n }\n \n-QVariantList WalletQmlModel::watchOnlyExports() const\n+QVariantList WalletQmlModel::descriptorExports() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n \n QVariantList exports;\n LOCK(raw_wallet->cs_wallet);\n- for (const OutputType type : WATCH_ONLY_EXPORT_TYPES) {\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n- const auto change = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true));\n+ const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n+ const auto change = ParseSingleKeyDescriptor(change_man);\n+ // A change chain in another form is listed as it is, and no single key covers it.\n+ const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- const WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ if (change_unreadable) {\n+ std::string change_text;\n+ const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n+ descriptor = {.text = change_text.empty() ? receive->descriptor\n+ : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n+ .parts = {}};\n+ }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n- const bool key_covers_both{receive->branch == QLatin1String(\"/0\") &&\n- (!change || (!descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")))};\n+ const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n@@ -1340,7 +1416,7 @@ QVariantList WalletQmlModel::watchOnlyExports() const\n return exports;\n }\n \n-QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n+QVariantList WalletQmlModel::inactiveDescriptorExports() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n@@ -1359,10 +1435,10 @@ QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n if (!type) continue;\n const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n LOCK(desc_man.cs_desc_man);\n- found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().next_index > 0});\n+ found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n }\n std::ranges::sort(found, {}, [](const Inactive& item) {\n- return std::tuple{std::ranges::find(WATCH_ONLY_EXPORT_TYPES, item.type) - WATCH_ONLY_EXPORT_TYPES.begin(),\n+ return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n \n@@ -1373,6 +1449,7 @@ QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n@@ -1395,14 +1472,130 @@ QVariantList WalletQmlModel::inactiveWatchOnlyExports() const\n return exports;\n }\n \n-QString WalletQmlModel::saveWatchOnlyExport(const QString& path, const QString& contents) const\n+namespace {\n+\n+enum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n+\n+PublicImport ClassifyPublicImport(const std::string& descriptor)\n+{\n+ FlatSigningProvider keys;\n+ std::string error;\n+ const auto parsed{Parse(descriptor, keys, error, /*require_checksum=*/false)};\n+ if (parsed.empty()) return PublicImport::NeedsPrivateKeys;\n+ // unused(), as addhdkey adds, has no addresses, and a wallet without\n+ // private keys rejects it.\n+ if (std::ranges::any_of(parsed, [](const auto& desc) { return !desc->HasScripts(); })) {\n+ return PublicImport::NoScripts;\n+ }\n+ // Hardened derivation after the key, as in a migrated wallet's old HD chain,\n+ // needs the private key, so importdescriptors rejects the public form.\n+ const bool expands{std::ranges::all_of(parsed, [&](const auto& desc) {\n+ std::vector<CScript> scripts;\n+ FlatSigningProvider out;\n+ return desc->Expand(0, keys, scripts, out);\n+ })};\n+ return expands ? PublicImport::Importable : PublicImport::NeedsPrivateKeys;\n+}\n+\n+std::ve\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 1478,
"evidence_id": "5abade8b40974b518a362b52da4fc9d5",
"finding_id": "finding:1",
"kind": "new_source",
"line": 1329,
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "a0908d244531dd3e0000b47c146937fbf2c20091",
"path": "qml/models/walletqmlmodel.cpp",
"revision": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"source_generation": 3,
"source_job_id": 2273,
"text": "}\n\nQString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) const\n{\n for (const QVariant& item : availableReceiveAddressTypes()) {\n const QVariantMap type{item.toMap()};\n if (type.value(QStringLiteral(\"id\")).toString() == address_type) {\n return type.value(QStringLiteral(\"label\")).toString();\n }\n }\n return {};\n}\n\nbool WalletQmlModel::canShowDescriptors() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return false;\n\n // Keypool and transaction notifications mostly leave the descriptors as\n // they were, so rebuild the lists only once one is added, activated or used.\n std::vector<std::pair<uint256, bool>> state;\n {\n LOCK(raw_wallet->cs_wallet);\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n for (const bool internal : {false, true}) {\n const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n }\n }\n const auto active_end{state.size()};\n for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n LOCK(desc_man->cs_desc_man);\n state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n }\n std::sort(state.begin() + active_end, state.end());\n }\n if (state != m_descriptor_state) {\n m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n m_descriptor_state = std::move(state);\n }\n return m_can_show_descriptors;\n}\n\nQVariantList WalletQmlModel::descriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n QVariantList exports;\n LOCK(raw_wallet->cs_wallet);\n for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n const auto change = ParseSingleKeyDescriptor(change_man);\n // A change chain in another form is listed as it is, and no single key covers it.\n const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n if (change_unreadable) {\n std::string change_text;\n const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n descriptor = {.text = change_text.empty() ? receive->descriptor\n : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n .parts = {}};\n }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n exports.append(item);\n }\n return exports;\n}\n\nQVariantList WalletQmlModel::inactiveDescriptorExports() const\n{\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n\n struct Inactive {\n SingleKeyDescriptor descriptor;\n OutputType type;\n bool used;\n };\n std::vector<Inactive> found;\n LOCK(raw_wallet->cs_wallet);\n for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n if (raw_wallet->IsActiveScriptPubKeyMan(*spk_man)) continue;\n const auto descriptor = ParseSingleKeyDescriptor(spk_man);\n const auto type = descriptor ? SingleKeyOutputType(descriptor->script) : std::nullopt;\n if (!type) continue;\n const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n LOCK(desc_man.cs_desc_man);\n found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n }\n std::ranges::sort(found, {}, [](const Inactive& item) {\n return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n });\n\n QVariantList exports;\n const auto append = [&](const Inactive& receive, const std::optional<SingleKeyDescriptor>& change) {\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(receive.type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(receive.type));\n item.insert(QStringLiteral(\"descriptor\"), MakeWatchOnlyDescriptor(receive.descriptor, change).text);\n item.insert(QStringLiteral(\"coversChange\"), change.has_value());\n item.insert(QStringLiteral(\"xpub\"), receive.descriptor.xpub);\n item.insert(QStringLiteral(\"fingerprint\"), receive.descriptor.fingerprint);\n exports.append(item);\n };\n for (auto it = found.begin(); it != found.end();) {\n const auto end = std::find_if(it, found.end(), [&](const Inactive& item) {\n return item.type != it->type || item.descriptor.origin != it->descriptor.origin ||\n item.descriptor.xpub != it->descriptor.xpub;\n });\n // next_index only moves once an address is handed out or seen in a transaction.\n if (std::any_of(it, end, [](const Inactive& item) { return item.used; })) {\n if (end - it == 2) {\n append(*it, std::next(it)->descriptor);\n } else {\n std::for_each(it, end, [&](const Inactive& item) { append(item, std::nullopt); });\n }\n }\n it = end;\n }\n return exports;\n}\n\nnamespace {\n\nenum class PublicImport { Importable, NeedsPrivateKeys, NoScripts };\n",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · a0908d244531..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1052 | Reduced motion reads the OS setting only at startupqml/motionpreference.h | still_present | AssessmentThe startup-only OS motion snapshot remains unchanged, with no live notification or explicit user-facing restart limitation shown. The new header still declares `Q_PROPERTY(QString mode READ mode CONSTANT)` and stores `m_mode` as `const`. Source report · 8ed9aee98603..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Return confirms the sweep alert without focusing its buttonqml/controls/AlertPopup.qml | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · 8ed9aee98603..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1050 | Custom cannot restore a remembered directory after Defaultqml/components/StorageLocations.qml | addressed | AssessmentThe updated handler directly submits the remembered path for selection instead of blocking on validateCustomDataDir, with immediate failure handling, matching the proposed fix. The diff replaces the validateCustomDataDir guard with a direct selectCustomDataDir call and false-return handling. The QML test exercises the not-checked validator result and then verifies the custom directory selection. Source report · b9b39b089357..f68f5bf24c50 2026-11-12T03:03:39Z · gpt-6-luna |
| gui#1062 | Post-update QR export check does not verify the exported payloadtest/functional/qml_test_receive.py | still_present | AssessmentThe reported export-content coverage gap remains. The new-head excerpt still contains no decoding of the saved QR or exact payload comparison, and the comment continues to make the encoding claim. Lines 353–354 retain the claim that the image encodes the applied request; lines 365–370 test only the PNG signature and inequality with the original export. Source report · 3db3212eee5e..405d23f1bcab 2026-11-11T00:42:34Z · gpt-6-luna |
| gui#1057 | Extended-key export drops incompatible receive/change layoutsqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new head gates extended-key export on compatible derivation paths and disables the option if no covering key exists. Tests assert that a split-key legacy layout has no extended key and that a swapped-branch layout is also rejected. `watchOnlyExports()` requires receive `/0` and compatible change `/1` before populating `extendedKey`; the modal filters unavailable keys and disables the format when none qualify. C++ and QML tests cover incompatible layouts. Source report · a8f185199ace..a0908d244531 2026-11-05T22:50:24Z · gpt-6-luna |
| gui#1057 | Extended-key exports do not round-trip through this app's watch-only importqml/models/walletqmlmodel.cpp | still_present | AssessmentThe change tightens when a bare extended key is offered, but this finding concerns the app’s xpub import assuming P2WPKH and the resulting script-type mismatch. The supplied new-head evidence does not show that the importer changed or that an explicit warning about re-importing exported keys was added. path_diff: qml/models/walletqmlmodel.cpp [
{
"evidence_id": "81dec5255ab546799c88e3681cb3b962",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "780a6a245a3ce263bf4bbd9de14e44818784ba6d",
"old_head": "a8f185199aceaa2740da271143041350b55db6c8",
"path": "qml/models/walletqmlmodel.cpp",
"source_generation": 2,
"source_job_id": 2169,
"text": "diff --git a/qml/models/walletqmlmodel.cpp b/qml/models/walletqmlmodel.cpp\nindex bba4c1c816..e3450a503a 100644\n--- a/qml/models/walletqmlmodel.cpp\n+++ b/qml/models/walletqmlmodel.cpp\n@@ -8,6 +8,7 @@\n \n #include <common/messages.h>\n #include <qml/bitcoinamount.h>\n+#include <qml/datadir.h>\n #include <qml/models/addresslistmodel.h>\n #include <qml/models/paymentrequest.h>\n #include <qml/models/psbtqmlmodel.h>\n@@ -50,15 +51,16 @@\n #include <util/threadnames.h>\n #include <util/translation.h>\n #include <wallet/coincontrol.h>\n+#include <wallet/export.h>\n #include <wallet/fees.h>\n #include <wallet/scriptpubkeyman.h>\n #include <wallet/spend.h>\n+#include <wallet/types.h>\n #include <wallet/wallet.h>\n \n #include <QDateTime>\n #include <QMetaObject>\n #include <QRegularExpression>\n-#include <QSaveFile>\n #include <QScopedValueRollback>\n #include <QSettings>\n #include <QVariantList>\n@@ -116,12 +118,12 @@ std::map<QString, CAmount> ScanReceiveRequestTransaction(const interfaces::Walle\n if (received.empty()) return received;\n \n interfaces::WalletTxStatus status{};\n- interfaces::WalletOrderForm order_form;\n+ std::vector<std::string> messages;\n+ std::vector<std::string> payment_requests;\n bool in_mempool{false};\n int num_blocks{0};\n- wallet.getWalletTxDetails(tx.tx->GetHash(), status, order_form, in_mempool, num_blocks);\n- const auto replacement = tx.value_map.find(\"replaced_by_txid\");\n- const bool replaced = replacement != tx.value_map.end() && !replacement->second.empty();\n+ wallet.getWalletTxDetails(tx.tx->GetHash(), status, messages, payment_requests, in_mempool, num_blocks);\n+ const bool replaced{tx.replaced_by_txid.has_value()};\n // The receiver's wallet has no replacement marker on the original tx.\n // An unconfirmed transaction that left the mempool must not add to the\n // received total, but its address remains locked against reuse.\n@@ -291,12 +293,11 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n return util::Error{Untranslated(\"Unable to prepare a send-all transaction.\")};\n }\n LOCK(wallet->cs_wallet);\n- FeeCalculation fee_calc;\n- const CFeeRate rate = wallet::GetMinimumFeeRate(*wallet, control, &fee_calc);\n- if (control.m_feerate && rate > *control.m_feerate) {\n+ const wallet::MinimumFeeRateResult min_fee_rate_result{wallet::GetMinimumFeeRate(*wallet, control)};\n+ if (control.m_feerate && min_fee_rate_result.fee_rate > *control.m_feerate) {\n return util::Error{Untranslated(\"Fee rate is below the minimum fee rate.\")};\n }\n- if (fee_calc.reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee) {\n+ if (min_fee_rate_result.fee_reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee) {\n return util::Error{Untranslated(\"Fee estimation failed. Fallbackfee is disabled.\")};\n }\n // Explicit selections restrict sendall; otherwise use all available coins\n@@ -313,14 +314,14 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n CAmount total{0};\n for (const auto& input : inputs) {\n const auto* source = wallet->GetWalletTx(input.hash);\n- if (!source || input.n >= source->tx->vout.size() || wallet->IsSpent(input)\n- || !wallet->IsMine(source->tx->vout[input.n])) {\n+ if (!source || input.n >= source->GetTx()->vout.size() || wallet->IsSpent(input)\n+ || !wallet->IsMine(source->GetTx()->vout[input.n])) {\n return util::Error{Untranslated(\"A selected input is no longer available.\")};\n }\n- if (wallet->GetTxDepthInMainChain(*source) == 0 && source->tx->version == TRUC_VERSION) {\n+ if (wallet->GetTxDepthInMainChain(*source) == 0 && source->GetTx()->version == TRUC_VERSION) {\n return util::Error{Untranslated(\"Cannot spend an unconfirmed version 3 input in this transaction.\")};\n }\n- total += source->tx->vout[input.n].nValue;\n+ total += source->GetTx()->vout[input.n].nValue;\n const uint32_t sequence = wallet->m_signal_rbf ? MAX_BIP125_RBF_SEQUENCE : CTxIn::MAX_SEQUENCE_NONFINAL;\n tx.vin.emplace_back(input, CScript{}, sequence);\n }\n@@ -338,9 +339,12 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n const auto size = wallet::CalculateMaximumSignedTxSize(CTransaction(tx), wallet);\n if (size.vsize < 0) return util::Error{Untranslated(\"Unable to determine the transaction size.\")};\n if (size.weight > MAX_STANDARD_TX_WEIGHT) return util::Error{Untranslated(\"Transaction too large.\")};\n- const CAmount fee = rate.GetFee(size.vsize)\n- + wallet->chain().calculateCombinedBumpFee(inputs, rate).value_or(0);\n- if (fee > wallet->m_default_max_tx_fee) return util::Error{Untranslated(\"Transaction fee exceeds the maximum configured fee.\")};\n+ const CAmount fee = min_fee_rate_result.fee_rate.GetFee(size.vsize)\n+ + wallet->chain().calculateCombinedBumpFee(inputs, min_fee_rate_result.fee_rate).value_or(0);\n+ if (fee > wallet->m_max_tx_fee) return util::Error{Untranslated(\"Transaction fee exceeds the maximum configured fee.\")};\n+ if (fee > wallet->m_max_tx_fee_rate.GetFee(size.vsize)) {\n+ return util::Error{Untranslated(\"Transaction fee rate exceeds the maximum configured fee rate.\")};\n+ }\n if (total <= fee || fixed_amount > total - fee) {\n return util::Error{Untranslated(\"Selected inputs do not cover the amount plus fee\")};\n }\n@@ -353,7 +357,7 @@ util::Result<wallet::CreatedTransactionResult> CreateSendAllTransaction(\n FastRandomContext rng;\n wallet::DiscourageFeeSniping(tx, rng, wallet->chain(), wallet->GetLastBlockHash(), wallet->GetLastBlockHeight());\n if (sign && !wallet->SignTransaction(tx)) return util::Error{Untranslated(\"Signing transaction failed.\")};\n- return wallet::CreatedTransactionResult{MakeTransactionRef(std::move(tx)), fee, std::nullopt, fee_calc};\n+ return wallet::CreatedTransactionResult{MakeTransactionRef(std::move(tx)), fee, std::nullopt, min_fee_rate_result.fee_reason};\n }\n \n // A failed fixed-amount preview can still report the fee needed to spend\n@@ -366,10 +370,10 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n if (!wallet || !control.HasSelected() || control.m_allow_other_inputs) return std::nullopt;\n \n LOCK(wallet->cs_wallet);\n- FeeCalculation fee_calc;\n- const CFeeRate rate = wallet::GetMinimumFeeRate(*wallet, control, &fee_calc);\n- if (rate.GetFeePerK() <= 0 || (control.m_feerate && rate > *control.m_feerate)\n- || (fee_calc.reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee)) {\n+ const wallet::MinimumFeeRateResult min_fee_rate_result{wallet::GetMinimumFeeRate(*wallet, control)};\n+ if (min_fee_rate_result.fee_rate.GetFeePerK() <= 0\n+ || (control.m_feerate && min_fee_rate_result.fee_rate > *control.m_feerate)\n+ || (min_fee_rate_result.fee_reason == FeeReason::FALLBACK && !wallet->m_allow_fallback_fee)) {\n return std::nullopt;\n }\n \n@@ -379,11 +383,11 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n const auto inputs = control.ListSelected();\n for (const auto& input : inputs) {\n const auto* source = wallet->GetWalletTx(input.hash);\n- if (!source || input.n >= source->tx->vout.size() || wallet->IsSpent(input)\n- || !wallet->IsMine(source->tx->vout[input.n])) {\n+ if (!source || input.n >= source->GetTx()->vout.size() || wallet->IsSpent(input)\n+ || !wallet->IsMine(source->GetTx()->vout[input.n])) {\n return std::nullopt;\n }\n- input_amount += source->tx->vout[input.n].nValue;\n+ input_amount += source->GetTx()->vout[input.n].nValue;\n tx.vin.emplace_back(input);\n }\n \n@@ -394,10 +398,10 @@ std::optional<SendFeePreview> EstimateInsufficientSelectedInputsFee(\n }\n const auto size = wallet::CalculateMaximumSignedTxSize(CTransaction(tx), wallet, &control);\n if (size.vsize < 0) return std::nullopt;\n- const CAmount fee = rate.GetFee(size.vsize)\n- + wallet->chain().calculateCombinedBumpFee(inputs, rate).value_or(0);\n+ const CAmount fee = min_fee_rate_result.fee_rate.GetFee(size.vsize)\n+ + wallet->chain().calculateCombinedBumpFee(inputs, min_fee_rate_result.fee_rate).value_or(0);\n if (!AmountPlusFeeExceedsBalance(send_amount, fee, input_amount)) return std::nullopt;\n- return SendFeePreview{fee, static_cast<int>(inputs.size()), rate.GetFeePerK(), std::nullopt, false};\n+ return SendFeePreview{fee, static_cast<int>(inputs.size()), min_fee_rate_result.fee_rate.GetFeePerK(), std::nullopt, false};\n }\n \n std::optional<SendFeePreview> TryPreviewFee(interfaces::Wallet& wallet,\n@@ -601,6 +605,17 @@ WatchOnlyDescriptor MakeWatchOnlyDescriptor(const SingleKeyDescriptor& receive,\n return {.text = text, .parts = parts};\n }\n \n+constexpr std::array DESCRIPTOR_EXPORT_TYPES{OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY};\n+\n+std::optional<OutputType> SingleKeyOutputType(const QString& script)\n+{\n+ if (script == QLatin1String(\"tr(\")) return OutputType::BECH32M;\n+ if (script == QLatin1String(\"wpkh(\")) return OutputType::BECH32;\n+ if (script == QLatin1String(\"sh(wpkh(\")) return OutputType::P2SH_SEGWIT;\n+ if (script == QLatin1String(\"pkh(\")) return OutputType::LEGACY;\n+ return std::nullopt;\n+}\n+\n QString DescriptorScriptName(OutputType type)\n {\n switch (type) {\n@@ -653,6 +668,36 @@ QString LocalizedString(const bilingual_str& value)\n return QString::fromStdString(value.translated.empty() ? value.original : value.translated);\n }\n \n+// An existing file is only replaced once the new one is written next to it,\n+// so a failed write never loses it.\n+QString WriteWalletFile(const fs::path& destination, bool replace, const std::function<QString(const fs::path&)>& write)\n+{\n+ std::error_code error;\n+ if (!std::filesystem::exists(destination, error)) return write(destination);\n+ if (!replace) {\n+ //: %1 is the path of a file that is kept as it is.\n+ return QObject::tr(\"A file already exists at %1.\").arg(QString::fromStdString(fs::PathToString(destination)));\n+ }\n+\n+ fs::path partial{fs::PathFromString(fs::PathToString(destination) + \".partial\")};\n+ for (int suffix{1}; std::filesystem::exists(partial, error); ++suffix) {\n+ partial = fs::PathFromString(fs::PathToString(destination) + strprintf(\".partial%d\", suffix));\n+ }\n+ const QString write_error{write(partial)};\n+ if (!write_error.isEmpty()) {\n+ std::error_code ignored;\n+ fs::remove(partial, ignored);\n+ return write_error;\n+ }\n+ fs::rename(partial, destination, error);\n+ if (error) {\n+ std::error_code ignored;\n+ fs::remove(partial, ignored);\n+ return QObject::tr(\"The existing file could not be replaced: %1\").arg(QString::fromStdString(error.message()));\n+ }\n+ return {};\n+}\n+\n QString OutputTypeId(OutputType type)\n {\n return QString::fromStdString(FormatOutputType(type));\n@@ -818,7 +863,8 @@ void WalletQmlModel::beginShutdown(bool remove_wallet)\n if (m_transaction_activity_model) m_transaction_activity_model->stop();\n if (m_fee_estimation_timer) m_fee_estimation_timer->stop();\n auto handlers = std::make_tuple(std::move(m_handler_status_changed), std::move(m_handler_address_list_changed),\n- std::move(m_handler_transaction_changed), std::move(m_handler_unload));\n+ std::move(m_handler_transaction_changed), std::move(m_handler_unload),\n+ std::move(m_handler_can_get_addresses_changed));\n if (m_bump_transaction_model) m_bump_transaction_model->detachWallet();\n if (m_imported_psbt_model) m_imported_psbt_model->detachWallet();\n auto wallet = std::move(m_wallet);\n@@ -1186,7 +1232,7 @@ bool WalletQmlModel::changeWalletPassphrase(const QString& old_passphrase, const\n return true;\n }\n \n-bool WalletQmlModel::backupWallet(const QString& path)\n+bool WalletQmlModel::backupWallet(const QString& path, bool replace)\n {\n clearSettingsError();\n if (!m_wallet) {\n@@ -1202,8 +1248,11 @@ bool WalletQmlModel::backupWallet(const QString& path)\n return false;\n }\n \n- if (!m_wallet->backupWallet(path.toStdString())) {\n- setSettingsError(tr(\"The wallet could not be backed up.\"));\n+ const QString error{WriteWalletFile(QmlDataDir::QStringToPath(PsbtQmlModel::LocalFilePath(path)), replace, [this](const fs::path& destination) {\n+ return m_wallet->backupWallet(fs::PathToString(destination)) ? QString{} : tr(\"The wallet could not be backed up.\");\n+ })};\n+ if (!error.isEmpty()) {\n+ setSettingsError(error);\n return false;\n }\n \n@@ -1290,29 +1339,76 @@ QString WalletQmlModel::receiveAddressTypeLabel(const QString& address_type) con\n return {};\n }\n \n-QVariantList WalletQmlModel::watchOnlyExports() const\n+bool WalletQmlModel::canShowDescriptors() const\n+{\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return false;\n+\n+ // Keypool and transaction notifications mostly leave the descriptors as\n+ // they were, so rebuild the lists only once one is added, activated or used.\n+ std::vector<std::pair<uint256, bool>> state;\n+ {\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n+ for (const bool internal : {false, true}) {\n+ const wallet::ScriptPubKeyMan* spk_man{raw_wallet->GetScriptPubKeyMan(type, internal)};\n+ state.emplace_back(spk_man ? spk_man->GetID() : uint256{}, true);\n+ }\n+ }\n+ const auto active_end{state.size()};\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ const auto* desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(spk_man);\n+ if (!desc_man || raw_wallet->IsActiveScriptPubKeyMan(*desc_man)) continue;\n+ LOCK(desc_man->cs_desc_man);\n+ state.emplace_back(desc_man->GetID(), desc_man->GetWalletDescriptor().GetNext() > 0);\n+ }\n+ std::sort(state.begin() + active_end, state.end());\n+ }\n+ if (state != m_descriptor_state) {\n+ m_can_show_descriptors = !descriptorExports().isEmpty() || !inactiveDescriptorExports().isEmpty();\n+ m_descriptor_state = std::move(state);\n+ }\n+ return m_can_show_descriptors;\n+}\n+\n+QVariantList WalletQmlModel::descriptorExports() const\n {\n const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n if (!raw_wallet) return {};\n \n QVariantList exports;\n LOCK(raw_wallet->cs_wallet);\n- for (const OutputType type : {OutputType::BECH32M, OutputType::BECH32, OutputType::P2SH_SEGWIT, OutputType::LEGACY}) {\n+ for (const OutputType type : DESCRIPTOR_EXPORT_TYPES) {\n const auto receive = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/false));\n if (!receive) continue;\n- const auto change = ParseSingleKeyDescriptor(raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true));\n+ const wallet::ScriptPubKeyMan* change_man{raw_wallet->GetScriptPubKeyMan(type, /*internal=*/true)};\n+ const auto change = ParseSingleKeyDescriptor(change_man);\n+ // A change chain in another form is listed as it is, and no single key covers it.\n+ const bool change_unreadable{change_man && !change};\n QVariantMap item;\n item.insert(QStringLiteral(\"id\"), OutputTypeId(type));\n item.insert(QStringLiteral(\"label\"), OutputTypeLabel(type));\n item.insert(QStringLiteral(\"description\"), OutputTypeDescription(type));\n- const WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ WatchOnlyDescriptor descriptor{MakeWatchOnlyDescriptor(*receive, change)};\n+ if (change_unreadable) {\n+ std::string change_text;\n+ const auto* change_desc_man = dynamic_cast<const wallet::DescriptorScriptPubKeyMan*>(change_man);\n+ if (change_desc_man && !change_desc_man->GetDescriptorString(change_text, /*priv=*/false)) change_text.clear();\n+ descriptor = {.text = change_text.empty() ? receive->descriptor\n+ : receive->descriptor + QLatin1Char('\\n') + QString::fromStdString(change_text),\n+ .parts = {}};\n+ }\n item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptName(type));\n item.insert(QStringLiteral(\"descriptor\"), descriptor.text);\n item.insert(QStringLiteral(\"descriptorParts\"), descriptor.parts);\n item.insert(QStringLiteral(\"receiveChain\"), receive->branch.mid(1));\n item.insert(QStringLiteral(\"changeChain\"), change ? change->branch.mid(1) : QString{});\n+ item.insert(QStringLiteral(\"coversChange\"), change.has_value() || descriptor.text.contains(QLatin1Char('\\n')));\n item.insert(QStringLiteral(\"xpub\"), receive->xpub);\n- item.insert(QStringLiteral(\"extendedKey\"), Slip132ExtendedKey(receive->xpub, type));\n+ // A bare key implies /0/* and /1/*, so any other layout needs the descriptor.\n+ const bool key_covers_both{!change_unreadable && receive->branch == QLatin1String(\"/0\") &&\n+ change && !descriptor.parts.isEmpty() && change->branch == QLatin1String(\"/1\")};\n+ item.insert(QStringLiteral(\"extendedKey\"), key_covers_both ? Slip132ExtendedKey(receive->xpub, type) : QString{});\n item.insert(QStringLiteral(\"fingerprint\"), receive->fingerprint);\n item.insert(QStringLiteral(\"derivationPath\"), receive->derivation_path);\n exports.append(item);\n@@ -1320,14 +1416,186 @@ QVariantList WalletQmlModel::watchOnlyExports() const\n return exports;\n }\n \n-QString WalletQmlModel::saveWatchOnlyExport(const QString& path, const QString& contents) const\n+QVariantList WalletQmlModel::inactiveDescriptorExports() const\n {\n- QSaveFile file(PsbtQmlModel::LocalFilePath(path));\n- const QByteArray data{(contents + QLatin1Char('\\n')).toUtf8()};\n- if (!file.open(QIODevice::WriteOnly) || file.write(data) != data.size() || !file.commit()) {\n- return tr(\"Could not save the export: %1\").arg(file.errorString());\n+ const wallet::CWallet* raw_wallet = m_wallet ? m_wallet->wallet() : nullptr;\n+ if (!raw_wallet) return {};\n+\n+ struct Inactive {\n+ SingleKeyDescriptor descriptor;\n+ OutputType type;\n+ bool used;\n+ };\n+ std::vector<Inactive> found;\n+ LOCK(raw_wallet->cs_wallet);\n+ for (const wallet::ScriptPubKeyMan* spk_man : raw_wallet->GetAllScriptPubKeyMans()) {\n+ if (raw_wallet->IsActiveScriptPubKeyMan(*spk_man)) continue;\n+ const auto descriptor = ParseSingleKeyDescriptor(spk_man);\n+ const auto type = descriptor ? SingleKeyOutputType(descriptor->script) : std::nullopt;\n+ if (!type) continue;\n+ const auto& desc_man = static_cast<const wallet::DescriptorScriptPubKeyMan&>(*spk_man);\n+ LOCK(desc_man.cs_desc_man);\n+ found.push_back({*descriptor, *type, desc_man.GetWalletDescriptor().GetNext() > 0});\n+ }\n+ std::ranges::sort(found, {}, [](const Inactive& item) {\n+ return std::tuple{std::ranges::find(DESCRIPTOR_EXPORT_TYPES, item.type) - DESCRIPTOR_EXPORT_TYPES.begin(),\n+ item.descriptor.origin, item.descriptor.xpub, item.descriptor.branch};\n+ });\n+\n+ QVariantList exports;\n+ const auto append = [&](const Inactive& receive, const std::optional<SingleKeyDescriptor>& change) {\n+ QVariantMap item;\n+ item.insert(QStringLiteral(\"id\"), OutputTypeId(receive.type));\n+ item.insert(QStringLiteral(\"label\"), OutputTypeLabel(receive.type));\n+ item.insert(QStringLiteral(\"scriptName\"), DescriptorScriptNa\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · a8f185199ace..780a6a245a3c 2026-11-25T10:41:24Z · gpt-6-luna |
| gui#1057 | “Complete watch-only wallet” export omits inactive descriptorsqml/models/walletqmlmodel.cpp | addressed | AssessmentThe new head retains and exports used, supported inactive descriptors, and the functional regression test verifies that an address funded before encryption remains covered by the post-encryption watch-only export. `inactiveWatchOnlyExports()` enumerates `GetAllScriptPubKeyMans()` and collects used inactive descriptors; the complete export payload combines active and inactive descriptors. The functional test imports that payload and verifies the old address is owned and balances match. Source report · a8f185199ace..a0908d244531 2026-11-05T22:50:24Z · gpt-6-luna |
| gui#895 | New IconButton tooltip API has no production userqml/controls/IconButton.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f01fc67844e5..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#895 | Export dialog title and suggested filename are untestedqml/pages/wallet/ActivityListPage.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f01fc67844e5..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#895 | Export dialog is reset to the home folder on every openqml/pages/wallet/ActivityListPage.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f01fc67844e5..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#895 | Raw home paths produce incorrect Activity export URLsqml/pages/wallet/ActivityListPage.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f01fc67844e5..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#895 | HoverTooltip bypasses the existing hover delay and transitionsqml/controls/HoverTooltip.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f01fc67844e5..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#1050 | Selecting Custom after Default fails to restore the remembered directoryqml/components/StorageLocations.qml | addressed | AssessmentThe Custom handler no longer pre-validates the remembered directory. It clears the local error, calls selectCustomDataDir directly, and displays an error only if that submission immediately fails, allowing selection to start the asynchronous preview as requested. StorageLocations.qml lines 84–90 now call selectCustomDataDir(root.settingsModel.customDataDir) directly and handle a false return. The test mock’s validator now returns the not-checked error for a path other than the active directory, and the test verifies that condition before clicking Custom and confirming the remembered directory becomes selected. Source report · 5ce9a489159e..f68f5bf24c50 2026-11-12T03:03:39Z · gpt-6-luna |
| gui#933 | Search constructs a seven-role map for every scanned rowqml/components/MonospaceOutputView.qml | unclear | AssessmentThe new-head source for MonospaceOutputView.qml is unavailable, and the truncated deletion diff does not show the replacement _plainTextOf implementation. Although the model gained plainTextAt(), the supplied evidence does not establish that the search scan uses it instead of constructing a role map. path_diff: qml/components/MonospaceOutputView.qml [
{
"evidence_id": "83d38727aeb7486395f28ca0fb48ccb5",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/components/MonospaceOutputView.qml",
"source_generation": 2,
"source_job_id": 2159,
"text": "diff --git a/qml/components/MonospaceOutputView.qml b/qml/components/MonospaceOutputView.qml\ndeleted file mode 100644\nindex 30bb8e9a..00000000\n--- a/qml/components/MonospaceOutputView.qml\n+++ /dev/null\n@@ -1,853 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-import \"../controls\"\n-\n-// MonospaceOutputView — a scrollable monospace text display backed by a\n-// list model.\n-//\n-// Architecture: ListView, one model row per line of output. Callers must feed\n-// it one line per row: a row holding a whole multi-line document defeats\n-// virtualization, since the view still has to lay that document out in full to\n-// know how tall the row is.\n-//\n-// The public model property is named \"listModel\" (not \"model\") to avoid\n-// shadowing the delegate's implicit \"model\" context property.\n-//\n-// Selection belongs to the view, not to the per-row TextEdits, so it can span\n-// rows: a mouse layer over the list tracks it as {row, pos} endpoints and each\n-// delegate's TextEdit only paints its own slice. On touch devices the TextEdits\n-// keep their own per-row selection and the list flicks as usual.\n-//\n-// Supports two optional side columns around the main content column:\n-// Console: [timestamp] | [content]\n-// Debug log: [line#] | [content] | [relative time]\n-\n-Item {\n- id: root\n-\n- Accessible.role: Accessible.List\n- Accessible.name: accessibleName\n-\n- // ── Model ────────────────────────────────────────────────────────────\n-\n- property var listModel: null\n- property string contentRole: \"content\"\n- // Role holding the plain-text rendering of contentRole, if the model has\n- // one. Search offsets are in the rendered document's coordinates, so\n- // without it the view has to strip the markup itself (see _plainTextOf).\n- property string plainContentRole: \"\"\n- property string leftColumnRole: \"\"\n- property string rightColumnRole: \"\"\n- property string categoryRole: \"\"\n- // Role whose value is shared by the rows of one entry (e.g. one RPC reply).\n- // Without it every row is an entry of its own.\n- property string entryRole: \"\"\n-\n- // ── Style ────────────────────────────────────────────────────────────\n-\n- property int fontPixelSize: 12\n- property string fontFamily: \"monospace\"\n- property string fontStyleName: \"\"\n- property int textLineHeight: 0\n- property int contentTextFormat: Text.PlainText\n- property color contentColor: Theme.color.neutral9\n- property color leftColumnColor: Theme.color.neutral5\n- property color rightColumnColor: Theme.color.neutral5\n- property int requestCategory: 0\n- property int replyCategory: 1\n- property int errorCategory: 2\n- property color requestContentColor: contentColor\n- property color replyContentColor: contentColor\n- property color errorContentColor: contentColor\n- property color requestLeftColumnColor: leftColumnColor\n- property color replyLeftColumnColor: leftColumnColor\n- property color errorLeftColumnColor: leftColumnColor\n- property color selectionColor: Theme.color.orange\n- property color selectedTextColor: Theme.color.white\n- property color hoverColor: Theme.color.neutral2\n- property string searchText: \"\"\n- readonly property int searchResultCount: _searchMatches.length\n- property int currentSearchResultIndex: -1\n- property var _searchMatches: []\n- // The match to highlight, as {row, start, end}, or null. Always assigned a\n- // fresh object so delegates see a change even when two matches share a row.\n- property var _currentMatch: null\n- property bool _resetSearchOnRefresh: false\n-\n- // ── Selection and hover ──────────────────────────────────────────────\n-\n- // Shown at the top-right of the hovered entry; it can read hoveredRow.\n- property Component hoverActions: null\n- readonly property int hoveredRow: _hoveredRow\n- readonly property var hoveredEntry: _hoverBounds ? _hoverBounds.entry : undefined\n- readonly property bool hasSelection: _selection !== null\n- // Endpoints as {row, pos}; the anchor stays put while the focus follows\n- // the pointer, so the selection can run in either direction.\n- property var _selAnchor: null\n- property var _selFocus: null\n- readonly property var _selection: root._normalizedSelection(_selAnchor, _selFocus)\n- // Row last clicked, which Select All expands to its whole entry.\n- property int _activeRow: -1\n- property int _hoveredRow: -1\n- // Rows of the hovered entry as {entry, first, last}, found once per entry\n- // rather than on every scroll step under a resting pointer.\n- property var _hoverBounds: null\n- readonly property var _hoverSpan: root._spanOf(_hoverBounds, listView.contentY, listView.contentHeight)\n- readonly property bool _pointerSelection: AppMode.isDesktop\n-\n- // ── Layout metrics ───────────────────────────────────────────────────\n-\n- property int horizontalPadding: 16\n- property int topPadding: 16\n- property int bottomPadding: 16\n- property int rowSpacing: 2\n- property int columnSpacing: 8\n- property int leftColumnWidth: 0\n- property int rightColumnWidth: 0\n-\n- // ── Accessibility ────────────────────────────────────────────────────\n-\n- property string accessibleName: \"\"\n-\n- // ── Scroll behaviour ─────────────────────────────────────────────────\n-\n- property bool autoScrollToBottom: true\n- // Cleared when the user scrolls away from the bottom, so a relayout (font\n- // or width change) only re-pins the view if it was pinned before.\n- property bool _followingTail: true\n-\n- // ── Header ───────────────────────────────────────────────────────────\n-\n- property Component header: null\n-\n- // ── Column-width samples ─────────────────────────────────────────────\n-\n- property string leftColumnSample: \"[00:00:00]\"\n- property string rightColumnSample: \"99 hr ago\"\n-\n- // ── Read-only scroll state ────────────────────────────────────────────\n-\n- readonly property bool atBottom: listView.atYEnd\n- readonly property bool atTop: listView.atYBeginning\n- readonly property real contentY: listView.contentY\n- readonly property int count: listView.count\n-\n- // ── Methods ──────────────────────────────────────────────────────────\n-\n- // positionViewAt{End,Beginning}() stop at the last/first row and leave the\n- // margins out of view, so finish the job by hand. The position call still\n- // has to happen first: it creates the end delegates that make contentHeight\n- // exact.\n- function scrollToBottom() {\n- listView.positionViewAtEnd()\n- listView.contentY = Math.max(root._minContentY(), root._maxContentY())\n- }\n- function scrollToTop() {\n- listView.positionViewAtBeginning()\n- listView.contentY = root._minContentY()\n- }\n-\n- function _minContentY() {\n- return listView.originY - listView.topMargin\n- }\n- function _maxContentY() {\n- return listView.originY + listView.contentHeight + listView.bottomMargin - listView.height\n- }\n-\n- function roleValueAt(row, role) {\n- if (!root.listModel || row < 0 || row >= listView.count) return undefined\n- const data = root.listModel.get(row)\n- return data ? data[role] : undefined\n- }\n-\n- function _entryAt(row) {\n- return root.entryRole !== \"\" ? root.roleValueAt(row, root.entryRole) : row\n- }\n-\n- // An entry's rows are contiguous, so gallop out from `row` and bisect the\n- // boundary: O(log n) lookups even for a reply tens of thousands of lines long.\n- function _entryBounds(row) {\n- if (root.entryRole === \"\") return { first: row, last: row }\n- const entry = root._entryAt(row)\n- const inEntry = function(r) { return root._entryAt(r) === entry }\n- const edge = function(direction, limit) {\n- let inside = row\n- let step = 1\n- while ((inside + direction * step - limit) * direction <= 0\n- && inEntry(inside + direction * step)) {\n- inside += direction * step\n- step *= 2\n- }\n- let outside = inside + direction * step\n- if ((outside - limit) * direction > 0) outside = limit + direction\n- while (Math.abs(outside - inside) > 1) {\n- const middle = Math.floor((inside + outside) / 2)\n- if (inEntry(middle)) inside = middle\n- else outside = middle\n- }\n- return inside\n- }\n- return { first: edge(-1, 0), last: edge(1, listView.count - 1) }\n- }\n-\n- function entryTextAt(row) {\n- if (row < 0 || row >= listView.count) return \"\"\n- const bounds = root._entryBounds(row)\n- const lines = []\n- for (let r = bounds.first; r <= bounds.last; ++r) lines.push(root._plainTextOf(r))\n- return lines.join(\"\\n\")\n- }\n-\n- function _normalizedSelection(anchor, focus) {\n- if (!anchor || !focus || (anchor.row === focus.row && anchor.pos === focus.pos)) return null\n- const forward = anchor.row < focus.row || (anchor.row === focus.row && anchor.pos < focus.pos)\n- const start = forward ? anchor : focus\n- const end = forward ? focus : anchor\n- return { startRow: start.row, startPos: start.pos, endRow: end.row, endPos: end.pos }\n- }\n-\n- // The slice of `row` inside `selection`, as {start, end}; end -1 means to\n- // the end of the row.\n- function _rangeInRow(row, selection) {\n- if (!selection || row < selection.startRow || row > selection.endRow) return null\n- return {\n- start: row === selection.startRow ? selection.startPos : 0,\n- end: row === selection.endRow ? selection.endPos : -1\n- }\n- }\n-\n- function _selectionContains(point) {\n- const selection = root._selection\n- if (!selection || point.row < selection.startRow || point.row > selection.endRow) return false\n- if (point.row === selection.startRow && point.pos < selection.startPos) return false\n- if (point.row === selection.endRow && point.pos > selection.endPos) return false\n- return true\n- }\n-\n- function selectRange(startRow, startPos, endRow, endPos) {\n- root._selAnchor = { row: startRow, pos: startPos }\n- root._selFocus = { row: endRow, pos: endPos }\n- }\n-\n- function selectEntryAt(row) {\n- if (row < 0 || row >= listView.count) return\n- const bounds = root._entryBounds(row)\n- root.selectRange(bounds.first, 0, bounds.last, root._plainTextOf(bounds.last).length)\n- }\n-\n- function selectAll() {\n- if (listView.count === 0) return\n- const last = listView.count - 1\n- root.selectRange(0, 0, last, root._plainTextOf(last).length)\n- }\n-\n- function clearSelection() {\n- root._selAnchor = null\n- root._selFocus = null\n- }\n-\n- function selectedText() {\n- const selection = root._selection\n- if (!selection) return \"\"\n- const lines = []\n- for (let row = selection.startRow; row <= selection.endRow; ++row) {\n- const text = root._plainTextOf(row)\n- const range = root._rangeInRow(row, selection)\n- lines.push(text.slice(range.start, range.end < 0 ? text.length : range.end))\n- }\n- return lines.join(\"\\n\")\n- }\n-\n- function copySelection() {\n- if (root.hasSelection) Clipboard.setText(root.selectedText())\n- }\n-\n- // The {row, pos} under a point in the view, clamped into the view so a\n- // drag past an edge still lands on the edge row.\n- function _hitTest(x, y) {\n- if (listView.count === 0) return null\n- const viewY = Math.max(0, Math.min(listView.height - 1, y))\n- const contentX = listView.width / 2\n- const contentY = viewY + listView.contentY\n- let row = listView.indexAt(contentX, contentY)\n- if (row < 0) {\n- const lastRow = listView.count - 1\n- const last = listView.itemAtIndex(lastRow)\n- if (last && contentY >= last.y)\n- return { row: lastRow, pos: root._plainTextOf(lastRow).length }\n- const first = listView.itemAtIndex(0)\n- if (first && contentY < first.y) return { row: 0, pos: 0 }\n- row = listView.indexAt(contentX, contentY + root.rowSpacing)\n- if (row < 0) return null\n- return { row: row, pos: 0 }\n- }\n- const item = listView.itemAtIndex(row)\n- if (!item) return null\n- const local = item.contentEditor.mapFromItem(pointerArea, x, viewY)\n- return { row: row, pos: item.contentEditor.positionAt(local.x, local.y) }\n- }\n-\n- // Words are runs of anything but whitespace and JSON punctuation, so a\n- // double-click on a quoted hash or address takes it without the quotes.\n- function _selectWordAt(point) {\n- const text = root._plainTextOf(point.row)\n- const isWordChar = function(c) { return !/[\\s\"',:{}\\[\\]()]/.test(c) }\n- let start = Math.min(point.pos, text.length)\n- let end = start\n- if (start < text.length && isWordChar(text[start])) {\n- while (start > 0 && isWordChar(text[start - 1])) --start\n- while (end < text.length && isWordChar(text[end])) ++end\n- } else if (start > 0 && isWordChar(text[start - 1])) {\n- while (start > 0 && isWordChar(text[start - 1])) --start\n- } else {\n- end = Math.min(start + 1, text.length)\n- }\n- root.selectRange(point.row, start, point.row, end)\n- }\n-\n- function _extendSelectionTo(x, y) {\n- const hit = root._hitTest(x, y)\n- if (hit && root._selAnchor) root._selFocus = hit\n- }\n-\n- function _rowAtY(y) {\n- return listView.indexAt(listView.width / 2, y + listView.contentY)\n- }\n-\n- function _updateHover() {\n- if (actionsHover.hovered) return\n- const row = pointerArea.containsMouse && !pointerArea.pressed\n- ? root._rowAtY(pointerArea.mouseY) : -1\n- root._hoveredRow = row\n- const bounds = root._hoverBounds\n- if (row < 0) {\n- root._hoverBounds = null\n- } else if (!bounds || row < bounds.first || row > bounds.last) {\n- const found = root._entryBounds(row)\n- root._hoverBounds = { entry: root._entryAt(row), first: found.first, last: found.last }\n- }\n- }\n-\n- // Content-y extent of the hovered entry. An end row without a delegate is\n- // beyond the cache buffer, so the extent just runs past that edge of the view.\n- function _spanOf(bounds, contentY, contentHeight) {\n- if (!bounds) return null\n- const first = listView.itemAtIndex(bounds.first)\n- const last = listView.itemAtIndex(bounds.last)\n- return {\n- top: first ? first.y : contentY - 1,\n- bottom: last ? last.y + last.height : contentY + listView.height + 1\n- }\n- }\n-\n- function scheduleSearchRefresh(resetCurrent) {\n- root._resetSearchOnRefresh = root._resetSearchOnRefresh || resetCurrent\n- searchRefreshTimer.restart()\n- }\n-\n- // Plain text of row `index`, in the coordinates the delegate's TextEdit\n- // reports. Falls back to undoing the markup when the model has no plain role.\n- function _plainTextOf(index) {\n- if (!root.listModel || typeof root.listModel.get !== \"function\") return \"\"\n- const data = root.listModel.get(index)\n- if (!data) return \"\"\n- if (root.plainContentRole !== \"\" && data[root.plainContentRole] !== undefined)\n- return String(data[root.plainContentRole])\n- const markup = String(data[root.contentRole] ?? \"\")\n- if (root.contentTextFormat === Text.PlainText) return markup\n- return markup.replace(/<br\\s*\\/?>/gi, \"\\n\")\n- .replace(/<[^>]*>/g, \"\")\n- .replace(/ /g, \" \")\n- .replace(/</g, \"<\")\n- .replace(/>/g, \">\")\n- .replace(/"/g, \"\\\"\")\n- .replace(/'/g, \"'\")\n- .replace(/&/g, \"&\")\n- }\n-\n- function rebuildSearchMatches(resetCurrent) {\n- const matches = []\n- if (root.searchText.length > 0) {\n- const pattern = root.searchText.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n- const expression = new RegExp(pattern, \"gi\")\n- // Scan model data, not delegates: off-screen rows have none.\n- for (let row = 0; row < listView.count; ++row) {\n- const plainText = root._plainTextOf(row)\n- if (plainText.length === 0) continue\n- expression.lastIndex = 0\n- let match\n- while ((match = expression.exec(plainText)) !== null) {\n- matches.push({\n- row: row,\n- start: match.index,\n- end: match.index + match[0].length\n- })\n- }\n- }\n- }\n-\n- root._searchMatches = matches\n- if (matches.length === 0) {\n- root.currentSearchResultIndex = -1\n- } else if (resetCurrent || root.currentSearchResultIndex < 0) {\n- root.currentSearchResultIndex = 0\n- } else {\n- root.currentSearchResultIndex = Math.min(root.currentSearchResultIndex,\n- matches.length - 1)\n- }\n- root.applyCurrentSearchMatch()\n- }\n-\n- function applyCurrentSearchMatch() {\n- if (root.currentSearchResultIndex < 0\n- || root.currentSearchResultIndex >= root._searchMatches.length) {\n- root._currentMatch = null\n- return\n- }\n-\n- const match = root._searchMatches[root.currentSearchResultIndex]\n- root._currentMatch = { row: match.row, start: match.start, end: match.end }\n- // Bring the row into existence before asking it where the match sits.\n- listView.positionViewAtIndex(match.row, ListView.Contain)\n- root._scrollToCurrentMatchRect()\n- }\n-\n- // Scroll to the occurrence itself, not merely its containing row: a row\n- // wrapped over several visual lines can hold the match well below its top.\n- function _scrollToCurrentMatchRect() {\n- if (!root._currentMatch) return\n- const item = listView.itemAtIndex(root._currentMatch.row)\n- if (!item || !item.contentEditor) return\n- const editor = item.contentEditor\n- const startRect = editor.positionToRectang\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 2f8f5613af9f..1e7d1a780b25 2026-11-21T03:17:11Z · gpt-6-luna |
| gui#933 | The line cap does not enforce the stated text-size boundqml/models/rpcconsolemodel.h | addressed | AssessmentThe misleading claim that the row cap bounds retained text to about 12 MB is removed. The new header says it counts lines and one line can hold a long reply, accurately describing the limitation rather than claiming an enforced size bound. path_diff: qml/models/rpcconsolemodel.h; new_source: qml/models/rpcconsolemodel.h [
{
"evidence_id": "ed47def6dd374facb9c0933150ec16b5",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/models/rpcconsolemodel.h",
"source_generation": 2,
"source_job_id": 2159,
"text": "diff --git a/qml/models/rpcconsolemodel.h b/qml/models/rpcconsolemodel.h\nindex fa67a970..0a5b2257 100644\n--- a/qml/models/rpcconsolemodel.h\n+++ b/qml/models/rpcconsolemodel.h\n@@ -26,7 +26,8 @@ class RpcConsoleWorker;\n * Owned by RpcConsoleModel and exposed to QML via the outputModel property;\n * the MonospaceOutputView in CommandConsole.qml binds to it directly. One row\n * holds one *line* of output, never a whole reply, so the view can virtualize.\n- * Rows are capped at kMaxRows — the oldest are dropped when the cap is hit.\n+ * Rows are capped at kMaxRows; the oldest entries are dropped whole when the\n+ * cap is hit.\n *\n * Each row carries the content twice: contentHtml for rendering and\n * contentPlain for search offsets, accessibility and copying. Rows appended in\n@@ -50,7 +51,7 @@ public:\n RedactedRole,\n };\n \n- /** Lines, not replies: bounds the buffer at ~12 MB of text. */\n+ /** Counts lines, not characters: one line can hold a whole long reply. */\n static constexpr int kMaxRows = 50000;\n \n struct OutputLine {\n@@ -66,6 +67,8 @@ public:\n \n /** Role values of @p row keyed by role name, as QML's ListModel::get(). */\n Q_INVOKABLE QVariantMap get(int row) const;\n+ /** The plainContent role of @p row, without building the whole get() map. */\n+ Q_INVOKABLE QString plainTextAt(int row) const;\n \n /** Append a block of lines as one batch; only its first row is stamped. */\n void appendLines(const QString& timestamp, const QVector<OutputLine>& lines, int category,\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 172,
"evidence_id": "b73a8d37db0c47e7b66e4f231ed2e118",
"finding_id": "finding:6",
"kind": "new_source",
"line": 23,
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/models/rpcconsolemodel.h",
"revision": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"source_generation": 2,
"source_job_id": 2159,
"text": "/**\n * List model exposing the console output rows.\n *\n * Owned by RpcConsoleModel and exposed to QML via the outputModel property;\n * the MonospaceOutputView in CommandConsole.qml binds to it directly. One row\n * holds one *line* of output, never a whole reply, so the view can virtualize.\n * Rows are capped at kMaxRows; the oldest entries are dropped whole when the\n * cap is hit.\n *\n * Each row carries the content twice: contentHtml for rendering and\n * contentPlain for search offsets, accessibility and copying. Rows appended in\n * one batch share an entry id, so a whole reply can be selected and copied.\n * The rows echoing a submitted command also carry it in the command role, and\n * whether secrets were redacted from it, so the view can offer to run it again.\n */\nclass RpcOutputListModel : public QAbstractListModel\n{\n Q_OBJECT\n Q_PROPERTY(int count READ rowCount NOTIFY countChanged)\n\npublic:\n enum Role {\n TimestampRole = Qt::UserRole + 1,\n ContentRole,\n PlainContentRole,\n CategoryRole,\n EntryRole,\n CommandRole,\n RedactedRole,\n };\n\n /** Counts lines, not characters: one line can hold a whole long reply. */\n static constexpr int kMaxRows = 50000;\n\n struct OutputLine {\n QString html;\n QString plain;\n };\n\n explicit RpcOutputListModel(QObject* parent = nullptr);\n\n int rowCount(const QModelIndex& parent = QModelIndex()) const override;\n QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;\n QHash<int, QByteArray> roleNames() const override;\n\n /** Role values of @p row keyed by role name, as QML's ListModel::get(). */\n Q_INVOKABLE QVariantMap get(int row) const;\n /** The plainContent role of @p row, without building the whole get() map. */\n Q_INVOKABLE QString plainTextAt(int row) const;\n\n /** Append a block of lines as one batch; only its first row is stamped. */\n void appendLines(const QString& timestamp, const QVector<OutputLine>& lines, int category,\n const QString& command = {}, bool redacted = false);\n void resetAll();\n\nQ_SIGNALS:\n void countChanged();\n\nprivate:\n struct Row {\n QString timestamp;\n QString contentHtml;\n QString contentPlain;\n int category;\n int entry;\n QString command;\n bool redacted;\n };\n QVector<Row> m_rows;\n int m_next_entry{0};\n};\n\n/**\n * Model for the RPC command console page.\n *\n * Exposes:\n * - availableCommands – sorted list of all RPC commands for autocomplete\n * - executing – true while an RPC call is in flight\n * - outputModel – list of output rows (timestamp + pre-formatted HTML)\n * - requestColor / replyColor / errorColor / keyColor –\n * palette used to render rows; QML writes these from Theme so the\n * colours update when the user toggles dark/light mode (already-\n * emitted rows keep their baked-in colours, which is intentional).\n *\n * Invokable from QML:\n * - submitCommand(command, walletName) → bool (false if rejected, e.g. empty or\n * refused while another command is executing)\n * - browseHistory(direction, currentText) → QString\n * - resetHistoryNavigation()\n * - clear()\n */\nclass RpcConsoleModel : public QObject\n{\n Q_OBJECT\n\n Q_PROPERTY(bool executing READ executing NOTIFY executingChanged)\n Q_PROPERTY(QStringList availableCommands READ availableCommands NOTIFY availableCommandsChanged)\n Q_PROPERTY(QAbstractListModel* outputModel READ outputModel CONSTANT)\n Q_PROPERTY(QColor requestColor MEMBER m_request_color)\n Q_PROPERTY(QColor replyColor MEMBER m_reply_color)\n Q_PROPERTY(QColor errorColor MEMBER m_error_color)\n Q_PROPERTY(QColor keyColor MEMBER m_key_color)\n\npublic:\n enum MessageCategory {\n CMD_REQUEST = 0,\n CMD_REPLY = 1,\n CMD_ERROR = 2\n };\n Q_ENUM(MessageCategory)\n\n explicit RpcConsoleModel(interfaces::Node& node, QObject* parent = nullptr);\n ~RpcConsoleModel();\n void beginShutdown();\n\n bool executing() const { return m_executing; }\n QStringList availableCommands() const { return m_available_commands; }\n QAbstractListModel* outputModel() { return &m_output_model; }\n\n Q_INVOKABLE bool submitCommand(const QString& command, const QString& wallet_name = {});\n\n /**\n * Navigate command history.\n * @param direction +1 = older entry, -1 = newer entry\n * @param currentText current input text (saved as pending on first call)\n * @return the history entry to display, or empty string if at newest end\n */\n Q_INVOKABLE QString browseHistory(int direction, const QString& currentText);\n\n /** Reset history navigation pointer (call when user starts typing a new command). */\n Q_INVOKABLE void resetHistoryNavigation();\n\n /** Clear the console output. */\n Q_INVOKABLE void clear();\n\npublic Q_SLOTS:\n void onNodeInitialized();\n\nQ_SIGNALS:\n void drained();\n void executingChanged();\n void availableCommandsChanged();\n\nprivate Q_SLOTS:\n void onResultReady(const QString& time, int category, const QString& rawText);\n\nprivate:\n void setExecuting(bool executing);\n void appendFormattedRow(const QString& time, int category, const QString& rawText,\n const QString& command = {}, bool redacted = false);",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 2f8f5613af9f..1e7d1a780b25 2026-11-21T03:17:11Z · gpt-6-luna |
| gui#933 | One-click replay does not identify its wallet targetqml/pages/node/CommandConsole.qml | still_present | AssessmentThe new-head runCommandAt still submits the stored command using root.walletName, and the supplied diff shows no changed replay labeling, confirmation, or original-wallet binding. The action therefore continues to target the current wallet without the requested explicit contract. path_diff: qml/pages/node/CommandConsole.qml; new_source: qml/pages/node/CommandConsole.qml [
{
"evidence_id": "52dc5687babe496cafed9897d24a3a3e",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/pages/node/CommandConsole.qml",
"source_generation": 2,
"source_job_id": 2159,
"text": "diff --git a/qml/pages/node/CommandConsole.qml b/qml/pages/node/CommandConsole.qml\nindex edd017c4..229b870b 100644\n--- a/qml/pages/node/CommandConsole.qml\n+++ b/qml/pages/node/CommandConsole.qml\n@@ -7,25 +7,24 @@ import QtQuick.Controls 2.15\n import QtQuick.Layouts 1.15\n import org.bitcoincore.qt 1.0\n import \"../../controls\"\n-import \"../../components\"\n \n Page {\n id: root\n objectName: \"commandConsole\"\n signal back()\n background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 16\n+ color: Theme.color.surface1\n+ radius: Theme.radius.card\n }\n clip: true\n \n // Theme-aware palette for model-generated inline spans (welcome links and\n // JSON keys). Row-level colours are applied by QML so the\n // output follows the design-system tokens.\n- readonly property color consoleRequestColor: Theme.color.blue\n+ readonly property color consoleRequestColor: Theme.color.infoText\n readonly property color consoleReplyColor: Theme.color.neutral9\n readonly property color consoleTimeColor: Theme.color.neutral7\n- readonly property color consoleKeyColor: Theme.dark ? \"#98C379\" : \"#3A7D2C\"\n+ readonly property color consoleKeyColor: Theme.color.syntaxKey\n readonly property int minimumOutputFontPixelSize: 10\n readonly property int maximumOutputFontPixelSize: 18\n property int outputFontPixelSize: Theme.text.caption.pixelSize\n@@ -46,14 +45,18 @@ Page {\n // child, the console is never destroyed on tab changes, and its autocomplete\n // Popup renders in the window overlay layer, so it is not hidden along with\n // the view. The embedder binds this to its tab's checked state; when the tab\n- // is left, dismiss the popup so it cannot linger over the newly selected tab.\n+ // is left, dismiss the popups so they cannot linger over the newly selected tab.\n property bool tabActive: true\n- onTabActiveChanged: if (!tabActive) autocompletePopup.close()\n+ onTabActiveChanged: {\n+ if (tabActive) return\n+ autocompletePopup.close()\n+ root.closeOutputMenu()\n+ }\n \n function _pushPalette() {\n rpcConsoleModel.requestColor = consoleRequestColor\n rpcConsoleModel.replyColor = consoleReplyColor\n- rpcConsoleModel.errorColor = Theme.color.red\n+ rpcConsoleModel.errorColor = Theme.color.dangerText\n rpcConsoleModel.keyColor = consoleKeyColor\n }\n // Focus the command input when the console becomes the active view, so the\n@@ -108,17 +111,10 @@ Page {\n \n header: NavigationBar2 {\n visible: root.showHeader\n- leftItem: NavButton {\n- objectName: \"consoleBackButton\"\n- iconSource: \"image://images/caret-left\"\n- text: qsTr(\"Back\")\n- onClicked: root.back()\n- }\n- centerItem: Header {\n- headerBold: true\n- headerSize: 18\n- header: qsTr(\"Console\")\n- }\n+ showBackButton: true\n+ backButtonObjectName: \"consoleBackButton\"\n+ onBackClicked: root.back()\n+ title: qsTr(\"Console\")\n TapHandler {\n grabPermissions: PointerHandler.TakeOverForbidden\n onTapped: inputField.focus = false\n@@ -148,18 +144,15 @@ Page {\n rightColumnRole: \"\"\n categoryRole: \"category\"\n fontPixelSize: root.outputFontPixelSize\n- fontFamily: Theme.text.monoFamily\n- fontStyleName: \"Regular\"\n textLineHeight: Math.round(root.outputFontPixelSize * 1.4)\n contentColor: Theme.color.neutral9\n leftColumnColor: root.consoleTimeColor\n requestContentColor: root.consoleRequestColor\n replyContentColor: root.consoleReplyColor\n- errorContentColor: Theme.color.red\n+ errorContentColor: Theme.color.dangerText\n requestLeftColumnColor: root.consoleRequestColor\n replyLeftColumnColor: root.consoleTimeColor\n errorLeftColumnColor: root.consoleTimeColor\n- selectionColor: Theme.color.orange\n accessibleName: qsTr(\"Console output\")\n autoScrollToBottom: true\n searchText: root.searchText\n@@ -317,7 +310,7 @@ Page {\n size: 24\n iconSize: 14\n iconSource: \"qrc:/icons/refresh\"\n- Accessible.name: qsTr(\"Run again\")\n+ accessibleName: qsTr(\"Run again\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: qsTr(\"Run again\")\n@@ -329,7 +322,7 @@ Page {\n size: 24\n iconSize: 14\n iconSource: \"qrc:/icons/edit\"\n- Accessible.name: qsTr(\"Edit command\")\n+ accessibleName: qsTr(\"Edit command\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: qsTr(\"Edit command\")\n@@ -351,8 +344,10 @@ Page {\n width: Math.min(inputField.width, 360)\n height: Math.min(autocompleteList.contentHeight + 2 * menuPadding, 228)\n minMenuWidth: 0\n- backgroundColor: Theme.color.neutral2\n+ backgroundColor: Theme.color.surface2\n focus: false\n+ // Modeless: the user keeps typing in the field while it is open.\n+ modal: false\n // Deliberately NOT CloseOnPressOutside: a real mouse press on the submit\n // button would otherwise close this popup (and clear filteredCommands)\n // before the button's onClicked fires, so the button could never act on\n@@ -406,10 +401,10 @@ Page {\n bottom: parent.bottom\n }\n height: 64\n- color: Theme.color.neutral1\n- radius: 16\n+ color: Theme.color.surface1\n+ radius: Theme.radius.card\n \n- Rectangle {\n+ Separator {\n id: inputDivider\n objectName: \"consoleInputDivider\"\n anchors {\n@@ -417,8 +412,6 @@ Page {\n left: parent.left\n right: parent.right\n }\n- height: 1\n- color: Theme.color.neutral2\n }\n \n RowLayout {\n@@ -436,7 +429,7 @@ Page {\n Icon {\n objectName: \"consolePromptIcon\"\n source: \"image://images/caret-right\"\n- color: Theme.color.orange\n+ color: Theme.color.accent\n size: 16\n Layout.preferredWidth: 16\n Layout.preferredHeight: 16\n@@ -448,21 +441,25 @@ Page {\n objectName: \"consoleInput\"\n Layout.fillWidth: true\n Layout.fillHeight: true\n- font.family: Theme.text.monoFamily\n- font.pixelSize: 13\n+ font: Theme.text.monoCaption.font\n color: Theme.color.neutral9\n placeholderText: qsTr(\"Enter command…\")\n- placeholderTextColor: Theme.color.neutral7\n+ placeholderTextColor: Theme.color.placeholder\n leftPadding: 12\n rightPadding: 12\n topPadding: 0\n bottomPadding: 0\n verticalAlignment: TextInput.AlignVCenter\n background: Rectangle {\n- color: Theme.color.neutral2\n- radius: 8\n- border.width: inputField.activeFocus ? 2 : 0\n- border.color: Theme.color.orange\n+ color: Theme.color.surface2\n+ radius: Theme.radius.field\n+\n+ FieldBorderRings {\n+ objectName: \"consoleInputFocusRing\"\n+ anchors.fill: parent\n+ visible: inputField.activeFocus\n+ cornerRadius: parent.radius\n+ }\n }\n \n // Enter accepts the highlighted autocomplete suggestion when the\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 305,
"evidence_id": "0e5a7151471444f4b4186c0ccf390a3f",
"finding_id": "finding:5",
"kind": "new_source",
"line": 156,
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/pages/node/CommandConsole.qml",
"revision": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"source_generation": 2,
"source_job_id": 2159,
"text": " accessibleName: qsTr(\"Console output\")\n autoScrollToBottom: true\n searchText: root.searchText\n horizontalPadding: 16\n topPadding: 16\n bottomPadding: 16\n // Rows are single lines, so this is line spacing, not entry spacing.\n rowSpacing: 0\n columnSpacing: 20\n leftColumnWidth: 60\n hoverActions: hoverActionsComponent\n onContextMenuRequested: (row, x, y) => root.openOutputMenu(row, x, y)\n }\n\n function commandAt(row) {\n return outputView.roleValueAt(row, \"command\") ?? \"\"\n }\n\n function canRunAgain(row) {\n return root.commandAt(row) !== \"\" && !outputView.roleValueAt(row, \"redacted\")\n && !rpcConsoleModel.executing\n }\n\n function runCommandAt(row) {\n if (root.canRunAgain(row)) rpcConsoleModel.submitCommand(root.commandAt(row), root.walletName)\n }\n\n // Like recalling it from history: the text is set without opening the\n // autocomplete menu, and the cursor goes to the end, not a selection.\n function editCommandAt(row) {\n const command = root.commandAt(row)\n if (command === \"\") return\n internal.navigatingHistory = true\n inputField.text = command\n internal.navigatingHistory = false\n inputField.forceActiveFocus()\n inputField.cursorPosition = command.length\n }\n\n function openOutputMenu(row, x, y) {\n outputMenu.row = row\n const position = outputView.mapToItem(root, x, y)\n outputMenu.x = Math.max(12, Math.min(position.x, root.width - outputMenu.width - 12))\n outputMenu.y = Math.max(12, Math.min(position.y, root.height - outputMenu.height - 12))\n outputMenu.open()\n }\n\n // Trimming old output shifts the rows, so the menu's row may now be\n // another command.\n Connections {\n target: rpcConsoleModel.outputModel\n function onRowsRemoved() { root.closeOutputMenu() }\n function onModelReset() { root.closeOutputMenu() }\n }\n\n function closeOutputMenu() {\n outputMenu.row = -1\n outputMenu.close()\n }\n\n ContextMenu {\n id: outputMenu\n objectName: \"consoleOutputMenu\"\n minMenuWidth: 200\n\n property int row: -1\n readonly property bool onRow: row >= 0\n readonly property bool onCommand: root.commandAt(row) !== \"\"\n\n ContextMenuButton {\n objectName: \"consoleMenuCopy\"\n text: qsTr(\"Copy\")\n enabled: outputView.hasSelection\n onTriggered: outputView.copySelection()\n }\n ContextMenuButton {\n objectName: \"consoleMenuCopyEntry\"\n visible: outputMenu.onRow\n text: outputMenu.onCommand ? qsTr(\"Copy command\") : qsTr(\"Copy output\")\n onTriggered: Clipboard.setText(outputView.entryTextAt(outputMenu.row))\n }\n ContextMenuButton {\n objectName: \"consoleMenuSelectEntry\"\n visible: outputMenu.onRow\n text: outputMenu.onCommand ? qsTr(\"Select command\") : qsTr(\"Select output\")\n onTriggered: outputView.selectEntryAt(outputMenu.row)\n }\n ContextMenuButton {\n objectName: \"consoleMenuSelectAll\"\n text: qsTr(\"Select all\")\n enabled: outputView.count > 0\n onTriggered: outputView.selectAll()\n }\n ContextMenuDivider {\n visible: outputMenu.onCommand\n }\n ContextMenuButton {\n objectName: \"consoleMenuRunAgain\"\n visible: outputMenu.onCommand\n text: qsTr(\"Run again\")\n enabled: root.canRunAgain(outputMenu.row)\n onTriggered: root.runCommandAt(outputMenu.row)\n }\n ContextMenuButton {\n objectName: \"consoleMenuEdit\"\n visible: outputMenu.onCommand\n text: qsTr(\"Edit command\")\n onTriggered: root.editCommandAt(outputMenu.row)\n }\n ContextMenuDivider { }\n ContextMenuButton {\n objectName: \"consoleMenuClear\"\n text: qsTr(\"Clear console\")\n role: ContextMenuButton.Destructive\n enabled: outputView.count > 0\n onTriggered: rpcConsoleModel.clear()\n }\n }\n\n Component {\n id: hoverActionsComponent\n\n Rectangle {\n id: hoverActions\n readonly property int row: outputView.hoveredRow\n readonly property bool onCommand: root.commandAt(row) !== \"\"\n\n implicitWidth: hoverActionsRow.implicitWidth + 4\n implicitHeight: hoverActionsRow.implicitHeight + 4\n radius: 6\n color: Theme.color.neutral1\n border.width: 1\n border.color: Theme.dark ? Theme.color.neutral2 : Theme.color.neutral3\n\n Row {\n id: hoverActionsRow\n anchors.centerIn: parent\n spacing: 2\n\n CopyButton {\n objectName: \"consoleHoverCopyButton\"\n displayMode: CopyButton.IconOnly\n iconSize: 14\n implicitHeight: 24\n copyText: hoverActions.onCommand ? qsTr(\"Copy command\") : qsTr(\"Copy output\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: text\n onCopyRequested: Clipboard.setText(outputView.entryTextAt(hoverActions.row))\n }",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 2f8f5613af9f..1e7d1a780b25 2026-11-21T03:17:11Z · gpt-6-luna |
| gui#933 | An oversized output block loses its timestampqml/models/rpcconsolemodel.cpp | addressed | AssessmentThe insertion loop now stamps the timestamp when i == skipped, which is the first retained line even when the oversized block has an omitted prefix. path_diff: qml/models/rpcconsolemodel.cpp; new_source: qml/models/rpcconsolemodel.cpp [
{
"evidence_id": "f84c8d3f2a9e42fab7ca1b3621a788f0",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/models/rpcconsolemodel.cpp",
"source_generation": 2,
"source_job_id": 2159,
"text": "diff --git a/qml/models/rpcconsolemodel.cpp b/qml/models/rpcconsolemodel.cpp\nindex 8108f12b..53f2210e 100644\n--- a/qml/models/rpcconsolemodel.cpp\n+++ b/qml/models/rpcconsolemodel.cpp\n@@ -75,6 +75,12 @@ QVariantMap RpcOutputListModel::get(int row) const\n };\n }\n \n+QString RpcOutputListModel::plainTextAt(int row) const\n+{\n+ if (row < 0 || row >= m_rows.size()) return {};\n+ return m_rows.at(row).contentPlain;\n+}\n+\n void RpcOutputListModel::appendLines(const QString& timestamp,\n const QVector<OutputLine>& lines,\n int category,\n@@ -88,7 +94,12 @@ void RpcOutputListModel::appendLines(const QString& timestamp,\n const int skipped = lines.size() - keep;\n \n if (m_rows.size() + keep > kMaxRows) {\n- const int to_remove = m_rows.size() + keep - kMaxRows;\n+ int to_remove = m_rows.size() + keep - kMaxRows;\n+ // Drop the rest of an entry the cut runs through, so no entry is left\n+ // without its first rows.\n+ while (to_remove < m_rows.size() && m_rows.at(to_remove).entry == m_rows.at(to_remove - 1).entry) {\n+ ++to_remove;\n+ }\n beginRemoveRows({}, 0, to_remove - 1);\n m_rows.remove(0, to_remove);\n endRemoveRows();\n@@ -100,7 +111,7 @@ void RpcOutputListModel::appendLines(const QString& timestamp,\n beginInsertRows({}, first, first + keep - 1);\n m_rows.reserve(first + keep);\n for (int i = skipped; i < lines.size(); ++i) {\n- m_rows.append(Row{i == 0 ? timestamp : QString{},\n+ m_rows.append(Row{i == skipped ? timestamp : QString{},\n lines.at(i).html, lines.at(i).plain, category, entry,\n command, redacted});\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 221,
"evidence_id": "147b9677281a4d0b865d491348eb8d5d",
"finding_id": "finding:4",
"kind": "new_source",
"line": 72,
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/models/rpcconsolemodel.cpp",
"revision": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"source_generation": 2,
"source_job_id": 2159,
"text": " {QStringLiteral(\"entry\"), r.entry},\n {QStringLiteral(\"command\"), r.command},\n {QStringLiteral(\"redacted\"), r.redacted},\n };\n}\n\nQString RpcOutputListModel::plainTextAt(int row) const\n{\n if (row < 0 || row >= m_rows.size()) return {};\n return m_rows.at(row).contentPlain;\n}\n\nvoid RpcOutputListModel::appendLines(const QString& timestamp,\n const QVector<OutputLine>& lines,\n int category,\n const QString& command,\n bool redacted)\n{\n if (lines.isEmpty()) return;\n\n // A single reply can exceed the cap on its own; keep only its tail.\n const int keep = std::min<int>(lines.size(), kMaxRows);\n const int skipped = lines.size() - keep;\n\n if (m_rows.size() + keep > kMaxRows) {\n int to_remove = m_rows.size() + keep - kMaxRows;\n // Drop the rest of an entry the cut runs through, so no entry is left\n // without its first rows.\n while (to_remove < m_rows.size() && m_rows.at(to_remove).entry == m_rows.at(to_remove - 1).entry) {\n ++to_remove;\n }\n beginRemoveRows({}, 0, to_remove - 1);\n m_rows.remove(0, to_remove);\n endRemoveRows();\n }\n\n // One insert signal for the whole block, not one per line.\n const int first = m_rows.size();\n const int entry = m_next_entry++;\n beginInsertRows({}, first, first + keep - 1);\n m_rows.reserve(first + keep);\n for (int i = skipped; i < lines.size(); ++i) {\n m_rows.append(Row{i == skipped ? timestamp : QString{},\n lines.at(i).html, lines.at(i).plain, category, entry,\n command, redacted});\n }\n endInsertRows();\n Q_EMIT countChanged();\n}\n\nvoid RpcOutputListModel::resetAll()\n{\n if (m_rows.isEmpty()) return;\n beginResetModel();\n m_rows.clear();\n endResetModel();\n Q_EMIT countChanged();\n}\n\n// ---------------------------------------------------------------------------\n// Reply formatting helpers\n// ---------------------------------------------------------------------------\n\nnamespace {\n\nusing OutputLine = RpcOutputListModel::OutputLine;\n\nbool IsCollapsible(QChar c) { return c.isSpace() && c != QChar::Nbsp; }\n\n/**\n * Accumulates output a line at a time, in two representations: HTML for the\n * delegate, and the plain text that HTML renders to. Recording the plain text\n * here beats deriving it later by stripping tags, which would have to reproduce\n * Qt's HTML-to-document mapping exactly for search offsets to line up.\n */\nclass LineSink\n{\npublic:\n /** Tags, which render to nothing. */\n void markup(const QString& html) { m_html += html; }\n\n /** Characters needing no escaping, e.g. JSON punctuation. */\n void raw(QLatin1String chars) { m_html += chars; m_plain += chars; }\n void raw(QChar c) { m_html += c; m_plain += c; }\n\n /**\n * Arbitrary text, escaped in the markup. The renderer collapses each run\n * of whitespace to one space, so all but the last of a run are emitted as\n * (the whole run at the start of a line, where it is indentation).\n */\n void text(const QString& t)\n {\n int i = 0;\n while (i < t.size()) {\n int j = i;\n if (IsCollapsible(t.at(i))) {\n while (j < t.size() && IsCollapsible(t.at(j))) ++j;\n const bool at_line_start = m_plain.isEmpty();\n indent(j - i - (at_line_start ? 0 : 1));\n if (!at_line_start) raw(QLatin1Char(' '));\n } else {\n while (j < t.size() && !IsCollapsible(t.at(j))) ++j;\n const QString chunk = t.mid(i, j - i);\n m_html += chunk.toHtmlEscaped();\n m_plain += QString{chunk}.replace(QChar::Nbsp, QLatin1Char(' '));\n }\n i = j;\n }\n }\n\n void indent(int count)\n {\n for (int i = 0; i < count; ++i) {\n m_html += QStringLiteral(\" \");\n m_plain += QLatin1Char(' ');\n }\n }\n\n void newLine()\n {\n m_lines.append(OutputLine{m_html, m_plain});\n m_html.clear();\n m_plain.clear();\n }\n\n QVector<OutputLine> take()\n {\n newLine();\n return std::move(m_lines);\n }\n\nprivate:\n QString m_html;\n QString m_plain;\n QVector<OutputLine> m_lines;\n};\n\nQVector<OutputLine> EscapeToLines(const QString& text)\n{\n LineSink out;\n const QStringList lines = text.split(QLatin1Char('\\n'));\n for (int i = 0; i < lines.size(); ++i) {\n out.text(lines.at(i));\n if (i + 1 < lines.size()) out.newLine();\n }\n return out.take();\n}\n\nvoid AppendValue(LineSink& out, const UniValue& v, int depth, const QString& key_color_hex);\n",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 2f8f5613af9f..1e7d1a780b25 2026-11-21T03:17:11Z · gpt-6-luna |
| gui#933 | Front trimming silently leaves partial output entriesqml/models/rpcconsolemodel.cpp | addressed | AssessmentEviction now advances the removal count through the remainder of the entry intersected by the cut, dropping that entire old entry instead of retaining a partial tail. path_diff: qml/models/rpcconsolemodel.cpp; new_source: qml/models/rpcconsolemodel.cpp [
{
"evidence_id": "65e19eb982af4ae3abfc22997c9e651b",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/models/rpcconsolemodel.cpp",
"source_generation": 2,
"source_job_id": 2159,
"text": "diff --git a/qml/models/rpcconsolemodel.cpp b/qml/models/rpcconsolemodel.cpp\nindex 8108f12b..53f2210e 100644\n--- a/qml/models/rpcconsolemodel.cpp\n+++ b/qml/models/rpcconsolemodel.cpp\n@@ -75,6 +75,12 @@ QVariantMap RpcOutputListModel::get(int row) const\n };\n }\n \n+QString RpcOutputListModel::plainTextAt(int row) const\n+{\n+ if (row < 0 || row >= m_rows.size()) return {};\n+ return m_rows.at(row).contentPlain;\n+}\n+\n void RpcOutputListModel::appendLines(const QString& timestamp,\n const QVector<OutputLine>& lines,\n int category,\n@@ -88,7 +94,12 @@ void RpcOutputListModel::appendLines(const QString& timestamp,\n const int skipped = lines.size() - keep;\n \n if (m_rows.size() + keep > kMaxRows) {\n- const int to_remove = m_rows.size() + keep - kMaxRows;\n+ int to_remove = m_rows.size() + keep - kMaxRows;\n+ // Drop the rest of an entry the cut runs through, so no entry is left\n+ // without its first rows.\n+ while (to_remove < m_rows.size() && m_rows.at(to_remove).entry == m_rows.at(to_remove - 1).entry) {\n+ ++to_remove;\n+ }\n beginRemoveRows({}, 0, to_remove - 1);\n m_rows.remove(0, to_remove);\n endRemoveRows();\n@@ -100,7 +111,7 @@ void RpcOutputListModel::appendLines(const QString& timestamp,\n beginInsertRows({}, first, first + keep - 1);\n m_rows.reserve(first + keep);\n for (int i = skipped; i < lines.size(); ++i) {\n- m_rows.append(Row{i == 0 ? timestamp : QString{},\n+ m_rows.append(Row{i == skipped ? timestamp : QString{},\n lines.at(i).html, lines.at(i).plain, category, entry,\n command, redacted});\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 209,
"evidence_id": "808d92078c124288a2cc25f7218c98d7",
"finding_id": "finding:3",
"kind": "new_source",
"line": 60,
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/models/rpcconsolemodel.cpp",
"revision": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"source_generation": 2,
"source_job_id": 2159,
"text": " };\n}\n\nQVariantMap RpcOutputListModel::get(int row) const\n{\n if (row < 0 || row >= m_rows.size()) return {};\n const Row& r = m_rows.at(row);\n return QVariantMap{\n {QStringLiteral(\"timestamp\"), r.timestamp},\n {QStringLiteral(\"content\"), r.contentHtml},\n {QStringLiteral(\"plainContent\"), r.contentPlain},\n {QStringLiteral(\"category\"), r.category},\n {QStringLiteral(\"entry\"), r.entry},\n {QStringLiteral(\"command\"), r.command},\n {QStringLiteral(\"redacted\"), r.redacted},\n };\n}\n\nQString RpcOutputListModel::plainTextAt(int row) const\n{\n if (row < 0 || row >= m_rows.size()) return {};\n return m_rows.at(row).contentPlain;\n}\n\nvoid RpcOutputListModel::appendLines(const QString& timestamp,\n const QVector<OutputLine>& lines,\n int category,\n const QString& command,\n bool redacted)\n{\n if (lines.isEmpty()) return;\n\n // A single reply can exceed the cap on its own; keep only its tail.\n const int keep = std::min<int>(lines.size(), kMaxRows);\n const int skipped = lines.size() - keep;\n\n if (m_rows.size() + keep > kMaxRows) {\n int to_remove = m_rows.size() + keep - kMaxRows;\n // Drop the rest of an entry the cut runs through, so no entry is left\n // without its first rows.\n while (to_remove < m_rows.size() && m_rows.at(to_remove).entry == m_rows.at(to_remove - 1).entry) {\n ++to_remove;\n }\n beginRemoveRows({}, 0, to_remove - 1);\n m_rows.remove(0, to_remove);\n endRemoveRows();\n }\n\n // One insert signal for the whole block, not one per line.\n const int first = m_rows.size();\n const int entry = m_next_entry++;\n beginInsertRows({}, first, first + keep - 1);\n m_rows.reserve(first + keep);\n for (int i = skipped; i < lines.size(); ++i) {\n m_rows.append(Row{i == skipped ? timestamp : QString{},\n lines.at(i).html, lines.at(i).plain, category, entry,\n command, redacted});\n }\n endInsertRows();\n Q_EMIT countChanged();\n}\n\nvoid RpcOutputListModel::resetAll()\n{\n if (m_rows.isEmpty()) return;\n beginResetModel();\n m_rows.clear();\n endResetModel();\n Q_EMIT countChanged();\n}\n\n// ---------------------------------------------------------------------------\n// Reply formatting helpers\n// ---------------------------------------------------------------------------\n\nnamespace {\n\nusing OutputLine = RpcOutputListModel::OutputLine;\n\nbool IsCollapsible(QChar c) { return c.isSpace() && c != QChar::Nbsp; }\n\n/**\n * Accumulates output a line at a time, in two representations: HTML for the\n * delegate, and the plain text that HTML renders to. Recording the plain text\n * here beats deriving it later by stripping tags, which would have to reproduce\n * Qt's HTML-to-document mapping exactly for search offsets to line up.\n */\nclass LineSink\n{\npublic:\n /** Tags, which render to nothing. */\n void markup(const QString& html) { m_html += html; }\n\n /** Characters needing no escaping, e.g. JSON punctuation. */\n void raw(QLatin1String chars) { m_html += chars; m_plain += chars; }\n void raw(QChar c) { m_html += c; m_plain += c; }\n\n /**\n * Arbitrary text, escaped in the markup. The renderer collapses each run\n * of whitespace to one space, so all but the last of a run are emitted as\n * (the whole run at the start of a line, where it is indentation).\n */\n void text(const QString& t)\n {\n int i = 0;\n while (i < t.size()) {\n int j = i;\n if (IsCollapsible(t.at(i))) {\n while (j < t.size() && IsCollapsible(t.at(j))) ++j;\n const bool at_line_start = m_plain.isEmpty();\n indent(j - i - (at_line_start ? 0 : 1));\n if (!at_line_start) raw(QLatin1Char(' '));\n } else {\n while (j < t.size() && !IsCollapsible(t.at(j))) ++j;\n const QString chunk = t.mid(i, j - i);\n m_html += chunk.toHtmlEscaped();\n m_plain += QString{chunk}.replace(QChar::Nbsp, QLatin1Char(' '));\n }\n i = j;\n }\n }\n\n void indent(int count)\n {\n for (int i = 0; i < count; ++i) {\n m_html += QStringLiteral(\" \");\n m_plain += QLatin1Char(' ');\n }\n }\n\n void newLine()\n {\n m_lines.append(OutputLine{m_html, m_plain});\n m_html.clear();\n m_plain.clear();\n }\n\n QVector<OutputLine> take()\n {\n newLine();\n return std::move(m_lines);\n }\n\nprivate:\n QString m_html;\n QString m_plain;\n QVector<OutputLine> m_lines;\n};\n\nQVector<OutputLine> EscapeToLines(const QString& text)",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 2f8f5613af9f..1e7d1a780b25 2026-11-21T03:17:11Z · gpt-6-luna |
| gui#933 | The output context menu outlives the active consoleqml/pages/node/CommandConsole.qml | addressed | AssessmentThe new head closes and resets the output menu when the console becomes inactive: onTabActiveChanged calls root.closeOutputMenu() when tabActive is false. That function sets outputMenu.row to -1 and closes it. path_diff: qml/pages/node/CommandConsole.qml; new_source: qml/pages/node/CommandConsole.qml [
{
"evidence_id": "7e781d0d2dcd4f26847d0803fd9cb8d6",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/pages/node/CommandConsole.qml",
"source_generation": 2,
"source_job_id": 2159,
"text": "diff --git a/qml/pages/node/CommandConsole.qml b/qml/pages/node/CommandConsole.qml\nindex edd017c4..229b870b 100644\n--- a/qml/pages/node/CommandConsole.qml\n+++ b/qml/pages/node/CommandConsole.qml\n@@ -7,25 +7,24 @@ import QtQuick.Controls 2.15\n import QtQuick.Layouts 1.15\n import org.bitcoincore.qt 1.0\n import \"../../controls\"\n-import \"../../components\"\n \n Page {\n id: root\n objectName: \"commandConsole\"\n signal back()\n background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 16\n+ color: Theme.color.surface1\n+ radius: Theme.radius.card\n }\n clip: true\n \n // Theme-aware palette for model-generated inline spans (welcome links and\n // JSON keys). Row-level colours are applied by QML so the\n // output follows the design-system tokens.\n- readonly property color consoleRequestColor: Theme.color.blue\n+ readonly property color consoleRequestColor: Theme.color.infoText\n readonly property color consoleReplyColor: Theme.color.neutral9\n readonly property color consoleTimeColor: Theme.color.neutral7\n- readonly property color consoleKeyColor: Theme.dark ? \"#98C379\" : \"#3A7D2C\"\n+ readonly property color consoleKeyColor: Theme.color.syntaxKey\n readonly property int minimumOutputFontPixelSize: 10\n readonly property int maximumOutputFontPixelSize: 18\n property int outputFontPixelSize: Theme.text.caption.pixelSize\n@@ -46,14 +45,18 @@ Page {\n // child, the console is never destroyed on tab changes, and its autocomplete\n // Popup renders in the window overlay layer, so it is not hidden along with\n // the view. The embedder binds this to its tab's checked state; when the tab\n- // is left, dismiss the popup so it cannot linger over the newly selected tab.\n+ // is left, dismiss the popups so they cannot linger over the newly selected tab.\n property bool tabActive: true\n- onTabActiveChanged: if (!tabActive) autocompletePopup.close()\n+ onTabActiveChanged: {\n+ if (tabActive) return\n+ autocompletePopup.close()\n+ root.closeOutputMenu()\n+ }\n \n function _pushPalette() {\n rpcConsoleModel.requestColor = consoleRequestColor\n rpcConsoleModel.replyColor = consoleReplyColor\n- rpcConsoleModel.errorColor = Theme.color.red\n+ rpcConsoleModel.errorColor = Theme.color.dangerText\n rpcConsoleModel.keyColor = consoleKeyColor\n }\n // Focus the command input when the console becomes the active view, so the\n@@ -108,17 +111,10 @@ Page {\n \n header: NavigationBar2 {\n visible: root.showHeader\n- leftItem: NavButton {\n- objectName: \"consoleBackButton\"\n- iconSource: \"image://images/caret-left\"\n- text: qsTr(\"Back\")\n- onClicked: root.back()\n- }\n- centerItem: Header {\n- headerBold: true\n- headerSize: 18\n- header: qsTr(\"Console\")\n- }\n+ showBackButton: true\n+ backButtonObjectName: \"consoleBackButton\"\n+ onBackClicked: root.back()\n+ title: qsTr(\"Console\")\n TapHandler {\n grabPermissions: PointerHandler.TakeOverForbidden\n onTapped: inputField.focus = false\n@@ -148,18 +144,15 @@ Page {\n rightColumnRole: \"\"\n categoryRole: \"category\"\n fontPixelSize: root.outputFontPixelSize\n- fontFamily: Theme.text.monoFamily\n- fontStyleName: \"Regular\"\n textLineHeight: Math.round(root.outputFontPixelSize * 1.4)\n contentColor: Theme.color.neutral9\n leftColumnColor: root.consoleTimeColor\n requestContentColor: root.consoleRequestColor\n replyContentColor: root.consoleReplyColor\n- errorContentColor: Theme.color.red\n+ errorContentColor: Theme.color.dangerText\n requestLeftColumnColor: root.consoleRequestColor\n replyLeftColumnColor: root.consoleTimeColor\n errorLeftColumnColor: root.consoleTimeColor\n- selectionColor: Theme.color.orange\n accessibleName: qsTr(\"Console output\")\n autoScrollToBottom: true\n searchText: root.searchText\n@@ -317,7 +310,7 @@ Page {\n size: 24\n iconSize: 14\n iconSource: \"qrc:/icons/refresh\"\n- Accessible.name: qsTr(\"Run again\")\n+ accessibleName: qsTr(\"Run again\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: qsTr(\"Run again\")\n@@ -329,7 +322,7 @@ Page {\n size: 24\n iconSize: 14\n iconSource: \"qrc:/icons/edit\"\n- Accessible.name: qsTr(\"Edit command\")\n+ accessibleName: qsTr(\"Edit command\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: qsTr(\"Edit command\")\n@@ -351,8 +344,10 @@ Page {\n width: Math.min(inputField.width, 360)\n height: Math.min(autocompleteList.contentHeight + 2 * menuPadding, 228)\n minMenuWidth: 0\n- backgroundColor: Theme.color.neutral2\n+ backgroundColor: Theme.color.surface2\n focus: false\n+ // Modeless: the user keeps typing in the field while it is open.\n+ modal: false\n // Deliberately NOT CloseOnPressOutside: a real mouse press on the submit\n // button would otherwise close this popup (and clear filteredCommands)\n // before the button's onClicked fires, so the button could never act on\n@@ -406,10 +401,10 @@ Page {\n bottom: parent.bottom\n }\n height: 64\n- color: Theme.color.neutral1\n- radius: 16\n+ color: Theme.color.surface1\n+ radius: Theme.radius.card\n \n- Rectangle {\n+ Separator {\n id: inputDivider\n objectName: \"consoleInputDivider\"\n anchors {\n@@ -417,8 +412,6 @@ Page {\n left: parent.left\n right: parent.right\n }\n- height: 1\n- color: Theme.color.neutral2\n }\n \n RowLayout {\n@@ -436,7 +429,7 @@ Page {\n Icon {\n objectName: \"consolePromptIcon\"\n source: \"image://images/caret-right\"\n- color: Theme.color.orange\n+ color: Theme.color.accent\n size: 16\n Layout.preferredWidth: 16\n Layout.preferredHeight: 16\n@@ -448,21 +441,25 @@ Page {\n objectName: \"consoleInput\"\n Layout.fillWidth: true\n Layout.fillHeight: true\n- font.family: Theme.text.monoFamily\n- font.pixelSize: 13\n+ font: Theme.text.monoCaption.font\n color: Theme.color.neutral9\n placeholderText: qsTr(\"Enter command…\")\n- placeholderTextColor: Theme.color.neutral7\n+ placeholderTextColor: Theme.color.placeholder\n leftPadding: 12\n rightPadding: 12\n topPadding: 0\n bottomPadding: 0\n verticalAlignment: TextInput.AlignVCenter\n background: Rectangle {\n- color: Theme.color.neutral2\n- radius: 8\n- border.width: inputField.activeFocus ? 2 : 0\n- border.color: Theme.color.orange\n+ color: Theme.color.surface2\n+ radius: Theme.radius.field\n+\n+ FieldBorderRings {\n+ objectName: \"consoleInputFocusRing\"\n+ anchors.fill: parent\n+ visible: inputField.activeFocus\n+ cornerRadius: parent.radius\n+ }\n }\n \n // Enter accepts the highlighted autocomplete suggestion when the\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 342,
"evidence_id": "f95f23d960e7457081485b07fd3130df",
"finding_id": "finding:2",
"kind": "new_source",
"line": 193,
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/pages/node/CommandConsole.qml",
"revision": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"source_generation": 2,
"source_job_id": 2159,
"text": " }\n\n function openOutputMenu(row, x, y) {\n outputMenu.row = row\n const position = outputView.mapToItem(root, x, y)\n outputMenu.x = Math.max(12, Math.min(position.x, root.width - outputMenu.width - 12))\n outputMenu.y = Math.max(12, Math.min(position.y, root.height - outputMenu.height - 12))\n outputMenu.open()\n }\n\n // Trimming old output shifts the rows, so the menu's row may now be\n // another command.\n Connections {\n target: rpcConsoleModel.outputModel\n function onRowsRemoved() { root.closeOutputMenu() }\n function onModelReset() { root.closeOutputMenu() }\n }\n\n function closeOutputMenu() {\n outputMenu.row = -1\n outputMenu.close()\n }\n\n ContextMenu {\n id: outputMenu\n objectName: \"consoleOutputMenu\"\n minMenuWidth: 200\n\n property int row: -1\n readonly property bool onRow: row >= 0\n readonly property bool onCommand: root.commandAt(row) !== \"\"\n\n ContextMenuButton {\n objectName: \"consoleMenuCopy\"\n text: qsTr(\"Copy\")\n enabled: outputView.hasSelection\n onTriggered: outputView.copySelection()\n }\n ContextMenuButton {\n objectName: \"consoleMenuCopyEntry\"\n visible: outputMenu.onRow\n text: outputMenu.onCommand ? qsTr(\"Copy command\") : qsTr(\"Copy output\")\n onTriggered: Clipboard.setText(outputView.entryTextAt(outputMenu.row))\n }\n ContextMenuButton {\n objectName: \"consoleMenuSelectEntry\"\n visible: outputMenu.onRow\n text: outputMenu.onCommand ? qsTr(\"Select command\") : qsTr(\"Select output\")\n onTriggered: outputView.selectEntryAt(outputMenu.row)\n }\n ContextMenuButton {\n objectName: \"consoleMenuSelectAll\"\n text: qsTr(\"Select all\")\n enabled: outputView.count > 0\n onTriggered: outputView.selectAll()\n }\n ContextMenuDivider {\n visible: outputMenu.onCommand\n }\n ContextMenuButton {\n objectName: \"consoleMenuRunAgain\"\n visible: outputMenu.onCommand\n text: qsTr(\"Run again\")\n enabled: root.canRunAgain(outputMenu.row)\n onTriggered: root.runCommandAt(outputMenu.row)\n }\n ContextMenuButton {\n objectName: \"consoleMenuEdit\"\n visible: outputMenu.onCommand\n text: qsTr(\"Edit command\")\n onTriggered: root.editCommandAt(outputMenu.row)\n }\n ContextMenuDivider { }\n ContextMenuButton {\n objectName: \"consoleMenuClear\"\n text: qsTr(\"Clear console\")\n role: ContextMenuButton.Destructive\n enabled: outputView.count > 0\n onTriggered: rpcConsoleModel.clear()\n }\n }\n\n Component {\n id: hoverActionsComponent\n\n Rectangle {\n id: hoverActions\n readonly property int row: outputView.hoveredRow\n readonly property bool onCommand: root.commandAt(row) !== \"\"\n\n implicitWidth: hoverActionsRow.implicitWidth + 4\n implicitHeight: hoverActionsRow.implicitHeight + 4\n radius: 6\n color: Theme.color.neutral1\n border.width: 1\n border.color: Theme.dark ? Theme.color.neutral2 : Theme.color.neutral3\n\n Row {\n id: hoverActionsRow\n anchors.centerIn: parent\n spacing: 2\n\n CopyButton {\n objectName: \"consoleHoverCopyButton\"\n displayMode: CopyButton.IconOnly\n iconSize: 14\n implicitHeight: 24\n copyText: hoverActions.onCommand ? qsTr(\"Copy command\") : qsTr(\"Copy output\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: text\n onCopyRequested: Clipboard.setText(outputView.entryTextAt(hoverActions.row))\n }\n IconButton {\n objectName: \"consoleHoverRunButton\"\n visible: hoverActions.onCommand\n enabled: root.canRunAgain(hoverActions.row)\n size: 24\n iconSize: 14\n iconSource: \"qrc:/icons/refresh\"\n accessibleName: qsTr(\"Run again\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: qsTr(\"Run again\")\n onClicked: root.runCommandAt(hoverActions.row)\n }\n IconButton {\n objectName: \"consoleHoverEditButton\"\n visible: hoverActions.onCommand\n size: 24\n iconSize: 14\n iconSource: \"qrc:/icons/edit\"\n accessibleName: qsTr(\"Edit command\")\n ToolTip.visible: hovered\n ToolTip.delay: 500\n ToolTip.text: qsTr(\"Edit command\")\n onClicked: root.editCommandAt(hoverActions.row)\n }\n }\n }\n }\n\n // Autocomplete menu, aligned to the command field's left edge and styled\n // like the shared application context menus.\n ContextMenu {\n id: autocompletePopup\n objectName: \"consoleAutocompletePopup\"\n parent: inputArea\n x: inputContent.x + inputField.x\n y: -height - 4",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 2f8f5613af9f..1e7d1a780b25 2026-11-21T03:17:11Z · gpt-6-luna |
| gui#933 | Front trimming can retarget a resting hover toolbarqml/components/MonospaceOutputView.qml | unclear | AssessmentThe new-head source for MonospaceOutputView.qml is unavailable; the supplied diff only shows the file deletion, so it does not establish whether the replacement implementation resets hover state on row shifts. path_diff: qml/components/MonospaceOutputView.qml [
{
"evidence_id": "c835180a5a774536b2b2194c024fb127",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "1e7d1a780b25678a028b376a074fcb71e21ad4e5",
"old_head": "2f8f5613af9f596a815054d7afb1fccd4d0f9c3e",
"path": "qml/components/MonospaceOutputView.qml",
"source_generation": 2,
"source_job_id": 2159,
"text": "diff --git a/qml/components/MonospaceOutputView.qml b/qml/components/MonospaceOutputView.qml\ndeleted file mode 100644\nindex 30bb8e9a..00000000\n--- a/qml/components/MonospaceOutputView.qml\n+++ /dev/null\n@@ -1,853 +0,0 @@\n-// Copyright (c) 2026 The Bitcoin Core developers\n-// Distributed under the MIT software license, see the accompanying\n-// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n-\n-import QtQuick 2.15\n-import QtQuick.Controls 2.15\n-import QtQuick.Layouts 1.15\n-import org.bitcoincore.qt 1.0\n-import \"../controls\"\n-\n-// MonospaceOutputView — a scrollable monospace text display backed by a\n-// list model.\n-//\n-// Architecture: ListView, one model row per line of output. Callers must feed\n-// it one line per row: a row holding a whole multi-line document defeats\n-// virtualization, since the view still has to lay that document out in full to\n-// know how tall the row is.\n-//\n-// The public model property is named \"listModel\" (not \"model\") to avoid\n-// shadowing the delegate's implicit \"model\" context property.\n-//\n-// Selection belongs to the view, not to the per-row TextEdits, so it can span\n-// rows: a mouse layer over the list tracks it as {row, pos} endpoints and each\n-// delegate's TextEdit only paints its own slice. On touch devices the TextEdits\n-// keep their own per-row selection and the list flicks as usual.\n-//\n-// Supports two optional side columns around the main content column:\n-// Console: [timestamp] | [content]\n-// Debug log: [line#] | [content] | [relative time]\n-\n-Item {\n- id: root\n-\n- Accessible.role: Accessible.List\n- Accessible.name: accessibleName\n-\n- // ── Model ────────────────────────────────────────────────────────────\n-\n- property var listModel: null\n- property string contentRole: \"content\"\n- // Role holding the plain-text rendering of contentRole, if the model has\n- // one. Search offsets are in the rendered document's coordinates, so\n- // without it the view has to strip the markup itself (see _plainTextOf).\n- property string plainContentRole: \"\"\n- property string leftColumnRole: \"\"\n- property string rightColumnRole: \"\"\n- property string categoryRole: \"\"\n- // Role whose value is shared by the rows of one entry (e.g. one RPC reply).\n- // Without it every row is an entry of its own.\n- property string entryRole: \"\"\n-\n- // ── Style ────────────────────────────────────────────────────────────\n-\n- property int fontPixelSize: 12\n- property string fontFamily: \"monospace\"\n- property string fontStyleName: \"\"\n- property int textLineHeight: 0\n- property int contentTextFormat: Text.PlainText\n- property color contentColor: Theme.color.neutral9\n- property color leftColumnColor: Theme.color.neutral5\n- property color rightColumnColor: Theme.color.neutral5\n- property int requestCategory: 0\n- property int replyCategory: 1\n- property int errorCategory: 2\n- property color requestContentColor: contentColor\n- property color replyContentColor: contentColor\n- property color errorContentColor: contentColor\n- property color requestLeftColumnColor: leftColumnColor\n- property color replyLeftColumnColor: leftColumnColor\n- property color errorLeftColumnColor: leftColumnColor\n- property color selectionColor: Theme.color.orange\n- property color selectedTextColor: Theme.color.white\n- property color hoverColor: Theme.color.neutral2\n- property string searchText: \"\"\n- readonly property int searchResultCount: _searchMatches.length\n- property int currentSearchResultIndex: -1\n- property var _searchMatches: []\n- // The match to highlight, as {row, start, end}, or null. Always assigned a\n- // fresh object so delegates see a change even when two matches share a row.\n- property var _currentMatch: null\n- property bool _resetSearchOnRefresh: false\n-\n- // ── Selection and hover ──────────────────────────────────────────────\n-\n- // Shown at the top-right of the hovered entry; it can read hoveredRow.\n- property Component hoverActions: null\n- readonly property int hoveredRow: _hoveredRow\n- readonly property var hoveredEntry: _hoverBounds ? _hoverBounds.entry : undefined\n- readonly property bool hasSelection: _selection !== null\n- // Endpoints as {row, pos}; the anchor stays put while the focus follows\n- // the pointer, so the selection can run in either direction.\n- property var _selAnchor: null\n- property var _selFocus: null\n- readonly property var _selection: root._normalizedSelection(_selAnchor, _selFocus)\n- // Row last clicked, which Select All expands to its whole entry.\n- property int _activeRow: -1\n- property int _hoveredRow: -1\n- // Rows of the hovered entry as {entry, first, last}, found once per entry\n- // rather than on every scroll step under a resting pointer.\n- property var _hoverBounds: null\n- readonly property var _hoverSpan: root._spanOf(_hoverBounds, listView.contentY, listView.contentHeight)\n- readonly property bool _pointerSelection: AppMode.isDesktop\n-\n- // ── Layout metrics ───────────────────────────────────────────────────\n-\n- property int horizontalPadding: 16\n- property int topPadding: 16\n- property int bottomPadding: 16\n- property int rowSpacing: 2\n- property int columnSpacing: 8\n- property int leftColumnWidth: 0\n- property int rightColumnWidth: 0\n-\n- // ── Accessibility ────────────────────────────────────────────────────\n-\n- property string accessibleName: \"\"\n-\n- // ── Scroll behaviour ─────────────────────────────────────────────────\n-\n- property bool autoScrollToBottom: true\n- // Cleared when the user scrolls away from the bottom, so a relayout (font\n- // or width change) only re-pins the view if it was pinned before.\n- property bool _followingTail: true\n-\n- // ── Header ───────────────────────────────────────────────────────────\n-\n- property Component header: null\n-\n- // ── Column-width samples ─────────────────────────────────────────────\n-\n- property string leftColumnSample: \"[00:00:00]\"\n- property string rightColumnSample: \"99 hr ago\"\n-\n- // ── Read-only scroll state ────────────────────────────────────────────\n-\n- readonly property bool atBottom: listView.atYEnd\n- readonly property bool atTop: listView.atYBeginning\n- readonly property real contentY: listView.contentY\n- readonly property int count: listView.count\n-\n- // ── Methods ──────────────────────────────────────────────────────────\n-\n- // positionViewAt{End,Beginning}() stop at the last/first row and leave the\n- // margins out of view, so finish the job by hand. The position call still\n- // has to happen first: it creates the end delegates that make contentHeight\n- // exact.\n- function scrollToBottom() {\n- listView.positionViewAtEnd()\n- listView.contentY = Math.max(root._minContentY(), root._maxContentY())\n- }\n- function scrollToTop() {\n- listView.positionViewAtBeginning()\n- listView.contentY = root._minContentY()\n- }\n-\n- function _minContentY() {\n- return listView.originY - listView.topMargin\n- }\n- function _maxContentY() {\n- return listView.originY + listView.contentHeight + listView.bottomMargin - listView.height\n- }\n-\n- function roleValueAt(row, role) {\n- if (!root.listModel || row < 0 || row >= listView.count) return undefined\n- const data = root.listModel.get(row)\n- return data ? data[role] : undefined\n- }\n-\n- function _entryAt(row) {\n- return root.entryRole !== \"\" ? root.roleValueAt(row, root.entryRole) : row\n- }\n-\n- // An entry's rows are contiguous, so gallop out from `row` and bisect the\n- // boundary: O(log n) lookups even for a reply tens of thousands of lines long.\n- function _entryBounds(row) {\n- if (root.entryRole === \"\") return { first: row, last: row }\n- const entry = root._entryAt(row)\n- const inEntry = function(r) { return root._entryAt(r) === entry }\n- const edge = function(direction, limit) {\n- let inside = row\n- let step = 1\n- while ((inside + direction * step - limit) * direction <= 0\n- && inEntry(inside + direction * step)) {\n- inside += direction * step\n- step *= 2\n- }\n- let outside = inside + direction * step\n- if ((outside - limit) * direction > 0) outside = limit + direction\n- while (Math.abs(outside - inside) > 1) {\n- const middle = Math.floor((inside + outside) / 2)\n- if (inEntry(middle)) inside = middle\n- else outside = middle\n- }\n- return inside\n- }\n- return { first: edge(-1, 0), last: edge(1, listView.count - 1) }\n- }\n-\n- function entryTextAt(row) {\n- if (row < 0 || row >= listView.count) return \"\"\n- const bounds = root._entryBounds(row)\n- const lines = []\n- for (let r = bounds.first; r <= bounds.last; ++r) lines.push(root._plainTextOf(r))\n- return lines.join(\"\\n\")\n- }\n-\n- function _normalizedSelection(anchor, focus) {\n- if (!anchor || !focus || (anchor.row === focus.row && anchor.pos === focus.pos)) return null\n- const forward = anchor.row < focus.row || (anchor.row === focus.row && anchor.pos < focus.pos)\n- const start = forward ? anchor : focus\n- const end = forward ? focus : anchor\n- return { startRow: start.row, startPos: start.pos, endRow: end.row, endPos: end.pos }\n- }\n-\n- // The slice of `row` inside `selection`, as {start, end}; end -1 means to\n- // the end of the row.\n- function _rangeInRow(row, selection) {\n- if (!selection || row < selection.startRow || row > selection.endRow) return null\n- return {\n- start: row === selection.startRow ? selection.startPos : 0,\n- end: row === selection.endRow ? selection.endPos : -1\n- }\n- }\n-\n- function _selectionContains(point) {\n- const selection = root._selection\n- if (!selection || point.row < selection.startRow || point.row > selection.endRow) return false\n- if (point.row === selection.startRow && point.pos < selection.startPos) return false\n- if (point.row === selection.endRow && point.pos > selection.endPos) return false\n- return true\n- }\n-\n- function selectRange(startRow, startPos, endRow, endPos) {\n- root._selAnchor = { row: startRow, pos: startPos }\n- root._selFocus = { row: endRow, pos: endPos }\n- }\n-\n- function selectEntryAt(row) {\n- if (row < 0 || row >= listView.count) return\n- const bounds = root._entryBounds(row)\n- root.selectRange(bounds.first, 0, bounds.last, root._plainTextOf(bounds.last).length)\n- }\n-\n- function selectAll() {\n- if (listView.count === 0) return\n- const last = listView.count - 1\n- root.selectRange(0, 0, last, root._plainTextOf(last).length)\n- }\n-\n- function clearSelection() {\n- root._selAnchor = null\n- root._selFocus = null\n- }\n-\n- function selectedText() {\n- const selection = root._selection\n- if (!selection) return \"\"\n- const lines = []\n- for (let row = selection.startRow; row <= selection.endRow; ++row) {\n- const text = root._plainTextOf(row)\n- const range = root._rangeInRow(row, selection)\n- lines.push(text.slice(range.start, range.end < 0 ? text.length : range.end))\n- }\n- return lines.join(\"\\n\")\n- }\n-\n- function copySelection() {\n- if (root.hasSelection) Clipboard.setText(root.selectedText())\n- }\n-\n- // The {row, pos} under a point in the view, clamped into the view so a\n- // drag past an edge still lands on the edge row.\n- function _hitTest(x, y) {\n- if (listView.count === 0) return null\n- const viewY = Math.max(0, Math.min(listView.height - 1, y))\n- const contentX = listView.width / 2\n- const contentY = viewY + listView.contentY\n- let row = listView.indexAt(contentX, contentY)\n- if (row < 0) {\n- const lastRow = listView.count - 1\n- const last = listView.itemAtIndex(lastRow)\n- if (last && contentY >= last.y)\n- return { row: lastRow, pos: root._plainTextOf(lastRow).length }\n- const first = listView.itemAtIndex(0)\n- if (first && contentY < first.y) return { row: 0, pos: 0 }\n- row = listView.indexAt(contentX, contentY + root.rowSpacing)\n- if (row < 0) return null\n- return { row: row, pos: 0 }\n- }\n- const item = listView.itemAtIndex(row)\n- if (!item) return null\n- const local = item.contentEditor.mapFromItem(pointerArea, x, viewY)\n- return { row: row, pos: item.contentEditor.positionAt(local.x, local.y) }\n- }\n-\n- // Words are runs of anything but whitespace and JSON punctuation, so a\n- // double-click on a quoted hash or address takes it without the quotes.\n- function _selectWordAt(point) {\n- const text = root._plainTextOf(point.row)\n- const isWordChar = function(c) { return !/[\\s\"',:{}\\[\\]()]/.test(c) }\n- let start = Math.min(point.pos, text.length)\n- let end = start\n- if (start < text.length && isWordChar(text[start])) {\n- while (start > 0 && isWordChar(text[start - 1])) --start\n- while (end < text.length && isWordChar(text[end])) ++end\n- } else if (start > 0 && isWordChar(text[start - 1])) {\n- while (start > 0 && isWordChar(text[start - 1])) --start\n- } else {\n- end = Math.min(start + 1, text.length)\n- }\n- root.selectRange(point.row, start, point.row, end)\n- }\n-\n- function _extendSelectionTo(x, y) {\n- const hit = root._hitTest(x, y)\n- if (hit && root._selAnchor) root._selFocus = hit\n- }\n-\n- function _rowAtY(y) {\n- return listView.indexAt(listView.width / 2, y + listView.contentY)\n- }\n-\n- function _updateHover() {\n- if (actionsHover.hovered) return\n- const row = pointerArea.containsMouse && !pointerArea.pressed\n- ? root._rowAtY(pointerArea.mouseY) : -1\n- root._hoveredRow = row\n- const bounds = root._hoverBounds\n- if (row < 0) {\n- root._hoverBounds = null\n- } else if (!bounds || row < bounds.first || row > bounds.last) {\n- const found = root._entryBounds(row)\n- root._hoverBounds = { entry: root._entryAt(row), first: found.first, last: found.last }\n- }\n- }\n-\n- // Content-y extent of the hovered entry. An end row without a delegate is\n- // beyond the cache buffer, so the extent just runs past that edge of the view.\n- function _spanOf(bounds, contentY, contentHeight) {\n- if (!bounds) return null\n- const first = listView.itemAtIndex(bounds.first)\n- const last = listView.itemAtIndex(bounds.last)\n- return {\n- top: first ? first.y : contentY - 1,\n- bottom: last ? last.y + last.height : contentY + listView.height + 1\n- }\n- }\n-\n- function scheduleSearchRefresh(resetCurrent) {\n- root._resetSearchOnRefresh = root._resetSearchOnRefresh || resetCurrent\n- searchRefreshTimer.restart()\n- }\n-\n- // Plain text of row `index`, in the coordinates the delegate's TextEdit\n- // reports. Falls back to undoing the markup when the model has no plain role.\n- function _plainTextOf(index) {\n- if (!root.listModel || typeof root.listModel.get !== \"function\") return \"\"\n- const data = root.listModel.get(index)\n- if (!data) return \"\"\n- if (root.plainContentRole !== \"\" && data[root.plainContentRole] !== undefined)\n- return String(data[root.plainContentRole])\n- const markup = String(data[root.contentRole] ?? \"\")\n- if (root.contentTextFormat === Text.PlainText) return markup\n- return markup.replace(/<br\\s*\\/?>/gi, \"\\n\")\n- .replace(/<[^>]*>/g, \"\")\n- .replace(/ /g, \" \")\n- .replace(/</g, \"<\")\n- .replace(/>/g, \">\")\n- .replace(/"/g, \"\\\"\")\n- .replace(/'/g, \"'\")\n- .replace(/&/g, \"&\")\n- }\n-\n- function rebuildSearchMatches(resetCurrent) {\n- const matches = []\n- if (root.searchText.length > 0) {\n- const pattern = root.searchText.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n- const expression = new RegExp(pattern, \"gi\")\n- // Scan model data, not delegates: off-screen rows have none.\n- for (let row = 0; row < listView.count; ++row) {\n- const plainText = root._plainTextOf(row)\n- if (plainText.length === 0) continue\n- expression.lastIndex = 0\n- let match\n- while ((match = expression.exec(plainText)) !== null) {\n- matches.push({\n- row: row,\n- start: match.index,\n- end: match.index + match[0].length\n- })\n- }\n- }\n- }\n-\n- root._searchMatches = matches\n- if (matches.length === 0) {\n- root.currentSearchResultIndex = -1\n- } else if (resetCurrent || root.currentSearchResultIndex < 0) {\n- root.currentSearchResultIndex = 0\n- } else {\n- root.currentSearchResultIndex = Math.min(root.currentSearchResultIndex,\n- matches.length - 1)\n- }\n- root.applyCurrentSearchMatch()\n- }\n-\n- function applyCurrentSearchMatch() {\n- if (root.currentSearchResultIndex < 0\n- || root.currentSearchResultIndex >= root._searchMatches.length) {\n- root._currentMatch = null\n- return\n- }\n-\n- const match = root._searchMatches[root.currentSearchResultIndex]\n- root._currentMatch = { row: match.row, start: match.start, end: match.end }\n- // Bring the row into existence before asking it where the match sits.\n- listView.positionViewAtIndex(match.row, ListView.Contain)\n- root._scrollToCurrentMatchRect()\n- }\n-\n- // Scroll to the occurrence itself, not merely its containing row: a row\n- // wrapped over several visual lines can hold the match well below its top.\n- function _scrollToCurrentMatchRect() {\n- if (!root._currentMatch) return\n- const item = listView.itemAtIndex(root._currentMatch.row)\n- if (!item || !item.contentEditor) return\n- const editor = item.contentEditor\n- const startRect = editor.positionToRectang\n[Path diff truncated]",
"truncated": true,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 2f8f5613af9f..1e7d1a780b25 2026-11-21T03:17:11Z · gpt-6-luna |
| gui#883 | Settings-file recovery also discards unrelated GUI preferencesqml/onboarding_settings.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · 8e5b4d1f090a..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Relative -conf paths cause false profile-drift failures for new foldersqml/onboarding_settings.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · 8e5b4d1f090a..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Settings recovery ignores application Quit eventsqml/bitcoin.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 8e5b4d1f090a..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Write-protected config-selected profiles bypass the chooserqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 8e5b4d1f090a..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Unreadable settings suppress data-directory chooser requestsqml/onboarding_settings.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · 8e5b4d1f090a..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Preparing settings directories skips first-use wallets/ initializationqml/onboarding_settings.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · 8e5b4d1f090a..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#863 | Compat resource aliases are defined twiceCMakeLists.txt | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f255017d0095..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Forced AOT leaves the documented disable-cache setting inertqml/qmlcachepolicy.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f255017d0095..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Cache smoke can pass before its watched QML document loadstest/functional/qml_test_cache_policy.py | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f255017d0095..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Linux stale-cache monitoring misses the Qt ≥ 6.6 AOT policy.github/workflows/artifacts.yml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · f255017d0095..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#1062 | Post-update QR export assertions do not verify its payloadtest/functional/qml_test_receive.py | still_present | AssessmentThe post-update export assertions remain unchanged: they check only the PNG signature and that the bytes differ from the original. The comment still claims the image encodes the applied request, but there is no decode-and-compare check or narrower claim. In the new excerpt, lines 353–354 still say the image “encodes the applied request”; lines 365–370 only check the PNG signature and `applied_png != original_png`. Source report · 1ea3a94995ba..405d23f1bcab 2026-11-11T00:42:34Z · gpt-6-luna |
| gui#994 | Node details elides long values without exposing their full textqml/components/NodeDetailsPopup.qml | addressed | AssessmentThe value text no longer disables wrapping or applies middle elision; it now wraps at word boundaries or anywhere, with row height based on the value text. This exposes long values rather than silently eliding them. path_diff: qml/components/NodeDetailsPopup.qml; new_source: qml/components/NodeDetailsPopup.qml [
{
"evidence_id": "7847bdc897a2489cac6ce1b75ee0e7b2",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/NodeDetailsPopup.qml",
"source_generation": 4,
"source_job_id": 2155,
"text": "diff --git a/qml/components/NodeDetailsPopup.qml b/qml/components/NodeDetailsPopup.qml\nindex 1b87037223..9044ebaddb 100644\n--- a/qml/components/NodeDetailsPopup.qml\n+++ b/qml/components/NodeDetailsPopup.qml\n@@ -6,9 +6,11 @@ import QtQuick 2.15\n import QtQuick.Controls 2.15\n import QtQuick.Layouts 1.15\n \n+import org.bitcoincore.qt 1.0\n+\n import \"../controls\"\n \n-Popup {\n+DialogPopup {\n id: root\n objectName: \"nodeDetailsPopup\"\n \n@@ -36,12 +38,8 @@ Popup {\n onMoreExpandedChanged: if (moreExpanded) root.loadAboutRows()\n signal actionTriggered(string action)\n \n- parent: Overlay.overlay\n- anchors.centerIn: parent\n- modal: true\n- width: parent ? Math.min(440, parent.width - 48) : 440\n- height: parent ? Math.min(implicitHeight, parent.height - 48) : implicitHeight\n- padding: 24\n+ title: qsTr(\"Node details\")\n+ implicitWidth: 480\n \n onOpened: {\n if (root.status.nodeModelRef !== null && root.status.nodeModelRef.mempoolInfoPollingActive !== undefined) root.status.nodeModelRef.mempoolInfoPollingActive = true\n@@ -84,7 +82,7 @@ Popup {\n \n function withSpeedRow(rows) {\n if (root.status.key !== \"blocks\") return rows\n- const progress = rows.findIndex(function(row) { return row.key === qsTr(\"Progress\") })\n+ const progress = rows.findIndex(function(row) { return row.id === \"progress\" })\n if (progress < 0) return rows\n let speed = root.syncSpeedText\n if (root.trafficRef !== null) speed += \" · ↓ \" + root.rateText(root.trafficRef.receivedRateList)\n@@ -124,7 +122,7 @@ Popup {\n for (const row of node.nodeInformationRows()) byId[row.id] = row\n const rows = []\n for (const [id, label] of root.aboutLabels) {\n- if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path })\n+ if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path, mono: byId[id].mono })\n }\n root.aboutRows = rows\n }\n@@ -147,58 +145,37 @@ Popup {\n onTriggered: root.sampleSyncSpeed()\n }\n \n- enter: Transition {\n- NumberAnimation { property: \"opacity\"; from: 0; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- NumberAnimation { property: \"scale\"; from: 0.98; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- }\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 12\n- border.width: 1\n- border.color: Theme.color.neutral3\n- }\n-\n contentItem: ColumnLayout {\n spacing: 0\n \n- RowLayout {\n+ DialogHeader {\n Layout.fillWidth: true\n- Layout.bottomMargin: 16\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"Node details\")\n- bold: true\n- font.pixelSize: 18\n- horizontalAlignment: Text.AlignLeft\n- }\n- CloseButton {\n- objectName: \"nodeDetailsCloseButton\"\n- size: 32\n- onClicked: root.close()\n- }\n+ Layout.bottomMargin: Theme.space.l\n+ title: root.title\n+ closeButtonObjectName: \"nodeDetailsCloseButton\"\n+ onCloseRequested: root.close()\n }\n \n RowLayout {\n- Layout.bottomMargin: 12\n- spacing: 8\n+ Layout.bottomMargin: Theme.space.ml\n+ spacing: Theme.space.m\n Rectangle {\n Layout.alignment: Qt.AlignVCenter\n- implicitWidth: 8\n- implicitHeight: 8\n- radius: 4\n+ implicitWidth: Theme.space.m\n+ implicitHeight: Theme.space.m\n+ radius: height / 2\n color: root.status.tone\n }\n CoreText {\n objectName: \"nodeDetailsStatus\"\n text: root.status.label\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.captionStrong\n wrap: false\n }\n WarningsLink {\n objectName: \"nodeDetailsWarnings\"\n status: root.status\n+ showDismissed: true\n onClicked: {\n root.close()\n root.actionTriggered(\"warnings\")\n@@ -234,10 +211,10 @@ Popup {\n AbstractButton {\n id: moreToggle\n objectName: \"nodeDetailsMoreToggle\"\n- topPadding: 12\n- bottomPadding: 8\n+ topPadding: Theme.space.ml\n+ bottomPadding: Theme.space.m\n text: root.moreExpanded ? qsTr(\"Fewer details\") : qsTr(\"More details\")\n- hoverEnabled: true\n+ hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n Accessible.name: text\n implicitWidth: moreToggleContent.implicitWidth + leftPadding + rightPadding\n@@ -249,19 +226,19 @@ Popup {\n \n contentItem: Row {\n id: moreToggleContent\n- spacing: 4\n+ spacing: Theme.space.xs\n CoreText {\n anchors.verticalCenter: parent.verticalCenter\n text: moreToggle.text\n- font: Theme.text.captionStrong.font\n+ textStyle: Theme.text.captionStrong\n wrap: false\n- color: Theme.color.orange\n+ color: Theme.color.accentText\n }\n CaretRightIcon {\n objectName: \"nodeDetailsMoreCaret\"\n anchors.verticalCenter: parent.verticalCenter\n- size: 12\n- color: Theme.color.orange\n+ size: Theme.size.caretDense\n+ color: Theme.color.accentText\n rotation: root.moreExpanded ? -90 : 90\n }\n }\n@@ -287,11 +264,10 @@ Popup {\n objectName: \"nodeDetailsAboutHeading\"\n visible: root.moreExpanded && root.aboutRows.length > 0\n width: rowsColumn.width\n- topPadding: 24\n- bottomPadding: 8\n+ topPadding: Theme.space.xxl\n+ bottomPadding: Theme.space.m\n text: qsTr(\"About this node\")\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.subheading\n horizontalAlignment: Text.AlignLeft\n }\n Repeater {\n@@ -308,12 +284,11 @@ Popup {\n \n RowLayout {\n Layout.fillWidth: true\n- Layout.topMargin: 20\n- spacing: 8\n+ Layout.topMargin: Theme.space.xl\n+ spacing: Theme.space.m\n NodeActionButton {\n objectName: \"nodeDetailsPrimaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n text: root.status.primaryActionText\n accent: root.status.primaryActionAccent\n enabled: root.status.primaryActionEnabled\n@@ -327,7 +302,6 @@ Popup {\n NodeActionButton {\n objectName: \"nodeDetailsSecondaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n visible: root.status.secondaryAction.length > 0\n text: root.status.secondaryActionText\n onClicked: {\n@@ -345,20 +319,20 @@ Popup {\n property string valueObjectName: \"\"\n property bool showTopLine: true\n readonly property bool isLink: row.url !== undefined && row.url.toString().length > 0\n- implicitHeight: 44\n+ implicitHeight: Math.max(Theme.size.row, valueText.height + 2 * Theme.space.ml)\n \n Rectangle {\n visible: detailRow.showTopLine\n width: parent.width\n height: 1\n- color: Theme.color.neutral3\n+ color: Theme.color.surfaceDivider\n }\n CoreText {\n id: keyText\n anchors.left: parent.left\n- anchors.verticalCenter: parent.verticalCenter\n+ anchors.top: valueText.top\n text: detailRow.row.key\n- font.pixelSize: 14\n+ textStyle: Theme.text.caption\n wrap: false\n color: Theme.color.neutral7\n }\n@@ -367,27 +341,35 @@ Popup {\n objectName: detailRow.valueObjectName\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n- width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - 16)\n+ width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - Theme.space.l)\n text: detailRow.row.value\n- bold: true\n- font.pixelSize: 14\n- wrap: false\n- elide: Text.ElideMiddle\n+ textStyle: detailRow.row.mono === true ? Theme.text.monoCaption : Theme.text.captionStrong\n+ // Wrap rather than elide so long paths and address lists stay readable.\n+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere\n horizontalAlignment: Text.AlignRight\n- color: detailRow.isLink ? Theme.color.orange : Theme.color.neutral9\n- opacity: linkArea.pressed ? 0.7 : linkArea.containsMouse ? 0.85 : 1\n+ color: detailRow.isLink ? Theme.color.accentText : Theme.color.neutral9\n+ opacity: linkButton.down ? 0.7 : linkButton.hovered ? 0.85 : 1\n \n- MouseArea {\n- id: linkArea\n+ AbstractButton {\n+ id: linkButton\n objectName: detailRow.valueObjectName.length > 0 ? detailRow.valueObjectName + \"_link\" : \"\"\n anchors.fill: parent\n enabled: detailRow.isLink\n- hoverEnabled: true\n- cursorShape: Qt.PointingHandCursor\n+ hoverEnabled: AppMode.isDesktop\n+ focusPolicy: Qt.StrongFocus\n Accessible.role: Accessible.Link\n Accessible.name: detailRow.row.key + \": \" + detailRow.row.value\n Accessible.description: qsTr(\"Opens the folder in your file manager\")\n+ Keys.onReturnPressed: clicked()\n+ Keys.onEnterPressed: clicked()\n onClicked: Qt.openUrlExternally(detailRow.row.url)\n+\n+ HoverHandler { cursorShape: Qt.PointingHandCursor }\n+\n+ background: FocusBorder {\n+ visible: linkButton.visualFocus\n+ borderRadius: 6\n+ }\n }\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 376,
"evidence_id": "45fabfcb94584e2fb7e924ad21fdca5d",
"finding_id": "finding:7",
"kind": "new_source",
"line": 335,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/NodeDetailsPopup.qml",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 4,
"source_job_id": 2155,
"text": " textStyle: Theme.text.caption\n wrap: false\n color: Theme.color.neutral7\n }\n CoreText {\n id: valueText\n objectName: detailRow.valueObjectName\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - Theme.space.l)\n text: detailRow.row.value\n textStyle: detailRow.row.mono === true ? Theme.text.monoCaption : Theme.text.captionStrong\n // Wrap rather than elide so long paths and address lists stay readable.\n wrapMode: Text.WrapAtWordBoundaryOrAnywhere\n horizontalAlignment: Text.AlignRight\n color: detailRow.isLink ? Theme.color.accentText : Theme.color.neutral9\n opacity: linkButton.down ? 0.7 : linkButton.hovered ? 0.85 : 1\n\n AbstractButton {\n id: linkButton\n objectName: detailRow.valueObjectName.length > 0 ? detailRow.valueObjectName + \"_link\" : \"\"\n anchors.fill: parent\n enabled: detailRow.isLink\n hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n Accessible.role: Accessible.Link\n Accessible.name: detailRow.row.key + \": \" + detailRow.row.value\n Accessible.description: qsTr(\"Opens the folder in your file manager\")\n Keys.onReturnPressed: clicked()\n Keys.onEnterPressed: clicked()\n onClicked: Qt.openUrlExternally(detailRow.row.url)\n\n HoverHandler { cursorShape: Qt.PointingHandCursor }\n\n background: FocusBorder {\n visible: linkButton.visualFocus\n borderRadius: 6\n }\n }\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b221ab2b0455..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Directory links in Node details lack keyboard activationqml/components/NodeDetailsPopup.qml | addressed | AssessmentThe directory-value MouseArea is replaced by an AbstractButton with StrongFocus, Return and Enter activation, and a FocusBorder, addressing keyboard focus, activation, and focus indication. path_diff: qml/components/NodeDetailsPopup.qml; new_source: qml/components/NodeDetailsPopup.qml [
{
"evidence_id": "c71697d8a06c43c8aaca10dd0a58e67c",
"finding_id": "finding:6",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/NodeDetailsPopup.qml",
"source_generation": 4,
"source_job_id": 2155,
"text": "diff --git a/qml/components/NodeDetailsPopup.qml b/qml/components/NodeDetailsPopup.qml\nindex 1b87037223..9044ebaddb 100644\n--- a/qml/components/NodeDetailsPopup.qml\n+++ b/qml/components/NodeDetailsPopup.qml\n@@ -6,9 +6,11 @@ import QtQuick 2.15\n import QtQuick.Controls 2.15\n import QtQuick.Layouts 1.15\n \n+import org.bitcoincore.qt 1.0\n+\n import \"../controls\"\n \n-Popup {\n+DialogPopup {\n id: root\n objectName: \"nodeDetailsPopup\"\n \n@@ -36,12 +38,8 @@ Popup {\n onMoreExpandedChanged: if (moreExpanded) root.loadAboutRows()\n signal actionTriggered(string action)\n \n- parent: Overlay.overlay\n- anchors.centerIn: parent\n- modal: true\n- width: parent ? Math.min(440, parent.width - 48) : 440\n- height: parent ? Math.min(implicitHeight, parent.height - 48) : implicitHeight\n- padding: 24\n+ title: qsTr(\"Node details\")\n+ implicitWidth: 480\n \n onOpened: {\n if (root.status.nodeModelRef !== null && root.status.nodeModelRef.mempoolInfoPollingActive !== undefined) root.status.nodeModelRef.mempoolInfoPollingActive = true\n@@ -84,7 +82,7 @@ Popup {\n \n function withSpeedRow(rows) {\n if (root.status.key !== \"blocks\") return rows\n- const progress = rows.findIndex(function(row) { return row.key === qsTr(\"Progress\") })\n+ const progress = rows.findIndex(function(row) { return row.id === \"progress\" })\n if (progress < 0) return rows\n let speed = root.syncSpeedText\n if (root.trafficRef !== null) speed += \" · ↓ \" + root.rateText(root.trafficRef.receivedRateList)\n@@ -124,7 +122,7 @@ Popup {\n for (const row of node.nodeInformationRows()) byId[row.id] = row\n const rows = []\n for (const [id, label] of root.aboutLabels) {\n- if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path })\n+ if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path, mono: byId[id].mono })\n }\n root.aboutRows = rows\n }\n@@ -147,58 +145,37 @@ Popup {\n onTriggered: root.sampleSyncSpeed()\n }\n \n- enter: Transition {\n- NumberAnimation { property: \"opacity\"; from: 0; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- NumberAnimation { property: \"scale\"; from: 0.98; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- }\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 12\n- border.width: 1\n- border.color: Theme.color.neutral3\n- }\n-\n contentItem: ColumnLayout {\n spacing: 0\n \n- RowLayout {\n+ DialogHeader {\n Layout.fillWidth: true\n- Layout.bottomMargin: 16\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"Node details\")\n- bold: true\n- font.pixelSize: 18\n- horizontalAlignment: Text.AlignLeft\n- }\n- CloseButton {\n- objectName: \"nodeDetailsCloseButton\"\n- size: 32\n- onClicked: root.close()\n- }\n+ Layout.bottomMargin: Theme.space.l\n+ title: root.title\n+ closeButtonObjectName: \"nodeDetailsCloseButton\"\n+ onCloseRequested: root.close()\n }\n \n RowLayout {\n- Layout.bottomMargin: 12\n- spacing: 8\n+ Layout.bottomMargin: Theme.space.ml\n+ spacing: Theme.space.m\n Rectangle {\n Layout.alignment: Qt.AlignVCenter\n- implicitWidth: 8\n- implicitHeight: 8\n- radius: 4\n+ implicitWidth: Theme.space.m\n+ implicitHeight: Theme.space.m\n+ radius: height / 2\n color: root.status.tone\n }\n CoreText {\n objectName: \"nodeDetailsStatus\"\n text: root.status.label\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.captionStrong\n wrap: false\n }\n WarningsLink {\n objectName: \"nodeDetailsWarnings\"\n status: root.status\n+ showDismissed: true\n onClicked: {\n root.close()\n root.actionTriggered(\"warnings\")\n@@ -234,10 +211,10 @@ Popup {\n AbstractButton {\n id: moreToggle\n objectName: \"nodeDetailsMoreToggle\"\n- topPadding: 12\n- bottomPadding: 8\n+ topPadding: Theme.space.ml\n+ bottomPadding: Theme.space.m\n text: root.moreExpanded ? qsTr(\"Fewer details\") : qsTr(\"More details\")\n- hoverEnabled: true\n+ hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n Accessible.name: text\n implicitWidth: moreToggleContent.implicitWidth + leftPadding + rightPadding\n@@ -249,19 +226,19 @@ Popup {\n \n contentItem: Row {\n id: moreToggleContent\n- spacing: 4\n+ spacing: Theme.space.xs\n CoreText {\n anchors.verticalCenter: parent.verticalCenter\n text: moreToggle.text\n- font: Theme.text.captionStrong.font\n+ textStyle: Theme.text.captionStrong\n wrap: false\n- color: Theme.color.orange\n+ color: Theme.color.accentText\n }\n CaretRightIcon {\n objectName: \"nodeDetailsMoreCaret\"\n anchors.verticalCenter: parent.verticalCenter\n- size: 12\n- color: Theme.color.orange\n+ size: Theme.size.caretDense\n+ color: Theme.color.accentText\n rotation: root.moreExpanded ? -90 : 90\n }\n }\n@@ -287,11 +264,10 @@ Popup {\n objectName: \"nodeDetailsAboutHeading\"\n visible: root.moreExpanded && root.aboutRows.length > 0\n width: rowsColumn.width\n- topPadding: 24\n- bottomPadding: 8\n+ topPadding: Theme.space.xxl\n+ bottomPadding: Theme.space.m\n text: qsTr(\"About this node\")\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.subheading\n horizontalAlignment: Text.AlignLeft\n }\n Repeater {\n@@ -308,12 +284,11 @@ Popup {\n \n RowLayout {\n Layout.fillWidth: true\n- Layout.topMargin: 20\n- spacing: 8\n+ Layout.topMargin: Theme.space.xl\n+ spacing: Theme.space.m\n NodeActionButton {\n objectName: \"nodeDetailsPrimaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n text: root.status.primaryActionText\n accent: root.status.primaryActionAccent\n enabled: root.status.primaryActionEnabled\n@@ -327,7 +302,6 @@ Popup {\n NodeActionButton {\n objectName: \"nodeDetailsSecondaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n visible: root.status.secondaryAction.length > 0\n text: root.status.secondaryActionText\n onClicked: {\n@@ -345,20 +319,20 @@ Popup {\n property string valueObjectName: \"\"\n property bool showTopLine: true\n readonly property bool isLink: row.url !== undefined && row.url.toString().length > 0\n- implicitHeight: 44\n+ implicitHeight: Math.max(Theme.size.row, valueText.height + 2 * Theme.space.ml)\n \n Rectangle {\n visible: detailRow.showTopLine\n width: parent.width\n height: 1\n- color: Theme.color.neutral3\n+ color: Theme.color.surfaceDivider\n }\n CoreText {\n id: keyText\n anchors.left: parent.left\n- anchors.verticalCenter: parent.verticalCenter\n+ anchors.top: valueText.top\n text: detailRow.row.key\n- font.pixelSize: 14\n+ textStyle: Theme.text.caption\n wrap: false\n color: Theme.color.neutral7\n }\n@@ -367,27 +341,35 @@ Popup {\n objectName: detailRow.valueObjectName\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n- width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - 16)\n+ width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - Theme.space.l)\n text: detailRow.row.value\n- bold: true\n- font.pixelSize: 14\n- wrap: false\n- elide: Text.ElideMiddle\n+ textStyle: detailRow.row.mono === true ? Theme.text.monoCaption : Theme.text.captionStrong\n+ // Wrap rather than elide so long paths and address lists stay readable.\n+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere\n horizontalAlignment: Text.AlignRight\n- color: detailRow.isLink ? Theme.color.orange : Theme.color.neutral9\n- opacity: linkArea.pressed ? 0.7 : linkArea.containsMouse ? 0.85 : 1\n+ color: detailRow.isLink ? Theme.color.accentText : Theme.color.neutral9\n+ opacity: linkButton.down ? 0.7 : linkButton.hovered ? 0.85 : 1\n \n- MouseArea {\n- id: linkArea\n+ AbstractButton {\n+ id: linkButton\n objectName: detailRow.valueObjectName.length > 0 ? detailRow.valueObjectName + \"_link\" : \"\"\n anchors.fill: parent\n enabled: detailRow.isLink\n- hoverEnabled: true\n- cursorShape: Qt.PointingHandCursor\n+ hoverEnabled: AppMode.isDesktop\n+ focusPolicy: Qt.StrongFocus\n Accessible.role: Accessible.Link\n Accessible.name: detailRow.row.key + \": \" + detailRow.row.value\n Accessible.description: qsTr(\"Opens the folder in your file manager\")\n+ Keys.onReturnPressed: clicked()\n+ Keys.onEnterPressed: clicked()\n onClicked: Qt.openUrlExternally(detailRow.row.url)\n+\n+ HoverHandler { cursorShape: Qt.PointingHandCursor }\n+\n+ background: FocusBorder {\n+ visible: linkButton.visualFocus\n+ borderRadius: 6\n+ }\n }\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 376,
"evidence_id": "0d152fab62e54daa9d4bffe1e7637c3a",
"finding_id": "finding:6",
"kind": "new_source",
"line": 350,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/NodeDetailsPopup.qml",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 4,
"source_job_id": 2155,
"text": " color: detailRow.isLink ? Theme.color.accentText : Theme.color.neutral9\n opacity: linkButton.down ? 0.7 : linkButton.hovered ? 0.85 : 1\n\n AbstractButton {\n id: linkButton\n objectName: detailRow.valueObjectName.length > 0 ? detailRow.valueObjectName + \"_link\" : \"\"\n anchors.fill: parent\n enabled: detailRow.isLink\n hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n Accessible.role: Accessible.Link\n Accessible.name: detailRow.row.key + \": \" + detailRow.row.value\n Accessible.description: qsTr(\"Opens the folder in your file manager\")\n Keys.onReturnPressed: clicked()\n Keys.onEnterPressed: clicked()\n onClicked: Qt.openUrlExternally(detailRow.row.url)\n\n HoverHandler { cursorShape: Qt.PointingHandCursor }\n\n background: FocusBorder {\n visible: linkButton.visualFocus\n borderRadius: 6\n }\n }\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b221ab2b0455..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | “Last block … ago” measures header time rather than arrivalqml/models/blockclockmodel.cpp | still_present | AssessmentThe age is now based on the active tip time, but the calculation still clamps future timestamps to zero. No supplied evidence changes the label to identify block time or updates onboarding wording, so the stated misleading freshness description remains. path_diff: qml/models/blockclockmodel.cpp; new_source: qml/models/blockclockmodel.cpp [
{
"evidence_id": "6536f7ca0e9d456e84a2490c3df72711",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/models/blockclockmodel.cpp",
"source_generation": 4,
"source_job_id": 2155,
"text": "diff --git a/qml/models/blockclockmodel.cpp b/qml/models/blockclockmodel.cpp\nindex 8cbf3fa59d..7f88a76bad 100644\n--- a/qml/models/blockclockmodel.cpp\n+++ b/qml/models/blockclockmodel.cpp\n@@ -51,6 +51,13 @@ void BlockClockModel::stop()\n m_clock_timer.stop();\n }\n \n+void BlockClockModel::setTipTime(qint64 tip_time)\n+{\n+ if (m_stopped || m_tip_time == tip_time) return;\n+ m_tip_time = tip_time;\n+ updateLastBlockAge();\n+}\n+\n void BlockClockModel::scheduleHistoryRefresh()\n {\n if (m_history_refresh_pending.exchange(true)) return;\n@@ -75,9 +82,9 @@ void BlockClockModel::updateCurrentTime(const QDateTime& current_time)\n const bool period_changed{m_timeline.period_start != period_start};\n if (period_changed) {\n m_timeline.period_start = period_start;\n- // Keep the previous period for ordinary backwards clock/DST changes,\n- // and retain future timestamps so rollover needs no backend reads.\n- m_history->setRetentionStart(period_start - PERIOD_SECONDS);\n+ // Keep one window before the previous origin so a backwards clock step\n+ // of up to twelve hours, and rollover, need no backend reads.\n+ m_history->setRetentionStart(period_start - 2 * PERIOD_SECONDS);\n if (auto snapshot = m_history->takeSnapshot()) m_cached_block_timestamps = std::move(*snapshot);\n }\n \n@@ -127,11 +134,7 @@ void BlockClockModel::replaceBlockHistory(QList<qint64> block_timestamps)\n \n void BlockClockModel::updateLastBlockAge()\n {\n- qint64 age{-1};\n- if (!m_cached_block_timestamps.isEmpty()) {\n- const qint64 newest{*std::max_element(m_cached_block_timestamps.cbegin(), m_cached_block_timestamps.cend())};\n- age = std::max<qint64>(0, m_timeline.current_time - newest);\n- }\n+ const qint64 age{m_tip_time > 0 ? std::max<qint64>(0, m_timeline.current_time - m_tip_time) : -1};\n if (age == m_last_block_age) return;\n m_last_block_age = age;\n Q_EMIT lastBlockAgeChanged();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 159,
"evidence_id": "456c357769714309b04857bee655f82c",
"finding_id": "finding:5",
"kind": "new_source",
"line": 98,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/models/blockclockmodel.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 4,
"source_job_id": 2155,
"text": " replaceBlockHistory(m_cached_block_timestamps);\n if (period_changed) Q_EMIT periodChanged();\n updateLastBlockAge();\n}\n\nvoid BlockClockModel::scheduleNextClockUpdate(const QDateTime& current_time)\n{\n if (m_stopped) return;\n const QTime time{current_time.time()};\n const int milliseconds_into_minute{time.second() * 1000 + time.msec()};\n m_clock_timer.start(CLOCK_UPDATE_INTERVAL_MS - milliseconds_into_minute);\n}\n\nvoid BlockClockModel::refreshHistory()\n{\n if (m_stopped) return;\n auto snapshot{m_history->takeSnapshot()};\n if (!snapshot) return;\n m_cached_block_timestamps = std::move(*snapshot);\n updateCurrentTime(m_current_time_provider());\n}\n\nvoid BlockClockModel::replaceBlockHistory(QList<qint64> block_timestamps)\n{\n const qint64 window_start{m_timeline.current_time - PERIOD_SECONDS};\n std::sort(block_timestamps.begin(), block_timestamps.end());\n block_timestamps.erase(std::remove_if(block_timestamps.begin(), block_timestamps.end(), [window_start](qint64 timestamp) {\n return timestamp < window_start;\n }), block_timestamps.end());\n\n // Fractions can change without the list changing (new origin, future blocks).\n const auto previous_fractions{m_block_time_fractions};\n m_timeline.block_timestamps = std::move(block_timestamps);\n rebuildBlockTimeFractions();\n if (previous_fractions != m_block_time_fractions) Q_EMIT blockTimeFractionsChanged();\n}\n\nvoid BlockClockModel::updateLastBlockAge()\n{\n const qint64 age{m_tip_time > 0 ? std::max<qint64>(0, m_timeline.current_time - m_tip_time) : -1};\n if (age == m_last_block_age) return;\n m_last_block_age = age;\n Q_EMIT lastBlockAgeChanged();\n}\n\nvoid BlockClockModel::rebuildBlockTimeFractions()\n{\n m_block_time_fractions.clear();\n m_block_time_fractions.reserve(m_timeline.block_timestamps.size());\n for (qint64 timestamp : m_timeline.block_timestamps) {\n m_block_time_fractions.push_back(fractionForTimestamp(timestamp));\n }\n}\n\nqreal BlockClockModel::fractionForTimestamp(qint64 timestamp) const\n{\n if (m_timeline.period_start == 0) return 0.0;\n return std::clamp<qreal>(\n static_cast<qreal>(timestamp - m_timeline.period_start) / PERIOD_SECONDS,\n m_current_time_fraction - 1.0,\n m_current_time_fraction);\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b221ab2b0455..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Closing a warning banner saves dismissal of future occurrencesqml/models/nodemodel.cpp | partially_addressed | AssessmentWhen a warning is observed clearing from the current warning list, its saved dismissal is removed, allowing a later recurrence to show. But the report also identifies the banner Close notice as silently applying persistent dismissal; the supplied diff does not show that banner-close behavior changed to session-only hiding. path_diff: qml/models/nodemodel.cpp; new_source: qml/models/nodemodel.cpp [
{
"evidence_id": "1583ecb648f6472fb4ce61a4fe314a59",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/models/nodemodel.cpp",
"source_generation": 4,
"source_job_id": 2155,
"text": "diff --git a/qml/models/nodemodel.cpp b/qml/models/nodemodel.cpp\nindex c3d0204f56..45ec8e60a1 100644\n--- a/qml/models/nodemodel.cpp\n+++ b/qml/models/nodemodel.cpp\n@@ -96,19 +96,20 @@ bool HasMultipleRuntimeDialogButtons(unsigned int buttons)\n return (buttons & (buttons - 1)) != 0;\n }\n \n-QVariant InformationRow(const QString& id, const QString& label, const QString& value)\n+QVariant InformationRow(const QString& id, const QString& label, const QString& value, bool mono = false)\n {\n QVariantMap row;\n // The id lets views pick rows without matching translated labels.\n row.insert(QStringLiteral(\"id\"), id);\n row.insert(QStringLiteral(\"label\"), label);\n row.insert(QStringLiteral(\"value\"), value);\n+ row.insert(QStringLiteral(\"mono\"), mono);\n return QVariant::fromValue(row);\n }\n \n QVariant DirectoryRow(const QString& id, const QString& label, const QString& path)\n {\n- QVariantMap row{InformationRow(id, label, ShortenHomePath(path, QDir::homePath())).toMap()};\n+ QVariantMap row{InformationRow(id, label, ShortenHomePath(path, QDir::homePath()), /*mono=*/true).toMap()};\n row.insert(QStringLiteral(\"path\"), path);\n row.insert(QStringLiteral(\"url\"), QUrl::fromLocalFile(path));\n return QVariant::fromValue(row);\n@@ -678,6 +679,12 @@ void NodeModel::setWarnings(const QString& warnings)\n if (m_warnings == warnings && m_warning_list == warning_list) {\n return;\n }\n+ // A dismissed warning that clears shows again if it recurs.\n+ bool dismissals_changed{false};\n+ for (const QString& warning : m_warning_list) {\n+ if (!warning_list.contains(warning) && m_dismissed_warnings.removeAll(warning) > 0) dismissals_changed = true;\n+ }\n+ if (dismissals_changed) QSettings{}.setValue(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS), m_dismissed_warnings);\n m_warnings = warnings;\n m_warning_list = warning_list;\n Q_EMIT warningsChanged();\n@@ -820,6 +827,7 @@ void NodeModel::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo\n setBlockTipHeight(tip_info.block_height);\n setVerificationProgress(tip_info.verification_progress);\n setBlockSyncActive(initial_block_download);\n+ Q_EMIT blockTipTimeChanged(m_block_tip_time);\n }\n // LoadChainTip emits an INIT_DOWNLOAD notification even on a caught-up\n // restart. Core's IBD flag only latches false: preserve a newer POST_INIT\n@@ -1034,8 +1042,8 @@ QVariantList NodeModel::nodeInformationRows()\n const QString warning_text{m_warning_list.empty() ? tr(\"None\") : m_warning_list.join(QStringLiteral(\"\\n\"))};\n \n QVariantList rows;\n- rows.push_back(InformationRow(QStringLiteral(\"clientVersion\"), tr(\"Client version\"), fullClientVersion()));\n- rows.push_back(InformationRow(QStringLiteral(\"userAgent\"), tr(\"User agent\"), QString::fromStdString(strSubVersion)));\n+ rows.push_back(InformationRow(QStringLiteral(\"clientVersion\"), tr(\"Client version\"), fullClientVersion(), /*mono=*/true));\n+ rows.push_back(InformationRow(QStringLiteral(\"userAgent\"), tr(\"User agent\"), QString::fromStdString(strSubVersion), /*mono=*/true));\n rows.push_back(DirectoryRow(QStringLiteral(\"dataDir\"), tr(\"Datadir\"), QString::fromStdString(fs::PathToString(gArgs.GetDataDirNet()))));\n rows.push_back(DirectoryRow(QStringLiteral(\"blocksDir\"), tr(\"Blocks dir\"), QString::fromStdString(fs::PathToString(gArgs.GetBlocksDirPath()))));\n rows.push_back(InformationRow(QStringLiteral(\"startupTime\"), tr(\"Startup time\"), QDateTime::currentDateTime().addSecs(-TicksSeconds(GetUptime())).toString()));\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 823,
"evidence_id": "90587bbd47e645cd86ef0b3eedea0124",
"finding_id": "finding:4",
"kind": "new_source",
"line": 674,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/models/nodemodel.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 4,
"source_job_id": 2155,
"text": "}\n\nvoid NodeModel::setWarnings(const QString& warnings)\n{\n const QStringList warning_list{SplitWarnings(warnings)};\n if (m_warnings == warnings && m_warning_list == warning_list) {\n return;\n }\n // A dismissed warning that clears shows again if it recurs.\n bool dismissals_changed{false};\n for (const QString& warning : m_warning_list) {\n if (!warning_list.contains(warning) && m_dismissed_warnings.removeAll(warning) > 0) dismissals_changed = true;\n }\n if (dismissals_changed) QSettings{}.setValue(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS), m_dismissed_warnings);\n m_warnings = warnings;\n m_warning_list = warning_list;\n Q_EMIT warningsChanged();\n}\n\nQStringList NodeModel::activeWarningList() const\n{\n QStringList active;\n for (const QString& warning : m_warning_list) {\n if (!m_dismissed_warnings.contains(warning)) active.push_back(warning);\n }\n return active;\n}\n\nQStringList NodeModel::dismissedWarningList() const\n{\n QStringList dismissed;\n for (const QString& warning : m_warning_list) {\n if (m_dismissed_warnings.contains(warning)) dismissed.push_back(warning);\n }\n return dismissed;\n}\n\nvoid NodeModel::dismissWarnings(const QStringList& warnings)\n{\n bool changed{false};\n for (const QString& warning : warnings) {\n if (warning.isEmpty() || m_dismissed_warnings.contains(warning)) continue;\n m_dismissed_warnings.push_back(warning);\n changed = true;\n }\n if (!changed) return;\n constexpr qsizetype MAX_DISMISSED_WARNINGS{50};\n while (m_dismissed_warnings.size() > MAX_DISMISSED_WARNINGS) m_dismissed_warnings.removeFirst();\n QSettings{}.setValue(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS), m_dismissed_warnings);\n Q_EMIT warningsChanged();\n}\n\nvoid NodeModel::restoreDismissedWarnings()\n{\n if (m_dismissed_warnings.isEmpty()) return;\n m_dismissed_warnings.clear();\n QSettings{}.remove(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS));\n Q_EMIT warningsChanged();\n}\n\nvoid NodeModel::showStartupWarnings()\n{\n if (m_startup_warning_messages.isEmpty()) {\n return;\n }\n\n const QString warnings{m_startup_warning_messages.join(QStringLiteral(\"\\n\\n\"))};\n m_startup_warning_messages.clear();\n // MSG_WARNING is modal; startup notices should be shown once without blocking initialization.\n showRuntimeDialogOnGuiThread(warnings, CClientUIInterface::ICON_WARNING, /*question=*/false);\n}\n\nvoid NodeModel::recordStartupErrorMessage(const QString& message)\n{\n const QString error{message.trimmed()};\n if (error.isEmpty() || m_startup_error_messages.contains(error)) {\n return;\n }\n m_startup_error_messages.push_back(error);\n}\n\nvoid NodeModel::recordStartupWarningMessage(const QString& message)\n{\n const QString warning{message.trimmed()};\n if (warning.isEmpty() || m_startup_warning_messages.contains(warning)) {\n return;\n }\n m_startup_warning_messages.push_back(warning);\n}\n\nvoid NodeModel::startNodeInitializionThread()\n{\n if (m_initialization_requested) {\n return;\n }\n m_initialization_requested = true;\n Q_EMIT requestedInitialize();\n}\n\nvoid NodeModel::requestShutdown()\n{\n if (m_fatal_exception) {\n std::_Exit(EXIT_FAILURE);\n }\n if (m_shutdown_requested) {\n return;\n }\n m_shutdown_requested = true;\n Q_EMIT networkActionReadyChanged();\n while (m_runtime_dialog_active) answerRuntimeDialog(CClientUIInterface::BTN_CANCEL);\n stopShutdownPolling();\n Q_EMIT requestedShutdown();\n}\n\nvoid NodeModel::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info, bool initial_block_download, bool shutdown_requested)\n{\n if (m_workers_stopping || m_fatal_exception) return;\n if (success && (m_shutdown_requested || shutdown_requested)) {\n requestShutdown();\n return;\n }\n\n if (!success) {\n if (m_startup_failure_dialog_shown) {\n requestShutdown();\n Q_EMIT nodeInitialized();\n return;\n }\n setErrorState(true);\n refreshStatus();\n QString startup_error{m_startup_error_messages.isEmpty() ? tr(\"Node initialization failed.\") : m_startup_error_messages.join(QStringLiteral(\"\\n\\n\"))};\n if (!m_startup_warning_messages.isEmpty()) {\n startup_error = tr(\"Startup warnings:\") + QStringLiteral(\"\\n\") + m_startup_warning_messages.join(QStringLiteral(\"\\n\\n\")) + QStringLiteral(\"\\n\\n\") + startup_error;\n }\n m_startup_warning_messages.clear();\n setStartupError(startup_error);\n if (shutdown_requested) {\n requestShutdown();\n }\n } else {\n m_backend_queries_ready = true;\n Q_EMIT networkActionReadyChanged();\n if (m_mempool_info_polling_active) {\n QMetaObject::invokeMethod(m_mempool_info_timer, [timer = m_mempool_info_timer] { timer->start(); }, Qt::QueuedConnection);\n }\n m_startup_error_messages.clear();\n m_runtime_dialogs_enabled = true;\n showStartupWarnings();\n {\n const QScopedValueRollback applying{m_applying_sync_snapshot, true};",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b221ab2b0455..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Closing an offline banner also hides subsequent outage noticesqml/components/NodeBanner.qml | addressed | AssessmentNodeBanner now clears dismissedMessage when message changes away from it, which clears the offline dismissal on recovery and permits the same offline notice to show during a subsequent outage. path_diff: qml/components/NodeBanner.qml; new_source: qml/components/NodeBanner.qml [
{
"evidence_id": "af3131dd3f044b7da27041d471999f6d",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/NodeBanner.qml",
"source_generation": 4,
"source_job_id": 2155,
"text": "diff --git a/qml/components/NodeBanner.qml b/qml/components/NodeBanner.qml\nindex 2aea30b6..f873a8bf 100644\n--- a/qml/components/NodeBanner.qml\n+++ b/qml/components/NodeBanner.qml\n@@ -8,7 +8,8 @@ import QtQuick.Layouts 1.15\n \n import \"../controls\"\n \n-// Closed warnings stay dismissed; other notices return when they change.\n+// Closing hides the current notice for this session; it returns when it\n+// changes or recurs. Saved warning dismissals belong to the Warnings dialog.\n Rectangle {\n id: root\n objectName: \"nodeBanner\"\n@@ -18,13 +19,10 @@ Rectangle {\n ? status.bannerKind + \"\\n\" + status.bannerText : \"\"\n property string dismissedMessage: \"\"\n readonly property bool shown: message.length > 0 && message !== dismissedMessage\n+ onMessageChanged: if (message !== dismissedMessage) dismissedMessage = \"\"\n \n function dismiss() {\n- if (root.status.bannerKind === \"warning\") {\n- root.status.dismissWarnings(root.status.activeWarnings)\n- } else {\n- root.dismissedMessage = root.message\n- }\n+ root.dismissedMessage = root.message\n }\n \n function escaped(text) {\n@@ -32,8 +30,8 @@ Rectangle {\n }\n \n visible: shown\n- implicitHeight: shown ? content.implicitHeight + 24 : 0\n- color: Qt.rgba(status.bannerColor.r, status.bannerColor.g, status.bannerColor.b, status.bannerKind === \"error\" ? 0.16 : 0.14)\n+ implicitHeight: shown ? content.implicitHeight + 2 * Theme.space.ml : 0\n+ color: Theme.color.tint(status.bannerColor)\n \n Rectangle {\n anchors.left: parent.left\n@@ -48,16 +46,16 @@ Rectangle {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n- anchors.leftMargin: 20\n- anchors.rightMargin: 12\n- spacing: 12\n+ anchors.leftMargin: Theme.space.xl\n+ anchors.rightMargin: Theme.space.ml\n+ spacing: Theme.space.ml\n \n Rectangle {\n Layout.alignment: Qt.AlignTop\n- Layout.topMargin: 6\n- implicitWidth: 8\n- implicitHeight: 8\n- radius: 4\n+ Layout.topMargin: Theme.space.s\n+ implicitWidth: Theme.space.m\n+ implicitHeight: Theme.space.m\n+ radius: height / 2\n color: root.status.bannerColor\n }\n CoreText {\n@@ -65,17 +63,16 @@ Rectangle {\n Layout.fillWidth: true\n textFormat: Text.StyledText\n text: \"<b>\" + root.escaped(root.status.bannerTitle) + \"</b> \" + root.escaped(root.status.bannerText)\n- font.pixelSize: 14\n- lineHeight: 1.45\n+ textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n- size: 24\n- iconSize: 8\n backgroundColor: \"transparent\"\n+ backgroundHoverColor: Theme.color.surfaceHover\n+ backgroundPressedColor: Theme.color.surfacePressed\n Accessible.name: qsTr(\"Close notice\")\n onClicked: root.dismiss()\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 80,
"evidence_id": "3e462908fc6047338811491bcd6fa1bd",
"finding_id": "finding:3",
"kind": "new_source",
"line": 1,
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/NodeBanner.qml",
"revision": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"source_generation": 4,
"source_job_id": 2155,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\n\nimport \"../controls\"\n\n// Closing hides the current notice for this session; it returns when it\n// changes or recurs. Saved warning dismissals belong to the Warnings dialog.\nRectangle {\n id: root\n objectName: \"nodeBanner\"\n\n property NodeStatus status: NodeStatus {}\n readonly property string message: status.bannerKind.length > 0\n ? status.bannerKind + \"\\n\" + status.bannerText : \"\"\n property string dismissedMessage: \"\"\n readonly property bool shown: message.length > 0 && message !== dismissedMessage\n onMessageChanged: if (message !== dismissedMessage) dismissedMessage = \"\"\n\n function dismiss() {\n root.dismissedMessage = root.message\n }\n\n function escaped(text) {\n return text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\")\n }\n\n visible: shown\n implicitHeight: shown ? content.implicitHeight + 2 * Theme.space.ml : 0\n color: Theme.color.tint(status.bannerColor)\n\n Rectangle {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.bottom: parent.bottom\n height: 1\n color: root.status.bannerColor\n }\n\n RowLayout {\n id: content\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n anchors.leftMargin: Theme.space.xl\n anchors.rightMargin: Theme.space.ml\n spacing: Theme.space.ml\n\n Rectangle {\n Layout.alignment: Qt.AlignTop\n Layout.topMargin: Theme.space.s\n implicitWidth: Theme.space.m\n implicitHeight: Theme.space.m\n radius: height / 2\n color: root.status.bannerColor\n }\n CoreText {\n objectName: \"nodeBannerText\"\n Layout.fillWidth: true\n textFormat: Text.StyledText\n text: \"<b>\" + root.escaped(root.status.bannerTitle) + \"</b> \" + root.escaped(root.status.bannerText)\n textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n backgroundColor: \"transparent\"\n backgroundHoverColor: Theme.color.surfaceHover\n backgroundPressedColor: Theme.color.surfacePressed\n Accessible.name: qsTr(\"Close notice\")\n onClicked: root.dismiss()\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b221ab2b0455..c693949d1a33 2026-11-21T03:49:00Z · gpt-6-luna |
| gui#994 | Node-only recovery buttons open the default settings sectionqml/pages/node/NodeRunner.qml | unclear | AssessmentNodeRunner now maps recovery actions to connection or debug-log and emits settingsSectionRequested, but the provided diff does not show the signal connected to MainWindow or the section-aware openSettings call. Thus the destination reached by node-only recovery actions is not established. path_diff: qml/pages/node/NodeRunner.qml; new_source: qml/pages/node/NodeRunner.qml [
{
"evidence_id": "beb2177a657c47ab8d6fce6b3e98376e",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/pages/node/NodeRunner.qml",
"source_generation": 4,
"source_job_id": 2155,
"text": "diff --git a/qml/pages/node/NodeRunner.qml b/qml/pages/node/NodeRunner.qml\nindex cf862449c9..f30aae6060 100644\n--- a/qml/pages/node/NodeRunner.qml\n+++ b/qml/pages/node/NodeRunner.qml\n@@ -11,6 +11,7 @@ import \"../../components\"\n \n Page {\n signal settingsClicked\n+ signal settingsSectionRequested(string section)\n signal peersClicked\n id: root\n objectName: \"nodeRunner\"\n@@ -32,16 +33,17 @@ Page {\n NodeStatusBar {\n id: nodeStatusBar\n Layout.alignment: Qt.AlignVCenter\n- onRouteRequested: root.settingsClicked()\n+ onRouteRequested: function(action) {\n+ root.settingsSectionRequested(action === \"debugLog\" ? \"debug-log\" : \"connection\")\n+ }\n onWarningsRequested: nodeWarnings.open()\n }\n IconButton {\n objectName: \"peersTabButton\"\n iconSource: Utils.nodeConnectionIcon(nodeModel.numPeers)\n iconColor: Theme.color.neutral7\n- hoverColor: Theme.color.neutral9\n size: 34\n- iconSize: 24\n+ accessibleName: qsTr(\"Peers\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.peersClicked()\n }\n@@ -49,9 +51,8 @@ Page {\n objectName: \"nodeSettingsButton\"\n iconSource: \"image://images/gear\"\n iconColor: Theme.color.neutral9\n- hoverColor: Theme.color.neutral9\n size: 34\n- iconSize: 34\n+ accessibleName: qsTr(\"Settings\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.settingsClicked()\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 101,
"evidence_id": "899175e90a864474be59fd12a654a404",
"finding_id": "finding:2",
"kind": "new_source",
"line": 5,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/pages/node/NodeRunner.qml",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 4,
"source_job_id": 2155,
"text": "import QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\nimport \"../../controls\"\nimport \"../../controls/utils.js\" as Utils\nimport \"../../components\"\n\nPage {\n signal settingsClicked\n signal settingsSectionRequested(string section)\n signal peersClicked\n id: root\n objectName: \"nodeRunner\"\n background: null\n clip: true\n header: NavigationBar2 {\n rightItem: Item {\n implicitWidth: actionsRow.implicitWidth + 12\n implicitHeight: actionsRow.implicitHeight + 10\n\n RowLayout {\n id: actionsRow\n anchors.top: parent.top\n anchors.right: parent.right\n anchors.topMargin: 8\n anchors.rightMargin: 12\n spacing: 4\n\n NodeStatusBar {\n id: nodeStatusBar\n Layout.alignment: Qt.AlignVCenter\n onRouteRequested: function(action) {\n root.settingsSectionRequested(action === \"debugLog\" ? \"debug-log\" : \"connection\")\n }\n onWarningsRequested: nodeWarnings.open()\n }\n IconButton {\n objectName: \"peersTabButton\"\n iconSource: Utils.nodeConnectionIcon(nodeModel.numPeers)\n iconColor: Theme.color.neutral7\n size: 34\n accessibleName: qsTr(\"Peers\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.peersClicked()\n }\n IconButton {\n objectName: \"nodeSettingsButton\"\n iconSource: \"image://images/gear\"\n iconColor: Theme.color.neutral9\n size: 34\n accessibleName: qsTr(\"Settings\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.settingsClicked()\n }\n }\n }\n }\n\n Component.onCompleted: nodeModel.startNodeInitializionThread();\n\n function openNodeDetails() {\n nodeDetails.open()\n }\n\n NodeBanner {\n anchors.top: parent.top\n anchors.left: parent.left\n anchors.right: parent.right\n z: 2\n }\n\n BlockClock {\n parentWidth: parent.width - 40\n parentHeight: parent.height\n anchors.centerIn: parent\n renderingActive: root.visible\n showDetailsLink: true\n onDetailsRequested: nodeDetails.open()\n onWarningsRequested: nodeWarnings.open()\n }\n\n NodeWarningsPopup {\n id: nodeWarnings\n }\n\n NodeDetailsPopup {\n id: nodeDetails\n onActionTriggered: function(action) { nodeStatusBar.trigger(action) }\n }\n\n NewBlockToast {\n anchors.horizontalCenter: parent.horizontalCenter\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 72\n active: root.visible\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b221ab2b0455..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Dismissing all warnings removes access to their restore controlsqml/components/WarningsLink.qml | partially_addressed | AssessmentWarningsLink supports a dismissed-only link and Node details explicitly enables it, but the excerpts do not establish that all other warning-link instances enable showDismissed. The requested close-popup, reopen-through-UI, restore test is also not evidenced. path_diff: qml/components/WarningsLink.qml; new_source: qml/components/WarningsLink.qml [
{
"evidence_id": "361170850ffd4cfb8386c71f641d384c",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/WarningsLink.qml",
"source_generation": 4,
"source_job_id": 2155,
"text": "diff --git a/qml/components/WarningsLink.qml b/qml/components/WarningsLink.qml\nindex 62afa901a3..9210da8348 100644\n--- a/qml/components/WarningsLink.qml\n+++ b/qml/components/WarningsLink.qml\n@@ -5,6 +5,8 @@\n import QtQuick 2.15\n import QtQuick.Controls 2.15\n \n+import org.bitcoincore.qt 1.0\n+\n import \"../controls\"\n \n AbstractButton {\n@@ -12,12 +14,24 @@ AbstractButton {\n objectName: \"warningsLink\"\n \n property NodeStatus status: NodeStatus {}\n- property int pixelSize: 14\n+ property var textStyle: Theme.text.caption\n+ // Keeps the dialog reachable to restore warnings once all are dismissed.\n+ property bool showDismissed: false\n \n- readonly property bool shown: status.warningsText.length > 0\n+ readonly property int dismissedCount: status.dismissedWarnings.length\n+ readonly property bool dismissedOnly: status.warningCount === 0 && showDismissed && dismissedCount > 0\n+ readonly property bool shown: status.warningsText.length > 0 || dismissedOnly\n visible: shown\n- text: status.warningsText\n- hoverEnabled: true\n+ text: {\n+ if (!dismissedOnly) return status.warningsText\n+ if (dismissedCount === 1) {\n+ //: Link that reopens the node warnings dialog after the user dismissed the only current warning.\n+ return qsTr(\"1 dismissed warning\")\n+ }\n+ //: Link that reopens the node warnings dialog after the user dismissed every current warning. %1 is the count.\n+ return qsTr(\"%1 dismissed warnings\").arg(dismissedCount)\n+ }\n+ hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n padding: 0\n implicitWidth: content.implicitWidth\n@@ -31,19 +45,20 @@ AbstractButton {\n \n contentItem: Row {\n id: content\n- spacing: 10\n+ spacing: Theme.space.ml\n CoreText {\n text: \"·\"\n- font.pixelSize: root.pixelSize\n+ textStyle: root.textStyle\n wrap: false\n- color: Theme.color.neutral5\n+ color: Theme.color.neutral6\n+ Accessible.ignored: true\n }\n CoreText {\n objectName: \"warningsLinkText\"\n text: root.text\n- font.pixelSize: root.pixelSize\n+ textStyle: root.textStyle\n wrap: false\n- color: Theme.color.amber\n+ color: root.dismissedOnly ? Theme.color.neutral7 : Theme.color.warningText\n }\n }\n \n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 69,
"evidence_id": "7314746fe43d4dac89d922b927fa32ed",
"finding_id": "finding:1",
"kind": "new_source",
"line": 1,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "b221ab2b0455d0f4bfb5738b05d8526ac51af3ab",
"path": "qml/components/WarningsLink.qml",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 4,
"source_job_id": 2155,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\n\nimport org.bitcoincore.qt 1.0\n\nimport \"../controls\"\n\nAbstractButton {\n id: root\n objectName: \"warningsLink\"\n\n property NodeStatus status: NodeStatus {}\n property var textStyle: Theme.text.caption\n // Keeps the dialog reachable to restore warnings once all are dismissed.\n property bool showDismissed: false\n\n readonly property int dismissedCount: status.dismissedWarnings.length\n readonly property bool dismissedOnly: status.warningCount === 0 && showDismissed && dismissedCount > 0\n readonly property bool shown: status.warningsText.length > 0 || dismissedOnly\n visible: shown\n text: {\n if (!dismissedOnly) return status.warningsText\n if (dismissedCount === 1) {\n //: Link that reopens the node warnings dialog after the user dismissed the only current warning.\n return qsTr(\"1 dismissed warning\")\n }\n //: Link that reopens the node warnings dialog after the user dismissed every current warning. %1 is the count.\n return qsTr(\"%1 dismissed warnings\").arg(dismissedCount)\n }\n hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n padding: 0\n implicitWidth: content.implicitWidth\n implicitHeight: content.implicitHeight\n opacity: down ? 0.7 : hovered ? 0.85 : 1\n Accessible.role: Accessible.Link\n Accessible.name: text\n Accessible.description: qsTr(\"Shows the warnings your node reported\")\n\n HoverHandler { cursorShape: Qt.PointingHandCursor }\n\n contentItem: Row {\n id: content\n spacing: Theme.space.ml\n CoreText {\n text: \"·\"\n textStyle: root.textStyle\n wrap: false\n color: Theme.color.neutral6\n Accessible.ignored: true\n }\n CoreText {\n objectName: \"warningsLinkText\"\n text: root.text\n textStyle: root.textStyle\n wrap: false\n color: root.dismissedOnly ? Theme.color.neutral7 : Theme.color.warningText\n }\n }\n\n background: FocusBorder {\n visible: root.visualFocus\n borderRadius: 6\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · b221ab2b0455..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#1052 | ExternalPopup keeps fixed text sizes and inconsistent copyqml/components/ExternalPopup.qml | partially_addressed | AssessmentThe URL now uses the scalable `Theme.text.description` role, but the title remains “Open link?” rather than the requested “External link”; the excerpt also still shows the fixed-size issue was addressed for the URL. The confirmation label is “OK,” and failed-open/copy fallback handling is retained. The new excerpt sets `textStyle: Theme.text.description` on the URL and `text: qsTr("OK")`; the diff changes the visible title to `qsTr("Open link?")`, while the heading's former fixed-size literal is removed through conversion to AlertPopup. Source report · 5bdd039b2640..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Reduced motion reads the OS preference only at startupqml/motionpreference.h | still_present | AssessmentThe motion mode still uses immutable startup sampling, and no explicit user-facing startup-only disclosure is evidenced. The header retains `Q_PROPERTY(QString mode READ mode CONSTANT)` and `const QString m_mode`. Source report · 5bdd039b2640..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Switch thumb still slides under reduced and off motionqml/controls/OptionSwitch.qml | still_present | AssessmentThe switch thumb position Behavior remains unconditional. The new OptionSwitch excerpt shows `Behavior on x { SmoothedAnimation { } }` without an enabled condition. Source report · 5bdd039b2640..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Password reveal state persists across passphrase promptsqml/components/WalletPassphrasePopup.qml | still_present | AssessmentPrompt cleanup clears the passphrase text but does not reset the field's password visibility state. `clearPassphraseField()` only overwrites and clears `passphraseField.text`; no `passwordVisible` reset appears. Source report · 5bdd039b2640..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Return confirms the full-wallet send without focusing its buttonqml/pages/wallet/SendTransactionReview.qml | still_present | AssessmentThe “Send all funds” action still lacks a Destructive role, leaving it subject to the default Return acceptance behavior. The new excerpt contains no role assignment on the confirmation AlertAction. Source report · 5bdd039b2640..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1062 | Post-update QR checks do not inspect the exported imagetest/functional/qml_test_receive.py | addressed | AssessmentThe test now performs a fresh Save QR export after Update, so post-Update export behavior is exercised rather than inferred only from the QR image's code property. The added block saves to `request-qr-applied.png`, waits for the file, checks the PNG signature, and compares its bytes with the original export (lines 353–370). Source report · af572a25bd7e..3db3212eee5e 2026-11-05T00:54:58Z · gpt-6-luna |
| gui#1062 | Open details on a hidden address repeat the wallet scan on every refreshqml/models/addresslistmodel.cpp | addressed | AssessmentThe repeated wallet scan on hidden-address lookup is removed. `rebuild()` now calls `collectEntries()` once, partitions used receive entries into `m_hidden_entries` when filtered, and `entryForAddress()` searches that retained list instead of calling `collectEntries(true)`. The diff replaces the fallback `collectEntries(/*include_used=*/true)` with iteration over `m_hidden_entries`; `rebuild()` populates visible and hidden vectors from one `collectEntries()` result. The unit test also records `getWalletTxs()` calls and verifies that `entryForAddress()` adds no call after refresh. Source report · af572a25bd7e..1ea3a94995ba 2026-11-04T20:37:15Z · gpt-6-luna |
| gui#994 | Speed-row placement depends on matching separate translationsqml/components/NodeDetailsPopup.qml | addressed | AssessmentwithSpeedRow now locates the Progress entry by the stable id progress rather than comparing translated labels. The supplied diff establishes the lookup change, although the new excerpt does not include the row-construction change requested in the finding. path_diff: qml/components/NodeDetailsPopup.qml [
{
"evidence_id": "48084165e6e5400d986b4e5d8ee40657",
"finding_id": "finding:9",
"kind": "path_diff",
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/NodeDetailsPopup.qml",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/components/NodeDetailsPopup.qml b/qml/components/NodeDetailsPopup.qml\nindex 1b870372..9044ebad 100644\n--- a/qml/components/NodeDetailsPopup.qml\n+++ b/qml/components/NodeDetailsPopup.qml\n@@ -6,9 +6,11 @@ import QtQuick 2.15\n import QtQuick.Controls 2.15\n import QtQuick.Layouts 1.15\n \n+import org.bitcoincore.qt 1.0\n+\n import \"../controls\"\n \n-Popup {\n+DialogPopup {\n id: root\n objectName: \"nodeDetailsPopup\"\n \n@@ -36,12 +38,8 @@ Popup {\n onMoreExpandedChanged: if (moreExpanded) root.loadAboutRows()\n signal actionTriggered(string action)\n \n- parent: Overlay.overlay\n- anchors.centerIn: parent\n- modal: true\n- width: parent ? Math.min(440, parent.width - 48) : 440\n- height: parent ? Math.min(implicitHeight, parent.height - 48) : implicitHeight\n- padding: 24\n+ title: qsTr(\"Node details\")\n+ implicitWidth: 480\n \n onOpened: {\n if (root.status.nodeModelRef !== null && root.status.nodeModelRef.mempoolInfoPollingActive !== undefined) root.status.nodeModelRef.mempoolInfoPollingActive = true\n@@ -84,7 +82,7 @@ Popup {\n \n function withSpeedRow(rows) {\n if (root.status.key !== \"blocks\") return rows\n- const progress = rows.findIndex(function(row) { return row.key === qsTr(\"Progress\") })\n+ const progress = rows.findIndex(function(row) { return row.id === \"progress\" })\n if (progress < 0) return rows\n let speed = root.syncSpeedText\n if (root.trafficRef !== null) speed += \" · ↓ \" + root.rateText(root.trafficRef.receivedRateList)\n@@ -124,7 +122,7 @@ Popup {\n for (const row of node.nodeInformationRows()) byId[row.id] = row\n const rows = []\n for (const [id, label] of root.aboutLabels) {\n- if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path })\n+ if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path, mono: byId[id].mono })\n }\n root.aboutRows = rows\n }\n@@ -147,58 +145,37 @@ Popup {\n onTriggered: root.sampleSyncSpeed()\n }\n \n- enter: Transition {\n- NumberAnimation { property: \"opacity\"; from: 0; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- NumberAnimation { property: \"scale\"; from: 0.98; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- }\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 12\n- border.width: 1\n- border.color: Theme.color.neutral3\n- }\n-\n contentItem: ColumnLayout {\n spacing: 0\n \n- RowLayout {\n+ DialogHeader {\n Layout.fillWidth: true\n- Layout.bottomMargin: 16\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"Node details\")\n- bold: true\n- font.pixelSize: 18\n- horizontalAlignment: Text.AlignLeft\n- }\n- CloseButton {\n- objectName: \"nodeDetailsCloseButton\"\n- size: 32\n- onClicked: root.close()\n- }\n+ Layout.bottomMargin: Theme.space.l\n+ title: root.title\n+ closeButtonObjectName: \"nodeDetailsCloseButton\"\n+ onCloseRequested: root.close()\n }\n \n RowLayout {\n- Layout.bottomMargin: 12\n- spacing: 8\n+ Layout.bottomMargin: Theme.space.ml\n+ spacing: Theme.space.m\n Rectangle {\n Layout.alignment: Qt.AlignVCenter\n- implicitWidth: 8\n- implicitHeight: 8\n- radius: 4\n+ implicitWidth: Theme.space.m\n+ implicitHeight: Theme.space.m\n+ radius: height / 2\n color: root.status.tone\n }\n CoreText {\n objectName: \"nodeDetailsStatus\"\n text: root.status.label\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.captionStrong\n wrap: false\n }\n WarningsLink {\n objectName: \"nodeDetailsWarnings\"\n status: root.status\n+ showDismissed: true\n onClicked: {\n root.close()\n root.actionTriggered(\"warnings\")\n@@ -234,10 +211,10 @@ Popup {\n AbstractButton {\n id: moreToggle\n objectName: \"nodeDetailsMoreToggle\"\n- topPadding: 12\n- bottomPadding: 8\n+ topPadding: Theme.space.ml\n+ bottomPadding: Theme.space.m\n text: root.moreExpanded ? qsTr(\"Fewer details\") : qsTr(\"More details\")\n- hoverEnabled: true\n+ hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n Accessible.name: text\n implicitWidth: moreToggleContent.implicitWidth + leftPadding + rightPadding\n@@ -249,19 +226,19 @@ Popup {\n \n contentItem: Row {\n id: moreToggleContent\n- spacing: 4\n+ spacing: Theme.space.xs\n CoreText {\n anchors.verticalCenter: parent.verticalCenter\n text: moreToggle.text\n- font: Theme.text.captionStrong.font\n+ textStyle: Theme.text.captionStrong\n wrap: false\n- color: Theme.color.orange\n+ color: Theme.color.accentText\n }\n CaretRightIcon {\n objectName: \"nodeDetailsMoreCaret\"\n anchors.verticalCenter: parent.verticalCenter\n- size: 12\n- color: Theme.color.orange\n+ size: Theme.size.caretDense\n+ color: Theme.color.accentText\n rotation: root.moreExpanded ? -90 : 90\n }\n }\n@@ -287,11 +264,10 @@ Popup {\n objectName: \"nodeDetailsAboutHeading\"\n visible: root.moreExpanded && root.aboutRows.length > 0\n width: rowsColumn.width\n- topPadding: 24\n- bottomPadding: 8\n+ topPadding: Theme.space.xxl\n+ bottomPadding: Theme.space.m\n text: qsTr(\"About this node\")\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.subheading\n horizontalAlignment: Text.AlignLeft\n }\n Repeater {\n@@ -308,12 +284,11 @@ Popup {\n \n RowLayout {\n Layout.fillWidth: true\n- Layout.topMargin: 20\n- spacing: 8\n+ Layout.topMargin: Theme.space.xl\n+ spacing: Theme.space.m\n NodeActionButton {\n objectName: \"nodeDetailsPrimaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n text: root.status.primaryActionText\n accent: root.status.primaryActionAccent\n enabled: root.status.primaryActionEnabled\n@@ -327,7 +302,6 @@ Popup {\n NodeActionButton {\n objectName: \"nodeDetailsSecondaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n visible: root.status.secondaryAction.length > 0\n text: root.status.secondaryActionText\n onClicked: {\n@@ -345,20 +319,20 @@ Popup {\n property string valueObjectName: \"\"\n property bool showTopLine: true\n readonly property bool isLink: row.url !== undefined && row.url.toString().length > 0\n- implicitHeight: 44\n+ implicitHeight: Math.max(Theme.size.row, valueText.height + 2 * Theme.space.ml)\n \n Rectangle {\n visible: detailRow.showTopLine\n width: parent.width\n height: 1\n- color: Theme.color.neutral3\n+ color: Theme.color.surfaceDivider\n }\n CoreText {\n id: keyText\n anchors.left: parent.left\n- anchors.verticalCenter: parent.verticalCenter\n+ anchors.top: valueText.top\n text: detailRow.row.key\n- font.pixelSize: 14\n+ textStyle: Theme.text.caption\n wrap: false\n color: Theme.color.neutral7\n }\n@@ -367,27 +341,35 @@ Popup {\n objectName: detailRow.valueObjectName\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n- width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - 16)\n+ width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - Theme.space.l)\n text: detailRow.row.value\n- bold: true\n- font.pixelSize: 14\n- wrap: false\n- elide: Text.ElideMiddle\n+ textStyle: detailRow.row.mono === true ? Theme.text.monoCaption : Theme.text.captionStrong\n+ // Wrap rather than elide so long paths and address lists stay readable.\n+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere\n horizontalAlignment: Text.AlignRight\n- color: detailRow.isLink ? Theme.color.orange : Theme.color.neutral9\n- opacity: linkArea.pressed ? 0.7 : linkArea.containsMouse ? 0.85 : 1\n+ color: detailRow.isLink ? Theme.color.accentText : Theme.color.neutral9\n+ opacity: linkButton.down ? 0.7 : linkButton.hovered ? 0.85 : 1\n \n- MouseArea {\n- id: linkArea\n+ AbstractButton {\n+ id: linkButton\n objectName: detailRow.valueObjectName.length > 0 ? detailRow.valueObjectName + \"_link\" : \"\"\n anchors.fill: parent\n enabled: detailRow.isLink\n- hoverEnabled: true\n- cursorShape: Qt.PointingHandCursor\n+ hoverEnabled: AppMode.isDesktop\n+ focusPolicy: Qt.StrongFocus\n Accessible.role: Accessible.Link\n Accessible.name: detailRow.row.key + \": \" + detailRow.row.value\n Accessible.description: qsTr(\"Opens the folder in your file manager\")\n+ Keys.onReturnPressed: clicked()\n+ Keys.onEnterPressed: clicked()\n onClicked: Qt.openUrlExternally(detailRow.row.url)\n+\n+ HoverHandler { cursorShape: Qt.PointingHandCursor }\n+\n+ background: FocusBorder {\n+ visible: linkButton.visualFocus\n+ borderRadius: 6\n+ }\n }\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..c693949d1a33 2026-11-21T03:49:00Z · gpt-6-luna |
| gui#994 | Last-block age uses the largest header timestamp, not arrival timeqml/models/blockclockmodel.cpp | still_present | AssessmentThe age calculation now uses the active tip's block time rather than the largest cached timestamp, but it still clamps future block times to zero age. The supplied evidence does not show the requested labeling change or corrected onboarding wording, so the future-timestamp misdescription remains. path_diff: qml/models/blockclockmodel.cpp; new_source: qml/models/blockclockmodel.cpp [
{
"evidence_id": "854dbce665e549fd8d0f973e04774842",
"finding_id": "finding:8",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/models/blockclockmodel.cpp",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/models/blockclockmodel.cpp b/qml/models/blockclockmodel.cpp\nindex 8cbf3fa59d..7f88a76bad 100644\n--- a/qml/models/blockclockmodel.cpp\n+++ b/qml/models/blockclockmodel.cpp\n@@ -51,6 +51,13 @@ void BlockClockModel::stop()\n m_clock_timer.stop();\n }\n \n+void BlockClockModel::setTipTime(qint64 tip_time)\n+{\n+ if (m_stopped || m_tip_time == tip_time) return;\n+ m_tip_time = tip_time;\n+ updateLastBlockAge();\n+}\n+\n void BlockClockModel::scheduleHistoryRefresh()\n {\n if (m_history_refresh_pending.exchange(true)) return;\n@@ -75,9 +82,9 @@ void BlockClockModel::updateCurrentTime(const QDateTime& current_time)\n const bool period_changed{m_timeline.period_start != period_start};\n if (period_changed) {\n m_timeline.period_start = period_start;\n- // Keep the previous period for ordinary backwards clock/DST changes,\n- // and retain future timestamps so rollover needs no backend reads.\n- m_history->setRetentionStart(period_start - PERIOD_SECONDS);\n+ // Keep one window before the previous origin so a backwards clock step\n+ // of up to twelve hours, and rollover, need no backend reads.\n+ m_history->setRetentionStart(period_start - 2 * PERIOD_SECONDS);\n if (auto snapshot = m_history->takeSnapshot()) m_cached_block_timestamps = std::move(*snapshot);\n }\n \n@@ -127,11 +134,7 @@ void BlockClockModel::replaceBlockHistory(QList<qint64> block_timestamps)\n \n void BlockClockModel::updateLastBlockAge()\n {\n- qint64 age{-1};\n- if (!m_cached_block_timestamps.isEmpty()) {\n- const qint64 newest{*std::max_element(m_cached_block_timestamps.cbegin(), m_cached_block_timestamps.cend())};\n- age = std::max<qint64>(0, m_timeline.current_time - newest);\n- }\n+ const qint64 age{m_tip_time > 0 ? std::max<qint64>(0, m_timeline.current_time - m_tip_time) : -1};\n if (age == m_last_block_age) return;\n m_last_block_age = age;\n Q_EMIT lastBlockAgeChanged();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 159,
"evidence_id": "35595ac7298a4725a06b8da1dd4e9bfe",
"finding_id": "finding:8",
"kind": "new_source",
"line": 98,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/models/blockclockmodel.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 3,
"source_job_id": 2097,
"text": " replaceBlockHistory(m_cached_block_timestamps);\n if (period_changed) Q_EMIT periodChanged();\n updateLastBlockAge();\n}\n\nvoid BlockClockModel::scheduleNextClockUpdate(const QDateTime& current_time)\n{\n if (m_stopped) return;\n const QTime time{current_time.time()};\n const int milliseconds_into_minute{time.second() * 1000 + time.msec()};\n m_clock_timer.start(CLOCK_UPDATE_INTERVAL_MS - milliseconds_into_minute);\n}\n\nvoid BlockClockModel::refreshHistory()\n{\n if (m_stopped) return;\n auto snapshot{m_history->takeSnapshot()};\n if (!snapshot) return;\n m_cached_block_timestamps = std::move(*snapshot);\n updateCurrentTime(m_current_time_provider());\n}\n\nvoid BlockClockModel::replaceBlockHistory(QList<qint64> block_timestamps)\n{\n const qint64 window_start{m_timeline.current_time - PERIOD_SECONDS};\n std::sort(block_timestamps.begin(), block_timestamps.end());\n block_timestamps.erase(std::remove_if(block_timestamps.begin(), block_timestamps.end(), [window_start](qint64 timestamp) {\n return timestamp < window_start;\n }), block_timestamps.end());\n\n // Fractions can change without the list changing (new origin, future blocks).\n const auto previous_fractions{m_block_time_fractions};\n m_timeline.block_timestamps = std::move(block_timestamps);\n rebuildBlockTimeFractions();\n if (previous_fractions != m_block_time_fractions) Q_EMIT blockTimeFractionsChanged();\n}\n\nvoid BlockClockModel::updateLastBlockAge()\n{\n const qint64 age{m_tip_time > 0 ? std::max<qint64>(0, m_timeline.current_time - m_tip_time) : -1};\n if (age == m_last_block_age) return;\n m_last_block_age = age;\n Q_EMIT lastBlockAgeChanged();\n}\n\nvoid BlockClockModel::rebuildBlockTimeFractions()\n{\n m_block_time_fractions.clear();\n m_block_time_fractions.reserve(m_timeline.block_timestamps.size());\n for (qint64 timestamp : m_timeline.block_timestamps) {\n m_block_time_fractions.push_back(fractionForTimestamp(timestamp));\n }\n}\n\nqreal BlockClockModel::fractionForTimestamp(qint64 timestamp) const\n{\n if (m_timeline.period_start == 0) return 0.0;\n return std::clamp<qreal>(\n static_cast<qreal>(timestamp - m_timeline.period_start) / PERIOD_SECONDS,\n m_current_time_fraction - 1.0,\n m_current_time_fraction);\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Closing a warning banner persistently dismisses future recurrencesqml/components/NodeBanner.qml | addressed | AssessmentClosing the banner now only records the current message in a local dismissedMessage property; it no longer calls dismissWarnings or persists warning text. Persistent dismissal is therefore not triggered by the generic banner close action. path_diff: qml/components/NodeBanner.qml; new_source: qml/components/NodeBanner.qml [
{
"evidence_id": "940958df3f684152b054f31a0f314074",
"finding_id": "finding:7",
"kind": "path_diff",
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/NodeBanner.qml",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/components/NodeBanner.qml b/qml/components/NodeBanner.qml\nindex 2aea30b6..f873a8bf 100644\n--- a/qml/components/NodeBanner.qml\n+++ b/qml/components/NodeBanner.qml\n@@ -8,7 +8,8 @@ import QtQuick.Layouts 1.15\n \n import \"../controls\"\n \n-// Closed warnings stay dismissed; other notices return when they change.\n+// Closing hides the current notice for this session; it returns when it\n+// changes or recurs. Saved warning dismissals belong to the Warnings dialog.\n Rectangle {\n id: root\n objectName: \"nodeBanner\"\n@@ -18,13 +19,10 @@ Rectangle {\n ? status.bannerKind + \"\\n\" + status.bannerText : \"\"\n property string dismissedMessage: \"\"\n readonly property bool shown: message.length > 0 && message !== dismissedMessage\n+ onMessageChanged: if (message !== dismissedMessage) dismissedMessage = \"\"\n \n function dismiss() {\n- if (root.status.bannerKind === \"warning\") {\n- root.status.dismissWarnings(root.status.activeWarnings)\n- } else {\n- root.dismissedMessage = root.message\n- }\n+ root.dismissedMessage = root.message\n }\n \n function escaped(text) {\n@@ -32,8 +30,8 @@ Rectangle {\n }\n \n visible: shown\n- implicitHeight: shown ? content.implicitHeight + 24 : 0\n- color: Qt.rgba(status.bannerColor.r, status.bannerColor.g, status.bannerColor.b, status.bannerKind === \"error\" ? 0.16 : 0.14)\n+ implicitHeight: shown ? content.implicitHeight + 2 * Theme.space.ml : 0\n+ color: Theme.color.tint(status.bannerColor)\n \n Rectangle {\n anchors.left: parent.left\n@@ -48,16 +46,16 @@ Rectangle {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n- anchors.leftMargin: 20\n- anchors.rightMargin: 12\n- spacing: 12\n+ anchors.leftMargin: Theme.space.xl\n+ anchors.rightMargin: Theme.space.ml\n+ spacing: Theme.space.ml\n \n Rectangle {\n Layout.alignment: Qt.AlignTop\n- Layout.topMargin: 6\n- implicitWidth: 8\n- implicitHeight: 8\n- radius: 4\n+ Layout.topMargin: Theme.space.s\n+ implicitWidth: Theme.space.m\n+ implicitHeight: Theme.space.m\n+ radius: height / 2\n color: root.status.bannerColor\n }\n CoreText {\n@@ -65,17 +63,16 @@ Rectangle {\n Layout.fillWidth: true\n textFormat: Text.StyledText\n text: \"<b>\" + root.escaped(root.status.bannerTitle) + \"</b> \" + root.escaped(root.status.bannerText)\n- font.pixelSize: 14\n- lineHeight: 1.45\n+ textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n- size: 24\n- iconSize: 8\n backgroundColor: \"transparent\"\n+ backgroundHoverColor: Theme.color.surfaceHover\n+ backgroundPressedColor: Theme.color.surfacePressed\n Accessible.name: qsTr(\"Close notice\")\n onClicked: root.dismiss()\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 80,
"evidence_id": "4a6b2420cbef439fb6bc41b088ce7552",
"finding_id": "finding:7",
"kind": "new_source",
"line": 1,
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/NodeBanner.qml",
"revision": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"source_generation": 3,
"source_job_id": 2097,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\n\nimport \"../controls\"\n\n// Closing hides the current notice for this session; it returns when it\n// changes or recurs. Saved warning dismissals belong to the Warnings dialog.\nRectangle {\n id: root\n objectName: \"nodeBanner\"\n\n property NodeStatus status: NodeStatus {}\n readonly property string message: status.bannerKind.length > 0\n ? status.bannerKind + \"\\n\" + status.bannerText : \"\"\n property string dismissedMessage: \"\"\n readonly property bool shown: message.length > 0 && message !== dismissedMessage\n onMessageChanged: if (message !== dismissedMessage) dismissedMessage = \"\"\n\n function dismiss() {\n root.dismissedMessage = root.message\n }\n\n function escaped(text) {\n return text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\")\n }\n\n visible: shown\n implicitHeight: shown ? content.implicitHeight + 2 * Theme.space.ml : 0\n color: Theme.color.tint(status.bannerColor)\n\n Rectangle {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.bottom: parent.bottom\n height: 1\n color: root.status.bannerColor\n }\n\n RowLayout {\n id: content\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n anchors.leftMargin: Theme.space.xl\n anchors.rightMargin: Theme.space.ml\n spacing: Theme.space.ml\n\n Rectangle {\n Layout.alignment: Qt.AlignTop\n Layout.topMargin: Theme.space.s\n implicitWidth: Theme.space.m\n implicitHeight: Theme.space.m\n radius: height / 2\n color: root.status.bannerColor\n }\n CoreText {\n objectName: \"nodeBannerText\"\n Layout.fillWidth: true\n textFormat: Text.StyledText\n text: \"<b>\" + root.escaped(root.status.bannerTitle) + \"</b> \" + root.escaped(root.status.bannerText)\n textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n backgroundColor: \"transparent\"\n backgroundHoverColor: Theme.color.surfaceHover\n backgroundPressedColor: Theme.color.surfacePressed\n Accessible.name: qsTr(\"Close notice\")\n onClicked: root.dismiss()\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..c693949d1a33 2026-11-21T03:49:00Z · gpt-6-luna |
| gui#994 | A backward clock step can leave gaps in the rolling block historyqml/models/blockclockmodel.cpp | partially_addressed | AssessmentRetention now keeps two periods of history, which can cover the stated backward step of up to twelve hours. However, the report calls for reloading history when the clock moves backward, and the shown code only changes the retention start and snapshots the existing cache; it does not reload previously pruned timestamps. Larger or otherwise uncovered rewinds can still leave missing history. path_diff: qml/models/blockclockmodel.cpp; new_source: qml/models/blockclockmodel.cpp [
{
"evidence_id": "a9286d4c3b7a41a3878b8985211c5e24",
"finding_id": "finding:5",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/models/blockclockmodel.cpp",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/models/blockclockmodel.cpp b/qml/models/blockclockmodel.cpp\nindex 8cbf3fa59d..7f88a76bad 100644\n--- a/qml/models/blockclockmodel.cpp\n+++ b/qml/models/blockclockmodel.cpp\n@@ -51,6 +51,13 @@ void BlockClockModel::stop()\n m_clock_timer.stop();\n }\n \n+void BlockClockModel::setTipTime(qint64 tip_time)\n+{\n+ if (m_stopped || m_tip_time == tip_time) return;\n+ m_tip_time = tip_time;\n+ updateLastBlockAge();\n+}\n+\n void BlockClockModel::scheduleHistoryRefresh()\n {\n if (m_history_refresh_pending.exchange(true)) return;\n@@ -75,9 +82,9 @@ void BlockClockModel::updateCurrentTime(const QDateTime& current_time)\n const bool period_changed{m_timeline.period_start != period_start};\n if (period_changed) {\n m_timeline.period_start = period_start;\n- // Keep the previous period for ordinary backwards clock/DST changes,\n- // and retain future timestamps so rollover needs no backend reads.\n- m_history->setRetentionStart(period_start - PERIOD_SECONDS);\n+ // Keep one window before the previous origin so a backwards clock step\n+ // of up to twelve hours, and rollover, need no backend reads.\n+ m_history->setRetentionStart(period_start - 2 * PERIOD_SECONDS);\n if (auto snapshot = m_history->takeSnapshot()) m_cached_block_timestamps = std::move(*snapshot);\n }\n \n@@ -127,11 +134,7 @@ void BlockClockModel::replaceBlockHistory(QList<qint64> block_timestamps)\n \n void BlockClockModel::updateLastBlockAge()\n {\n- qint64 age{-1};\n- if (!m_cached_block_timestamps.isEmpty()) {\n- const qint64 newest{*std::max_element(m_cached_block_timestamps.cbegin(), m_cached_block_timestamps.cend())};\n- age = std::max<qint64>(0, m_timeline.current_time - newest);\n- }\n+ const qint64 age{m_tip_time > 0 ? std::max<qint64>(0, m_timeline.current_time - m_tip_time) : -1};\n if (age == m_last_block_age) return;\n m_last_block_age = age;\n Q_EMIT lastBlockAgeChanged();\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 159,
"evidence_id": "1d05676626b04fcbbf73e402fa1c81e6",
"finding_id": "finding:5",
"kind": "new_source",
"line": 85,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/models/blockclockmodel.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 3,
"source_job_id": 2097,
"text": " // Keep one window before the previous origin so a backwards clock step\n // of up to twelve hours, and rollover, need no backend reads.\n m_history->setRetentionStart(period_start - 2 * PERIOD_SECONDS);\n if (auto snapshot = m_history->takeSnapshot()) m_cached_block_timestamps = std::move(*snapshot);\n }\n\n const qreal fraction{std::clamp<qreal>(\n static_cast<qreal>(m_timeline.current_time - m_timeline.period_start) / PERIOD_SECONDS, 0.0, 1.0)};\n if (!qFuzzyCompare(m_current_time_fraction + 1.0, fraction + 1.0)) {\n m_current_time_fraction = fraction;\n Q_EMIT currentTimeFractionChanged();\n }\n\n replaceBlockHistory(m_cached_block_timestamps);\n if (period_changed) Q_EMIT periodChanged();\n updateLastBlockAge();\n}\n\nvoid BlockClockModel::scheduleNextClockUpdate(const QDateTime& current_time)\n{\n if (m_stopped) return;\n const QTime time{current_time.time()};\n const int milliseconds_into_minute{time.second() * 1000 + time.msec()};\n m_clock_timer.start(CLOCK_UPDATE_INTERVAL_MS - milliseconds_into_minute);\n}\n\nvoid BlockClockModel::refreshHistory()\n{\n if (m_stopped) return;\n auto snapshot{m_history->takeSnapshot()};\n if (!snapshot) return;\n m_cached_block_timestamps = std::move(*snapshot);\n updateCurrentTime(m_current_time_provider());\n}\n\nvoid BlockClockModel::replaceBlockHistory(QList<qint64> block_timestamps)\n{\n const qint64 window_start{m_timeline.current_time - PERIOD_SECONDS};\n std::sort(block_timestamps.begin(), block_timestamps.end());\n block_timestamps.erase(std::remove_if(block_timestamps.begin(), block_timestamps.end(), [window_start](qint64 timestamp) {\n return timestamp < window_start;\n }), block_timestamps.end());\n\n // Fractions can change without the list changing (new origin, future blocks).\n const auto previous_fractions{m_block_time_fractions};\n m_timeline.block_timestamps = std::move(block_timestamps);\n rebuildBlockTimeFractions();\n if (previous_fractions != m_block_time_fractions) Q_EMIT blockTimeFractionsChanged();\n}\n\nvoid BlockClockModel::updateLastBlockAge()\n{\n const qint64 age{m_tip_time > 0 ? std::max<qint64>(0, m_timeline.current_time - m_tip_time) : -1};\n if (age == m_last_block_age) return;\n m_last_block_age = age;\n Q_EMIT lastBlockAgeChanged();\n}\n\nvoid BlockClockModel::rebuildBlockTimeFractions()\n{\n m_block_time_fractions.clear();\n m_block_time_fractions.reserve(m_timeline.block_timestamps.size());\n for (qint64 timestamp : m_timeline.block_timestamps) {\n m_block_time_fractions.push_back(fractionForTimestamp(timestamp));\n }\n}\n\nqreal BlockClockModel::fractionForTimestamp(qint64 timestamp) const\n{\n if (m_timeline.period_start == 0) return 0.0;\n return std::clamp<qreal>(\n static_cast<qreal>(timestamp - m_timeline.period_start) / PERIOD_SECONDS,\n m_current_time_fraction - 1.0,\n m_current_time_fraction);\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Closing the offline banner also suppresses a later outageqml/components/NodeBanner.qml | addressed | AssessmentNodeBanner now clears dismissedMessage when the message changes away from that dismissal. Recovery changes the message, so a later recurrence of the same offline notice is no longer suppressed by the previous dismissal. path_diff: qml/components/NodeBanner.qml; new_source: qml/components/NodeBanner.qml [
{
"evidence_id": "9bfec579d4634106a904c0eb39fed0aa",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/NodeBanner.qml",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/components/NodeBanner.qml b/qml/components/NodeBanner.qml\nindex 2aea30b6..f873a8bf 100644\n--- a/qml/components/NodeBanner.qml\n+++ b/qml/components/NodeBanner.qml\n@@ -8,7 +8,8 @@ import QtQuick.Layouts 1.15\n \n import \"../controls\"\n \n-// Closed warnings stay dismissed; other notices return when they change.\n+// Closing hides the current notice for this session; it returns when it\n+// changes or recurs. Saved warning dismissals belong to the Warnings dialog.\n Rectangle {\n id: root\n objectName: \"nodeBanner\"\n@@ -18,13 +19,10 @@ Rectangle {\n ? status.bannerKind + \"\\n\" + status.bannerText : \"\"\n property string dismissedMessage: \"\"\n readonly property bool shown: message.length > 0 && message !== dismissedMessage\n+ onMessageChanged: if (message !== dismissedMessage) dismissedMessage = \"\"\n \n function dismiss() {\n- if (root.status.bannerKind === \"warning\") {\n- root.status.dismissWarnings(root.status.activeWarnings)\n- } else {\n- root.dismissedMessage = root.message\n- }\n+ root.dismissedMessage = root.message\n }\n \n function escaped(text) {\n@@ -32,8 +30,8 @@ Rectangle {\n }\n \n visible: shown\n- implicitHeight: shown ? content.implicitHeight + 24 : 0\n- color: Qt.rgba(status.bannerColor.r, status.bannerColor.g, status.bannerColor.b, status.bannerKind === \"error\" ? 0.16 : 0.14)\n+ implicitHeight: shown ? content.implicitHeight + 2 * Theme.space.ml : 0\n+ color: Theme.color.tint(status.bannerColor)\n \n Rectangle {\n anchors.left: parent.left\n@@ -48,16 +46,16 @@ Rectangle {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n- anchors.leftMargin: 20\n- anchors.rightMargin: 12\n- spacing: 12\n+ anchors.leftMargin: Theme.space.xl\n+ anchors.rightMargin: Theme.space.ml\n+ spacing: Theme.space.ml\n \n Rectangle {\n Layout.alignment: Qt.AlignTop\n- Layout.topMargin: 6\n- implicitWidth: 8\n- implicitHeight: 8\n- radius: 4\n+ Layout.topMargin: Theme.space.s\n+ implicitWidth: Theme.space.m\n+ implicitHeight: Theme.space.m\n+ radius: height / 2\n color: root.status.bannerColor\n }\n CoreText {\n@@ -65,17 +63,16 @@ Rectangle {\n Layout.fillWidth: true\n textFormat: Text.StyledText\n text: \"<b>\" + root.escaped(root.status.bannerTitle) + \"</b> \" + root.escaped(root.status.bannerText)\n- font.pixelSize: 14\n- lineHeight: 1.45\n+ textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n- size: 24\n- iconSize: 8\n backgroundColor: \"transparent\"\n+ backgroundHoverColor: Theme.color.surfaceHover\n+ backgroundPressedColor: Theme.color.surfacePressed\n Accessible.name: qsTr(\"Close notice\")\n onClicked: root.dismiss()\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 80,
"evidence_id": "e9e6a434d461455fb021871284a67e0a",
"finding_id": "finding:4",
"kind": "new_source",
"line": 1,
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/NodeBanner.qml",
"revision": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"source_generation": 3,
"source_job_id": 2097,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\n\nimport \"../controls\"\n\n// Closing hides the current notice for this session; it returns when it\n// changes or recurs. Saved warning dismissals belong to the Warnings dialog.\nRectangle {\n id: root\n objectName: \"nodeBanner\"\n\n property NodeStatus status: NodeStatus {}\n readonly property string message: status.bannerKind.length > 0\n ? status.bannerKind + \"\\n\" + status.bannerText : \"\"\n property string dismissedMessage: \"\"\n readonly property bool shown: message.length > 0 && message !== dismissedMessage\n onMessageChanged: if (message !== dismissedMessage) dismissedMessage = \"\"\n\n function dismiss() {\n root.dismissedMessage = root.message\n }\n\n function escaped(text) {\n return text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\")\n }\n\n visible: shown\n implicitHeight: shown ? content.implicitHeight + 2 * Theme.space.ml : 0\n color: Theme.color.tint(status.bannerColor)\n\n Rectangle {\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.bottom: parent.bottom\n height: 1\n color: root.status.bannerColor\n }\n\n RowLayout {\n id: content\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n anchors.leftMargin: Theme.space.xl\n anchors.rightMargin: Theme.space.ml\n spacing: Theme.space.ml\n\n Rectangle {\n Layout.alignment: Qt.AlignTop\n Layout.topMargin: Theme.space.s\n implicitWidth: Theme.space.m\n implicitHeight: Theme.space.m\n radius: height / 2\n color: root.status.bannerColor\n }\n CoreText {\n objectName: \"nodeBannerText\"\n Layout.fillWidth: true\n textFormat: Text.StyledText\n text: \"<b>\" + root.escaped(root.status.bannerTitle) + \"</b> \" + root.escaped(root.status.bannerText)\n textStyle: Theme.text.description\n horizontalAlignment: Text.AlignLeft\n verticalAlignment: Text.AlignTop\n }\n CloseButton {\n objectName: \"nodeBannerCloseButton\"\n Layout.alignment: Qt.AlignTop\n backgroundColor: \"transparent\"\n backgroundHoverColor: Theme.color.surfaceHover\n backgroundPressedColor: Theme.color.surfacePressed\n Accessible.name: qsTr(\"Close notice\")\n onClicked: root.dismiss()\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..c693949d1a33 2026-11-21T03:49:00Z · gpt-6-luna |
| gui#994 | Warning dismissals load before the resolved network settings identityqml/models/nodemodel.cpp | still_present | AssessmentThe new source excerpt still loads DISMISSED_WARNINGS from QSettings in the NodeModel constructor. The supplied diff does not show that the resolved-network settings identity is installed before this constructor read; changes to warning clearing and information rows do not resolve the reported initialization-order issue. path_diff: qml/models/nodemodel.cpp; new_source: qml/models/nodemodel.cpp [
{
"evidence_id": "0bf3be590f2743589b5f44a29add27c0",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/models/nodemodel.cpp",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/models/nodemodel.cpp b/qml/models/nodemodel.cpp\nindex c3d0204f56..45ec8e60a1 100644\n--- a/qml/models/nodemodel.cpp\n+++ b/qml/models/nodemodel.cpp\n@@ -96,19 +96,20 @@ bool HasMultipleRuntimeDialogButtons(unsigned int buttons)\n return (buttons & (buttons - 1)) != 0;\n }\n \n-QVariant InformationRow(const QString& id, const QString& label, const QString& value)\n+QVariant InformationRow(const QString& id, const QString& label, const QString& value, bool mono = false)\n {\n QVariantMap row;\n // The id lets views pick rows without matching translated labels.\n row.insert(QStringLiteral(\"id\"), id);\n row.insert(QStringLiteral(\"label\"), label);\n row.insert(QStringLiteral(\"value\"), value);\n+ row.insert(QStringLiteral(\"mono\"), mono);\n return QVariant::fromValue(row);\n }\n \n QVariant DirectoryRow(const QString& id, const QString& label, const QString& path)\n {\n- QVariantMap row{InformationRow(id, label, ShortenHomePath(path, QDir::homePath())).toMap()};\n+ QVariantMap row{InformationRow(id, label, ShortenHomePath(path, QDir::homePath()), /*mono=*/true).toMap()};\n row.insert(QStringLiteral(\"path\"), path);\n row.insert(QStringLiteral(\"url\"), QUrl::fromLocalFile(path));\n return QVariant::fromValue(row);\n@@ -678,6 +679,12 @@ void NodeModel::setWarnings(const QString& warnings)\n if (m_warnings == warnings && m_warning_list == warning_list) {\n return;\n }\n+ // A dismissed warning that clears shows again if it recurs.\n+ bool dismissals_changed{false};\n+ for (const QString& warning : m_warning_list) {\n+ if (!warning_list.contains(warning) && m_dismissed_warnings.removeAll(warning) > 0) dismissals_changed = true;\n+ }\n+ if (dismissals_changed) QSettings{}.setValue(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS), m_dismissed_warnings);\n m_warnings = warnings;\n m_warning_list = warning_list;\n Q_EMIT warningsChanged();\n@@ -820,6 +827,7 @@ void NodeModel::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo\n setBlockTipHeight(tip_info.block_height);\n setVerificationProgress(tip_info.verification_progress);\n setBlockSyncActive(initial_block_download);\n+ Q_EMIT blockTipTimeChanged(m_block_tip_time);\n }\n // LoadChainTip emits an INIT_DOWNLOAD notification even on a caught-up\n // restart. Core's IBD flag only latches false: preserve a newer POST_INIT\n@@ -1034,8 +1042,8 @@ QVariantList NodeModel::nodeInformationRows()\n const QString warning_text{m_warning_list.empty() ? tr(\"None\") : m_warning_list.join(QStringLiteral(\"\\n\"))};\n \n QVariantList rows;\n- rows.push_back(InformationRow(QStringLiteral(\"clientVersion\"), tr(\"Client version\"), fullClientVersion()));\n- rows.push_back(InformationRow(QStringLiteral(\"userAgent\"), tr(\"User agent\"), QString::fromStdString(strSubVersion)));\n+ rows.push_back(InformationRow(QStringLiteral(\"clientVersion\"), tr(\"Client version\"), fullClientVersion(), /*mono=*/true));\n+ rows.push_back(InformationRow(QStringLiteral(\"userAgent\"), tr(\"User agent\"), QString::fromStdString(strSubVersion), /*mono=*/true));\n rows.push_back(DirectoryRow(QStringLiteral(\"dataDir\"), tr(\"Datadir\"), QString::fromStdString(fs::PathToString(gArgs.GetDataDirNet()))));\n rows.push_back(DirectoryRow(QStringLiteral(\"blocksDir\"), tr(\"Blocks dir\"), QString::fromStdString(fs::PathToString(gArgs.GetBlocksDirPath()))));\n rows.push_back(InformationRow(QStringLiteral(\"startupTime\"), tr(\"Startup time\"), QDateTime::currentDateTime().addSecs(-TicksSeconds(GetUptime())).toString()));\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 296,
"evidence_id": "bdb39d403d344bd1b058794737c81565",
"finding_id": "finding:3",
"kind": "new_source",
"line": 147,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/models/nodemodel.cpp",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 3,
"source_job_id": 2097,
"text": " bool bans{false};\n uint64_t status_generation{0};\n uint64_t network_generation{0};\n\n // Called with mutex held, so detaching the receiver cannot race dispatch.\n void schedule()\n {\n if (!receiver || delivery_pending) return;\n delivery_pending = true;\n QMetaObject::invokeMethod(receiver, [target = receiver] {\n {\n std::lock_guard lock{target->m_notifications->mutex};\n target->m_notifications->delivery_pending = false;\n }\n target->publishNotifications();\n }, Qt::QueuedConnection);\n }\n};\n\nstruct NodeModel::StatusSnapshot {\n int inbound;\n int outbound;\n QString warnings;\n std::optional<bool> network_active;\n bool mempool_available;\n};\n\nNodeModel::NodeModel(interfaces::Node& node, bool backend_ready)\n : m_notifications{std::make_shared<Notifications>()}, m_backend_queries_ready{backend_ready}, m_node{node}\n{\n m_notifications->receiver = this;\n m_dismissed_warnings = QSettings{}.value(QString::fromLatin1(SettingsKeys::DISMISSED_WARNINGS)).toStringList();\n m_sync_progress_clock.start();\n initializeMempoolInfoPolling();\n ConnectToBlockTipSignal();\n ConnectToHeaderTipSignal();\n ConnectToNumConnectionsChangedSignal();\n ConnectToNetworkActiveChangedSignal();\n ConnectToAlertChangedSignal();\n ConnectToRuntimeDialogSignals();\n ConnectToBannedListChangedSignal();\n connect(&m_snapshots, &BackendExecutor::drained, this, &NodeModel::finishDrain);\n connect(m_commands.get(), &BackendExecutor::drained, this, &NodeModel::finishDrain);\n refreshStatus();\n refreshMempoolInfo();\n}\n\nNodeModel::~NodeModel()\n{\n detachNotifications();\n m_snapshots.shutdown();\n m_commands->shutdown();\n unsubscribeFromCoreSignals();\n setMempoolInfoPollingActive(false);\n if (m_mempool_info_thread) {\n m_mempool_info_thread->quit();\n m_mempool_info_thread->wait();\n }\n}\n\nvoid NodeModel::beginShutdown()\n{\n if (m_workers_stopping) return;\n detachNotifications();\n setMempoolInfoPollingActive(false);\n m_workers_stopping = true;\n Q_EMIT networkActionReadyChanged();\n m_snapshots.shutdown();\n m_commands->shutdown();\n setNodeReady(false);\n stopShutdownPolling();\n if (!m_mempool_info_thread) {\n finishDrain();\n return;\n }\n auto handlers = std::make_shared<std::vector<std::unique_ptr<interfaces::Handler>>>();\n handlers->push_back(std::move(m_handler_notify_block_tip));\n handlers->push_back(std::move(m_handler_notify_header_tip));\n handlers->push_back(std::move(m_handler_notify_num_peers_changed));\n handlers->push_back(std::move(m_handler_notify_network_active_changed));\n handlers->push_back(std::move(m_handler_notify_alert_changed));\n handlers->push_back(std::move(m_handler_message_box));\n handlers->push_back(std::move(m_handler_question));\n handlers->push_back(std::move(m_handler_notify_banned_list_changed));\n JoinThreadAsync(m_mempool_info_thread, this, [this] {\n m_mempool_info_thread = nullptr;\n m_mempool_info_worker = nullptr;\n m_mempool_info_timer = nullptr;\n finishDrain();\n });\n QMetaObject::invokeMethod(m_mempool_info_worker,\n [handlers = std::move(handlers), timer = m_mempool_info_timer, thread = m_mempool_info_thread] {\n timer->stop();\n for (const auto& handler : *handlers) {\n if (handler) handler->disconnect();\n }\n handlers->clear();\n QMetaObject::invokeMethod(thread, &QThread::quit, Qt::QueuedConnection);\n }, Qt::QueuedConnection);\n}\n\nvoid NodeModel::finishDrain()\n{\n if (!m_workers_stopping || m_drained || m_mempool_info_thread ||\n !m_snapshots.isDrained() || !m_commands->isDrained()) return;\n m_drained = true;\n Q_EMIT workDrained();\n}\n\nvoid NodeModel::detachNotifications()\n{\n std::lock_guard lock{m_notifications->mutex};\n m_notifications->receiver = nullptr;\n}\n\nvoid NodeModel::publishNotifications()\n{\n if (m_workers_stopping || m_shutdown_requested) return;\n std::optional<Notifications::Block> block;\n std::optional<Notifications::Header> header;\n std::optional<int> peers;\n std::optional<bool> network_active;\n bool warnings;\n bool bans;\n {\n std::lock_guard lock{m_notifications->mutex};\n block = std::exchange(m_notifications->block, {});\n header = std::exchange(m_notifications->header, {});\n peers = std::exchange(m_notifications->peers, {});\n network_active = std::exchange(m_notifications->network_active, {});\n warnings = std::exchange(m_notifications->warnings, false);\n bans = std::exchange(m_notifications->bans, false);\n }\n {\n // Decide sync completion only after both heights belong to this snapshot.\n const QScopedValueRollback applying{m_applying_sync_snapshot, true};\n if (header) {\n m_seen_header_tip = true;\n setHeaderSyncState(header->tip.block_height, header->tip.block_time, header->presync);\n }\n if (block) {\n m_seen_block_tip = true;\n m_block_tip_time = block->tip.block_time;\n setBlockTipHeight(block->tip.block_height);\n setVerificationProgress(block->progress);\n setBlockSyncActive(block->state != SynchronizationState::POST_INIT);\n Q_EMIT blockTipTimeChanged(m_block_tip_time);\n }\n }\n updateSyncCompletion();",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Node-only recovery actions open the default settings sectionqml/pages/node/NodeRunner.qml | unclear | AssessmentNodeRunner now maps recovery actions to connection or debug-log and emits settingsSectionRequested, but the supplied evidence does not show a receiver that forwards that signal to MainWindow or invokes nodeStack.openSettings(section). The actual destination in node-only mode therefore cannot be confirmed. path_diff: qml/pages/node/NodeRunner.qml; new_source: qml/pages/node/NodeRunner.qml [
{
"evidence_id": "5b369bbca4c84e81a32b24794988e0b8",
"finding_id": "finding:2",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/pages/node/NodeRunner.qml",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/pages/node/NodeRunner.qml b/qml/pages/node/NodeRunner.qml\nindex cf862449c9..f30aae6060 100644\n--- a/qml/pages/node/NodeRunner.qml\n+++ b/qml/pages/node/NodeRunner.qml\n@@ -11,6 +11,7 @@ import \"../../components\"\n \n Page {\n signal settingsClicked\n+ signal settingsSectionRequested(string section)\n signal peersClicked\n id: root\n objectName: \"nodeRunner\"\n@@ -32,16 +33,17 @@ Page {\n NodeStatusBar {\n id: nodeStatusBar\n Layout.alignment: Qt.AlignVCenter\n- onRouteRequested: root.settingsClicked()\n+ onRouteRequested: function(action) {\n+ root.settingsSectionRequested(action === \"debugLog\" ? \"debug-log\" : \"connection\")\n+ }\n onWarningsRequested: nodeWarnings.open()\n }\n IconButton {\n objectName: \"peersTabButton\"\n iconSource: Utils.nodeConnectionIcon(nodeModel.numPeers)\n iconColor: Theme.color.neutral7\n- hoverColor: Theme.color.neutral9\n size: 34\n- iconSize: 24\n+ accessibleName: qsTr(\"Peers\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.peersClicked()\n }\n@@ -49,9 +51,8 @@ Page {\n objectName: \"nodeSettingsButton\"\n iconSource: \"image://images/gear\"\n iconColor: Theme.color.neutral9\n- hoverColor: Theme.color.neutral9\n size: 34\n- iconSize: 34\n+ accessibleName: qsTr(\"Settings\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.settingsClicked()\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 101,
"evidence_id": "4d08a5b6ff1c481fbb3a87f7bcb73849",
"finding_id": "finding:2",
"kind": "new_source",
"line": 5,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/pages/node/NodeRunner.qml",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 3,
"source_job_id": 2097,
"text": "import QtQuick 2.15\nimport QtQuick.Controls 2.15\nimport QtQuick.Layouts 1.15\nimport \"../../controls\"\nimport \"../../controls/utils.js\" as Utils\nimport \"../../components\"\n\nPage {\n signal settingsClicked\n signal settingsSectionRequested(string section)\n signal peersClicked\n id: root\n objectName: \"nodeRunner\"\n background: null\n clip: true\n header: NavigationBar2 {\n rightItem: Item {\n implicitWidth: actionsRow.implicitWidth + 12\n implicitHeight: actionsRow.implicitHeight + 10\n\n RowLayout {\n id: actionsRow\n anchors.top: parent.top\n anchors.right: parent.right\n anchors.topMargin: 8\n anchors.rightMargin: 12\n spacing: 4\n\n NodeStatusBar {\n id: nodeStatusBar\n Layout.alignment: Qt.AlignVCenter\n onRouteRequested: function(action) {\n root.settingsSectionRequested(action === \"debugLog\" ? \"debug-log\" : \"connection\")\n }\n onWarningsRequested: nodeWarnings.open()\n }\n IconButton {\n objectName: \"peersTabButton\"\n iconSource: Utils.nodeConnectionIcon(nodeModel.numPeers)\n iconColor: Theme.color.neutral7\n size: 34\n accessibleName: qsTr(\"Peers\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.peersClicked()\n }\n IconButton {\n objectName: \"nodeSettingsButton\"\n iconSource: \"image://images/gear\"\n iconColor: Theme.color.neutral9\n size: 34\n accessibleName: qsTr(\"Settings\")\n Layout.alignment: Qt.AlignVCenter\n onClicked: root.settingsClicked()\n }\n }\n }\n }\n\n Component.onCompleted: nodeModel.startNodeInitializionThread();\n\n function openNodeDetails() {\n nodeDetails.open()\n }\n\n NodeBanner {\n anchors.top: parent.top\n anchors.left: parent.left\n anchors.right: parent.right\n z: 2\n }\n\n BlockClock {\n parentWidth: parent.width - 40\n parentHeight: parent.height\n anchors.centerIn: parent\n renderingActive: root.visible\n showDetailsLink: true\n onDetailsRequested: nodeDetails.open()\n onWarningsRequested: nodeWarnings.open()\n }\n\n NodeWarningsPopup {\n id: nodeWarnings\n }\n\n NodeDetailsPopup {\n id: nodeDetails\n onActionTriggered: function(action) { nodeStatusBar.trigger(action) }\n }\n\n NewBlockToast {\n anchors.horizontalCenter: parent.horizontalCenter\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 72\n active: root.visible\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#994 | Directory links lack keyboard focus and activationqml/components/NodeDetailsPopup.qml | addressed | AssessmentThe directory link is now an AbstractButton with strong focus, Return/Enter activation, and a FocusBorder, while its click handler still opens the row URL externally. path_diff: qml/components/NodeDetailsPopup.qml; new_source: qml/components/NodeDetailsPopup.qml [
{
"evidence_id": "d0ced7a9d8d843afa8662e63d0bf86d4",
"finding_id": "finding:10",
"kind": "path_diff",
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/NodeDetailsPopup.qml",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/components/NodeDetailsPopup.qml b/qml/components/NodeDetailsPopup.qml\nindex 1b870372..9044ebad 100644\n--- a/qml/components/NodeDetailsPopup.qml\n+++ b/qml/components/NodeDetailsPopup.qml\n@@ -6,9 +6,11 @@ import QtQuick 2.15\n import QtQuick.Controls 2.15\n import QtQuick.Layouts 1.15\n \n+import org.bitcoincore.qt 1.0\n+\n import \"../controls\"\n \n-Popup {\n+DialogPopup {\n id: root\n objectName: \"nodeDetailsPopup\"\n \n@@ -36,12 +38,8 @@ Popup {\n onMoreExpandedChanged: if (moreExpanded) root.loadAboutRows()\n signal actionTriggered(string action)\n \n- parent: Overlay.overlay\n- anchors.centerIn: parent\n- modal: true\n- width: parent ? Math.min(440, parent.width - 48) : 440\n- height: parent ? Math.min(implicitHeight, parent.height - 48) : implicitHeight\n- padding: 24\n+ title: qsTr(\"Node details\")\n+ implicitWidth: 480\n \n onOpened: {\n if (root.status.nodeModelRef !== null && root.status.nodeModelRef.mempoolInfoPollingActive !== undefined) root.status.nodeModelRef.mempoolInfoPollingActive = true\n@@ -84,7 +82,7 @@ Popup {\n \n function withSpeedRow(rows) {\n if (root.status.key !== \"blocks\") return rows\n- const progress = rows.findIndex(function(row) { return row.key === qsTr(\"Progress\") })\n+ const progress = rows.findIndex(function(row) { return row.id === \"progress\" })\n if (progress < 0) return rows\n let speed = root.syncSpeedText\n if (root.trafficRef !== null) speed += \" · ↓ \" + root.rateText(root.trafficRef.receivedRateList)\n@@ -124,7 +122,7 @@ Popup {\n for (const row of node.nodeInformationRows()) byId[row.id] = row\n const rows = []\n for (const [id, label] of root.aboutLabels) {\n- if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path })\n+ if (byId[id] !== undefined) rows.push({ key: label, value: byId[id].value, url: byId[id].url, path: byId[id].path, mono: byId[id].mono })\n }\n root.aboutRows = rows\n }\n@@ -147,58 +145,37 @@ Popup {\n onTriggered: root.sampleSyncSpeed()\n }\n \n- enter: Transition {\n- NumberAnimation { property: \"opacity\"; from: 0; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- NumberAnimation { property: \"scale\"; from: 0.98; to: 1; duration: 180; easing.type: Easing.OutCubic }\n- }\n-\n- background: Rectangle {\n- color: Theme.color.neutral1\n- radius: 12\n- border.width: 1\n- border.color: Theme.color.neutral3\n- }\n-\n contentItem: ColumnLayout {\n spacing: 0\n \n- RowLayout {\n+ DialogHeader {\n Layout.fillWidth: true\n- Layout.bottomMargin: 16\n- CoreText {\n- Layout.fillWidth: true\n- text: qsTr(\"Node details\")\n- bold: true\n- font.pixelSize: 18\n- horizontalAlignment: Text.AlignLeft\n- }\n- CloseButton {\n- objectName: \"nodeDetailsCloseButton\"\n- size: 32\n- onClicked: root.close()\n- }\n+ Layout.bottomMargin: Theme.space.l\n+ title: root.title\n+ closeButtonObjectName: \"nodeDetailsCloseButton\"\n+ onCloseRequested: root.close()\n }\n \n RowLayout {\n- Layout.bottomMargin: 12\n- spacing: 8\n+ Layout.bottomMargin: Theme.space.ml\n+ spacing: Theme.space.m\n Rectangle {\n Layout.alignment: Qt.AlignVCenter\n- implicitWidth: 8\n- implicitHeight: 8\n- radius: 4\n+ implicitWidth: Theme.space.m\n+ implicitHeight: Theme.space.m\n+ radius: height / 2\n color: root.status.tone\n }\n CoreText {\n objectName: \"nodeDetailsStatus\"\n text: root.status.label\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.captionStrong\n wrap: false\n }\n WarningsLink {\n objectName: \"nodeDetailsWarnings\"\n status: root.status\n+ showDismissed: true\n onClicked: {\n root.close()\n root.actionTriggered(\"warnings\")\n@@ -234,10 +211,10 @@ Popup {\n AbstractButton {\n id: moreToggle\n objectName: \"nodeDetailsMoreToggle\"\n- topPadding: 12\n- bottomPadding: 8\n+ topPadding: Theme.space.ml\n+ bottomPadding: Theme.space.m\n text: root.moreExpanded ? qsTr(\"Fewer details\") : qsTr(\"More details\")\n- hoverEnabled: true\n+ hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n Accessible.name: text\n implicitWidth: moreToggleContent.implicitWidth + leftPadding + rightPadding\n@@ -249,19 +226,19 @@ Popup {\n \n contentItem: Row {\n id: moreToggleContent\n- spacing: 4\n+ spacing: Theme.space.xs\n CoreText {\n anchors.verticalCenter: parent.verticalCenter\n text: moreToggle.text\n- font: Theme.text.captionStrong.font\n+ textStyle: Theme.text.captionStrong\n wrap: false\n- color: Theme.color.orange\n+ color: Theme.color.accentText\n }\n CaretRightIcon {\n objectName: \"nodeDetailsMoreCaret\"\n anchors.verticalCenter: parent.verticalCenter\n- size: 12\n- color: Theme.color.orange\n+ size: Theme.size.caretDense\n+ color: Theme.color.accentText\n rotation: root.moreExpanded ? -90 : 90\n }\n }\n@@ -287,11 +264,10 @@ Popup {\n objectName: \"nodeDetailsAboutHeading\"\n visible: root.moreExpanded && root.aboutRows.length > 0\n width: rowsColumn.width\n- topPadding: 24\n- bottomPadding: 8\n+ topPadding: Theme.space.xxl\n+ bottomPadding: Theme.space.m\n text: qsTr(\"About this node\")\n- bold: true\n- font.pixelSize: 14\n+ textStyle: Theme.text.subheading\n horizontalAlignment: Text.AlignLeft\n }\n Repeater {\n@@ -308,12 +284,11 @@ Popup {\n \n RowLayout {\n Layout.fillWidth: true\n- Layout.topMargin: 20\n- spacing: 8\n+ Layout.topMargin: Theme.space.xl\n+ spacing: Theme.space.m\n NodeActionButton {\n objectName: \"nodeDetailsPrimaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n text: root.status.primaryActionText\n accent: root.status.primaryActionAccent\n enabled: root.status.primaryActionEnabled\n@@ -327,7 +302,6 @@ Popup {\n NodeActionButton {\n objectName: \"nodeDetailsSecondaryAction\"\n Layout.fillWidth: true\n- implicitHeight: 40\n visible: root.status.secondaryAction.length > 0\n text: root.status.secondaryActionText\n onClicked: {\n@@ -345,20 +319,20 @@ Popup {\n property string valueObjectName: \"\"\n property bool showTopLine: true\n readonly property bool isLink: row.url !== undefined && row.url.toString().length > 0\n- implicitHeight: 44\n+ implicitHeight: Math.max(Theme.size.row, valueText.height + 2 * Theme.space.ml)\n \n Rectangle {\n visible: detailRow.showTopLine\n width: parent.width\n height: 1\n- color: Theme.color.neutral3\n+ color: Theme.color.surfaceDivider\n }\n CoreText {\n id: keyText\n anchors.left: parent.left\n- anchors.verticalCenter: parent.verticalCenter\n+ anchors.top: valueText.top\n text: detailRow.row.key\n- font.pixelSize: 14\n+ textStyle: Theme.text.caption\n wrap: false\n color: Theme.color.neutral7\n }\n@@ -367,27 +341,35 @@ Popup {\n objectName: detailRow.valueObjectName\n anchors.right: parent.right\n anchors.verticalCenter: parent.verticalCenter\n- width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - 16)\n+ width: Math.min(implicitWidth, detailRow.width - keyText.implicitWidth - Theme.space.l)\n text: detailRow.row.value\n- bold: true\n- font.pixelSize: 14\n- wrap: false\n- elide: Text.ElideMiddle\n+ textStyle: detailRow.row.mono === true ? Theme.text.monoCaption : Theme.text.captionStrong\n+ // Wrap rather than elide so long paths and address lists stay readable.\n+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere\n horizontalAlignment: Text.AlignRight\n- color: detailRow.isLink ? Theme.color.orange : Theme.color.neutral9\n- opacity: linkArea.pressed ? 0.7 : linkArea.containsMouse ? 0.85 : 1\n+ color: detailRow.isLink ? Theme.color.accentText : Theme.color.neutral9\n+ opacity: linkButton.down ? 0.7 : linkButton.hovered ? 0.85 : 1\n \n- MouseArea {\n- id: linkArea\n+ AbstractButton {\n+ id: linkButton\n objectName: detailRow.valueObjectName.length > 0 ? detailRow.valueObjectName + \"_link\" : \"\"\n anchors.fill: parent\n enabled: detailRow.isLink\n- hoverEnabled: true\n- cursorShape: Qt.PointingHandCursor\n+ hoverEnabled: AppMode.isDesktop\n+ focusPolicy: Qt.StrongFocus\n Accessible.role: Accessible.Link\n Accessible.name: detailRow.row.key + \": \" + detailRow.row.value\n Accessible.description: qsTr(\"Opens the folder in your file manager\")\n+ Keys.onReturnPressed: clicked()\n+ Keys.onEnterPressed: clicked()\n onClicked: Qt.openUrlExternally(detailRow.row.url)\n+\n+ HoverHandler { cursorShape: Qt.PointingHandCursor }\n+\n+ background: FocusBorder {\n+ visible: linkButton.visualFocus\n+ borderRadius: 6\n+ }\n }\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 376,
"evidence_id": "c4d87faf6c0c43ae86e6e868dff19453",
"finding_id": "finding:10",
"kind": "new_source",
"line": 350,
"new_head": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/NodeDetailsPopup.qml",
"revision": "c693949d1a33242ff4bd37f2c6db2418d5d1b3bb",
"source_generation": 3,
"source_job_id": 2097,
"text": " color: detailRow.isLink ? Theme.color.accentText : Theme.color.neutral9\n opacity: linkButton.down ? 0.7 : linkButton.hovered ? 0.85 : 1\n\n AbstractButton {\n id: linkButton\n objectName: detailRow.valueObjectName.length > 0 ? detailRow.valueObjectName + \"_link\" : \"\"\n anchors.fill: parent\n enabled: detailRow.isLink\n hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n Accessible.role: Accessible.Link\n Accessible.name: detailRow.row.key + \": \" + detailRow.row.value\n Accessible.description: qsTr(\"Opens the folder in your file manager\")\n Keys.onReturnPressed: clicked()\n Keys.onEnterPressed: clicked()\n onClicked: Qt.openUrlExternally(detailRow.row.url)\n\n HoverHandler { cursorShape: Qt.PointingHandCursor }\n\n background: FocusBorder {\n visible: linkButton.visualFocus\n borderRadius: 6\n }\n }\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..c693949d1a33 2026-11-21T03:49:00Z · gpt-6-luna |
| gui#994 | Dismissing every warning removes access to the restore controlsqml/components/WarningsLink.qml | partially_addressed | AssessmentA dismissed-only link is now available when showDismissed is enabled, and the Node details link enables it. But the supplied diff does not establish that the clock and status-bar links enable showDismissed, nor does it show the requested close-and-reopen restoration test. Those entry points may still disappear after dismissing all warnings. path_diff: qml/components/WarningsLink.qml; new_source: qml/components/WarningsLink.qml [
{
"evidence_id": "b2bd67ba20084e399201866fd40725f2",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/WarningsLink.qml",
"source_generation": 3,
"source_job_id": 2097,
"text": "diff --git a/qml/components/WarningsLink.qml b/qml/components/WarningsLink.qml\nindex 62afa901a3..9210da8348 100644\n--- a/qml/components/WarningsLink.qml\n+++ b/qml/components/WarningsLink.qml\n@@ -5,6 +5,8 @@\n import QtQuick 2.15\n import QtQuick.Controls 2.15\n \n+import org.bitcoincore.qt 1.0\n+\n import \"../controls\"\n \n AbstractButton {\n@@ -12,12 +14,24 @@ AbstractButton {\n objectName: \"warningsLink\"\n \n property NodeStatus status: NodeStatus {}\n- property int pixelSize: 14\n+ property var textStyle: Theme.text.caption\n+ // Keeps the dialog reachable to restore warnings once all are dismissed.\n+ property bool showDismissed: false\n \n- readonly property bool shown: status.warningsText.length > 0\n+ readonly property int dismissedCount: status.dismissedWarnings.length\n+ readonly property bool dismissedOnly: status.warningCount === 0 && showDismissed && dismissedCount > 0\n+ readonly property bool shown: status.warningsText.length > 0 || dismissedOnly\n visible: shown\n- text: status.warningsText\n- hoverEnabled: true\n+ text: {\n+ if (!dismissedOnly) return status.warningsText\n+ if (dismissedCount === 1) {\n+ //: Link that reopens the node warnings dialog after the user dismissed the only current warning.\n+ return qsTr(\"1 dismissed warning\")\n+ }\n+ //: Link that reopens the node warnings dialog after the user dismissed every current warning. %1 is the count.\n+ return qsTr(\"%1 dismissed warnings\").arg(dismissedCount)\n+ }\n+ hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n padding: 0\n implicitWidth: content.implicitWidth\n@@ -31,19 +45,20 @@ AbstractButton {\n \n contentItem: Row {\n id: content\n- spacing: 10\n+ spacing: Theme.space.ml\n CoreText {\n text: \"·\"\n- font.pixelSize: root.pixelSize\n+ textStyle: root.textStyle\n wrap: false\n- color: Theme.color.neutral5\n+ color: Theme.color.neutral6\n+ Accessible.ignored: true\n }\n CoreText {\n objectName: \"warningsLinkText\"\n text: root.text\n- font.pixelSize: root.pixelSize\n+ textStyle: root.textStyle\n wrap: false\n- color: Theme.color.amber\n+ color: root.dismissedOnly ? Theme.color.neutral7 : Theme.color.warningText\n }\n }\n \n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 69,
"evidence_id": "e29a956333054ae590fd601b8f3fda87",
"finding_id": "finding:1",
"kind": "new_source",
"line": 1,
"new_head": "bc34774d4b94074a9374137994bbed0d3201a51e",
"old_head": "62ade9e1ac81042717e182d855b94882dd6113fb",
"path": "qml/components/WarningsLink.qml",
"revision": "bc34774d4b94074a9374137994bbed0d3201a51e",
"source_generation": 3,
"source_job_id": 2097,
"text": "// Copyright (c) 2026 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nimport QtQuick 2.15\nimport QtQuick.Controls 2.15\n\nimport org.bitcoincore.qt 1.0\n\nimport \"../controls\"\n\nAbstractButton {\n id: root\n objectName: \"warningsLink\"\n\n property NodeStatus status: NodeStatus {}\n property var textStyle: Theme.text.caption\n // Keeps the dialog reachable to restore warnings once all are dismissed.\n property bool showDismissed: false\n\n readonly property int dismissedCount: status.dismissedWarnings.length\n readonly property bool dismissedOnly: status.warningCount === 0 && showDismissed && dismissedCount > 0\n readonly property bool shown: status.warningsText.length > 0 || dismissedOnly\n visible: shown\n text: {\n if (!dismissedOnly) return status.warningsText\n if (dismissedCount === 1) {\n //: Link that reopens the node warnings dialog after the user dismissed the only current warning.\n return qsTr(\"1 dismissed warning\")\n }\n //: Link that reopens the node warnings dialog after the user dismissed every current warning. %1 is the count.\n return qsTr(\"%1 dismissed warnings\").arg(dismissedCount)\n }\n hoverEnabled: AppMode.isDesktop\n focusPolicy: Qt.StrongFocus\n padding: 0\n implicitWidth: content.implicitWidth\n implicitHeight: content.implicitHeight\n opacity: down ? 0.7 : hovered ? 0.85 : 1\n Accessible.role: Accessible.Link\n Accessible.name: text\n Accessible.description: qsTr(\"Shows the warnings your node reported\")\n\n HoverHandler { cursorShape: Qt.PointingHandCursor }\n\n contentItem: Row {\n id: content\n spacing: Theme.space.ml\n CoreText {\n text: \"·\"\n textStyle: root.textStyle\n wrap: false\n color: Theme.color.neutral6\n Accessible.ignored: true\n }\n CoreText {\n objectName: \"warningsLinkText\"\n text: root.text\n textStyle: root.textStyle\n wrap: false\n color: root.dismissedOnly ? Theme.color.neutral7 : Theme.color.warningText\n }\n }\n\n background: FocusBorder {\n visible: root.visualFocus\n borderRadius: 6\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 62ade9e1ac81..bc34774d4b94 2026-11-26T01:42:57Z · gpt-6-luna |
| gui#1052 | Alert action buttons bypass the shared busy guardqml/controls/AlertPopup.qml | still_present | AssessmentNo busy guard was added to `trigger()`, and neither action delegate's enabled binding incorporates `root.busy`. The new excerpt shows `if (!action.enabled) return` and button enablement bound only to `alertAction.enabled`. Source report · cc5cd2d25654..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Reduce motion keeps a startup snapshot of the OS preferenceqml/motionpreference.h | still_present | AssessmentNo live preference updates or explicit startup-only limitation are evidenced; the property remains constant and immutable. The new header excerpt retains the CONSTANT mode property and const backing member. Source report · ef8cca83ae42..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Compact Wallet settings lack a Back route to the settings listqml/components/SettingsPageContainer.qml | still_present | AssessmentThe supplied new excerpt does not show a wallet-root Back route or changes to host navigation; it shows only focus-tracking additions in SettingsPageContainer. `configureRootPage()` still only wires roots exposing `showBackButton` and `back`; the shown diff adds focus tracking, not the requested wallet host forwarding. Source report · ef8cca83ae42..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Return accepts the full-wallet send alert without focusing its buttonqml/pages/wallet/SendTransactionReview.qml | still_present | AssessmentThe sweep confirmation action still has no explicit role, so it remains eligible as the sole Normal-role action for Return/Enter acceptance. The new `SendTransactionReview.qml` excerpt shows the “Send all funds” AlertAction without a `role` assignment. Source report · ef8cca83ae42..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#983 | Network-policy tests do not cover production engine constructiontest/test_qmlengine.cpp | addressed | AssessmentThe production integration fixture now actively checks network access on the engine passed to qmlEngineCreated, addressing the gap that helper-only tests could not catch. It fails the fixture with a diagnostic if the request is not immediately denied. The diff adds a GET to the TEST-NET-1 address in TestApplication::qmlEngineCreated and sets m_status to EXIT_FAILURE with “QML engine allows network access” unless the reply is finished with QNetworkReply::ContentAccessDenied. This tests the production-created engine rather than only engines created directly by the helpers. Source report · 0bdb96dc0a9f..dd0a5991f748 2026-11-07T19:32:30Z · gpt-6-luna |
| gui#934 | MainRouting lacks the new paymentUriHandler context propertyqml/pages/MainWindow.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · c8f6a5a3b64c..f37c8aaca1b7 2026-11-20T22:41:53Z · gpt-6-luna |
| gui#934 | Payment queue outcomes lack request identity and complete retry wiringqml/pages/MainWindow.qml | addressed | AssessmentThe updated flow separates availability notifications from request completion, retries delivery when the queue changes or relevant blockers clear, and treats an open transaction review as a blocker. The finding's requested delivery-contract protections are present in the new head. SendCreate.qml adds `!transactionReviewPopup.visible` to `canAcceptPaymentRequest()`, emits `paymentRequestAcceptable()` when the form becomes available, and emits it when the transaction review closes. MainWindow.qml retries on `onPendingRequestChanged`, `onPaymentRequestAcceptable`, and active-view changes; clipboard paste paths no longer report request completion. Source report · c8f6a5a3b64c..67ace0024aea 2026-11-07T19:16:37Z · gpt-6-luna |
| gui#934 | Payment review hides the amount retained by an amount-less URIqml/pages/wallet/SendCreate.qml | addressed | AssessmentThe review now displays the amount that remains in the form when the request has no amount, without changing the existing import behavior that preserves it. SendCreate.qml sets `paymentRequestReviewPopup.keptAmountSatoshi` from the current recipient amount when `result.hasAmount` is false. PaymentRequestReviewPopup.qml shows the Amount row when either an amount was requested or a retained amount is nonzero, and displays `Not specified, keeps %1` in the latter case. Source report · c8f6a5a3b64c..67ace0024aea 2026-11-07T19:16:37Z · gpt-6-luna |
| gui#934 | Escape on the wallet-disabled notice stalls the payment queueqml/pages/MainWindow.qml | addressed | AssessmentThe wallet-disabled notice's OK action now has the Neutral role, so Escape acknowledges the notice through the same discard handler as clicking OK. MainWindow.qml adds `role: AlertAction.Neutral` to the `paymentUriWalletDisabledOkButton` action, whose `onTriggered` calls `appWindow.discardPendingPaymentUri()`. Source report · c8f6a5a3b64c..67ace0024aea 2026-11-07T19:16:37Z · gpt-6-luna |
| gui#934 | Deferred payment review can consume a request in the placeholder walletqml/pages/wallet/SendCreate.qml | addressed | AssessmentThe deferred callback now checks whether the payment request can still be accepted before calling the handler, and interrupts the delivery if readiness has been lost. The interrupt outcome keeps the queued request available for retry. In SendCreate.qml, `applyPaymentRequest()` defers execution and checks `root.canAcceptPaymentRequest()` before `page.handleIncomingPaymentUri(uri, source)`; on failure it calls `root.interruptPaymentRequest()`, which finishes the incoming request as `interrupted`. Source report · c8f6a5a3b64c..67ace0024aea 2026-11-07T19:16:37Z · gpt-6-luna |
| gui#1057 | Wallet changes leave a save dialog that silently writes nothingqml/components/WatchOnlyExportModal.qml | addressed | AssessmentA wallet change now closes the visible save dialog before the popup clears its export data. The added test verifies that changing wallets closes the dialog as well as the popup. `WatchOnlyExportModal.qml` checks `saveDialog.visible` and calls `saveDialog.close()` in `onWalletChanged`. `test_wallet_change_closes_save_dialog` opens the dialog, changes wallets, and asserts it is no longer visible. Source report · 71947071a56e..a0908d244531 2026-11-05T22:50:24Z · gpt-6-luna |
| gui#1057 | Export availability stays stale after descriptor changesqml/pages/settings/WalletSectionPage.qml | addressed | AssessmentWatch-only export availability is now a notifying property, and the wallet model forwards Core’s address-availability change notification through a queued signal. The settings page binds to that property instead of invoking an unnotified method. `canExportWatchOnly` is declared with `NOTIFY watchOnlyExportsChanged`; `subscribeToWalletSignals()` registers `handleCanGetAddressesChanged` and emits that signal queued. `canExportWatchOnlyFollowsActiveDescriptors` checks availability updates after loading an active descriptor. Source report · 71947071a56e..a0908d244531 2026-11-05T22:50:24Z · gpt-6-luna |
| gui#1057 | Wallet changes during opening leave the previous export visibleqml/components/WatchOnlyExportModal.qml | addressed | AssessmentWallet changes invalidate the popup session while it is visible, rather than waiting for `opened`, which remains false during entry. A test changes wallets immediately after `openForWallet()` and verifies the popup and export payload are cleared. `onWalletChanged` now closes when `visible` is true, with a comment explaining that `opened` remains false during the enter transition. `test_closes_when_wallet_changes_while_opening` exercises the transition-time case. Source report · 71947071a56e..a0908d244531 2026-11-05T22:50:24Z · gpt-6-luna |
| gui#1057 | Extended-key export silently omits incompatible derivation layoutsqml/models/walletqmlmodel.cpp | addressed | AssessmentExtended-key export is now limited to layouts compatible with the conventional receive/change derivation paths. Incompatible layouts have an empty `extendedKey` and are excluded from the format’s available types; tests cover a separate-key legacy layout and swapped branches. `watchOnlyExports()` sets `extendedKey` only when receive uses `/0` and change is absent or represented by the compatible `/1` descriptor. The modal disables the format when no compatible key exists and filters incompatible types. `watchOnlyExportsJoinReceiveAndChange` asserts the split legacy fixture has an empty extended key, and also verifies a swapped-branch export is not offered as a key. Source report · 71947071a56e..a0908d244531 2026-11-05T22:50:24Z · gpt-6-luna |
| gui#1057 | The complete-wallet export omits pre-encryption addressesqml/models/walletqmlmodel.cpp | addressed | AssessmentThe export now collects supported inactive descriptors and includes them in the modal’s complete descriptor list. A functional regression test funds an address before encryption, exports afterward, imports the descriptors into a watch-only wallet, and verifies that the old address and balance are covered. `inactiveWatchOnlyExports()` iterates `GetAllScriptPubKeyMans()` and returns used inactive single-key descriptors; `WatchOnlyExportModal.qml` combines them into `completeExports` and its all-types payload. `case_export_covers_funds_from_before_encryption` verifies the old address is owned and balances match after import. Source report · 71947071a56e..a0908d244531 2026-11-05T22:50:24Z · gpt-6-luna |
| gui#895 | Repeated exports reseed the save dialog with the home folderqml/pages/wallet/ActivityListPage.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 28cd7b9d375c..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#895 | HoverTooltip leaves stacking and clipping to its callersqml/controls/HoverTooltip.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 28cd7b9d375c..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#895 | Activity export constructs malformed local-file URLsqml/pages/wallet/ActivityListPage.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 28cd7b9d375c..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#895 | HoverTooltip bypasses the existing hover delay and transitionsqml/controls/HoverTooltip.qml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 28cd7b9d375c..bdd0564335ff 2026-11-21T02:34:59Z · gpt-6-luna |
| gui#1060 | LinkText scans the full text area to locate one linkqml/controls/LinkText.qml | partially_addressed | AssessmentEach row now probes linkAt at 8-pixel intervals and refines near the detected link ends, reducing horizontal hit-test work. However, measurement still scans every 2-pixel row across the full item height, including rows of plain sentence text; it does not use laid-out line geometry to restrict the scan as requested. The per-line rectangles and icon extension are retained. path_diff: qml/controls/LinkText.qml; new_source: qml/controls/LinkText.qml [
{
"evidence_id": "7e59c1e5427044bfbc82cf0698fe1db6",
"finding_id": "finding:4",
"kind": "path_diff",
"new_head": "73594a9e17ac42292d13e48388f6b84c2e78dd6a",
"old_head": "733018ca9eab3aa155d633375f09087d65b587e1",
"path": "qml/controls/LinkText.qml",
"source_generation": 3,
"source_job_id": 2028,
"text": "diff --git a/qml/controls/LinkText.qml b/qml/controls/LinkText.qml\nindex a468d6d7..c1d9de63 100644\n--- a/qml/controls/LinkText.qml\n+++ b/qml/controls/LinkText.qml\n@@ -55,17 +55,40 @@ CoreText {\n // outlines the link rather than the whole sentence, and the sentence\n // around a link that wraps stays plain text.\n property var linkAreas: []\n+ // Each row is checked every 8 px to find the link, then every 2 px only\n+ // around its two ends. For a link at least 8 px wide on each line, that\n+ // finds the same stretch as checking every 2 px, with a quarter of the\n+ // linkAt() calls, which add up when a resize measures again.\n+ function linkStretchAt(y) {\n+ let left = -1\n+ let right = -1\n+ for (let x = 0; x < width; x += 8) {\n+ if (linkAt(x, y).length === 0) continue\n+ if (left < 0) left = x\n+ right = x\n+ }\n+ if (left < 0) return null\n+ for (let x = Math.max(0, left - 6); x < left; x += 2) {\n+ if (linkAt(x, y).length > 0) {\n+ left = x\n+ break\n+ }\n+ }\n+ for (let x = right + 6; x > right; x -= 2) {\n+ if (x < width && linkAt(x, y).length > 0) {\n+ right = x\n+ break\n+ }\n+ }\n+ return { left: left, right: right }\n+ }\n function measureLinkArea() {\n const lines = []\n let line = null\n for (let y = 0; y < height; y += 2) {\n- let left = -1\n- let right = -1\n- for (let x = 0; x < width; x += 2) {\n- if (linkAt(x, y).length === 0) continue\n- if (left < 0) left = x\n- right = x\n- }\n+ const stretch = linkStretchAt(y)\n+ const left = stretch === null ? -1 : stretch.left\n+ const right = stretch === null ? -1 : stretch.right\n if (left < 0) {\n line = null\n continue\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 151,
"evidence_id": "679cd3481228419c9110e48a37f05c67",
"finding_id": "finding:4",
"kind": "new_source",
"line": 28,
"new_head": "73594a9e17ac42292d13e48388f6b84c2e78dd6a",
"old_head": "733018ca9eab3aa155d633375f09087d65b587e1",
"path": "qml/controls/LinkText.qml",
"revision": "73594a9e17ac42292d13e48388f6b84c2e78dd6a",
"source_generation": 3,
"source_job_id": 2028,
"text": " // Same as LinkRow, the shared row for external links.\n signal activated(url link)\n\n function escaped(value) {\n return value.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\")\n }\n\n textFormat: Text.StyledText\n // The icon follows the underlined words directly (its image has its own\n // margin), outside the link markup so the underline stops at the words.\n // It is drawn in the link color by the image provider, since an image in\n // text can't be recolored like Icon, and centered on the line, like\n // LinkRow's icon beside its text. It still belongs to the link: see\n // linkArea.\n readonly property int iconSize: Math.round(font.pixelSize * 1.15)\n readonly property string iconMarkup: linkIconSource.toString().length === 0 ? \"\"\n : \"<img src=\\\"\" + linkIconSource + \"?color=\" + linkTextColor.toString().substring(1, 7)\n + \"\\\" width=\\\"\" + iconSize + \"\\\" height=\\\"\" + iconSize + \"\\\" align=\\\"middle\\\">\"\n text: sentence.arg(\"<a href=\\\"\" + escaped(link.toString()) + \"\\\">\" + escaped(linkText) + \"</a>\" + iconMarkup)\n color: enabled ? Theme.color.neutral7 : Theme.color.disabledContent\n linkColor: linkTextColor\n\n // Where the link's words and its icon are drawn, one area for each line\n // the link takes. Text only reports links under a point, so these are\n // measured with linkAt(), and the last line's area is widened by the\n // icon that follows the last word. Clicks, the hand cursor and the focus\n // ring use these areas, so the icon acts as part of the link, Tab\n // outlines the link rather than the whole sentence, and the sentence\n // around a link that wraps stays plain text.\n property var linkAreas: []\n // Each row is checked every 8 px to find the link, then every 2 px only\n // around its two ends. For a link at least 8 px wide on each line, that\n // finds the same stretch as checking every 2 px, with a quarter of the\n // linkAt() calls, which add up when a resize measures again.\n function linkStretchAt(y) {\n let left = -1\n let right = -1\n for (let x = 0; x < width; x += 8) {\n if (linkAt(x, y).length === 0) continue\n if (left < 0) left = x\n right = x\n }\n if (left < 0) return null\n for (let x = Math.max(0, left - 6); x < left; x += 2) {\n if (linkAt(x, y).length > 0) {\n left = x\n break\n }\n }\n for (let x = right + 6; x > right; x -= 2) {\n if (x < width && linkAt(x, y).length > 0) {\n right = x\n break\n }\n }\n return { left: left, right: right }\n }\n function measureLinkArea() {\n const lines = []\n let line = null\n for (let y = 0; y < height; y += 2) {\n const stretch = linkStretchAt(y)\n const left = stretch === null ? -1 : stretch.left\n const right = stretch === null ? -1 : stretch.right\n if (left < 0) {\n line = null\n continue\n }\n // Every row of a line covers the same stretch of the link; a\n // different stretch is the link's next line.\n if (line !== null && line.left === left && line.right === right) {\n line.bottom = y\n } else {\n line = { left: left, right: right, top: y, bottom: y }\n lines.push(line)\n }\n }\n if (lines.length > 0 && iconMarkup.length > 0) lines[lines.length - 1].right += iconSize\n linkAreas = lines.map(function(l) {\n const right = Math.min(width, l.right + 2)\n return Qt.rect(l.left, l.top, right - l.left, l.bottom - l.top + 2)\n })\n }\n onWidthChanged: Qt.callLater(measureLinkArea)\n onHeightChanged: Qt.callLater(measureLinkArea)\n onTextChanged: Qt.callLater(measureLinkArea)\n Component.onCompleted: Qt.callLater(measureLinkArea)\n textStyle: Theme.text.description\n wrap: true\n horizontalAlignment: Text.AlignLeft\n activeFocusOnTab: enabled\n Accessible.role: Accessible.Link\n // A link that ends its sentence can carry the period, so the icon comes\n // last; the link's name leaves it out.\n Accessible.name: linkText.replace(/[.!?:;,]+$/, \"\")\n Accessible.description: sentence.arg(linkText)\n Accessible.onPressAction: if (enabled) root.activated(link)\n\n // The Text reports the href as a string; report the link itself, as LinkRow does.\n onLinkActivated: if (enabled) root.activated(root.link)\n Keys.onReturnPressed: root.activated(link)\n Keys.onEnterPressed: root.activated(link)\n Keys.onSpacePressed: root.activated(link)\n\n Repeater {\n model: root.linkAreas\n MouseArea {\n objectName: root.objectName.length > 0\n ? root.objectName + \"LinkArea\" + (index > 0 ? index : \"\") : \"\"\n x: modelData.x\n y: modelData.y\n width: modelData.width\n height: modelData.height\n enabled: root.enabled\n hoverEnabled: true\n cursorShape: Qt.PointingHandCursor\n onClicked: root.activated(root.link)\n\n FocusBorder {\n visible: root.activeFocus\n }\n }\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 733018ca9eab..73594a9e17ac 2026-11-19T23:39:06Z · gpt-6-luna |
| gui#1060 | Sync-time translations cannot select additional plural formsqml/controls/utils.js | addressed | AssessmentThe full-unit labels for weeks, days, hours, minutes, and seconds now use qsTr numerus calls with the corresponding count. The existing duration thresholds and abbreviated mixed-unit branches remain unchanged. path_diff: qml/controls/utils.js; new_source: qml/controls/utils.js [
{
"evidence_id": "670b4ecbbed24a8c9b51bd2ddd13f1a9",
"finding_id": "finding:3",
"kind": "path_diff",
"new_head": "73594a9e17ac42292d13e48388f6b84c2e78dd6a",
"old_head": "733018ca9eab3aa155d633375f09087d65b587e1",
"path": "qml/controls/utils.js",
"source_generation": 3,
"source_job_id": 2028,
"text": "diff --git a/qml/controls/utils.js b/qml/controls/utils.js\nindex 4a90bc95..3a970cba 100644\n--- a/qml/controls/utils.js\n+++ b/qml/controls/utils.js\n@@ -42,21 +42,23 @@ function formatRemainingSyncTime(milliseconds) {\n var result = \"\";\n var estimatingStatus = false;\n \n+ // Both English source forms pass the count so translators can supply all\n+ // plural forms, while untranslated messages keep natural English.\n if (weeks > 0) {\n return {\n- text: weeks === 1 ? qsTr(\"~1 week left\") : qsTr(\"~%1 weeks left\").arg(weeks),\n+ text: weeks === 1 ? qsTr(\"~%n week left\", \"\", weeks) : qsTr(\"~%n weeks left\", \"\", weeks),\n estimating: false\n };\n }\n if (days > 0) {\n return {\n- text: days === 1 ? qsTr(\"~1 day left\") : qsTr(\"~%1 days left\").arg(days),\n+ text: days === 1 ? qsTr(\"~%n day left\", \"\", days) : qsTr(\"~%n days left\", \"\", days),\n estimating: false\n };\n }\n if (hours >= 5) {\n return {\n- text: qsTr(\"~%1 hours left\").arg(hours),\n+ text: qsTr(\"~%n hours left\", \"\", hours),\n estimating: false\n };\n }\n@@ -68,7 +70,7 @@ function formatRemainingSyncTime(milliseconds) {\n }\n if (minutes >= 5) {\n return {\n- text: qsTr(\"~%1 minutes left\").arg(minutes),\n+ text: qsTr(\"~%n minutes left\", \"\", minutes),\n estimating: false\n };\n }\n@@ -80,7 +82,7 @@ function formatRemainingSyncTime(milliseconds) {\n }\n if (seconds > 0) {\n return {\n- text: seconds === 1 ? qsTr(\"~1 second left\") : qsTr(\"~%1 seconds left\").arg(seconds),\n+ text: seconds === 1 ? qsTr(\"~%n second left\", \"\", seconds) : qsTr(\"~%n seconds left\", \"\", seconds),\n estimating: false\n };\n } else {\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
},
{
"bounded": true,
"end_line": 94,
"evidence_id": "a41a6e6e0557458aada0d3f2ed3ef13d",
"finding_id": "finding:3",
"kind": "new_source",
"line": 17,
"new_head": "73594a9e17ac42292d13e48388f6b84c2e78dd6a",
"old_head": "733018ca9eab3aa155d633375f09087d65b587e1",
"path": "qml/controls/utils.js",
"revision": "73594a9e17ac42292d13e48388f6b84c2e78dd6a",
"source_generation": 3,
"source_job_id": 2028,
"text": "}\n\nfunction formatRelativeTime(isoString) {\n if (!isoString) return \"\"\n var then = new Date(isoString)\n var now = new Date()\n var diffSec = Math.floor((now - then) / 1000)\n if (diffSec < 60) return qsTr(\"just now\")\n var m = Math.floor(diffSec / 60)\n if (diffSec < 3600) return m === 1 ? qsTr(\"1 minute ago\") : qsTr(\"%1 minutes ago\").arg(m)\n var h = Math.floor(diffSec / 3600)\n if (diffSec < 86400) return h === 1 ? qsTr(\"1 hour ago\") : qsTr(\"%1 hours ago\").arg(h)\n var d = Math.floor(diffSec / 86400)\n return d === 1 ? qsTr(\"1 day ago\") : qsTr(\"%1 days ago\").arg(d)\n}\n\nfunction formatRemainingSyncTime(milliseconds) {\n var minutes = Math.floor(milliseconds / 60000);\n var seconds = Math.floor((milliseconds % 60000) / 1000);\n var weeks = Math.floor(minutes / 10080);\n minutes %= 10080;\n var days = Math.floor(minutes / 1440);\n minutes %= 1440;\n var hours = Math.floor(minutes / 60);\n minutes %= 60;\n var result = \"\";\n var estimatingStatus = false;\n\n // Both English source forms pass the count so translators can supply all\n // plural forms, while untranslated messages keep natural English.\n if (weeks > 0) {\n return {\n text: weeks === 1 ? qsTr(\"~%n week left\", \"\", weeks) : qsTr(\"~%n weeks left\", \"\", weeks),\n estimating: false\n };\n }\n if (days > 0) {\n return {\n text: days === 1 ? qsTr(\"~%n day left\", \"\", days) : qsTr(\"~%n days left\", \"\", days),\n estimating: false\n };\n }\n if (hours >= 5) {\n return {\n text: qsTr(\"~%n hours left\", \"\", hours),\n estimating: false\n };\n }\n if (hours > 0) {\n return {\n text: qsTr(\"~%1h %2m left\").arg(hours).arg(minutes),\n estimating: false\n };\n }\n if (minutes >= 5) {\n return {\n text: qsTr(\"~%n minutes left\", \"\", minutes),\n estimating: false\n };\n }\n if (minutes > 0) {\n return {\n text: qsTr(\"~%1m %2s left\").arg(minutes).arg(seconds),\n estimating: false\n };\n }\n if (seconds > 0) {\n return {\n text: seconds === 1 ? qsTr(\"~%n second left\", \"\", seconds) : qsTr(\"~%n seconds left\", \"\", seconds),\n estimating: false\n };\n } else {\n return {\n text: qsTr(\"Estimating\"),\n estimating: true\n };\n }\n}",
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 733018ca9eab..73594a9e17ac 2026-11-19T23:39:06Z · gpt-6-luna |
| gui#1060 | Command-line signer paths disable manual checksqml/pages/settings/ExternalSignerSettingsPage.qml | addressed | AssessmentThe settings-page check button now uses pathSection.canCheck rather than requiring pathSection.editable. The shared externalSignerModel exposes canCheck and performs the check independently of editing, while the path row remains disabled when editing is disallowed. This addresses the locked command-line path retry problem. path_diff: qml/pages/settings/ExternalSignerSettingsPage.qml [
{
"evidence_id": "8772172665fc48b28b05f1f14b06eaab",
"finding_id": "finding:1",
"kind": "path_diff",
"new_head": "73594a9e17ac42292d13e48388f6b84c2e78dd6a",
"old_head": "733018ca9eab3aa155d633375f09087d65b587e1",
"path": "qml/pages/settings/ExternalSignerSettingsPage.qml",
"source_generation": 3,
"source_job_id": 2028,
"text": "diff --git a/qml/pages/settings/ExternalSignerSettingsPage.qml b/qml/pages/settings/ExternalSignerSettingsPage.qml\nindex 93164c29..998cef1b 100644\n--- a/qml/pages/settings/ExternalSignerSettingsPage.qml\n+++ b/qml/pages/settings/ExternalSignerSettingsPage.qml\n@@ -41,7 +41,7 @@ SettingsPage {\n ? qsTr(\"Checking…\")\n //: Button that saves the signer path and checks the command and the connected device.\n : qsTr(\"Check device\")\n- enabled: pathSection.pathError.length === 0 && pathSection.editable && !pathSection.checking\n+ enabled: pathSection.canCheck\n onClicked: pathSection.check()\n }\n }\n",
"truncated": false,
"repository_id": "gui",
"repository": "bitcoin-core/gui-qml",
"repository_url": "https://github.com/bitcoin-core/gui-qml"
}
]Source report · 733018ca9eab..73594a9e17ac 2026-11-19T23:39:06Z · gpt-6-luna |
| gui#883 | -choosedatadir is ignored when the current profile's settings.json is unreadableqml/onboarding_settings.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · ae2b20394c7b..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Settings-recovery dialog ignores application Quit eventsqml/bitcoin.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · ae2b20394c7b..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Onboarding drops an explicit NAT-PMP opt-out alongside listen-off or a proxyqml/onboarding_settings.cpp | unclear | AssessmentDeferred because the follow-up candidate limit was reached. candidate_limit Source report · ae2b20394c7b..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#863 | Modern cache policy overrides the documented disable settingqml/qmlcachepolicy.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 73bc6e29c7c6..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Cache smoke test never confirms preinit.qml was loadedtest/functional/qml_test_cache_policy.py | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 73bc6e29c7c6..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Linux stale-cache read coverage misses the Qt ≥6.6 AOT policy.github/workflows/artifacts.yml | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · 73bc6e29c7c6..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#1060 | A canceled signer check can leave the previous path's status visibleqml/components/ExternalSignerPathSection.qml | addressed | AssessmentA pending delayed signer check is refreshed when the path section is destroyed, so the saved new path does not remain paired with the prior command's status. ExternalSignerPathSection.qml adds Component.onDestruction that calls refreshExternalSignerStatus() when checkTimer.running. Source report · 5e92187a028a..733018ca9eab 2026-11-03T04:48:41Z · gpt-6-luna |
| gui#1060 | Signer error text is interpreted as markupqml/walletqmlcontroller.cpp | addressed | AssessmentThe new code no longer interpolates tag-like signer-provided error details into the displayed diagnostic; such details are omitted in favor of a fixed fallback message. walletqmlcontroller.cpp checks the extracted reason with Qt::mightBeRichText before including it in the returned message; rich-text-like reasons fall through to the generic device-not-ready message. Source report · 5e92187a028a..733018ca9eab 2026-11-03T04:48:41Z · gpt-6-luna |
| gui#1060 | Wrapped links make surrounding sentence text clickableqml/controls/LinkText.qml | addressed | AssessmentLink hit regions are now measured and created per line, avoiding one enclosing rectangle that spans ordinary text between wrapped link segments. LinkText.qml changes linkArea to linkAreas, measures line-specific bounds with linkAt(), and creates a separate MouseArea and FocusBorder for each region. Source report · 5e92187a028a..733018ca9eab 2026-11-03T04:48:41Z · gpt-6-luna |
| gui#1060 | Command-line-only signer configuration leads to a disabled setup stepqml/pages/wallet/WalletCreationFlow.qml | addressed | AssessmentThe controller now derives the signer path from the effective command-line setting when -signer overrides the persistent setting, and avoids forcing a conflicting persistent value. walletqmlcontroller.cpp diff checks QmlCoreSettings::IsCommandLineOverridden, reads DisplaySettingValue for that case, and sets path_configured from the resulting signer_path. The new head's flow branches to the wallet form when externalSignerResponding is true. Source report · 5e92187a028a..733018ca9eab 2026-11-03T04:48:41Z · gpt-6-luna |
| gui#1060 | Hide amounts leaves the Pending section total visibleqml/pages/wallet/ActivityListPage.qml | addressed | AssessmentThe pending-balance header now uses BitcoinAmountDisplayLabel with hidesAmount: true, addressing the reported unmasked aggregate. ActivityListPage.qml diff replaces CoreText with BitcoinAmountDisplayLabel and adds hidesAmount: true; the label retains the existing pendingBalance text and right alignment. Source report · 5e92187a028a..733018ca9eab 2026-11-03T04:48:41Z · gpt-6-luna |
| gui#1050 | Existing profiles without block data still lack a full-storage space warningqml/components/StorageOptions.qml | partially_addressed | AssessmentThe full-storage warning now appears whenever there is a storage result below the full-storage requirement, rather than only when the existing profile has a positive prune target. However, the supplied evidence does not show whether this condition covers the reported profile with no downloaded chain data, and the finding specifically identifies that case as needing a warning while preserving the operational minimum. StorageOptions.qml changes errorText so the needed/available warning is gated by hasStorageResult && availableGB < fullRequiredGB, independently of the existing-profile prune-target check. The new test asserts the warning for a full-storage option with 5GB available, but the excerpt does not establish that the test represents an existing profile without chain data. Source report · 34acc2a9d52f..f68f5bf24c50 2026-11-12T03:03:39Z · gpt-6-luna |
| gui#1050 | The storage popup's off position is ambiguous for manual pruningqml/components/StorageOptions.qml | addressed | AssessmentThe popup now explains the manual-pruning state and clarifies that enabling the switch activates automatic pruning, while turning it off afterwards selects full storage. This directly addresses the reported ambiguity without presenting the boolean switch as already enabled for prune=1. In the supplied diff, StorageSettingsPage.qml adds supporting text when onboarding an existing profile with currentPruneTargetMiB === 1: “Manual pruning is currently selected. Turning this switch on enables automatic pruning; turning it off afterwards selects full storage.” The QML test checks for this explanation when target is 1. Source report · 34acc2a9d52f..f68f5bf24c50 2026-11-12T03:03:39Z · gpt-6-luna |
| gui#1052 | System reduced-motion state stays frozen for the sessionqml/motionpreference.h | still_present | AssessmentThe motion preference is still a CONSTANT property backed by a const snapshot, with no stated settings-row limitation in the supplied evidence. The new excerpt retains `Q_PROPERTY(QString mode READ mode CONSTANT)` and `const QString m_mode`. Source report · c29497481379..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#1052 | Busy action dispatch relies on every AlertPopup callerqml/controls/AlertPopup.qml | still_present | AssessmentBusy dispatch remains unguarded in the shared popup, and the action buttons remain enabled solely by `alertAction.enabled`. `trigger()` checks only `if (!action.enabled) return`; both delegates still use `enabled: actionDelegate.alertAction.enabled`. Source report · c29497481379..e89a2bcd4624 2026-11-12T17:25:05Z · gpt-6-luna |
| gui#981 | The onboarding shutdown contract has no production callerqml/models/onboardingoptionsmodel.cpp | still_present | AssessmentThe production onboarding shutdown contract remains in the new head. The shown code still defines beginShutdown and shutdown-only state/branches; the supplied diff does not show a production caller or removal of this API. qml/models/onboardingoptionsmodel.cpp:69–87 retains `beginShutdown()`, `m_shutdown_requested`, `m_stopping`, and shutdown completion handling. Lines 99–105 retain the preparation-after-shutdown rejection. No relevant change appears in the supplied old-to-new diff. Source report · 19472d4944f1..a1bbbfde6536 2026-11-03T00:26:02Z · gpt-6-luna |
| gui#981 | Blocksonly startup temporarily exposes the Mempool settings sectionqml/models/nodemodel.cpp | still_present | AssessmentThe new excerpt retains the argument-derived mempool availability in the asynchronous status snapshot, with no evidence of restoring constructor initialization. It therefore does not address the premature/default availability behavior described in the finding. qml/models/nodemodel.cpp:294–300 still returns `!gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)` as `StatusSnapshot` data; lines 327–330 apply that value after the snapshot completes. The supplied old and new excerpts match. Source report · 19472d4944f1..a1bbbfde6536 2026-11-03T00:26:02Z · gpt-6-luna |
| gui#981 | An empty -lang leaves the saved startup translation installedqml/bitcoin.cpp | still_present | AssessmentThe reported startup-language issue is not changed in the supplied diff. The new excerpt still installs the language only when settings are already ready, and the shown languageChanged handler does not reconcile translators when the initial settings snapshot becomes ready. qml/bitcoin.cpp:852 still has `if (options_model.settingsReady()) install_language(options_model.language());`; the handler at lines 854–858 is connected only to `languageChanged`. The old and new excerpts are identical here. Source report · 19472d4944f1..a1bbbfde6536 2026-11-03T00:26:02Z · gpt-6-luna |
| gui#883 | New-folder preview skips an explicit relative configuration fileqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · e66868e449c6..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Settings-file recovery also resets unrelated GUI preferencesqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · e66868e449c6..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | The settings-recovery dialog ignores application Quit eventsqml/bitcoin.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · e66868e449c6..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | An unwritable config-selected data directory no longer opens the chooserqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · e66868e449c6..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#883 | Onboarding drops an explicit NAT-PMP opt-out when listening is disabledqml/onboarding_settings.cpp | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · e66868e449c6..976e00e4826c 2026-11-12T02:10:49Z · gpt-6-luna |
| gui#863 | Top-level compat resource aliases are overwritten by the helperCMakeLists.txt | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · a065e5f32e9a..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Cold-launch cache isolation relies on macOS default-path resolutiontest/functional/qml_test_cache_policy.py | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · a065e5f32e9a..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Cache smoke test never confirms preinit.qml was loadedtest/functional/qml_test_cache_policy.py | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · a065e5f32e9a..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#863 | Linux stale-cache read coverage misses the Qt ≥ 6.6 AOT policytest/CMakeLists.txt | unclear | AssessmentRalph could not make a reliable follow-up assessment. ValueError Source report · a065e5f32e9a..d77b2cbbc0da 2026-11-12T03:35:06Z · gpt-6-luna |
| gui#981 | Pending signer-path validation is presented as a valid pathqml/pages/settings/ExternalSignerSettingsPage.qml | addressed | AssessmentPending validation is now reflected in connected status, status text, the indicator, and Check device eligibility. The test exercises a previously detected signer while validation is held pending and confirms it is not presented as connected. `ExternalSignerSettingsPage.qml` defines `signerPathPending` from `signerPathValidationPending` (and `settingsPending`), requires it to be false for `signerConnected`, displays “Checking signer path…” while pending, uses a neutral indicator color, and disables Check device. The new `test_signerPendingDoesNotShowStaleConnectedDevice` verifies those behaviors. Source report · 498fb132e7a7..19472d4944f1 2026-11-02T20:22:44Z · gpt-6-luna |
| gui#981 | Settings saves disable unrelated wallet, console and debug-log pagesqml/components/SettingsView.qml | addressed | AssessmentThe shared container is no longer disabled during options loading or saving. Only option-backed sections are gated, and the QML test checks that unrelated pages remain enabled while pending. `SettingsView.qml` now passes a list of option-backed `disabledSectionIds` to `SettingsPageContainer`; its page stacks are enabled unless their section ID is in that list. The new `test_pendingOptionsOnlyDisableSettingsEditors` verifies wallet, network-traffic, RPC-console, debug-log, and about pages remain enabled during loading and saving, while option-backed pages are disabled. Source report · 498fb132e7a7..19472d4944f1 2026-11-02T20:22:44Z · gpt-6-luna |
| gui#981 | Signer-path errors lose their existing Spanish translationsqml/models/options_model.cpp | addressed | AssessmentThe three signer-path errors now use `OptionsQmlModel::tr`, restoring the translation context cited in the finding. In `qml/models/options_model.cpp`, the missing, non-file, and non-executable error branches at lines 548–550 changed from `QObject::tr(...)` in the old version to `OptionsQmlModel::tr(...)` in the new version. Source report · 498fb132e7a7..19472d4944f1 2026-11-02T20:22:44Z · gpt-6-luna |
| gui#1050 | Database-cache errors present the integer type limit as guidanceqml/models/options_model.cpp | addressed | AssessmentInvalid database-cache input now reports only the actionable minimum, without presenting the integer type limit as guidance. The accepted range remains enforced by the same parser and setter bounds. options_model.cpp changes the error to “Enter a whole number of at least %1 MiB.” while ParseLocalizedInteger still receives both minDbcacheSizeMiB() and maxDbcacheSizeMiB(). The added C++ and QML tests check malformed, below-minimum, and overflow inputs receive the lower-bound-only message. Source report · 73ca0bc518ee..34acc2a9d52f 2026-11-02T22:06:34Z · gpt-6-luna |
| gui#1050 | Restoring the exact prune target leaves the current-setting card uncheckedqml/components/StorageOptions.qml | addressed | AssessmentThe model now compares the pending prune mode and its converted MiB target with the original target, clearing the touched state on an exact match. The onboarding model calls this after edits and storage selection, so restoring 1907 MiB from 3 GB back to 2 GB restores the current-setting state; non-round-trippable targets remain custom. In onboardingoptionsmodel.cpp, clearUnchangedStorageSelection() computes prune() ? PruneGBToMiB(pruneSizeGB()) : 0 and clears the prune touched flag when that target equals currentPruneTargetMiB(). It is invoked after user prune changes and selectStorage(). Tests cover exact 1907 and 6675 MiB restoration and ensure rounded targets such as 4096 MiB do not restore current-setting status. Source report · 73ca0bc518ee..34acc2a9d52f 2026-11-02T22:06:34Z · gpt-6-luna |
| gui#990 | Pending request payments trigger full-wallet pollingqml/models/walletstatesnapshot.cpp | addressed | AssessmentThe full-wallet polling issue is fixed by tracking outstanding payment txids during read() and checking only those txids on unchanged-tip polls, with a full read retained when payment status changes or the processed block advances. New walletstatesnapshot.cpp lines 185–186 collect unconfirmed payment txids, lines 205–208 store them, and lines 218–234 use them for targeted polling and return no snapshot when unchanged. Source report · 18e374fcb804..389e2f1dac5c 2026-11-12T02:37:34Z · gpt-6-luna |
| gui#990 | Unchanged payment polls reset editable address rowsqml/models/addresslistmodel.cpp | addressed | AssessmentThe recurring full-wallet read on unchanged-tip polls with outstanding unconfirmed request payments has been removed. The backend now retains the pending transaction IDs and checks their status; it calls read() only when a status change is detected or the processed block changes. This prevents unchanged polls from applying snapshots and resetting the list models. New walletstatesnapshot.cpp lines 220–234 check only m_unconfirmed_payment_txids after the processed-block comparison and return std::nullopt when they remain unchanged. The diff shows the prior unconditional read() path replaced by this targeted check. Source report · 18e374fcb804..389e2f1dac5c 2026-11-12T02:37:34Z · gpt-6-luna |
| gui#990 | Wallet snapshots re-run synchronous send-balance queriesqml/models/walletqmlmodel.cpp | still_present | AssessmentThe reported synchronous send-balance query work remains: the new-head excerpt still emits walletStateChanged() and sendAmountExhaustsBalanceChanged() unconditionally for each applied snapshot. The supplied diff shows no change to either getter or worker-side revision-guarded exhaustion calculation. In new walletqmlmodel.cpp, lines 687 and 690 still emit walletStateChanged() and sendAmountExhaustsBalanceChanged() unconditionally. The supplied diff contains no modifications addressing the balance getters or exhaustion predicate. Source report · 18e374fcb804..389e2f1dac5c 2026-11-12T02:37:34Z · gpt-6-luna |
| gui#986 | Background import failures interrupt the active workflowqml/pages/MainWindow.qml | addressed | AssessmentImport failures no longer automatically open a modal. They display a persistent dismissible error toast with a Details action that opens the existing import error UI when requested. MainWindow's onWalletImportFailed sets walletImportErrorToast.shown rather than calling openForImportError(). The ToastBanner has a Details action whose handler opens the error modal, and it has a close/dismiss path. Source report · fc26982db3c3..9eb5f34bee3f 2026-11-07T04:38:13Z · gpt-6-luna |
| gui#986 | A failed import can leave a nonexistent wallet in the selectorqml/models/walletlistmodel.cpp | addressed | AssessmentWhen the import marker is cleared, the model now refreshes wallet-directory membership if the prior importing wallet is not open and the directory has already been loaded. That reconciles rows that were discovered during the import with Core's removal of a failed restore copy. WalletListModel::setImportingWallet() now calls listWalletDir() and returns when previous_wallet is nonempty, not open, and m_wallet_dir_loaded. This refresh occurs on clearing the import name and replaces the stale directory-derived row based on current directory contents. Source report · fc26982db3c3..9eb5f34bee3f 2026-11-07T04:38:13Z · gpt-6-luna |
| gui#986 | Migration can queue behind a background importqml/walletqmlcontroller.cpp | addressed | AssessmentMigration now rejects work while the wallet worker is busy, before submitting migration, and reports a recoverable error and failure signal. A new test exercises migration during a blocked import and verifies no migration call occurs. migrateWallet() checks walletWorkerBusy(), sets the error “Another wallet is still opening. Try again when it finishes.”, emits walletMigrationFailed(), and returns. migrateWalletDuringImportIsRefused verifies the failure and that loader.migrate_wallet_calls remains zero. Source report · fc26982db3c3..9eb5f34bee3f 2026-11-07T04:38:13Z · gpt-6-luna |
| gui#986 | Import success tests can outlive their fake wallet statetest/test_walletqmlcontroller.cpp | addressed | AssessmentBoth import success tests now use DrainingWalletController, and the first test's semaphores are declared before the controller and guarded so blocked restore work is released on early test exit. In the new excerpt, importWalletLeavesLoadedWalletsSelectable declares restore_started and allow_restore_return before DrainingWalletController and installs qScopeGuard to release the latter. importWalletWithoutSelectedWalletSelectsIt also uses DrainingWalletController, so teardown drains asynchronous cleanup. Source report · fc26982db3c3..a974a48da76d 2026-11-07T22:12:53Z · gpt-6-luna |
| gui#986 | Import busy state clears before restoreWallet() returnsqml/walletqmlcontroller.cpp | addressed | AssessmentThe import marker is no longer cleared during wallet-load notification handling. The import completion callback now clears it after `restoreWallet()` returns, and the failure path also clears it, so the described early-clear interval is removed. The diff removes `finishWalletImport()` calls from both branches of `addOrSelectWalletModel()`. In `startWalletImport()`'s completion callback, `setLastImportedWalletInfo(...)` is followed by `addOrSelectWalletModel(...)`, then `setImportingWalletName(QString())` and `walletImportSucceeded(...)`. `failWalletImport()` likewise clears the marker on failure. Source report · fc26982db3c3..a9b2ea2c99ac 2026-11-12T01:44:42Z · gpt-6-luna |
| gui#1049 | Per-wallet Activity preferences still share app-wide storage keysqml/pages/wallet/WalletView.qml | unclear | AssessmentThe supplied new-head excerpt does not show Activity settings storage or synchronization, and the old-to-new diff contains no relevant changes. Thus the evidence does not establish that preferences are now consistently shared app-wide or isolated per wallet. The provided WalletView excerpt shows ActivityList receiving its wallet, but does not include the Activity settings implementation or preference keys. No relevant settings changes appear in the supplied diff. Source report · c0aac977c710..63346e0200e6 2026-11-02T22:42:51Z · gpt-6-luna |
| gui#1049 | Unvisited startup wallets also load and poll their activityqml/pages/wallet/DesktopWallets.qml | still_present | AssessmentThe new head still mirrors every available open wallet into openWalletsModel. The supplied excerpt shows syncOpenWallets appending each wallet without checking whether it is selected or has previously been activated, so the eager WalletView creation described by the finding is not removed. DesktopWallets.qml lines 50–66: syncOpenWallets filters available wallets, then appends every wallet not already in openWalletsModel. The supplied change set contains no alteration to this code. Source report · c0aac977c710..63346e0200e6 2026-11-02T22:42:51Z · gpt-6-luna |
| gui#863 | Stale-cache smoke test cannot detect reads without writestest/functional/qml_test_cache_policy.py | addressed | AssessmentThe smoke now monitors the seeded stale cache file for Linux IN_OPEN and IN_ACCESS events during the upgrade launch, in addition to retaining the cache-file and contents checks. This detects a read/open that does not rewrite the file. The diff adds CacheReadMonitor using inotify IN_ACCESS | IN_OPEN and wraps the upgrade launch in it; lines 171–179 fail if the stale file was accessed. Source report · 8f1c9e2ce847..73bc6e29c7c6 2026-11-03T01:27:51Z · gpt-6-luna |
| gui#863 | Integration tests omit the application's generated QML unitstest/integration/CMakeLists.txt | addressed | AssessmentThe integration executable now uses the shared QML module setup rather than embedding the QML files as plain resources, so it receives generated units as well as the production executable. The old and new base hashes match, so this change is not attributable to a rebase alone. In test/integration/CMakeLists.txt, the old qt6_add_resources block is replaced by bitcoin_qml_add_application_sources(bitcoinqml_integration_tests). cmake/BitcoinQml.cmake defines that helper to call qt6_add_qml_module with a target-specific output directory and the shared application QML files. Source report · 8f1c9e2ce847..a065e5f32e9a 2026-11-02T18:32:50Z · gpt-6-luna |
| gui#883 | Explicit listen-off choices are elided when onboarding enables a proxyqml/onboarding_settings.cpp | addressed | AssessmentThe apply path now explicitly persists a touched listen value when Core has forced listening off, preventing the proxy-implied value from being elided when the user independently selected listen=false. After writing `listen`, ApplyPendingCoreSettings checks that listen was touched and editable, then stores `pending.values.listen` in rw_settings when `forced_settings` contains `listen`. The updated reset test expects persisted false, and the new apply test verifies listen=false remains effective after removing the proxy. Source report · 3fe7762233c1..e66868e449c6 2026-11-02T19:19:30Z · gpt-6-luna |
| gui#883 | Nested custom settings paths fail before their parent is createdqml/bitcoin.cpp | addressed | AssessmentBefore InitConfig runs for onboarding apply, the resolved settings file's parent directory is created, and startup reports an error if creation fails. prepare_node now calls PrepareSettingsDirectory for pending onboarding before InitConfig. PrepareSettingsDirectory uses the pending resolved settings path's parent and QDir::mkpath; the added relative and absolute nested-settings tests verify creation and successful finalization. Source report · 3fe7762233c1..e66868e449c6 2026-11-02T19:19:30Z · gpt-6-luna |
| gui#883 | Malformed settings.json is overwritten before its backup is savedqml/bitcoin.cpp | addressed | AssessmentThe malformed settings bytes are now preserved to the `.bak` path during the recovery callback, before Core is allowed to continue and replace settings.json. If backup preservation fails, the callback aborts recovery. CaptureSettingsFileBackup now returns BackupSettingsFile(args, &backup, error) after reading the original bytes. ErrorSettingsRead returns `!capture_backup()` for both reset paths, so a failed capture aborts. Added tests verify the backup exists before a later GUI-store failure and that a backup-path failure leaves the original malformed file intact. Source report · 3fe7762233c1..e66868e449c6 2026-11-02T19:19:30Z · gpt-6-luna |
| gui#883 | A new folder can trigger false profile drift with an absolute -confqml/onboarding_settings.cpp | addressed | AssessmentPreview for a not-yet-created selected data directory now reads an absolute configuration file, including its chain/reset settings and include handling, so the target can reflect the configuration used by InitConfig instead of only the command-line defaults. The new-data-directory Preview branch calls ReadConfigForNewDataDir before setting resolved chain/reset values. The added `newDataDirPreviewReadsAbsoluteConfig` tests exercise chain and reset values from an absolute config, included chain values, and include controls, and then apply the model. Source report · 3fe7762233c1..e66868e449c6 2026-11-02T19:19:30Z · gpt-6-luna |
| gui#883 | Unwritable legacy settings can block ordinary startupqml/onboarding_settings.cpp | addressed | AssessmentFailed legacy cleanup during ordinary startup, when there is no pending apply and no reset, is now logged as a warning and treated as non-fatal. The existing rollback/failure path remains for apply and reset. FinalizeStartupSettings checks `!legacy_cleanup_ok && !pending && !reset_gui_settings`, logs the cleanup error, and sets `legacy_cleanup_ok = true` before the rollback-and-return branch. Source report · 3fe7762233c1..e66868e449c6 2026-11-02T19:19:30Z · gpt-6-luna |
| gui#883 | Config-redirected data directories can crash pre-init resolutionqml/onboarding_settings.cpp | addressed | AssessmentThe resolved config-selected data directory is now validated when profile reading fails, and filesystem exceptions thrown during the complete profile read are caught and returned as an error instead of escaping pre-init resolution. `ReadResolvedProfile` wraps `ReadResolvedProfileImpl` in a `try`/`catch(std::exception)`. In the failure branch around lines 981–989, a non-explicit configured directory that is absent or fails `ValidateCustomDataDir` is recorded and onboarding is shown. Source report · 3fe7762233c1..ae2b20394c7b 2026-11-03T02:09:05Z · gpt-6-luna |
| gui#981 | Overlapping notifications can starve status publicationqml/models/nodemodel.cpp | addressed | AssessmentSuccessful status-query completions now publish peer counts, warnings, mempool availability, and node-information notifications regardless of whether the status generation changed. A changed generation still triggers a follow-up refresh, while network-active state has its own freshness check so a stale snapshot cannot override a newer notification. The added overlap test exercises notifications during successive blocked queries and verifies that each completed snapshot is published. In qml/models/nodemodel.cpp, the old `if (current)` guard around publication is removed: lines 314–318 publish status fields unconditionally, and line 332 requests another refresh when `!current`. The `network_current` check independently guards applying `snapshot.network_active` at lines 319–325. `test/test_nodemodel.cpp` adds `overlappingStatusNotificationsPublishEachCompletedSnapshot`, which overlaps notifications with queries and checks published values. Source report · 8d9fbbd9fe52..498fb132e7a7 2026-11-02T16:54:10Z · gpt-6-luna |
| gui#1050 | Header.animateColors has no remaining callerqml/controls/Header.qml | addressed | AssessmentThe unused animation customization API and its guards have been removed from Header. The new Header excerpt has no `animateColors` property, and each of the three `Behavior on color` blocks remains without an `enabled` guard, matching the requested removal while retaining animations. Source report · 1d80b79819cc..73ca0bc518ee 2026-11-02T16:20:31Z · gpt-6-luna |
| gui#1050 | Redownload warning presents a conditional consequence as certainqml/components/StorageOptions.qml | addressed | AssessmentThe unconditional claim that a full blockchain download is required has been changed to conditional wording. `StorageOptions.qml` now uses `May require downloading the full blockchain again.` for the positive-prune profile warning; the associated functional and QML test expectations were updated to that wording. Source report · 1d80b79819cc..73ca0bc518ee 2026-11-02T16:20:31Z · gpt-6-luna |
| gui#1050 | Popup switch can select the current-setting card for a changed prune targetqml/components/StorageOptions.qml | addressed | AssessmentThe prior false selection of the current-setting card for an existing positive prune configuration is prevented, and the changed pending target is exposed as Custom. The reduce card's checked binding now explicitly excludes any existing profile with a positive current prune target (`&& !(root.existingProfile && root.currentPruneTargetMiB > 0)`). `showCustomOption` now includes that case when not keeping the current storage, and the added popup-toggle test verifies reduce and full are unchecked while Custom is checked after toggling, including manual and rounded targets. Source report · 1d80b79819cc..73ca0bc518ee 2026-11-02T16:20:31Z · gpt-6-luna |
Conceptual concerns
The archaeology pass can complete without publishing a concern. Published conceptual concerns are tracked separately from code findings.
160 saved reviews completed archaeology research; 0 saved and 0 published a conceptual concern.
| Status | Reviews |
|---|---|
| candidate | 3 |
| drop | 9 |
| failed | 2 |
| no_concern | 145 |
| unresolved | 3 |
Median citations: N/A; median alternatives: N/A.