diff --git a/src/core_write.cpp b/src/core_write.cpp index b44416db1f..189d96718f 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -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::size_type>(4)) { str += strprintf("%d", CScriptNum(vch, false).getint()); } else { diff --git a/src/script/script.h b/src/script/script.h index a98de89099..744b993645 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -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; } diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json index b6ad2f02bf..beda3b62d5 100644 --- a/src/test/data/script_tests.json +++ b/src/test/data/script_tests.json @@ -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"],