fix(bitcoin-v2): Prevent setting 'max_amount_output' with existing outputs or change output#4716
Open
sergei-boiko-trustwallet wants to merge 1 commit intomasterfrom
Open
fix(bitcoin-v2): Prevent setting 'max_amount_output' with existing outputs or change output#4716sergei-boiko-trustwallet wants to merge 1 commit intomasterfrom
sergei-boiko-trustwallet wants to merge 1 commit intomasterfrom
Conversation
…ts or change output
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens transaction-builder parameter validation for Decred and Zcash (BitcoinV2 proto-based builders) by enforcing mutual exclusivity between max_amount_output and regular output configuration, preventing silent misconfiguration when building “send max” transactions.
Changes:
- Reject configurations where
max_amount_outputis set together withoutputs. - Reject configurations where
max_amount_outputis set together withchange_output. - Apply the same validation behavior in both Decred and Zcash signing request builders for consistency.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rust/chains/tw_zcash/src/modules/signing_request.rs | Adds invalid-params guard preventing max_amount_output from being combined with outputs/change_output. |
| rust/chains/tw_decred/src/modules/signing_request.rs | Adds the same mutual-exclusion validation for max_amount_output vs outputs/change_output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Binary size comparison➡️ aarch64-apple-ios: - 14.34 MB
+ 14.34 MB +2 KB➡️ aarch64-apple-ios-sim: - 14.34 MB
+ 14.34 MB +2 KB➡️ aarch64-linux-android: - 18.77 MB
+ 18.78 MB +3 KB➡️ armv7-linux-androideabi: - 16.20 MB
+ 16.20 MB +3 KB➡️ wasm32-unknown-emscripten: - 13.68 MB
+ 13.68 MB +2 KB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request adds stricter validation to the transaction building logic for both Decred and Zcash chains. Specifically, it ensures that the
max_amount_outputparameter cannot be used together with regular outputs or a change output, preventing invalid transaction configurations.Validation improvements for transaction building:
DecredSigningRequestBuilderto return an error ifmax_amount_outputis set together withoutputsorchange_output, enforcing mutual exclusivity.