qml: Require a custom fee when fees cannot be estimated #1092

Open
AndreaDiazCorreia wants to merge 4 commits from fix/fallback-fee-unavailable into qt6 AGit
AndreaDiazCorreia commented 2026-11-09 18:04:08 +00:00 (Migrated from github.com)

Without fee estimates and with -fallbackfee disabled (the default outside regtest), the Send preview made up a rate from the required fee times a per-preset multiplier, while transaction preparation used the confirmation target alone. Review showed a fee, and Core rejected the transaction only after the passphrase was entered. Remove the made-up preview rate so the preview follows the same fee policy as the final transaction. When the selected target has no estimate, show "Your node can't estimate fees yet. Choose Custom and enter a fee rate to continue." and keep Review disabled until a valid custom rate is entered. New blocks retry the estimate, so Review unlocks once the node can estimate.

The availability check and the preview now share one prepared coin control per target, so they cannot diverge.

#1036 asks to either expose fallbackfee or recommend a custom fee. This takes the second option. Missing estimates are temporary, Core disables fallbackfee by default to avoid a fixed rate that ignores the network, and the Qt Widgets GUI never exposed it. It remains available in bitcoin.conf.

A custom fee rate such as 18446744073709552.616 sat/vB overflowed whole_part * 1000 + fractional_value in ParseCustomFeeRatePerKvB() and became an unrelated rate. Check the bound before the arithmetic and reject the rate.

Selecting the already-checked Custom option replaced the entered rate with an estimate. Only seed the rate from an estimate when switching to Custom from a preset; moving the target slider still updates it.

Unit tests cover the overflow bound and the unavailable-estimate reporting with fallback disabled and enabled. QML tests cover the Review gate, the block retry and reselecting Custom. Manually tested on a custom signet without fee history or -fallbackfee: Standard keeps Review disabled with the new message; Custom at 17 sat/vB keeps its rate after reselecting Custom and sends at 17 sat/vB; after a few blocks of fee history, Review enables without editing the form and Standard sends at the estimated rate.

Fixes #997
Fixes #1025
Fixes #1036
Fixes #1086

Without fee estimates and with `-fallbackfee` disabled (the default outside regtest), the Send preview made up a rate from the required fee times a per-preset multiplier, while transaction preparation used the confirmation target alone. Review showed a fee, and Core rejected the transaction only after the passphrase was entered. Remove the made-up preview rate so the preview follows the same fee policy as the final transaction. When the selected target has no estimate, show "Your node can't estimate fees yet. Choose Custom and enter a fee rate to continue." and keep Review disabled until a valid custom rate is entered. New blocks retry the estimate, so Review unlocks once the node can estimate. The availability check and the preview now share one prepared coin control per target, so they cannot diverge. #1036 asks to either expose `fallbackfee` or recommend a custom fee. This takes the second option. Missing estimates are temporary, Core disables `fallbackfee` by default to avoid a fixed rate that ignores the network, and the Qt Widgets GUI never exposed it. It remains available in `bitcoin.conf`. A custom fee rate such as `18446744073709552.616` sat/vB overflowed `whole_part * 1000 + fractional_value` in `ParseCustomFeeRatePerKvB()` and became an unrelated rate. Check the bound before the arithmetic and reject the rate. Selecting the already-checked Custom option replaced the entered rate with an estimate. Only seed the rate from an estimate when switching to Custom from a preset; moving the target slider still updates it. Unit tests cover the overflow bound and the unavailable-estimate reporting with fallback disabled and enabled. QML tests cover the Review gate, the block retry and reselecting Custom. Manually tested on a custom signet without fee history or `-fallbackfee`: Standard keeps Review disabled with the new message; Custom at 17 sat/vB keeps its rate after reselecting Custom and sends at 17 sat/vB; after a few blocks of fee history, Review enables without editing the form and Standard sends at the estimated rate. Fixes #997 Fixes #1025 Fixes #1036 Fixes #1086
rreview commented 2026-11-09 18:52:03 +00:00 (Migrated from github.com)

No verified findings are available from this review.

Review coverage was incomplete.


Reviewed: ca075b1df770 · Review report

<!-- ralph-major:bitcoin-core/gui-qml --> No verified findings are available from this review. Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`ca075b1df770`](<https://github.com/bitcoin-core/gui-qml/commit/ca075b1df770653f58980bb5a6c449ddcffe1ab8>) · [Review report](<https://review.fish.foo/report/gui/1092-ca075b1df770653f58980bb5a6c449ddcffe1ab8-2548-4.html>)
jarolrod commented 2026-11-10 15:41:44 +00:00 (Migrated from github.com)

I found a regtest case where the preset itself selects a rate below the node’s relay minimum. On merged qt6 at eed1f426fcb6, I started a funded wallet with -minrelaytxfee=0.00002 (2 sat/vB) and entered a 0.1 BTC payment.

  1. Priority, Standard and Flexible each showed Fee estimate unavailable with Review Transaction enabled.
  2. Clicking Review on Standard failed with Fee rate (1.000 sat/vB) is lower than the minimum fee rate setting (2.000 sat/vB).
  3. Switching the same payment to Custom and entering 2 sat/vB opened Review at 2 sat/vB. With the default relay minimum in a separate profile, Standard opened Review at 1 sat/vB.

Reading the PR at e22379e6f358, the regtest override still sets an explicit 1 sat/vB rate, and NetworkFeeEstimateUnavailable() returns false when that rate is set. That appears to skip the new Custom-fee guidance for this case. Regtest override, availability check.

Could the preset use at least the configured relay minimum? If a preset cannot produce a valid transaction, it would help to explain why and point to Custom before enabling Review.

I found a regtest case where the preset itself selects a rate below the node’s relay minimum. On merged `qt6` at `eed1f426fcb6`, I started a funded wallet with `-minrelaytxfee=0.00002` (2 sat/vB) and entered a 0.1 BTC payment. 1. Priority, Standard and Flexible each showed **Fee estimate unavailable** with **Review Transaction** enabled. 2. Clicking Review on Standard failed with `Fee rate (1.000 sat/vB) is lower than the minimum fee rate setting (2.000 sat/vB).` 3. Switching the same payment to Custom and entering 2 sat/vB opened Review at 2 sat/vB. With the default relay minimum in a separate profile, Standard opened Review at 1 sat/vB. Reading the PR at `e22379e6f358`, the regtest override still sets an explicit 1 sat/vB rate, and `NetworkFeeEstimateUnavailable()` returns `false` when that rate is set. That appears to skip the new Custom-fee guidance for this case. [Regtest override](https://github.com/bitcoin-core/gui-qml/blob/e22379e6f3586673e0aa8b97a56ea6668db7d53c/qml/models/walletqmlmodel.cpp#L239), [availability check](https://github.com/bitcoin-core/gui-qml/blob/e22379e6f3586673e0aa8b97a56ea6668db7d53c/qml/models/walletqmlmodel.cpp#L440). Could the preset use at least the configured relay minimum? If a preset cannot produce a valid transaction, it would help to explain why and point to Custom before enabling Review.
AndreaDiazCorreia commented 2026-11-10 22:34:00 +00:00 (Migrated from github.com)

@jarolrod Thanks, reproduced. The regtest override now uses at least the wallet's required fee rate (max of -mintxfee and -minrelaytxfee), so the presets produce a valid fee instead of falling below the minimum. With -minrelaytxfee=0.00002, Standard now opens Review and broadcasts at 2 sat/vB; the default profile stays at 1 sat/vB. Fixed in 09007d296e with a unit test.

@jarolrod Thanks, reproduced. The regtest override now uses at least the wallet's required fee rate (max of -mintxfee and -minrelaytxfee), so the presets produce a valid fee instead of falling below the minimum. With -minrelaytxfee=0.00002, Standard now opens Review and broadcasts at 2 sat/vB; the default profile stays at 1 sat/vB. Fixed in 09007d296e with a unit test.
AndreaDiazCorreia commented 2026-11-16 21:13:33 +00:00 (Migrated from github.com)

@jarolrod could you take another look? The -minrelaytxfee case is fixed in 09007d296e

@jarolrod could you take another look? The -minrelaytxfee case is fixed in 09007d296e
Sign in to join this conversation.
No description provided.