Claim name returned is strange #172

Closed
mirgee wants to merge 286 commits from issue-119 into master
Showing only changes of commit 3d0b033614 - Show all commits

View file

@ -87,27 +87,23 @@ string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode)
return str; return str;
} }
if (0 <= opcode && opcode <= OP_PUSHDATA4) { if (0 <= opcode && opcode <= OP_PUSHDATA4) {
if (vch.size() <= static_cast<vector<unsigned char>::size_type>(4)) { // the IsUnspendable check makes sure not to try to decode OP_RETURN data that may match the format of a signature
str += strprintf("%d", CScriptNum(vch, false).getint()); if (fAttemptSighashDecode && !script.IsUnspendable()) {
} else { string strSigHashDecode;
// the IsUnspendable check makes sure not to try to decode OP_RETURN data that may match the format of a signature // goal: only attempt to decode a defined sighash type from data that looks like a signature within a scriptSig.
if (fAttemptSighashDecode && !script.IsUnspendable()) { // this won't decode correctly formatted public keys in Pubkey or Multisig scripts due to
string strSigHashDecode; // the restrictions on the pubkey formats (see IsCompressedOrUncompressedPubKey) being incongruous with the
// goal: only attempt to decode a defined sighash type from data that looks like a signature within a scriptSig. // checks in CheckSignatureEncoding.
// this won't decode correctly formatted public keys in Pubkey or Multisig scripts due to if (CheckSignatureEncoding(vch, SCRIPT_VERIFY_STRICTENC, NULL)) {
// the restrictions on the pubkey formats (see IsCompressedOrUncompressedPubKey) being incongruous with the const unsigned char chSigHashType = vch.back();
// checks in CheckSignatureEncoding. if (mapSigHashTypes.count(chSigHashType)) {
if (CheckSignatureEncoding(vch, SCRIPT_VERIFY_STRICTENC, NULL)) { strSigHashDecode = "[" + mapSigHashTypes.find(chSigHashType)->second + "]";
const unsigned char chSigHashType = vch.back(); vch.pop_back(); // remove the sighash type byte. it will be replaced by the decode.
if (mapSigHashTypes.count(chSigHashType)) {
strSigHashDecode = "[" + mapSigHashTypes.find(chSigHashType)->second + "]";
vch.pop_back(); // remove the sighash type byte. it will be replaced by the decode.
}
} }
str += HexStr(vch) + strSigHashDecode;
} else {
str += HexStr(vch);
} }
str += HexStr(vch) + strSigHashDecode;
} else {
str += HexStr(vch);
} }
} else { } else {
str += GetOpName(opcode); str += GetOpName(opcode);