[#btck_script_pubkey_verify] = btck_script_pubkey_verify :mrdocs: 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. == Synopsis Declared in `<kernel/bitcoinkernel.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard, __nonnull__]] int btck_script_pubkey_verify( xref:btck_ScriptPubkey-0e.adoc[btck_ScriptPubkey] const* script_pubkey, int64_t amount, xref:btck_Transaction-08.adoc[btck_Transaction] const* tx_to, xref:btck_PrecomputedTransactionData-00.adoc[btck_PrecomputedTransactionData] const* precomputed_txdata, unsigned int input_index, xref:btck_ScriptVerificationFlags.adoc[btck_ScriptVerificationFlags] flags, xref:btck_ScriptVerifyStatus.adoc[btck_ScriptVerifyStatus]* status); ---- == Return Value 1 if the script is valid, 0 otherwise. [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | 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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#