Precompute sighashes
This commit is contained in:
@@ -82,11 +82,11 @@ int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned i
|
||||
if (tx.GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION) != txToLen)
|
||||
return set_error(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
|
||||
|
||||
// Regardless of the verification result, the tx did not error.
|
||||
set_error(err, bitcoinconsensus_ERR_OK);
|
||||
|
||||
CAmount am(0);
|
||||
return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), flags, TransactionSignatureChecker(&tx, nIn, am), NULL);
|
||||
// Regardless of the verification result, the tx did not error.
|
||||
set_error(err, bitcoinconsensus_ERR_OK);
|
||||
CachedHashes cachedHashes(tx);
|
||||
CAmount amount(0);
|
||||
return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), flags, TransactionSignatureChecker(&tx, nIn, amount, cachedHashes), NULL);
|
||||
} catch (const std::exception&) {
|
||||
return set_error(err, bitcoinconsensus_ERR_TX_DESERIALIZE); // Error deserializing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user