|
|
@ -318,13 +318,6 @@ private: |
|
|
|
int64_t m_value; |
|
|
|
int64_t m_value; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
inline std::string ValueString(const std::vector<unsigned char>& vch) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (vch.size() <= 4) |
|
|
|
|
|
|
|
return strprintf("%d", CScriptNum(vch).getint()); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return HexStr(vch); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Serialized script, used inside transaction inputs and outputs */ |
|
|
|
/** Serialized script, used inside transaction inputs and outputs */ |
|
|
|
class CScript : public std::vector<unsigned char> |
|
|
|
class CScript : public std::vector<unsigned char> |
|
|
@ -571,28 +564,7 @@ public: |
|
|
|
return (size() > 0 && *begin() == OP_RETURN); |
|
|
|
return (size() > 0 && *begin() == OP_RETURN); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string ToString() const |
|
|
|
std::string ToString() const; |
|
|
|
{ |
|
|
|
|
|
|
|
std::string str; |
|
|
|
|
|
|
|
opcodetype opcode; |
|
|
|
|
|
|
|
std::vector<unsigned char> vch; |
|
|
|
|
|
|
|
const_iterator pc = begin(); |
|
|
|
|
|
|
|
while (pc < end()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!str.empty()) |
|
|
|
|
|
|
|
str += " "; |
|
|
|
|
|
|
|
if (!GetOp(pc, opcode, vch)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
str += "[error]"; |
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (0 <= opcode && opcode <= OP_PUSHDATA4) |
|
|
|
|
|
|
|
str += ValueString(vch); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
str += GetOpName(opcode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void clear() |
|
|
|
void clear() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// The default std::vector::clear() does not release memory.
|
|
|
|
// The default std::vector::clear() does not release memory.
|
|
|
|