Repository navigation
Description
Issues, reports or feature requests related to the qbit GUI should be opened here only when they apply to this repository
- I still think this issue should be opened here
Report
Summary
qbit-qt signs PSBT inputs synchronously and sequentially on the GUI thread. A PSBT containing many P2MR inputs can therefore make the application appear hung, with no progress indication or cancellation path.
This is independent of the unlock-time deadlock in #138. It remains after wallet unlock successfully returns.
Current behaviour
PSBTOperationsDialog::signTransaction() directly calls:
m_wallet_model->wallet().fillPSBT(
std::nullopt,
/*sign=*/true,
/*bip32derivs=*/true,
&n_signed,
m_transaction_data,
complete);This call runs on the Qt GUI thread.
CWallet::FillPSBT() subsequently loops over PSBT input indexes and calls SignPSBTInput() sequentially. Unlike normal Send Coins transaction preparation, this path has:
- no background worker;
- no signing progress callback;
- no parallel P2MR input-signing path;
- no cancellation state; and
- no explicit shutdown or wallet-unload handling for in-progress PSBT signing.
The checked-in bounded SLH-DSA benchmark reports approximately 149 ms per signature on Apple M3 Max. Ignoring wallet database overhead, this suggests approximately:
- 10 P2MR inputs: 1.5 seconds;
- 50 P2MR inputs: 7.4 seconds;
- 100 P2MR inputs: 14.9 seconds.
Counter persistence and PSBT processing add further latency.
Steps to reproduce
- Create and fund an encrypted P2MR wallet with many spendable outputs.
- Construct a PSBT spending at least 20–50 P2MR inputs.
- Open the PSBT in qbit-qt.
- Click Sign Transaction.
- Enter the correct wallet passphrase if prompted.
- Observe that the GUI stops processing input and repaint events until every input has been signed.
For deterministic testing, replace the signer with a latch-controlled or delayed synthetic wallet.
Expected behaviour
PSBT signing should run outside the GUI thread and display bounded progress. The dialog should remain responsive, and cancellation and shutdown should follow explicit stateful-PQC safety rules.
Scope boundary
This issue is limited to PSBT signing initiated by PSBTOperationsDialog.
- qbit-qt deadlocks after wallet unlock during deferred P2MR keypool top-up #138 tracks the unlock-time keypool deadlock.
- Unbounded P2MR proof parsing can block the qbit-qt event loop #93 covered oversized P2MR proof parsing on the GUI thread.
- qbit-qt shutdown can access a destroyed WalletModel during transaction preparation #80 covered normal Send Coins shutdown lifetime.
- Normal Send Coins preparation and fee-bump signing are outside this issue.
No existing issue covers synchronous multi-input FillPSBT() signing in PSBTOperationsDialog.
Suggested direction
Use the background-worker pattern already implemented for normal Send Coins preparation:
- Move or copy the PSBT into a worker-owned object.
- Clone or obtain a background wallet interface.
- Perform provider collection, counter reservation, signing, and finalization off the GUI thread.
- Queue progress and completion back to the dialog.
- Replace
m_transaction_dataonly after successful worker completion.
Extend the PSBT signing interface with progress phases such as:
- preparing;
- reserving PQC counters;
- signing inputs;
- finalizing; and
- verifying.
Cancellation may be allowed before durable PQC counter reservation. Once counters have been reserved, disable cancellation and finish deterministically, matching the normal send flow.
Parallel P2MR signing should be considered, but moving work off the GUI thread is required even if signing remains sequential.
Suggested tests
Add latch-controlled Qt tests covering:
- signing a many-input PSBT without blocking the event loop;
- incremental progress updates;
- cancellation before PQC counter reservation;
- attempted cancellation after reservation;
- dialog closure during signing;
- wallet unload and application shutdown during signing; and
- failed signing after some counters were consumed.
Acceptance criteria
- No P2MR PSBT signature is generated on the GUI thread.
- The GUI remains responsive throughout signing.
- Progress identifies completed and total input counts.
- Cancellation cannot abandon work after durable counter reservation.
- Worker completion cannot access a destroyed dialog or
WalletModel. - Successful signing updates the displayed PSBT exactly once.
- Failure leaves the original PSBT in a defined state and reports any consumed PQC capacity.
- Existing non-P2MR and external-signer PSBT behaviour remains supported.
Relevant code
src/qt/psbtoperationsdialog.cpp:PSBTOperationsDialog::signTransactionsrc/wallet/wallet.cpp:CWallet::FillPSBTsrc/wallet/scriptpubkeyman.cpp:DescriptorScriptPubKeyMan::FillPSBTsrc/libbitcoinpqc/benches/REPORT.md: bounded SLH-DSA signing benchmark
Version and platform
Source-inspected on qbit v1.0.0. Applies to all Qt-supported platforms.
Activity