firmware/psbt: add BTCSignNeedsNonWitnessUTXOs() helper
#139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BitBox needs access to the input's previous
transactions (NonWitnessUTXO in PSBT-jargon) if not all inputs are Taproot. Since it can be costly to retrieve them, client's can check if they are needed using this function before providing them.
When signing using
BTCSign()directly, one could do this withBTCSignNeedsPrevTxs(), but that is not compatible with PSBT signing workflow.A small complication: BitBox has a bug (to be fixed in a future FW version) where the previous transactions are required, even if all inputs are Taproot - when an output is marked as belonging to the same account (change or otherwise) but the output is a non-Taproot output. The function as it is now aligns with this bug, and will be extended/corrected once the FW with the bugfix is available. When that happens, the
TestSimulatorBTCPSBTTaprootSpendsToNonTaprootcan be adjusted.