Skip to content

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
fix/zcash-decred-max-amount-output
Open

fix(bitcoin-v2): Prevent setting 'max_amount_output' with existing outputs or change output#4716
sergei-boiko-trustwallet wants to merge 1 commit intomasterfrom
fix/zcash-decred-max-amount-output

Conversation

@sergei-boiko-trustwallet
Copy link
Copy Markdown
Contributor

This pull request adds stricter validation to the transaction building logic for both Decred and Zcash chains. Specifically, it ensures that the max_amount_output parameter cannot be used together with regular outputs or a change output, preventing invalid transaction configurations.

Validation improvements for transaction building:

  • Added a check in DecredSigningRequestBuilder to return an error if max_amount_output is set together with outputs or change_output, enforcing mutual exclusivity.
  • Added the same validation logic to the Zcash signing request builder, ensuring consistent behavior across both chains.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_output is set together with outputs.
  • Reject configurations where max_amount_output is set together with change_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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants