PSBT import can replace another wallet’s send draft after unloading the original wallet #1012

Closed
opened 2026-10-15 01:09:48 +00:00 by jarolrod · 1 comment
jarolrod commented 2026-10-15 01:09:48 +00:00 (Migrated from github.com)

I reproduced an import dialog opened for wallet A importing into B instead, replacing a draft already entered in B. Splitting this out from #992 so we can track the import fix separately.

Steps to reproduce

  1. Load regtest wallets A and B, with mature funds in B.
  2. Create an unsigned PSBT spending B’s coins to send 1.25 BTC to an address in A. Base64-decode the psbt field returned by walletcreatefundedpsbt and save it as a binary .psbt file.
  3. In B’s Send page, enter an unrelated 0.75 BTC draft.
  4. Select A, choose More options → Import PSBT from file, and leave the native file dialog open.
  5. Through the GUI’s RPC server, run unloadwallet "A" false. B becomes selected.
  6. Select the PSBT file and accept the original dialog.

B’s draft changes from 0.75 to 1.25 BTC, and the transaction review opens for B. Nothing was signed or broadcast.

The acceptance handler uses the currently selected wallet, so the pending import effectively changes wallets while the picker is open. We should invalidate it when its wallet changes or unloads, before it can touch another wallet’s draft. Switching away and back shouldn’t make an old opening valid again either.

Reproduced with native dialogs on macOS / Qt 6.9.0 at b03cf0554841 and its parent 77e8005455cd, so this predates #1009. Related to #975.

I reproduced an import dialog opened for wallet A importing into B instead, replacing a draft already entered in B. Splitting this out from [#992](https://github.com/bitcoin-core/gui-qml/issues/992#issuecomment-6162087075) so we can track the import fix separately. **Steps to reproduce** 1. Load regtest wallets A and B, with mature funds in B. 2. Create an unsigned PSBT spending B’s coins to send 1.25 BTC to an address in A. Base64-decode the `psbt` field returned by `walletcreatefundedpsbt` and save it as a binary `.psbt` file. 3. In B’s Send page, enter an unrelated 0.75 BTC draft. 4. Select A, choose More options → Import PSBT from file, and leave the native file dialog open. 5. Through the GUI’s RPC server, run `unloadwallet "A" false`. B becomes selected. 6. Select the PSBT file and accept the original dialog. B’s draft changes from 0.75 to 1.25 BTC, and the transaction review opens for B. Nothing was signed or broadcast. The acceptance handler uses the currently selected wallet, so the pending import effectively changes wallets while the picker is open. We should invalidate it when its wallet changes or unloads, before it can touch another wallet’s draft. Switching away and back shouldn’t make an old opening valid again either. Reproduced with native dialogs on macOS / Qt 6.9.0 at `b03cf0554841` and its parent `77e8005455cd`, so this predates #1009. Related to [#975](https://github.com/bitcoin-core/gui-qml/issues/975).
pseudoramdom commented 2026-10-16 00:10:14 +00:00 (Migrated from github.com)

I'll take this

I'll take this
Sign in to join this conversation.
No description provided.