Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,18 @@ std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDeco
if (!str.empty()) {
str += " ";
}

if (!script.GetOp(pc, opcode, vch)) {
str += "[error]";
return str;
}
if (0 <= opcode && opcode <= OP_PUSHDATA4) {

if (opcode == OP_RVN_ASSET) {
// Once we hit an OP_RVN_ASSET, we know that all the next data should be considered as hex
str += GetOpName(opcode);
str += " ";
str += HexStr(vch);
} else if (0 <= opcode && opcode <= OP_PUSHDATA4) {
if (vch.size() <= static_cast<std::vector<unsigned char>::size_type>(4)) {
str += strprintf("%d", CScriptNum(vch, false).getint());
} else {
Expand Down
9 changes: 9 additions & 0 deletions src/script/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,15 @@ class CScript : public CScriptBase
pc += nSize;
}

// If we see an op rvn asset, we consider all data after it has data, and not op codes
// Move the pc to the end of the script
if (opcode == OP_RVN_ASSET) {
unsigned int nSize = end() - pc;
if (pvchRet)
pvchRet->assign(pc, pc + nSize);
pc += nSize;
}

opcodeRet = (opcodetype)opcode;
return true;
}
Expand Down
1 change: 0 additions & 1 deletion src/test/data/script_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@
["0", "IF 0xbd ELSE 1 ENDIF", "P2SH,STRICTENC", "OK"],
["0", "IF 0xbe ELSE 1 ENDIF", "P2SH,STRICTENC", "OK"],
["0", "IF 0xbf ELSE 1 ENDIF", "P2SH,STRICTENC", "OK"],
["0", "IF 0xc0 ELSE 1 ENDIF", "P2SH,STRICTENC", "OK"],
["0", "IF 0xc1 ELSE 1 ENDIF", "P2SH,STRICTENC", "OK"],
["0", "IF 0xc2 ELSE 1 ENDIF", "P2SH,STRICTENC", "OK"],
["0", "IF 0xc3 ELSE 1 ENDIF", "P2SH,STRICTENC", "OK"],
Expand Down