Repository navigation
Conversation
When every input amount is known, AnalyzePSBT computed fee as in_amt - out_amt and returned it even if it was negative, together with a negative fee rate and a next role of updater or signer. Treat a PSBT that pays out more than it spends as invalid, like the other amount checks in the same function.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, 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. |
|
Tested ACK 8262933 on Windows. Would it be worth also adding a unit test in psbt_tests? |
|
tACK 8262933 Verified the bug on The guard in |
|
Sorry for bikeshedding. I am trying to understand what the motive for a unit test is here.. What special thing would the unit test assert that the current functional test does not 🤔 ? |
|
Hi @winterrdog. It's totally fine to enquire! While I'd say it's a nit, obviously, the thought was mainly direct coverage on the C++ struct ( That said, since rpc_psbt.py already asserts both |
| self.log.info("PSBT whose outputs exceed its inputs should have error message and Creator as next") | ||
| overspend_utxo = self.create_outpoints(self.nodes[0], outputs=[{self.nodes[0].getnewaddress(): 1}])[0] | ||
| self.generate(self.nodes[0], 1) | ||
| overspend = self.nodes[0].createpsbt([overspend_utxo], [{self.nodes[0].getnewaddress(): 2}], psbt_version=0) |
There was a problem hiding this comment.
psbt_version=0 doesn't seem required - v2 is the default.

AnalyzePSBTcomputesfee = in_amt - out_amtonce every input amount is known and returns it as is. A PSBT whose outputs are worth more than its inputs therefore gets a negativefeeand anextrole of updater, even though no wallet can ever sign it into a valid transaction. The function already returnsPSBT is not valid. ...for bad input values, unspendable outputs and an out-of-range output total.An output total above the input total is reported the same way:
The functional test builds a PSBT that spends a 1 BTC output into a 2 BTC output and checks the error and the
creatorrole. Without the change the assertion onnextfails.rpc_psbt.py,wallet_send.py,wallet_multisig_descriptor_psbt.py,rpc_openrpc.pyand the psbt unit tests pass.