Update stake cheat spend
This commit is contained in:
@@ -295,6 +295,41 @@ bool CScript::GetBalancedData(const_iterator& pc, std::vector<std::vector<unsign
|
||||
return netPushes == 0;
|
||||
}
|
||||
|
||||
// this returns true if either there is nothing left and pc points at the end
|
||||
// if there is data, it also returns all the values as byte vectors in a list of vectors
|
||||
bool CScript::GetPushedData(CScript::const_iterator pc, std::vector<std::vector<unsigned char>>& vData) const
|
||||
{
|
||||
vector<unsigned char> data;
|
||||
opcodetype opcode;
|
||||
std::vector<unsigned char> vch1 = std::vector<unsigned char>(1);
|
||||
|
||||
vData.clear();
|
||||
|
||||
while (pc < end())
|
||||
{
|
||||
if (GetOp(pc, opcode, data))
|
||||
{
|
||||
if (opcode == OP_0)
|
||||
{
|
||||
vch1[0] = 0;
|
||||
vData.push_back(vch1);
|
||||
}
|
||||
else if (opcode >= OP_1 && opcode <= OP_16)
|
||||
{
|
||||
vch1[0] = (opcode - OP_1) + 1;
|
||||
vData.push_back(vch1);
|
||||
}
|
||||
else if (opcode > 0 && opcode <= OP_PUSHDATA4 && data.size() > 0)
|
||||
{
|
||||
vData.push_back(data);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return vData.size() != 0;
|
||||
}
|
||||
|
||||
// this returns true if either there is nothing left and pc points at the end
|
||||
// if there is data, it also returns all the values as byte vectors in a list of vectors
|
||||
bool CScript::GetOpretData(std::vector<std::vector<unsigned char>>& vData) const
|
||||
@@ -302,34 +337,12 @@ bool CScript::GetOpretData(std::vector<std::vector<unsigned char>>& vData) const
|
||||
vector<unsigned char> data;
|
||||
opcodetype opcode;
|
||||
CScript::const_iterator pc = this->begin();
|
||||
std::vector<unsigned char> vch1 = std::vector<unsigned char>(1);
|
||||
|
||||
vData.clear();
|
||||
|
||||
if (GetOp(pc, opcode, data) && opcode == OP_RETURN)
|
||||
{
|
||||
while (pc < end())
|
||||
{
|
||||
if (GetOp(pc, opcode, data))
|
||||
{
|
||||
if (opcode == OP_0)
|
||||
{
|
||||
vch1[0] = 0;
|
||||
vData.push_back(vch1);
|
||||
}
|
||||
else if (opcode >= OP_1 && opcode <= OP_16)
|
||||
{
|
||||
vch1[0] = (opcode - OP_1) + 1;
|
||||
vData.push_back(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
vData.push_back(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return vData.size() != 0;
|
||||
return GetPushedData(pc, vData);
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool CScript::IsPayToCryptoCondition(CScript *pCCSubScript, std::vector<std::vector<unsigned char>>& vParams) const
|
||||
|
||||
@@ -577,6 +577,7 @@ public:
|
||||
bool IsPayToPublicKey() const;
|
||||
|
||||
bool IsPayToScriptHash() const;
|
||||
bool GetPushedData(CScript::const_iterator pc, std::vector<std::vector<unsigned char>>& vData) const;
|
||||
bool IsOpReturn() const { return size() > 0 && (*this)[0] == OP_RETURN; }
|
||||
bool GetOpretData(std::vector<std::vector<unsigned char>>& vData) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user