make IsPayToCryptoCondition neat

This commit is contained in:
Scott Sadler
2018-02-18 19:35:48 -03:00
parent 5a7cc8287b
commit 28b946127b

View File

@@ -227,28 +227,15 @@ bool CScript::IsPayToCryptoCondition() const
{ {
const_iterator pc = this->begin(); const_iterator pc = this->begin();
vector<unsigned char> data; vector<unsigned char> data;
int i = 0; opcodetype opcode;
while (pc < this->end()) if (this->GetOp(pc, opcode, data))
{ // Sha256 conditions are <76 bytes
opcodetype opcode; if (opcode > OP_0 && opcode < OP_PUSHDATA1)
if (!this->GetOp(pc, opcode, data)) if (this->GetOp(pc, opcode, data))
return 0; if (opcode == OP_CHECKCRYPTOCONDITION)
switch (i++) { if (pc == this->end())
case 0: return 1;
// Binary condition should be less than 76 bytes return 0;
if (!(opcode > OP_0 && opcode < OP_PUSHDATA1))
return 0;
break;
case 1:
if (opcode != OP_CHECKCRYPTOCONDITION)
return 0;
break;
default:
return 0;
break;
}
}
return 1;
} }
bool CScript::IsPushOnly() const bool CScript::IsPushOnly() const