Keep fee replacement preparation, signing and commit off the GUI thread #976

Open
opened 2026-10-02 17:35:50 +00:00 by johnny9 · 3 comments
johnny9 commented 2026-10-02 17:35:50 +00:00 (Migrated from github.com)

Parent: #925.

Opening a speed-up dialog can block while preparing a replacement transaction. Confirming can block again during security checks, signing, commit or external-device communication. Updating the visible state to Preparing or Committing does not offload those calls.

Cover createBumpTransaction(), transactionCanBeBumped(), unlock/relock, signBumpTransaction() and commitBumpTransaction(). Preparation can acquire wallet, chain and mempool locks; commit includes persistence and validation work.

Run the complete operation outside the GUI thread and return fees, transaction identity, security state and errors without completion-time backend queries. Keep presentation getters cached. Reject obsolete preparation after the transaction or target changes, and prevent duplicate confirmation.

Recheck replaceability before commit. Once commit begins, closing the dialog must not imply cancellation or release resources still in use.

Acceptance should cover delayed preparation/signing, changed targets, repeated confirmation, wrong passwords, relock after failure, mined or replaced originals and close during work. Coordinate hardware helper behavior with #583 and wallet retirement with #577/#917.

Parent: #925. Opening a speed-up dialog can block while preparing a replacement transaction. Confirming can block again during security checks, signing, commit or external-device communication. Updating the visible state to Preparing or Committing does not offload those calls. Cover `createBumpTransaction()`, `transactionCanBeBumped()`, unlock/relock, `signBumpTransaction()` and `commitBumpTransaction()`. Preparation can acquire wallet, chain and mempool locks; commit includes persistence and validation work. Run the complete operation outside the GUI thread and return fees, transaction identity, security state and errors without completion-time backend queries. Keep presentation getters cached. Reject obsolete preparation after the transaction or target changes, and prevent duplicate confirmation. Recheck replaceability before commit. Once commit begins, closing the dialog must not imply cancellation or release resources still in use. Acceptance should cover delayed preparation/signing, changed targets, repeated confirmation, wrong passwords, relock after failure, mined or replaced originals and close during work. Coordinate hardware helper behavior with #583 and wallet retirement with #577/#917.
jarolrod commented 2026-11-06 17:14:11 +00:00 (Migrated from github.com)

Two concrete cases for the replacement failure/retry handling here:

  1. In an encrypted, locked wallet, open Speed up → Update transaction and leave the password prompt open. Confirm the original transaction in a block, or have its recipient spend the unconfirmed payment output. Submit the correct password. The bump fails with Transaction can no longer be bumped, but the password prompt stays open. Typing another password enables Unlock and update again; submitting either the correct or an incorrect password just clears the field and leaves the same error. Cancel still works.
  2. Have the recipient spend the payment output before opening Speed up. The transaction detail continues offering Speed up, but clicking it opens a failed preview with Transaction has descendants in the mempool. Closing that preview leaves the same action offered again.

The first case also occurs when the original confirms while the fee preview is open: Update transaction remains enabled and still opens the password prompt.

Core correctly refuses these replacements, and the wallet relocks. The GUI should retire an obsolete preview and stop offering password retries once the operation has entered a terminal failure. The detail action also needs to reflect changed replacement eligibility.

With the original transaction still eligible, an incorrect password followed by the correct one succeeds normally. No replacement was submitted in the failure cases.

Reproduced on qt6 at 6e54a48ab571, macOS / Qt 6.9, using isolated offscreen regtest checks.

Two concrete cases for the replacement failure/retry handling here: 1. In an encrypted, locked wallet, open **Speed up → Update transaction** and leave the password prompt open. Confirm the original transaction in a block, or have its recipient spend the unconfirmed payment output. Submit the correct password. The bump fails with **Transaction can no longer be bumped**, but the password prompt stays open. Typing another password enables **Unlock and update** again; submitting either the correct or an incorrect password just clears the field and leaves the same error. Cancel still works. 2. Have the recipient spend the payment output before opening Speed up. The transaction detail continues offering **Speed up**, but clicking it opens a failed preview with **Transaction has descendants in the mempool**. Closing that preview leaves the same action offered again. The first case also occurs when the original confirms while the fee preview is open: **Update transaction** remains enabled and still opens the password prompt. Core correctly refuses these replacements, and the wallet relocks. The GUI should retire an obsolete preview and stop offering password retries once the operation has entered a terminal failure. The detail action also needs to reflect changed replacement eligibility. With the original transaction still eligible, an incorrect password followed by the correct one succeeds normally. No replacement was submitted in the failure cases. Reproduced on `qt6` at `6e54a48ab571`, macOS / Qt 6.9, using isolated offscreen regtest checks.
jarolrod commented 2026-11-09 01:18:23 +00:00 (Migrated from github.com)

An additional case for the stale-review work here: the original transaction can remain eligible for a fee bump while an input added to the prepared replacement starts funding a separate pending payment.

To reproduce:

  1. Create a replaceable payment A with no change available to cover the fee increase.
  2. Open Speed Up. Let preparation add a confirmed wallet input X, then leave Review open.
  3. Using a second client of the same wallet, create a separate low-fee payment B that spends X. In the fixture, B paid another recipient 0.2 BTC. A and B coexist in the mempool with disjoint inputs.
  4. Click Update on the still-open review for A.

The prepared replacement C is accepted and mined. It spends the inputs of both A and B, preserves A’s recipient, and omits B’s recipient. B receives zero confirmed credit; its value returns as sender change. In the matched Cancel control, both A and B confirm and B’s recipient receives 0.2 BTC. Spending X before opening Speed Up prevents preparation instead.

The current bump model already rechecks transactionCanBeBumped(A). That check passes here because A itself remains eligible. The missing check concerns the additional conflicts acquired by the retained candidate while Review was open.

Core permits multi-conflict replacement. The GUI should invalidate or require renewed review of a fee-bump approval when it would also replace a separate payment. Checking only the original transaction again does not establish that the approved replacement still has the same scope.

This adds an accepted-replacement case to the refusal and retry cases already discussed here. Reproduced with the full merged application at 6e54a48ab571, macOS / Qt 6.9, offscreen regtest. It requires a second client acting on the same wallet during the open review.

An additional case for the stale-review work here: the original transaction can remain eligible for a fee bump while an input added to the prepared replacement starts funding a separate pending payment. To reproduce: 1. Create a replaceable payment A with no change available to cover the fee increase. 2. Open Speed Up. Let preparation add a confirmed wallet input X, then leave Review open. 3. Using a second client of the same wallet, create a separate low-fee payment B that spends X. In the fixture, B paid another recipient 0.2 BTC. A and B coexist in the mempool with disjoint inputs. 4. Click Update on the still-open review for A. The prepared replacement C is accepted and mined. It spends the inputs of both A and B, preserves A’s recipient, and omits B’s recipient. B receives zero confirmed credit; its value returns as sender change. In the matched Cancel control, both A and B confirm and B’s recipient receives 0.2 BTC. Spending X before opening Speed Up prevents preparation instead. The current [bump model](https://github.com/bitcoin-core/gui-qml/blob/6e54a48ab571cb46b813eb1d98a301401089192f/qml/models/bumptransactionmodel.cpp#L168) already rechecks `transactionCanBeBumped(A)`. That check passes here because A itself remains eligible. The missing check concerns the additional conflicts acquired by the retained candidate while Review was open. Core permits multi-conflict replacement. The GUI should invalidate or require renewed review of a fee-bump approval when it would also replace a separate payment. Checking only the original transaction again does not establish that the approved replacement still has the same scope. This adds an accepted-replacement case to the refusal and retry cases already discussed here. Reproduced with the full merged application at `6e54a48ab571`, macOS / Qt 6.9, offscreen regtest. It requires a second client acting on the same wallet during the open review.
jarolrod commented 2026-11-09 18:45:31 +00:00 (Migrated from github.com)

An open Speed Up review also survives explicit abandonment of the original payment.

To reproduce:

  1. Create a replaceable payment and open its Speed Up review.
  2. Leave the review open while the original expires from the local mempool.
  3. Use a second client of the same wallet to call abandontransaction for the original.
  4. Click Update transaction in the retained review.

The wallet reports the original as abandoned. Activity changes to Cancelled and removes its Speed Up action, but the already-open review still permits Update.

In the reproduction, Update created a replacement that entered the mempool and confirmed, paying the recipient 0.125 BTC. Closing the review instead preserved abandonment and produced no replacement payment.

This requires a subsequent explicit Update click; abandonment itself does not trigger a payment. The inconsistency is that the retained review remains actionable after the wallet and transaction detail have retired that action.

QML should invalidate the prepared review when the original is abandoned and recheck this state before signing or committing. Core’s current fee-bump preconditions do not reject the abandonment flag.

Reproduced on merged qt6 at 6e54a48ab571, macOS / Qt 6.9, using isolated offscreen regtest with accelerated mempool expiry and a second wallet client.

An open Speed Up review also survives explicit abandonment of the original payment. To reproduce: 1. Create a replaceable payment and open its Speed Up review. 2. Leave the review open while the original expires from the local mempool. 3. Use a second client of the same wallet to call `abandontransaction` for the original. 4. Click **Update transaction** in the retained review. The wallet reports the original as abandoned. Activity changes to **Cancelled** and removes its Speed Up action, but the already-open review still permits Update. In the reproduction, Update created a replacement that entered the mempool and confirmed, paying the recipient 0.125 BTC. Closing the review instead preserved abandonment and produced no replacement payment. This requires a subsequent explicit Update click; abandonment itself does not trigger a payment. The inconsistency is that the retained review remains actionable after the wallet and transaction detail have retired that action. QML should invalidate the prepared review when the original is abandoned and recheck this state before signing or committing. Core’s current fee-bump preconditions do not reject the abandonment flag. Reproduced on merged `qt6` at `6e54a48ab571`, macOS / Qt 6.9, using isolated offscreen regtest with accelerated mempool expiry and a second wallet client.
Sign in to join this conversation.
No description provided.