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.
Declared in <kernel/bitcoinkernel.h>
[[nodiscard, __nonnull__]]
int
btck_script_pubkey_verify(
btck_ScriptPubkey const* script_pubkey,
int64_t amount,
btck_Transaction const* tx_to,
btck_PrecomputedTransactionData const* precomputed_txdata,
unsigned int input_index,
btck_ScriptVerificationFlags flags,
btck_ScriptVerifyStatus* status);
| Name | Description |
|---|---|
| script_pubkey [in] | Non-null, script pubkey to be spent. |
| amount [in] | Amount of the script pubkey's associated output. May be zero if the witness flag is not set. |
| tx_to [in] | Non-null, transaction spending the script_pubkey. |
| precomputed_txdata [in] | Nullable if the taproot flag is not set. Otherwise, precomputed data for tx_to with the spent outputs must be provided. |
| input_index [in] | Index of the input in tx_to spending the script_pubkey. |
| flags [in] | Bitfield of btck_ScriptVerificationFlags controlling validation constraints. |
| status [out] | Nullable, will be set to an error code if the operation fails, or OK otherwise. |