diff --git a/depend/zcash/src/script/zcash_script.cpp b/depend/zcash/src/script/zcash_script.cpp index 5db1fd85f..b322f8715 100644 --- a/depend/zcash/src/script/zcash_script.cpp +++ b/depend/zcash/src/script/zcash_script.cpp @@ -6,14 +6,15 @@ #include "zcash_script.h" -// #include "consensus/upgrades.h" -// #include "primitives/transaction.h" -// #include "pubkey.h" +#if 0 +#include "consensus/upgrades.h" +#include "primitives/transaction.h" +#include "pubkey.h" +#endif #include "script/interpreter.h" #include "version.h" -namespace -{ +namespace { inline int set_error(zcash_script_error* ret, zcash_script_error serror) { if (ret) @@ -21,263 +22,266 @@ inline int set_error(zcash_script_error* ret, zcash_script_error serror) return 0; } -// // Copy of GetLegacySigOpCount from main.cpp commit c4b2ef7c4. -// // Replace with the copy from src/consensus/tx_verify.{cpp,h} after backporting that refactor. -// unsigned int GetLegacySigOpCount(const CTransaction& tx) -// { -// unsigned int nSigOps = 0; -// for (const CTxIn& txin : tx.vin) { -// nSigOps += txin.scriptSig.GetSigOpCount(false); -// } -// for (const CTxOut& txout : tx.vout) { -// nSigOps += txout.scriptPubKey.GetSigOpCount(false); -// } -// return nSigOps; -// } -} // namespace +#if 0 +// Copy of GetLegacySigOpCount from main.cpp commit c4b2ef7c4. +// Replace with the copy from src/consensus/tx_verify.{cpp,h} after backporting that refactor. +unsigned int GetLegacySigOpCount(const CTransaction& tx) +{ + unsigned int nSigOps = 0; + for (const CTxIn& txin : tx.vin) + { + nSigOps += txin.scriptSig.GetSigOpCount(false); + } + for (const CTxOut& txout : tx.vout) + { + nSigOps += txout.scriptPubKey.GetSigOpCount(false); + } + return nSigOps; +} +#endif +} -// struct PrecomputedTransaction { -// const CTransaction tx; -// const PrecomputedTransactionData txdata; +#if 0 +struct PrecomputedTransaction { + const CTransaction tx; + const PrecomputedTransactionData txdata; -// PrecomputedTransaction( -// CTransaction txIn, -// const unsigned char* allPrevOutputs, -// size_t allPrevOutputsLen) : tx(txIn), txdata(txIn, allPrevOutputs, allPrevOutputsLen) {} -// }; + PrecomputedTransaction( + CTransaction txIn, + const unsigned char* allPrevOutputs, + size_t allPrevOutputsLen) : tx(txIn), txdata(txIn, allPrevOutputs, allPrevOutputsLen) {} +}; -// void* zcash_script_new_precomputed_tx( -// const unsigned char* txTo, -// unsigned int txToLen, -// zcash_script_error* err) -// { -// try { -// const char* txToEnd = (const char*)(txTo + txToLen); -// RustDataStream stream((const char*)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); -// CTransaction tx; -// stream >> tx; -// if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) { -// set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); -// return nullptr; -// } -// if (tx.nVersion >= ZIP225_TX_VERSION) { -// set_error(err, zcash_script_ERR_TX_VERSION); -// return nullptr; -// } +void* zcash_script_new_precomputed_tx( + const unsigned char* txTo, + unsigned int txToLen, + zcash_script_error* err) +{ + try { + const char* txToEnd = (const char *)(txTo + txToLen); + RustDataStream stream((const char *)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); + CTransaction tx; + stream >> tx; + if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) { + set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); + return nullptr; + } + if (tx.nVersion >= ZIP225_TX_VERSION) { + set_error(err, zcash_script_ERR_TX_VERSION); + return nullptr; + } -// // Deserializing the tx did not error. -// set_error(err, zcash_script_ERR_OK); -// // This is a pre-v5 tx, so the PrecomputedTransactionData constructor -// // field `allPrevOutputs` is not used. -// auto preTx = new PrecomputedTransaction(tx, nullptr, 0); -// return preTx; -// } catch (const std::exception&) { -// set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing -// return nullptr; -// } -// } + // Deserializing the tx did not error. + set_error(err, zcash_script_ERR_OK); + // This is a pre-v5 tx, so the PrecomputedTransactionData constructor + // field `allPrevOutputs` is not used. + auto preTx = new PrecomputedTransaction(tx, nullptr, 0); + return preTx; + } catch (const std::exception&) { + set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing + return nullptr; + } +} -// void* zcash_script_new_precomputed_tx_v5( -// const unsigned char* txTo, -// unsigned int txToLen, -// const unsigned char* allPrevOutputs, -// unsigned int allPrevOutputsLen, -// zcash_script_error* err) -// { -// CTransaction tx; -// try { -// const char* txToEnd = (const char*)(txTo + txToLen); -// RustDataStream stream((const char*)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); -// stream >> tx; -// if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) { -// set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); -// return nullptr; -// } -// } catch (const std::exception&) { -// set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing -// return nullptr; -// } +void* zcash_script_new_precomputed_tx_v5( + const unsigned char* txTo, + unsigned int txToLen, + const unsigned char* allPrevOutputs, + unsigned int allPrevOutputsLen, + zcash_script_error* err) +{ + CTransaction tx; + try { + const char* txToEnd = (const char *)(txTo + txToLen); + RustDataStream stream((const char *)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); + stream >> tx; + if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) { + set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); + return nullptr; + } + } catch (const std::exception&) { + set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing + return nullptr; + } -// try { -// auto preTx = new PrecomputedTransaction(tx, allPrevOutputs, allPrevOutputsLen); -// // Deserializing the tx did not error. -// set_error(err, zcash_script_ERR_OK); -// return preTx; -// } catch (const std::exception&) { -// // We had some error when parsing allPrevOutputs inside the -// // PrecomputedTransactionData constructor. -// set_error(err, zcash_script_ERR_ALL_PREV_OUTPUTS_DESERIALIZE); -// return nullptr; -// } -// } + try { + auto preTx = new PrecomputedTransaction(tx, allPrevOutputs, allPrevOutputsLen); + // Deserializing the tx did not error. + set_error(err, zcash_script_ERR_OK); + return preTx; + } catch (const std::exception&) { + // We had some error when parsing allPrevOutputs inside the + // PrecomputedTransactionData constructor. + set_error(err, zcash_script_ERR_ALL_PREV_OUTPUTS_DESERIALIZE); + return nullptr; + } +} -// void zcash_script_free_precomputed_tx(void* pre_preTx) -// { -// PrecomputedTransaction* preTx = static_cast(pre_preTx); -// delete preTx; -// preTx = nullptr; -// } +void zcash_script_free_precomputed_tx(void* pre_preTx) +{ + PrecomputedTransaction* preTx = static_cast(pre_preTx); + delete preTx; + preTx = nullptr; +} -// int zcash_script_verify_precomputed( -// const void* pre_preTx, -// unsigned int nIn, -// const unsigned char* scriptPubKey, -// unsigned int scriptPubKeyLen, -// int64_t amount, -// unsigned int flags, -// uint32_t consensusBranchId, -// zcash_script_error* err) -// { -// const PrecomputedTransaction* preTx = static_cast(pre_preTx); -// if (nIn >= preTx->tx.vin.size()) -// return set_error(err, zcash_script_ERR_TX_INDEX); +int zcash_script_verify_precomputed( + const void* pre_preTx, + unsigned int nIn, + const unsigned char* scriptPubKey, + unsigned int scriptPubKeyLen, + int64_t amount, + unsigned int flags, + uint32_t consensusBranchId, + zcash_script_error* err) +{ + const PrecomputedTransaction* preTx = static_cast(pre_preTx); + if (nIn >= preTx->tx.vin.size()) + return set_error(err, zcash_script_ERR_TX_INDEX); -// // Regardless of the verification result, the tx did not error. -// set_error(err, zcash_script_ERR_OK); -// return VerifyScript( -// preTx->tx.vin[nIn].scriptSig, -// CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), -// flags, -// TransactionSignatureChecker(&preTx->tx, preTx->txdata, nIn, amount), -// consensusBranchId, -// NULL); -// } + // Regardless of the verification result, the tx did not error. + set_error(err, zcash_script_ERR_OK); + return VerifyScript( + preTx->tx.vin[nIn].scriptSig, + CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), + flags, + TransactionSignatureChecker(&preTx->tx, preTx->txdata, nIn, amount), + consensusBranchId, + NULL); +} -// int zcash_script_verify( -// const unsigned char* scriptPubKey, -// unsigned int scriptPubKeyLen, -// int64_t amount, -// const unsigned char* txTo, -// unsigned int txToLen, -// unsigned int nIn, -// unsigned int flags, -// uint32_t consensusBranchId, -// zcash_script_error* err) -// { -// try { -// const char* txToEnd = (const char*)(txTo + txToLen); -// RustDataStream stream((const char*)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); -// CTransaction tx; -// stream >> tx; -// if (nIn >= tx.vin.size()) -// return set_error(err, zcash_script_ERR_TX_INDEX); -// if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) -// return set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); -// if (tx.nVersion >= ZIP225_TX_VERSION) { -// return set_error(err, zcash_script_ERR_TX_VERSION); -// } +int zcash_script_verify( + const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, + int64_t amount, + const unsigned char *txTo, unsigned int txToLen, + unsigned int nIn, unsigned int flags, + uint32_t consensusBranchId, + zcash_script_error* err) +{ + try { + const char* txToEnd = (const char *)(txTo + txToLen); + RustDataStream stream((const char *)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); + CTransaction tx; + stream >> tx; + if (nIn >= tx.vin.size()) + return set_error(err, zcash_script_ERR_TX_INDEX); + if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) + return set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); + if (tx.nVersion >= ZIP225_TX_VERSION) { + return set_error(err, zcash_script_ERR_TX_VERSION); + } + + // Regardless of the verification result, the tx did not error. + set_error(err, zcash_script_ERR_OK); + // This is a pre-v5 tx, so the PrecomputedTransactionData constructor + // field `allPrevOutputs` is not used. + PrecomputedTransactionData txdata(tx, {}); + return VerifyScript( + tx.vin[nIn].scriptSig, + CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), + flags, + TransactionSignatureChecker(&tx, txdata, nIn, amount), + consensusBranchId, + NULL); + } catch (const std::exception&) { + return set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing + } +} -// // Regardless of the verification result, the tx did not error. -// set_error(err, zcash_script_ERR_OK); -// // This is a pre-v5 tx, so the PrecomputedTransactionData constructor -// // field `allPrevOutputs` is not used. -// PrecomputedTransactionData txdata(tx, {}); -// return VerifyScript( -// tx.vin[nIn].scriptSig, -// CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), -// flags, -// TransactionSignatureChecker(&tx, txdata, nIn, amount), -// consensusBranchId, -// NULL); -// } catch (const std::exception&) { -// return set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing -// } -// } -// -// int zcash_script_verify_v5( -// const unsigned char* txTo, -// unsigned int txToLen, -// const unsigned char* allPrevOutputs, -// unsigned int allPrevOutputsLen, -// unsigned int nIn, -// unsigned int flags, -// uint32_t consensusBranchId, -// zcash_script_error* err) -// { -// CTransaction tx; -// try { -// const char* txToEnd = (const char*)(txTo + txToLen); -// RustDataStream stream((const char*)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); -// stream >> tx; -// if (nIn >= tx.vin.size()) -// return set_error(err, zcash_script_ERR_TX_INDEX); -// if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) -// return set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); -// } catch (const std::exception&) { -// return set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing -// } +int zcash_script_verify_v5( + const unsigned char* txTo, + unsigned int txToLen, + const unsigned char* allPrevOutputs, + unsigned int allPrevOutputsLen, + unsigned int nIn, + unsigned int flags, + uint32_t consensusBranchId, + zcash_script_error* err) +{ + CTransaction tx; + try { + const char* txToEnd = (const char *)(txTo + txToLen); + RustDataStream stream((const char *)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); + stream >> tx; + if (nIn >= tx.vin.size()) + return set_error(err, zcash_script_ERR_TX_INDEX); + if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) + return set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); + } catch (const std::exception&) { + return set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing + } -// std::vector prevOutputs; -// try { -// // TODO: we can swap this second deserialization for an FFI call by -// // fetching this through PrecomputedTransactionData. Simplicity for now. -// CDataStream sAllPrevOutputs( -// reinterpret_cast(allPrevOutputs), -// reinterpret_cast(allPrevOutputs + allPrevOutputsLen), -// SER_NETWORK, -// PROTOCOL_VERSION); -// sAllPrevOutputs >> prevOutputs; -// if (!(tx.IsCoinBase() ? prevOutputs.empty() : tx.vin.size() == prevOutputs.size())) { -// return set_error(err, zcash_script_ERR_ALL_PREV_OUTPUTS_SIZE_MISMATCH); -// } -// } catch (const std::exception&) { -// // We had some error when parsing allPrevOutputs inside the -// // PrecomputedTransactionData constructor. -// return set_error(err, zcash_script_ERR_ALL_PREV_OUTPUTS_DESERIALIZE); -// } + std::vector prevOutputs; + try { + // TODO: we can swap this second deserialization for an FFI call by + // fetching this through PrecomputedTransactionData. Simplicity for now. + CDataStream sAllPrevOutputs( + reinterpret_cast(allPrevOutputs), + reinterpret_cast(allPrevOutputs + allPrevOutputsLen), + SER_NETWORK, + PROTOCOL_VERSION); + sAllPrevOutputs >> prevOutputs; + if (!(tx.IsCoinBase() ? prevOutputs.empty() : tx.vin.size() == prevOutputs.size())) { + return set_error(err, zcash_script_ERR_ALL_PREV_OUTPUTS_SIZE_MISMATCH); + } + } catch (const std::exception&) { + // We had some error when parsing allPrevOutputs inside the + // PrecomputedTransactionData constructor. + return set_error(err, zcash_script_ERR_ALL_PREV_OUTPUTS_DESERIALIZE); + } -// try { -// // Regardless of the verification result, the tx did not error. -// set_error(err, zcash_script_ERR_OK); -// PrecomputedTransactionData txdata(tx, allPrevOutputs, allPrevOutputsLen); -// return VerifyScript( -// tx.vin[nIn].scriptSig, -// prevOutputs[nIn].scriptPubKey, -// flags, -// TransactionSignatureChecker(&tx, txdata, nIn, prevOutputs[nIn].nValue), -// consensusBranchId, -// NULL); -// } catch (const std::exception&) { -// return set_error(err, zcash_script_ERR_VERIFY_SCRIPT); // Error during script verification -// } -// } + try { + // Regardless of the verification result, the tx did not error. + set_error(err, zcash_script_ERR_OK); + PrecomputedTransactionData txdata(tx, allPrevOutputs, allPrevOutputsLen); + return VerifyScript( + tx.vin[nIn].scriptSig, + prevOutputs[nIn].scriptPubKey, + flags, + TransactionSignatureChecker(&tx, txdata, nIn, prevOutputs[nIn].nValue), + consensusBranchId, + NULL); + } catch (const std::exception&) { + return set_error(err, zcash_script_ERR_VERIFY_SCRIPT); // Error during script verification + } +} -// unsigned int zcash_script_legacy_sigop_count_precomputed( -// const void* pre_preTx, -// zcash_script_error* err) -// { -// const PrecomputedTransaction* preTx = static_cast(pre_preTx); +unsigned int zcash_script_legacy_sigop_count_precomputed( + const void* pre_preTx, + zcash_script_error* err) +{ + const PrecomputedTransaction* preTx = static_cast(pre_preTx); -// // The current implementation of this method never errors. -// set_error(err, zcash_script_ERR_OK); + // The current implementation of this method never errors. + set_error(err, zcash_script_ERR_OK); -// return GetLegacySigOpCount(preTx->tx); -// } + return GetLegacySigOpCount(preTx->tx); +} -// unsigned int zcash_script_legacy_sigop_count( -// const unsigned char* txTo, -// unsigned int txToLen, -// zcash_script_error* err) -// { -// try { -// const char* txToEnd = (const char*)(txTo + txToLen); -// RustDataStream stream((const char*)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); -// CTransaction tx; -// stream >> tx; -// if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) { -// set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); -// return UINT_MAX; -// } +unsigned int zcash_script_legacy_sigop_count( + const unsigned char *txTo, + unsigned int txToLen, + zcash_script_error* err) +{ + try { + const char* txToEnd = (const char *)(txTo + txToLen); + RustDataStream stream((const char *)txTo, txToEnd, SER_NETWORK, PROTOCOL_VERSION); + CTransaction tx; + stream >> tx; + if (GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) != txToLen) { + set_error(err, zcash_script_ERR_TX_SIZE_MISMATCH); + return UINT_MAX; + } -// // Deserializing the tx did not error. -// set_error(err, zcash_script_ERR_OK); + // Deserializing the tx did not error. + set_error(err, zcash_script_ERR_OK); -// return GetLegacySigOpCount(tx); -// } catch (const std::exception&) { -// set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing -// return UINT_MAX; -// } -// } + return GetLegacySigOpCount(tx); + } catch (const std::exception&) { + set_error(err, zcash_script_ERR_TX_DESERIALIZE); // Error deserializing + return UINT_MAX; + } +} +#endif unsigned int zcash_script_version() { diff --git a/depend/zcash/src/script/zcash_script.h b/depend/zcash/src/script/zcash_script.h index 449a2ea9e..475a0f3ee 100644 --- a/depend/zcash/src/script/zcash_script.h +++ b/depend/zcash/src/script/zcash_script.h @@ -57,6 +57,7 @@ enum zcash_script_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65) }; +#if 0 /// Deserializes the given transaction and precomputes values to improve /// script verification performance. /// @@ -69,10 +70,10 @@ enum /// after this function returns. /// /// If not NULL, err will contain an error/success code for the operation. -// void* zcash_script_new_precomputed_tx( -// const unsigned char* txTo, -// unsigned int txToLen, -// zcash_script_error* err); +void* zcash_script_new_precomputed_tx( + const unsigned char* txTo, + unsigned int txToLen, + zcash_script_error* err); /// Deserializes the given transaction and precomputes values to improve /// script verification performance. Must be used for V5 transactions; @@ -88,16 +89,16 @@ enum /// zcash_script_free_precomputed_tx once you are done. /// /// If not NULL, err will contain an error/success code for the operation. -// void* zcash_script_new_precomputed_tx_v5( -// const unsigned char* txTo, -// unsigned int txToLen, -// const unsigned char* allPrevOutputs, -// unsigned int allPrevOutputsLen, -// zcash_script_error* err); +void* zcash_script_new_precomputed_tx_v5( + const unsigned char* txTo, + unsigned int txToLen, + const unsigned char* allPrevOutputs, + unsigned int allPrevOutputsLen, + zcash_script_error* err); /// Frees a precomputed transaction previously created with /// zcash_script_new_precomputed_tx. -// void zcash_script_free_precomputed_tx(void* preTx); +void zcash_script_free_precomputed_tx(void* preTx); /// Returns 1 if the input nIn of the precomputed transaction pointed to by /// preTx correctly spends the scriptPubKey pointed to by scriptPubKey under @@ -106,15 +107,15 @@ enum /// If not NULL, err will contain an error/success code for the operation. /// Note that script verification failure is indicated by err being set to /// zcash_script_ERR_OK and a return value of 0. -// EXPORT_SYMBOL int zcash_script_verify_precomputed( -// const void* preTx, -// unsigned int nIn, -// const unsigned char* scriptPubKey, -// unsigned int scriptPubKeyLen, -// int64_t amount, -// unsigned int flags, -// uint32_t consensusBranchId, -// zcash_script_error* err); +EXPORT_SYMBOL int zcash_script_verify_precomputed( + const void* preTx, + unsigned int nIn, + const unsigned char* scriptPubKey, + unsigned int scriptPubKeyLen, + int64_t amount, + unsigned int flags, + uint32_t consensusBranchId, + zcash_script_error* err); /// Returns 1 if the input nIn of the serialized transaction pointed to by /// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under @@ -125,17 +126,14 @@ enum /// If not NULL, err will contain an error/success code for the operation. /// Note that script verification failure is indicated by err being set to /// zcash_script_ERR_OK and a return value of 0. -// EXPORT_SYMBOL int zcash_script_verify( -// const unsigned char* scriptPubKey, -// unsigned int scriptPubKeyLen, -// int64_t amount, -// const unsigned char* txTo, -// unsigned int txToLen, -// unsigned int nIn, -// unsigned int flags, -// uint32_t consensusBranchId, -// zcash_script_error* err); -// +EXPORT_SYMBOL int zcash_script_verify( + const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, + int64_t amount, + const unsigned char *txTo, unsigned int txToLen, + unsigned int nIn, unsigned int flags, + uint32_t consensusBranchId, + zcash_script_error* err); + /// Returns 1 if the input nIn of the serialized transaction pointed to by /// txTo correctly spends the matching output in allPrevOutputs under /// the additional constraints specified by flags. Must be used for V5 transactions; @@ -150,15 +148,15 @@ enum /// If not NULL, err will contain an error/success code for the operation. /// Note that script verification failure is indicated by err being set to /// zcash_script_ERR_OK and a return value of 0. -// EXPORT_SYMBOL int zcash_script_verify_v5( -// const unsigned char* txTo, -// unsigned int txToLen, -// const unsigned char* allPrevOutputs, -// unsigned int allPrevOutputsLen, -// unsigned int nIn, -// unsigned int flags, -// uint32_t consensusBranchId, -// zcash_script_error* err); +EXPORT_SYMBOL int zcash_script_verify_v5( + const unsigned char* txTo, + unsigned int txToLen, + const unsigned char* allPrevOutputs, + unsigned int allPrevOutputsLen, + unsigned int nIn, + unsigned int flags, + uint32_t consensusBranchId, + zcash_script_error* err); /// Returns the number of transparent signature operations in the /// transparent inputs and outputs of the precomputed transaction @@ -166,9 +164,9 @@ enum /// /// Returns UINT_MAX on error, so that invalid transactions don't pass the Zcash consensus rules. /// If not NULL, err will contain an error/success code for the operation. -// EXPORT_SYMBOL unsigned int zcash_script_legacy_sigop_count_precomputed( -// const void* preTx, -// zcash_script_error* err); +EXPORT_SYMBOL unsigned int zcash_script_legacy_sigop_count_precomputed( + const void* preTx, + zcash_script_error* err); /// Returns the number of transparent signature operations in the /// transparent inputs and outputs of the serialized transaction @@ -176,10 +174,11 @@ enum /// /// Returns UINT_MAX on error. /// If not NULL, err will contain an error/success code for the operation. -// EXPORT_SYMBOL unsigned int zcash_script_legacy_sigop_count( -// const unsigned char* txTo, -// unsigned int txToLen, -// zcash_script_error* err); +EXPORT_SYMBOL unsigned int zcash_script_legacy_sigop_count( + const unsigned char* txTo, + unsigned int txToLen, + zcash_script_error* err); +#endif /// Returns the current version of the zcash_script library. EXPORT_SYMBOL unsigned int zcash_script_version();