Send ignores an enabled avoid_reuse wallet policy #1087

Open
opened 2026-11-09 00:54:19 +00:00 by jarolrod · 0 comments
jarolrod commented 2026-11-09 00:54:19 +00:00 (Migrated from github.com)

Automatic Send can spend reused outputs even when the wallet has avoid_reuse=true. The same wallet’s normal RPC send respects the flag and refuses when no eligible funds are available. Send’s balance and Max calculation also disagree with its amount validation.

To reproduce on regtest:

  1. Create a wallet with avoid_reuse=true. Fund an address, spend from it, then receive more funds at that same address. Confirm that listunspent marks the new outputs as reused: true. Retain a separate clean change output.
  2. Open Send with Automatic input selection and choose Use maximum. In the fixture, the wallet badge showed 4,998,590 sats, while Send included another 12,000,000 sats of reused funds. Max filled 16,998,345 sats, then reported “Amount exceeds available balance” and disabled Review.
  3. Clear the amount and lock the clean output using lockunspent, leaving only reused outputs available for selection.
  4. Try an RPC sendtoaddress for 0.01999890 BTC at 1 sat/vB, without overriding avoidance. It returns Insufficient funds.
  5. Prepare the same payment in the GUI using Automatic inputs and 1 sat/vB, then approve it.

The GUI submits the transaction. Its decoded input is a 2,000,000-sat output previously recorded as reused; it pays the intended recipient 1,999,890 sats with a 110-sat fee. The transaction appears in the wallet and local mempool, the clean output remains locked, and avoid_reuse remains true.

With avoidance disabled in an equivalent fixture, the badge and Send balances agree and Max is valid.

Automatic selection should inherit the enabled wallet policy. Available balance, Max, amount validation and transaction preparation should apply the same policy.

This is in the GUI’s coin-control setup. QML preparation leaves avoidance at its default false value, which Core treats as an opt-out. The RPC path inherits the wallet flag.

This requires an explicitly configured wallet; default GUI-created wallets leave the flag off. Bitcoin-Qt shares this limitation; related upstream discussion is gui#341. Observed on merged qt6 at 6e54a48ab571, macOS / Qt 6.9, using the full application with isolated offscreen regtest fixtures.

Automatic Send can spend reused outputs even when the wallet has `avoid_reuse=true`. The same wallet’s normal RPC send respects the flag and refuses when no eligible funds are available. Send’s balance and Max calculation also disagree with its amount validation. To reproduce on regtest: 1. Create a wallet with `avoid_reuse=true`. Fund an address, spend from it, then receive more funds at that same address. Confirm that `listunspent` marks the new outputs as `reused: true`. Retain a separate clean change output. 2. Open Send with Automatic input selection and choose Use maximum. In the fixture, the wallet badge showed 4,998,590 sats, while Send included another 12,000,000 sats of reused funds. Max filled 16,998,345 sats, then reported “Amount exceeds available balance” and disabled Review. 3. Clear the amount and lock the clean output using `lockunspent`, leaving only reused outputs available for selection. 4. Try an RPC `sendtoaddress` for `0.01999890 BTC` at `1 sat/vB`, without overriding avoidance. It returns `Insufficient funds`. 5. Prepare the same payment in the GUI using Automatic inputs and `1 sat/vB`, then approve it. The GUI submits the transaction. Its decoded input is a 2,000,000-sat output previously recorded as reused; it pays the intended recipient 1,999,890 sats with a 110-sat fee. The transaction appears in the wallet and local mempool, the clean output remains locked, and `avoid_reuse` remains true. With avoidance disabled in an equivalent fixture, the badge and Send balances agree and Max is valid. Automatic selection should inherit the enabled wallet policy. Available balance, Max, amount validation and transaction preparation should apply the same policy. This is in the GUI’s coin-control setup. [QML preparation](https://github.com/bitcoin-core/gui-qml/blob/6e54a48ab571cb46b813eb1d98a301401089192f/qml/models/walletqmlmodel.cpp#L2348) leaves avoidance at its default false value, which Core treats as an opt-out. The [RPC path](https://github.com/bitcoin/bitcoin/blob/dc282ff31d1cc97507530a541d9cec8a8f6a6ef4/src/wallet/rpc/util.cpp#L22) inherits the wallet flag. This requires an explicitly configured wallet; default GUI-created wallets leave the flag off. Bitcoin-Qt shares this limitation; related upstream discussion is [gui#341](https://github.com/bitcoin-core/gui/issues/341). Observed on merged `qt6` at `6e54a48ab571`, macOS / Qt 6.9, using the full application with isolated offscreen regtest fixtures.
Sign in to join this conversation.
No description provided.