mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:26:38 +00:00
wallet: handle MiniMiner bump fee calculation failures #34698
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!34698
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-wallet-bump-fee-error"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #29711.
When MiniMiner cannot calculate individual bump fees, wallet funding can
index missing bump-fee entries and return
map::atto users.Treat an empty bump-fee map for non-empty requested outpoints as a
calculation failure. Make
AvailableCoinsreturnutil::Result<CoinsResult>so transaction creation andsendallcanpropagate the wallet error instead of leaking an internal exception.
Add a functional regression test in
wallet_spend_unconfirmed.pycovering the large unconfirmed set scenario from #29711. The test checks
auto-selected inputs, manually selected inputs, and
sendall, and verifiesthat spending succeeds again after mining a block.
Tested:
cmake --build buildbuild/bin/test_bitcoin --catch_system_errors=nobuild/bin/test_bitcoin --run_test=miniminer_tests --catch_system_errors=nobuild/bin/test_bitcoin --run_test=spend_tests --catch_system_errors=nobuild/bin/test_bitcoin --run_test=coinselector_tests/bump_fee_test --catch_system_errors=nobuild/bin/test_bitcoin --run_test=wallet_tests/ListCoinsTest --catch_system_errors=nobuild/bin/test_bitcoin --run_test=wallet_tests/BasicOutputTypesTest --catch_system_errors=nopython3 build/test/functional/test_runner.py wallet_spend_unconfirmed.py wallet_sendall.py wallet_send.py wallet_fundrawtransaction.py wallet_bumpfee.py wallet_create_tx.py wallet_basic.pybuild/bin/bench_bitcoin -filter='WalletAvailableCoins|WalletCreateTxUseOnlyPresetInputs|WalletCreateTxUsePresetInputsAndCoinSelection' -sanity-checkThe following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Changing this to be
std::optionalseems a bit unnecessary to me as it's equivalently easy to check for!empty(). That probably reduces the diff by half.Makes sense. I'll simplify this by keeping the map return type and detecting failure based on whether entries were produced for all requested outpoints, rather than changing the interface to return
std::optional.I don't think this is the right way to propagate errors out of
AvailableCoins. This is already returningCoinsResultwhich can be extended to include error codes/states, a laValidationState. Or this could return autil::Result<CoinsResult>to contain the error message on error.Took the second option,
AvailableCoinsnow returnsutil::Result<CoinsResult>Rebased on master.
Changes since the last round of review:
AvailableCoinsreturnsutil::Result<CoinsResult>rather than reporting through anout-parameter, so the error travels with the result.
CreateTransactionInternalmoves theCoinsResultinstead of copying it.gave up, and comments in the functional test for the cluster limit the scenario relies on.
Base:
a829aeaac1aff6cb786aab7d2514b49eb233334bHead:
a34afcd4366dd49b74922486bbce8a3fbd71ed83Design and approach
Should fee-calculation failure block spends using confirmed coins? (src/wallet/spend.cpp:521, head)
AvailableCoinsgathers bump fees for all eligible outpoints beforeSelectCoinsruns. If the combined gathered set exceeds 500 transactions, including across multiple clusters,GatherClustersreturns no result and prevents the transaction from proceeding even when coin selection could use confirmed inputs. Could the wallet calculate fees per independent cluster or otherwise keep confirmed coins available when fee calculation for unconfirmed coins fails? This would require additional handling or calculation work, but would avoid blocking otherwise fundable spends. Please clarify whether blocking the entire funding request until the unconfirmed set shrinks is intentional.Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial review had incomplete evidence. The adversarial_glm review did not complete. The design review did not complete.
Full review report
ACK
a34afcd436Independent reproduce + review notes
Reproduced on pristine master (Debug) and on v30.2:
error code: -1/map::atRoot cause matches the PR:
GatherClustersreturns empty when size > 500 →MiniMinernot ready →CalculateBumpFeesreturns empty map → wallet.at()throws. Combined bump-fee path already fails with a descriptive error (nullopt); this PR correctly aligns the individual path viautil::Result<CoinsResult>.Suggestions (non-blocking)
empty() && !outpoints.empty()stays a sound failure detector.sendmaps the newutil::ErrortoRPC_WALLET_ERROR(not-1), same as thesendallpath in this PR.sendfunctional path is a good end-to-end check; if CI time bites, the newminiminer_testscluster-501 case already covers the MiniMiner contract tightly.Approach LGTM relative to achow101's earlier feedback (
util::Result+ keep map return type). Happy to help with rebase/test-runtime follow-ups if useful.Approach ACK