Caravan Documentation
    Preparing search index...

    Function validateNonWitnessUtxo

    • Validates a non-witness UTXO (Unspent Transaction Output) for use in a PSBT.

      This function performs several checks on the provided UTXO to ensure it's valid:

      1. Verifies that the transaction can be parsed from the buffer.
      2. Checks if the specified output index (vout) is within the range of available outputs.
      3. Validates that the output value is a positive number.
      4. Ensures that the output script is a valid Buffer.

      Note: This function does not validate the txid, as the provided buffer represents the previous transaction, not the transaction containing this input.

      Parameters

      • utxoBuffer: Buffer

        The raw transaction buffer containing the UTXO.

      • txid: string

        The transaction ID of the input (not used in validation, but included for potential future use).

      • vout: number

        The index of the output in the transaction that we're spending.

      Returns boolean

      True if the UTXO is valid, false otherwise.

      Implicitly, if there's an issue parsing the transaction. The error is caught and logged, returning false.