Send fees: avoid creating wallet addresses for fee previews #715

Closed
opened 2026-05-18 23:43:15 +00:00 by johnny9 · 0 comments
johnny9 commented 2026-05-18 23:43:15 +00:00 (Migrated from github.com)

Problem

QML send fee preview currently calls WalletQmlModel::ensurePreviewChangeAddress(), which generates a wallet destination with the label qml-fee-preview:

  • qml/models/walletqmlmodel.cpp: ensurePreviewChangeAddress()
  • m_wallet->getNewDestination(m_wallet->getDefaultAddressType(), "qml-fee-preview")

That destination is cached for the current WalletQmlModel lifetime, so it does not create a new address on every estimate. However, it still creates a real receive/address-book entry, and after app restart or wallet model recreation another preview address can be generated.

The fee preview path only needs to estimate fees. It should not consume wallet addresses or leave qml-fee-preview entries in wallet state/address-book surfaces.

Expected behavior

Send fee preview should estimate transaction fees without creating persistent wallet addresses or address-book entries.

Repeated preview updates, app restarts, and wallet reloads should not accumulate preview-only receive addresses.

Implementation notes

The current code pins a preview change destination to avoid a worse behavior: if coin_control.destChange is left unset, CreateTransactionInternal() reserves an internal change destination and keeps it on success, even for unsigned preview transactions. Since fee preview runs repeatedly for High/Default/Low/custom estimates, simply removing the pinned destination would likely burn internal change indexes.

Potential safer approaches:

  • Use a valid dummy CTxDestination with the same output type for preview-only coin_control.destChange, so fee estimation has the right script shape without asking the wallet for a new address.
  • Or add a wallet/interface-level preview API that can create fee estimates using an internal change script without keeping a reserved destination.

The Review page should remain the authoritative final preview because it prepares the real transaction candidate.

Acceptance criteria

  • Fee preview no longer calls getNewDestination() just to estimate fees.
  • Opening or updating the Send fee selector does not create qml-fee-preview address-book entries.
  • Repeated fee preview updates and app restarts do not consume new wallet destinations.
  • Existing fee-preview behavior remains covered for standard targets, custom fee, selected coins, and subtract-fee-from-amount.
## Problem QML send fee preview currently calls `WalletQmlModel::ensurePreviewChangeAddress()`, which generates a wallet destination with the label `qml-fee-preview`: - `qml/models/walletqmlmodel.cpp`: `ensurePreviewChangeAddress()` - `m_wallet->getNewDestination(m_wallet->getDefaultAddressType(), "qml-fee-preview")` That destination is cached for the current `WalletQmlModel` lifetime, so it does not create a new address on every estimate. However, it still creates a real receive/address-book entry, and after app restart or wallet model recreation another preview address can be generated. The fee preview path only needs to estimate fees. It should not consume wallet addresses or leave `qml-fee-preview` entries in wallet state/address-book surfaces. ## Expected behavior Send fee preview should estimate transaction fees without creating persistent wallet addresses or address-book entries. Repeated preview updates, app restarts, and wallet reloads should not accumulate preview-only receive addresses. ## Implementation notes The current code pins a preview change destination to avoid a worse behavior: if `coin_control.destChange` is left unset, `CreateTransactionInternal()` reserves an internal change destination and keeps it on success, even for unsigned preview transactions. Since fee preview runs repeatedly for High/Default/Low/custom estimates, simply removing the pinned destination would likely burn internal change indexes. Potential safer approaches: - Use a valid dummy `CTxDestination` with the same output type for preview-only `coin_control.destChange`, so fee estimation has the right script shape without asking the wallet for a new address. - Or add a wallet/interface-level preview API that can create fee estimates using an internal change script without keeping a reserved destination. The Review page should remain the authoritative final preview because it prepares the real transaction candidate. ## Acceptance criteria - Fee preview no longer calls `getNewDestination()` just to estimate fees. - Opening or updating the Send fee selector does not create `qml-fee-preview` address-book entries. - Repeated fee preview updates and app restarts do not consume new wallet destinations. - Existing fee-preview behavior remains covered for standard targets, custom fee, selected coins, and subtract-fee-from-amount.
Sign in to join this conversation.
No description provided.