Skip to main content

btck_script_pubkey_verify

Function btck_script_pubkey_verify 

Source
pub unsafe extern "C" fn btck_script_pubkey_verify(
    script_pubkey: *const btck_ScriptPubkey,
    amount: i64,
    tx_to: *const btck_Transaction,
    precomputed_txdata: *const btck_PrecomputedTransactionData,
    input_index: c_uint,
    flags: btck_ScriptVerificationFlags,
    status: *mut btck_ScriptVerifyStatus,
) -> c_int
Expand description

@brief Verify if the input at input_index of tx_to spends the script pubkey under the constraints specified by flags. If the btck_ScriptVerificationFlags_WITNESS flag is set in the flags bitfield, the amount parameter is used. If the taproot flag is set, the precomputed data must contain the spent outputs.

@param[in] script_pubkey Non-null, script pubkey to be spent. @param[in] amount Amount of the script pubkey’s associated output. May be zero if the witness flag is not set. @param[in] tx_to Non-null, transaction spending the script_pubkey. @param[in] precomputed_txdata Nullable if the taproot flag is not set. Otherwise, precomputed data for tx_to with the spent outputs must be provided. @param[in] input_index Index of the input in tx_to spending the script_pubkey. @param[in] flags Bitfield of btck_ScriptVerificationFlags controlling validation constraints. @param[out] status Nullable, will be set to an error code if the operation fails, or OK otherwise. @return 1 if the script is valid, 0 otherwise.