#36569 psbt: analyzepsbt reports an error when outputs exceed inputs
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36569 psbt: analyzepsbt reports an error when outputs exceed inputs | Waiting on author | 2 | Strong | 5 + 8 tests | |||
|
|
|
| ||||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Updates `analyzepsbt` to mark a PSBT as invalid when total output amount exceeds total input amount once all input amounts are known. Instead of returning a negative fee and suggesting next roles like updater or signer, the RPC now returns an error string and sets the next role to creator.
Problem: When all input amounts are known but outputs exceed inputs, `analyzepsbt` calculates a negative fee and fee rate, advising downstream roles like updater or signer for a transaction that can never be validly mined.
Evidence of importance:
- PR description: 'A PSBT whose outputs are worth more than its inputs therefore gets a negative fee and a next role of updater, even though no wallet can ever sign it into a valid transaction.'
Risk of a mistake: low (rpc_api). A bug in this check could falsely reject or misreport the next role in analyzepsbt for valid PSBTs, but it only triggers when known outputs strictly exceed known inputs.
Reviewability
Paused · Waiting on author
Open objection from Yudis-bit with no author reply for 12 days; review would repeat what has been asked.
Waiting on (from the thread read):
- author: response to suggestion about adding a unit test in psbt_tests 2026-10-19
Agreement
Strong
substantive support, no open objection (Husteem)
Thread notes: Added Husteem's Tested ACK and winterrdog's query regarding test scope. Yudis-bit's unit test suggestion remains open awaiting author response.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| Yudis-bit (none) | suggestion, maintenance | Consider adding a unit test in psbt_tests | open · no author reply | answered | no | 2026-10-19: 'Would it be worth also adding a unit test in psbt_tests?' |
Support:
- Yudis-bit (none) (Tested ACK, 2026-10-19) [tested]: tested on Windows [not substantive]
- Husteem (none) (Tested ACK, 2026-10-20) [both: AnalyzePSBT, rpc_psbt.py]: guard in AnalyzePSBT is a good fix; verified bug on master and rpc_psbt.py passes
Participants:
- Yudis-bit (none, support, 1 statements 2026-10-19 to 2026-10-19): Tested ACK; suggested adding a unit test in psbt_tests
- Husteem (none, support, 2 statements 2026-10-20 to 2026-10-20): Tested ACK; supported adding a unit test but conceded functional tests cover the regression
- winterrdog (contributor, neutral, 1 statements 2026-10-20 to 2026-10-20): questioned the motive for adding a unit test given existing functional test coverage
Files
8 lines under test/bench/ci.
- test/functional/rpc_psbt.py +8/-0
- src/node/psbt.cpp +5/-0
Card
The short text the ranking pass compares across PRs.
Updates analyzepsbt to report an error when output amounts exceed input amounts on a PSBT with all input values known. Currently, analyzepsbt calculates a negative fee and directs the user to updater or signer for a transaction that can never become valid. It now sets the next role to creator and returns an invalid PSBT error, aligning with existing checks for bad input values or unspendable outputs.
Data
thread read through 2026-10-20 (4 statements), head 8262933013
labels: PSBT
Categories
RPC / REST / ZMQ
P3 · bug fix (ranking pass: Moved up 9: corrects misleading analyzepsbt output (negative fee, wrong next role) for an impossible transaction.)
Fixes `analyzepsbt` calculating a negative fee and advising downstream roles like updater or signer for unspendable transactions. The change prevents confusing output when inputs and outputs are fully known.
Membership: Modifies `src/node/psbt.cpp` to adjust `analyzepsbt` RPC behavior and error reporting when PSBT outputs exceed inputs.
Factors: security/stability 0, bug 1, performance 0, user value 1, leverage 0