corr opretid for old-style assets
This commit is contained in:
@@ -197,8 +197,8 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCodeTokens, ui
|
|||||||
uint256 dummySrcTokenId;
|
uint256 dummySrcTokenId;
|
||||||
CPubKey voutPubkey1, voutPubkey2;
|
CPubKey voutPubkey1, voutPubkey2;
|
||||||
|
|
||||||
vscript_t vroguedata;
|
vscript_t voldstyledata;
|
||||||
bool foundRogue = false;
|
bool foundOldstyle = false;
|
||||||
|
|
||||||
GetOpReturnData(scriptPubKey, vopret);
|
GetOpReturnData(scriptPubKey, vopret);
|
||||||
script = (uint8_t *)vopret.data();
|
script = (uint8_t *)vopret.data();
|
||||||
@@ -227,22 +227,19 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCodeTokens, ui
|
|||||||
return DecodeTokenImportOpRet(scriptPubKey, dummyPubkey, dummyName, dummyDescription, dummySrcTokenId, oprets);
|
return DecodeTokenImportOpRet(scriptPubKey, dummyPubkey, dummyName, dummyDescription, dummySrcTokenId, oprets);
|
||||||
//break;
|
//break;
|
||||||
case 't':
|
case 't':
|
||||||
//not used yet: case 'l':
|
|
||||||
// NOTE: 'E_UNMARSHAL result==false' means 'parse error' OR 'not eof state'. Consequently, 'result==false' but 'isEof==true' means just 'parse error'
|
// compatibility with old-style rogue or assets data (with no opretid):
|
||||||
|
// try to unmarshal old-style rogue or assets data:
|
||||||
// compatibility with rogue or assets data:
|
foundOldstyle = E_UNMARSHAL(vopret, ss >> dummyEvalCode; ss >> dummyFuncId; ss >> tokenid; ss >> ccType;
|
||||||
// try to unmarshal rogue or assets data:
|
|
||||||
|
|
||||||
foundRogue = E_UNMARSHAL(vopret, ss >> dummyEvalCode; ss >> dummyFuncId; ss >> tokenid; ss >> ccType;
|
|
||||||
if (ccType >= 1) ss >> voutPubkey1;
|
if (ccType >= 1) ss >> voutPubkey1;
|
||||||
if (ccType == 2) ss >> voutPubkey2;
|
if (ccType == 2) ss >> voutPubkey2;
|
||||||
if (!ss.eof()) {
|
if (!ss.eof()) {
|
||||||
ss >> vroguedata;
|
ss >> voldstyledata;
|
||||||
}) && vroguedata.size() > 2 &&
|
}) && voldstyledata.size() > 2 &&
|
||||||
(vroguedata.begin()[0] == 0x11 /*EVAL_ROGUE*/ && IS_CHARINSTR(vroguedata.begin()[1], "RHQKG") ||
|
(voldstyledata.begin()[0] == 0x11 /*EVAL_ROGUE*/ && IS_CHARINSTR(voldstyledata.begin()[1], "RHQKG") ||
|
||||||
vroguedata.begin()[0] == EVAL_ASSETS && IS_CHARINSTR(vroguedata.begin()[1], "sbSBxo")) ;
|
voldstyledata.begin()[0] == EVAL_ASSETS && IS_CHARINSTR(voldstyledata.begin()[1], "sbSBxo")) ;
|
||||||
|
|
||||||
if(foundRogue || // fix for compatibility with old rogue data (no opretid)
|
if (foundOldstyle || // fix for compatibility with old style data (no opretid)
|
||||||
E_UNMARSHAL(vopret, ss >> dummyEvalCode; ss >> dummyFuncId; ss >> tokenid; ss >> ccType;
|
E_UNMARSHAL(vopret, ss >> dummyEvalCode; ss >> dummyFuncId; ss >> tokenid; ss >> ccType;
|
||||||
if (ccType >= 1) ss >> voutPubkey1;
|
if (ccType >= 1) ss >> voutPubkey1;
|
||||||
if (ccType == 2) ss >> voutPubkey2;
|
if (ccType == 2) ss >> voutPubkey2;
|
||||||
@@ -268,9 +265,15 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCodeTokens, ui
|
|||||||
|
|
||||||
tokenid = revuint256(tokenid);
|
tokenid = revuint256(tokenid);
|
||||||
|
|
||||||
if (foundRogue) {
|
if (foundOldstyle) { //patch for old-style opret data with no opretid
|
||||||
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG1, stream << "DecodeTokenOpRet() found old-style rogue data" << " for tokenid=" << revuint256(tokenid).GetHex() << std::endl);
|
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG1, stream << "DecodeTokenOpRet() found old-style rogue/asset data, evalcode=" << (int)voldstyledata.begin()[0] << " funcid=" << (char)voldstyledata.begin()[1] << " for tokenid=" << revuint256(tokenid).GetHex() << std::endl);
|
||||||
oprets.push_back(std::make_pair(OPRETID_ROGUEGAMEDATA, vroguedata));
|
uint8_t opretIdRestored;
|
||||||
|
if (voldstyledata.begin()[0] == 0x11 /*EVAL_ROGUE*/)
|
||||||
|
opretIdRestored = OPRETID_ROGUEGAMEDATA;
|
||||||
|
else // EVAL_ASSETS
|
||||||
|
opretIdRestored = OPRETID_ASSETSDATA;
|
||||||
|
|
||||||
|
oprets.push_back(std::make_pair(opretIdRestored, voldstyledata));
|
||||||
}
|
}
|
||||||
|
|
||||||
return(funcId);
|
return(funcId);
|
||||||
|
|||||||
Reference in New Issue
Block a user