mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-15 10:05:40 +01:00
Delete error-prone CScript constructor
This commit is contained in:
@@ -926,7 +926,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
|
||||
|
||||
// Drop the signature in pre-segwit scripts but not segwit scripts
|
||||
if (sigversion == SigVersion::BASE) {
|
||||
int found = FindAndDelete(scriptCode, CScript(vchSig));
|
||||
int found = FindAndDelete(scriptCode, CScript() << vchSig);
|
||||
if (found > 0 && (flags & SCRIPT_VERIFY_CONST_SCRIPTCODE))
|
||||
return set_error(serror, SCRIPT_ERR_SIG_FINDANDDELETE);
|
||||
}
|
||||
@@ -992,7 +992,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
|
||||
{
|
||||
valtype& vchSig = stacktop(-isig-k);
|
||||
if (sigversion == SigVersion::BASE) {
|
||||
int found = FindAndDelete(scriptCode, CScript(vchSig));
|
||||
int found = FindAndDelete(scriptCode, CScript() << vchSig);
|
||||
if (found > 0 && (flags & SCRIPT_VERIFY_CONST_SCRIPTCODE))
|
||||
return set_error(serror, SCRIPT_ERR_SIG_FINDANDDELETE);
|
||||
}
|
||||
|
||||
@@ -437,7 +437,9 @@ public:
|
||||
|
||||
explicit CScript(opcodetype b) { operator<<(b); }
|
||||
explicit CScript(const CScriptNum& b) { operator<<(b); }
|
||||
explicit CScript(const std::vector<unsigned char>& b) { operator<<(b); }
|
||||
// delete non-existent constructor to defend against future introduction
|
||||
// e.g. via prevector
|
||||
explicit CScript(const std::vector<unsigned char>& b) = delete;
|
||||
|
||||
|
||||
CScript& operator<<(int64_t b) { return push_int64(b); }
|
||||
|
||||
Reference in New Issue
Block a user