Skip to content

Conversation

@OttoAllmendinger
Copy link
Contributor

This PR enhances the transaction parsing and output handling in the
abstract-utxo package with several key improvements:

  • Refactored parseTransaction and parsePsbt for better organization and
    readability, including extraction of RBF parsing and output conversion
    into separate functions
  • Added support for external change addresses to improve testing capabilities
  • Improved error messaging for invalid recipients by displaying more
    useful information
  • Added WASM test cases for parsePsbt
  • Enhanced handling of script recipients in toCanonicalTransipient
  • Fixed OP_RETURN output value to ensure transaction standardness
  • Added support for RBF in parsePsbt tests
  • Improved expected outputs logic for transaction explanations

BTC-2732

OttoAllmendinger and others added 9 commits November 19, 2025 15:32
…tests

Refactored the conditional structure in parsePsbt test file to improve
readability by using an early return pattern instead of a nested if block.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
This way the transaction is standard per policy rules, which some of our
tests expect.

It maybe worthwhile to have a non-standard consensus-valid suite and maybe
even an consensus-invalid suite, but that is for another time.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Handles script recipients properly by not attempting to canonicalize them.
Also makes address required to ensure proper type safety and consistent
behavior.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Improve error message for non-encodeable scriptPubkeys by displaying
the amount and address directly instead of stringifying the entire
output object, which can cause issues with bigint values.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Add test coverage for parsing RBF transactions in PSBT format by:
- Adding logic to handle rbfTxIds in test parameters
- Mocking wallet.getTransaction for RBF test cases
- Adding a dedicated RBF test case with txid placeholder

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Added ability to set a recipient address as a change address for testing
and verification purposes. This helps with scenarios where we need to
test custom change addresses without applying size constraints.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Extracted RBF parsing and output conversion logic into separate functions
for better code organization and readability. This improves maintainability
and makes the transaction parsing flow clearer.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Move transaction explanation logic after expected outputs calculation to
improve logical flow. Change how external change addresses are handled in
expectedOutputs to use 'max' amount instead of adding all outputs.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Adds new test cases that use WASM implementation for parsing PSBTs in
fixedScript/parsePsbt.ts. The code extracts a utility function into a
shared util.ts file and reuses it across test files.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review November 19, 2025 15:00
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner November 19, 2025 15:00
@OttoAllmendinger OttoAllmendinger merged commit 87c6042 into master Nov 19, 2025
14 checks passed
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.

3 participants