Skip to content
Permalink
Browse files

FULLFEATURE: Enable some disabled and add new new script ops

  • Loading branch information...
patrick authored and TheBlueMatt committed May 29, 2015
1 parent 292f923 commit a04ea8a81286f1d2917c918a3b5ac3599464895c
@@ -32,7 +32,7 @@ CScript ParseScript(std::string s)

if (mapOpNames.empty())
{
for (int op = 0; op <= OP_NOP10; op++)
for (int op = 0; op < 0xff; op++)
{
// Allow OP_RESERVED to get into mapOpNames
if (op < OP_NOP && op != OP_RESERVED)
@@ -73,10 +73,10 @@ bool CKey::Sign(const uint256 &hash, std::vector<unsigned char>& vchSig, uint32_
if (!fValid)
return false;
vchSig.resize(72);
int nSigLen = 72;
int nSigLen = 64;
unsigned char extra_entropy[32] = {0};
WriteLE32(extra_entropy, test_case);
int ret = secp256k1_ecdsa_sign(secp256k1_context, hash.begin(), (unsigned char*)&vchSig[0], &nSigLen, begin(), secp256k1_nonce_function_rfc6979, test_case ? extra_entropy : NULL);
int ret = secp256k1_schnorr_sign(secp256k1_context, hash.begin(), (unsigned char*)&vchSig[0], begin(), secp256k1_nonce_function_rfc6979, test_case ? extra_entropy : NULL);
assert(ret);
vchSig.resize(nSigLen);
return true;
@@ -1591,10 +1591,10 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
REJECT_INVALID, "bad-txns-amount-mismatch");

// The first loop above does all the inexpensive checks.
// Only if ALL inputs pass do we perform expensive ECDSA signature checks.
// Only if ALL inputs pass do we perform expensive signature checks.
// Helps prevent CPU exhaustion attacks.

// Skip ECDSA signature verification when connecting blocks
// Skip signature verification when connecting blocks
// before the last block chain checkpoint. This is safe because block merkle hashes are
// still computed and checked, and any change will be caught at the next checkpoint.
if (fScriptChecks) {
@@ -271,14 +271,14 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF
bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);

/**
* Count ECDSA signature operations the old-fashioned (pre-0.6) way
* Count signature operations the old-fashioned (pre-0.6) way
* @return number of sigops this transaction's outputs will produce when spent
* @see CTransaction::FetchInputs
*/
unsigned int GetLegacySigOpCount(const CTransaction& tx);

/**
* Count ECDSA signature operations in pay-to-script-hash inputs.
* Count signature operations in pay-to-script-hash inputs.
*
* @param[in] mapInputs Map of previous transactions that have outputs we're spending
* @return maximum number of sigops required to validate this transaction's inputs
@@ -12,7 +12,9 @@ static secp256k1_context_t*& secp256k1_context = secp256k1_bitcoin_verify_contex
bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const {
if (!IsValid())
return false;
if (secp256k1_ecdsa_verify(secp256k1_context, (const unsigned char*)&hash, &vchSig[0], vchSig.size(), begin(), size()) != 1)
if (vchSig.size() != 64)
return false;
if (secp256k1_schnorr_verify(secp256k1_context, (const unsigned char*)&hash, &vchSig[0], begin(), size()) != 1)
return false;
return true;
}
Oops, something went wrong.

0 comments on commit a04ea8a

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.