mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 16:02:38 +00:00
wallet: return broadcast errors from CommitTransaction #36597
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!36597
Loading…
Reference in a new issue
No description provided.
Delete branch "commit-transaction-interface"
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?
Part of https://github.com/bitcoin-core/gui-qml/issues/1008.
The QML GUI shows "Transaction sent" even when the node rejected the transaction, because
CWallet::CommitTransaction()only logs the rejection and returnsvoid.This PR bubbles up the submission result through
interfaces::Wallet::commitTransaction()so the GUI can report it.Key changes
TransactionBroadcastError, holding aTransactionErrorcode and an untranslated message.Expected<void, TransactionBroadcastError>.TransactionError::OK, a success value in an error enum.SUBMISSION_SKIPPEDcode for when the wallet doesn't submit the transaction (broadcasting disabled, abandoned, coinbase, confirmed or conflicted).SubmitTxMemoryPoolAndRelay()previously returnedfalsein these cases.Note
commitBumpTransaction()similarly reports success for a rejected replacement. This will be addressed in a follow-up PR.interfaces::Walletmock for the newcommitTransaction()signature.The 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.
Concept ACK
🔵 Suggestion · A failed commit can leave the transaction pending and its inputs reserved
If a caller presents a non-skipped commit error as a failed send, the user may resend while the original transaction remains reserved and can later be rebroadcast; whether gui-qml does this is unverified.
Location:
src/interfaces/wallet.h:159(head).🔵 Suggestion · Show the detailed rejection reason for PSBT broadcasts
psbtoperationsdialog.cpp:131 still shows only TransactionErrorString(code). It omits result.error().message, which for mempool failures carries the validation reason (e.g. 'mempool min fee not met'). The base discarded err_string the same way, so this is a pre-existing optional improvement.
Location:
src/qt/psbtoperationsdialog.cpp:129(head).Review coverage was incomplete.
Reviewed:
4e3d16755971· Full review report · Previous reportspermalink
Concept ACK
4e3d167559With -walletbroadcast=0, commitTransaction now returns an error (SUBMISSION_SKIPPED), even though the user chose not to broadcast. Will the QML GUI treat that as "saved, not broadcast" rather than as a failure?
Yes, that's the intent.
SUBMISSION_SKIPPEDis a separate code precisely so a caller can differentiate between "the wallet didn't submit it" and "the node rejected it" and act accordingly.Can you explain why this would be needed? If the wallet creates a consensus-invalid (permanently invalid) transaction, that seems like a severe bug that should be fixed instead. If the wallet creates a tx which permanently fails the mempool policy, that seems like an equally severe bug that should be fixed instead. If the wallet creates a tx that undershoots the fee, that seems irrelevant and can equally happen when the tx was accepted to the mempool, but then dropped? If the mempool min fee is 0.677 sat/vB, but the user explicitly asked for a tx at
0.1, it seems like a case that the GUI should not allow or display a warning while creating the tx. Some feedback directly after the tx was created seems misplaced? If this was needed, the feedback could be done async?The GUI can import a PSBT that spends the wallet's coins, sign it with the wallet and commit it. Its inputs and fee were chosen elsewhere and none of
createTransaction()'s checks ran, so a rejection (fee above-maxtxfee, a non-standard output, a mempool conflict) isn't a wallet bug and can't be caught at creation. An early rejection with the reason atcommitTransaction()time seems useful.Partially agree. The GUI should catch this before the user confirms. Currently, it looks like
GetMinimumFeeRate()only checks-mintxfee/-minrelaytxfeewhen the user has set the fee rate manually. Maybe GUI should also check for mempool minimum.A synchronous error when submission fails right away seems more useful than returning
void, which is what we do today.Async feedback sounds like a good idea. Something the GUI can subscribe to and be notified about (a later eviction). I see it as complementing the sync error rather than replacing it.
I ran some mutation testing on the changed files. One surviving mutant seems relevant here:
Surviving mutant
wallet/interfaces.cpp: returning success onMEMPOOL_REJECTEDsurvives.CommitTransactionErrorscovers the rejection onCWallet, but the interface testcommit_transaction(the path gui-qml#1008 uses) only coversSUBMISSION_SKIPPEDand success.🐙 This pull request conflicts with the target branch and needs rebase.
Concept ACK