Skip to content

fix: skip re-sanitization of already-sanitized UTXOs in fetchAndSanit…#15

Open
ipseonet wants to merge 1 commit into
syscoin:masterfrom
ipseonet:fix/wif-signing-double-sanitization
Open

fix: skip re-sanitization of already-sanitized UTXOs in fetchAndSanit…#15
ipseonet wants to merge 1 commit into
syscoin:masterfrom
ipseonet:fix/wif-signing-double-sanitization

Conversation

@ipseonet

Copy link
Copy Markdown

Summary

Fixes #14

When utxos are passed in already sanitized (e.g. when using WIF signing without a Signer), fetchAndSanitizeUTXOs was incorrectly re-sanitizing them via sanitizeBlockbookUTXOs.

This caused txId to be silently lost because sanitizeBlockbookUTXOs reads utxo.txid (lowercase) which is undefined on already-sanitized objects that use camelCase txId.

Error

Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]

Fix

Detect already-sanitized UTXOs by checking for the presence of a .utxos array with txId fields, and skip re-sanitization in that case.

Testing

Verified by successfully building and broadcasting a syscoinBurnToAssetAllocation transaction using WIF signing on Tanenbaum testnet.
TXID: f131e672f31ef490c3e92cd78ee844abae711ff3d66b5383121d8e6e90b1e349

…izeUTXOs

When utxos are passed in already sanitized (e.g. when using WIF signing
without a Signer), fetchAndSanitizeUTXOs was re-sanitizing them via
sanitizeBlockbookUTXOs. This caused txId to be lost because the re-
sanitization reads utxo.txid (lowercase) which is undefined on already-
sanitized objects that use camelCase txId.

This broke PSBT construction for WIF signers with the error:
'Invalid arguments for Psbt.addInput. Requires single object with at
least [hash] and [index]'

Fix: detect already-sanitized UTXOs by checking for the presence of
.utxos array with txId fields, and skip re-sanitization in that case.

Fixes: syscoin#14
@sidhujag

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 1f58ff8c18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidhujag

Copy link
Copy Markdown
Member

@ipseonet can you describe your organization and how you use it, who are your clients?

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.

syscoinBurnToAssetAllocation fails with WIF signing — txId stripped during double sanitization

2 participants