mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-03-02 17:16:00 +00:00
a few more tweaks
This commit is contained in:
parent
d0640f940d
commit
3071f2072e
@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#if MAC_OSX
|
||||
#undef MSG_NOSIGNAL // undef prior to redefinition eliminates warnings
|
||||
#define MSG_NOSIGNAL SO_NOSIGPIPE
|
||||
#endif
|
||||
|
||||
|
||||
@ -31,8 +31,6 @@ static const CBigNum bnFalse(0);
|
||||
static const CBigNum bnTrue(1);
|
||||
static const size_t nMaxNumSize = 4;
|
||||
|
||||
#undef printf
|
||||
|
||||
CBigNum CastToBigNum(const valtype& vch)
|
||||
{
|
||||
if (vch.size() > nMaxNumSize)
|
||||
@ -1197,9 +1195,9 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!script1.GetOp(pc1, opcode1, vch1))
|
||||
if (!script1.GetOp2(pc1, opcode1, &vch1))
|
||||
break;
|
||||
if (!testScript->GetOp(pc2, opcode2)) // templates push no data, no need to get vch
|
||||
if (!testScript->GetOp2(pc2, opcode2, NULL)) // templates push no data, no need to get vch
|
||||
break;
|
||||
|
||||
// Template matching opcodes:
|
||||
@ -1208,10 +1206,10 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
||||
while (vch1.size() >= 33 && vch1.size() <= 120)
|
||||
{
|
||||
vSolutionsRet.push_back(vch1);
|
||||
if (!script1.GetOp(pc1, opcode1, vch1))
|
||||
if (!script1.GetOp2(pc1, opcode1, &vch1))
|
||||
break;
|
||||
}
|
||||
if (!testScript->GetOp(pc2, opcode2))
|
||||
if (!testScript->GetOp2(pc2, opcode2, NULL))
|
||||
break;
|
||||
// Normal situation is to fall through
|
||||
// to other if/else statements
|
||||
@ -1812,7 +1810,7 @@ unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const
|
||||
return subscript.GetSigOpCount(true);
|
||||
}
|
||||
|
||||
inline bool CScript::IsPayToScriptHash() const
|
||||
bool CScript::IsPayToScriptHash() const
|
||||
{
|
||||
// Extra-fast test for pay-to-script-hash CScripts:
|
||||
return (this->size() == 23 &&
|
||||
|
||||
14
src/script.h
14
src/script.h
@ -426,14 +426,14 @@ public:
|
||||
|
||||
bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>* pvchRet) const
|
||||
{
|
||||
const_iterator scriptEnd = end();
|
||||
|
||||
opcodeRet = OP_INVALIDOPCODE;
|
||||
if (pvchRet)
|
||||
pvchRet->clear();
|
||||
if (pc >= end())
|
||||
return false;
|
||||
|
||||
// Read instruction
|
||||
if (end() - pc < 1)
|
||||
if (scriptEnd - pc < 1)
|
||||
return false;
|
||||
unsigned int opcode = *pc++;
|
||||
|
||||
@ -447,13 +447,13 @@ public:
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA1)
|
||||
{
|
||||
if (end() - pc < 1)
|
||||
if (scriptEnd - pc < 1)
|
||||
return false;
|
||||
nSize = *pc++;
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA2)
|
||||
{
|
||||
if (end() - pc < 2)
|
||||
if (scriptEnd - pc < 2)
|
||||
return false;
|
||||
nSize = 0;
|
||||
memcpy(&nSize, &pc[0], 2);
|
||||
@ -461,12 +461,12 @@ public:
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA4)
|
||||
{
|
||||
if (end() - pc < 4)
|
||||
if (scriptEnd - pc < 4)
|
||||
return false;
|
||||
memcpy(&nSize, &pc[0], 4);
|
||||
pc += 4;
|
||||
}
|
||||
if (end() - pc < 0 || (unsigned int)(end() - pc) < nSize)
|
||||
if (scriptEnd - pc < 0 || (unsigned int)(scriptEnd - pc) < nSize)
|
||||
return false;
|
||||
if (pvchRet)
|
||||
pvchRet->assign(pc, pc + nSize);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user