Create (MANDATORY|STANDARD)_SCRIPT_VERIFY_FLAGS constants
This commit is contained in:
parent
d4ffe4e425
commit
68f7d1d7af
@ -945,7 +945,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
|
|
||||||
// Check against previous transactions
|
// Check against previous transactions
|
||||||
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
||||||
if (!CheckInputs(tx, state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC))
|
if (!CheckInputs(tx, state, view, true, STANDARD_SCRIPT_VERIFY_FLAGS))
|
||||||
{
|
{
|
||||||
return error("AcceptToMemoryPool: : ConnectInputs failed %s", hash.ToString());
|
return error("AcceptToMemoryPool: : ConnectInputs failed %s", hash.ToString());
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ inline bool AllowFree(double dPriority)
|
|||||||
// This does not modify the UTXO set. If pvChecks is not NULL, script checks are pushed onto it
|
// This does not modify the UTXO set. If pvChecks is not NULL, script checks are pushed onto it
|
||||||
// instead of being performed inline.
|
// instead of being performed inline.
|
||||||
bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCache &view, bool fScriptChecks = true,
|
bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCache &view, bool fScriptChecks = true,
|
||||||
unsigned int flags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC,
|
unsigned int flags = STANDARD_SCRIPT_VERIFY_FLAGS,
|
||||||
std::vector<CScriptCheck> *pvChecks = NULL);
|
std::vector<CScriptCheck> *pvChecks = NULL);
|
||||||
|
|
||||||
// Apply the effects of this transaction on the UTXO set represented by view
|
// Apply the effects of this transaction on the UTXO set represented by view
|
||||||
|
@ -276,8 +276,11 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
|
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Note that flags: we don't want to set mempool/IsStandard()
|
||||||
|
// policy here, but we still have to ensure that the block we
|
||||||
|
// create only contains transactions that are valid in new blocks.
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
if (!CheckInputs(tx, state, view, true, SCRIPT_VERIFY_P2SH))
|
if (!CheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CTxUndo txundo;
|
CTxUndo txundo;
|
||||||
|
@ -722,7 +722,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
|||||||
{
|
{
|
||||||
txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
|
txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
|
||||||
}
|
}
|
||||||
if (!VerifyScript(txin.scriptSig, prevPubKey, mergedTx, i, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, 0))
|
if (!VerifyScript(txin.scriptSig, prevPubKey, mergedTx, i, STANDARD_SCRIPT_VERIFY_FLAGS, 0))
|
||||||
fComplete = false;
|
fComplete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1670,7 +1670,7 @@ bool SignSignature(const CKeyStore &keystore, const CScript& fromPubKey, CTransa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test solution
|
// Test solution
|
||||||
return VerifyScript(txin.scriptSig, fromPubKey, txTo, nIn, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, 0);
|
return VerifyScript(txin.scriptSig, fromPubKey, txTo, nIn, STANDARD_SCRIPT_VERIFY_FLAGS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType)
|
bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType)
|
||||||
|
12
src/script.h
12
src/script.h
@ -44,6 +44,18 @@ enum
|
|||||||
SCRIPT_VERIFY_NOCACHE = (1U << 3), // do not store results in signature cache (but do query it)
|
SCRIPT_VERIFY_NOCACHE = (1U << 3), // do not store results in signature cache (but do query it)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Mandatory script verification flags that all new blocks must comply with for
|
||||||
|
// them to be valid. (but old blocks may not comply with) Currently just P2SH,
|
||||||
|
// but in the future other flags may be added, such as a soft-fork to enforce
|
||||||
|
// strict DER encoding.
|
||||||
|
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH;
|
||||||
|
|
||||||
|
// Standard script verification flags that standard transactions will comply
|
||||||
|
// with. However scripts violating these flags may still be present in valid
|
||||||
|
// blocks and we must accept those blocks.
|
||||||
|
static const unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
|
||||||
|
SCRIPT_VERIFY_STRICTENC;
|
||||||
|
|
||||||
enum txnouttype
|
enum txnouttype
|
||||||
{
|
{
|
||||||
TX_NONSTANDARD,
|
TX_NONSTANDARD,
|
||||||
|
Loading…
Reference in New Issue
Block a user