corr FilterOutNonCCOprets checking cc opret data
This commit is contained in:
@@ -69,15 +69,18 @@ one other technical note is that komodod has the insight-explorer extensions bui
|
|||||||
|
|
||||||
// token opret additional data block ids:
|
// token opret additional data block ids:
|
||||||
enum opretid : uint8_t {
|
enum opretid : uint8_t {
|
||||||
OPRETID_NONFUNGIBLEDATA = 0x11, OPRETID_FIRST = OPRETID_NONFUNGIBLEDATA, // first id
|
// cc contracts data:
|
||||||
|
OPRETID_NONFUNGIBLEDATA = 0x11,
|
||||||
OPRETID_ASSETSDATA = 0x12,
|
OPRETID_ASSETSDATA = 0x12,
|
||||||
OPRETID_GATEWAYSDATA = 0x13,
|
OPRETID_GATEWAYSDATA = 0x13,
|
||||||
OPRETID_CHANNELSDATA = 0x14,
|
OPRETID_CHANNELSDATA = 0x14,
|
||||||
OPRETID_HEIRDATA = 0x15,
|
OPRETID_HEIRDATA = 0x15,
|
||||||
OPRETID_ROGUEGAMEDATA = 0x16,
|
OPRETID_ROGUEGAMEDATA = 0x16,
|
||||||
|
|
||||||
OPRETID_BURNDATA = 0x70,
|
// non cc contract data:
|
||||||
OPRETID_IMPORTDATA = 0x71, OPRETID_LAST = OPRETID_IMPORTDATA // last id
|
OPRETID_FIRSTNONCCDATA = 0x80,
|
||||||
|
OPRETID_BURNDATA = 0x80,
|
||||||
|
OPRETID_IMPORTDATA = 0x81
|
||||||
};
|
};
|
||||||
|
|
||||||
// find opret blob by opretid
|
// find opret blob by opretid
|
||||||
|
|||||||
@@ -265,16 +265,16 @@ void FilterOutTokensUnspendablePk(const std::vector<CPubKey> &sourcePubkeys, std
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterOutBurnOpret(const std::vector<std::pair<uint8_t, vscript_t>> &oprets, vscript_t vopret) {
|
void FilterOutNonCCOprets(const std::vector<std::pair<uint8_t, vscript_t>> &oprets, vscript_t vopret) {
|
||||||
|
|
||||||
vopret.clear();
|
vopret.clear();
|
||||||
|
|
||||||
if (oprets.size() > 2)
|
if (oprets.size() > 2)
|
||||||
LOGSTREAM((char *)"cctokens", CCLOG_INFO, stream << "FilterOutBurnOpret() oprets.size > 2 currently not supported" << oprets.size() << std::endl);
|
LOGSTREAM("cctokens", CCLOG_INFO, stream << "FilterOutNonCCOprets() warning!! oprets.size > 2 currently not supported" << oprets.size() << std::endl);
|
||||||
|
|
||||||
for (auto o : oprets) {
|
for (auto o : oprets) {
|
||||||
if (o.first != EVAL_IMPORTCOIN) { // skip burn opret
|
if (o.first < OPRETID_FIRSTNONCCDATA) { // skip burn, import, etc opret data
|
||||||
vopret = o.second; // return first contract opret (more than 1 is not supported yet)
|
vopret = o.second; // return first contract opret (more than 1 is not supported yet)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,7 +343,7 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys /*<--not used, always true
|
|||||||
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "IsTokensvout() oprets.size()=" << oprets.size() << std::endl);
|
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "IsTokensvout() oprets.size()=" << oprets.size() << std::endl);
|
||||||
|
|
||||||
// get assets/channels/gateways token data:
|
// get assets/channels/gateways token data:
|
||||||
FilterOutBurnOpret(oprets, vopretExtra); // NOTE: only 1 additional evalcode in token opret is currently supported
|
FilterOutNonCCOprets(oprets, vopretExtra); // NOTE: only 1 additional evalcode in token opret is currently supported
|
||||||
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "IsTokensvout() vopretExtra=" << HexStr(vopretExtra) << std::endl);
|
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "IsTokensvout() vopretExtra=" << HexStr(vopretExtra) << std::endl);
|
||||||
|
|
||||||
// get non-fungible data
|
// get non-fungible data
|
||||||
@@ -679,7 +679,7 @@ int64_t HasBurnedTokensvouts(struct CCcontract_info *cp, Eval* eval, const CTran
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get assets/channels/gateways token data:
|
// get assets/channels/gateways token data:
|
||||||
FilterOutBurnOpret(oprets, vopretExtra); // NOTE: only 1 additional evalcode in token opret is currently supported
|
FilterOutNonCCOprets(oprets, vopretExtra); // NOTE: only 1 additional evalcode in token opret is currently supported
|
||||||
|
|
||||||
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "HasBurnedTokensvouts() vopretExtra=" << HexStr(vopretExtra) << std::endl);
|
LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "HasBurnedTokensvouts() vopretExtra=" << HexStr(vopretExtra) << std::endl);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user