Skip to content

syscoinBurnToAssetAllocation fails with WIF signing — txId stripped during double sanitization #14

Description

@ipseonet

Describe the bug
When calling syscoinBurnToAssetAllocation with a WIF key (no Signer) and passing sysFromXpubOrAddress, the UTXOs are fetched and sanitized correctly but then re-sanitized inside fetchAndSanitizeUTXOs. The re-sanitization reads utxo.txid (lowercase) but sanitized UTXOs use utxo.txId (camelCase), causing txId to be undefined in the resulting inputs. This causes createPSBTFromRes to fail with "Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]".

To Reproduce

  1. Call syscoinBurnToAssetAllocation without a Signer
  2. Pass sysFromXpubOrAddress as an address string
  3. Pass null for utxos

Expected behavior
Transaction builds and broadcasts successfully.

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

Root cause
In fetchAndSanitizeUTXOs, when utxos is null and fromXpubOrAddress is set, UTXOs are fetched and sanitized correctly. However the sanitized UTXOs are then passed back through sanitizeBlockbookUTXOs again at line 610, which reads utxo.txid (undefined on already-sanitized UTXOs) instead of utxo.txId.

Fix
Skip re-sanitization when UTXOs are already in sanitized format, or ensure sanitizeBlockbookUTXOs handles both txid and txId field names.

Impact
This affects all developers using WIF key signing (server-side scripts, automated tools,
testing). The HD Signer path works correctly. WIF signing is the natural choice for
backend integrations and development tooling, making this a significant barrier to
adoption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions