8000 Update asm output when decoding a script · etherscan-io/Ravencoin@b957731 · GitHub
[go: up one dir, main page]

Skip to content

Commit b957731

Browse files
committed
Update asm output when decoding a script

2 files changed

+17
-1
lines changed

src/core_write.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,18 @@ std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDeco
107107
if (!str.empty()) {
108108
str += " ";
109109
}
110+
110111
if (!script.GetOp(pc, opcode, vch)) {
111112
str += "[error]";
112113
return str;
113114
}
114-
if (0 <= opcode && opcode <= OP_PUSHDATA4) {
115+
116+
if (opcode == OP_RVN_ASSET) {
117+
// Once we hit an OP_RVN_ASSET, we know that all the next data should be considered as hex
118+
str += GetOpName(opcode);
119+
str += " ";
120+
str += HexStr(vch);
121+
} else if (0 <= opcode && opcode <= OP_PUSHDATA4) {
115122
if (vch.size() <= static_cast<std::vector<unsigned char>::size_type>(4)) {
116123
str += strprintf("%d", CScriptNum(vch, false).getint());
117124
} else {

src/script/script.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,15 @@ class CScript : public CScriptBase
575575
pc += nSize;
576576
}
577577

578+
// If we see an op rvn asset, we consider all data after it has data, and not op codes
579+
// Move the pc to the end of the script
580+
if (opcode == OP_RVN_ASSET) {
581+
unsigned int nSize = end() - pc;
582+
if (pvchRet)
583+
pvchRet->assign(pc, pc + nSize);
584+
pc += nSize;
585+
}
586+
578587
opcodeRet = (opcodetype)opcode;
579588
return true;
580589
}

0 commit comments

Comments
 (0)
0