Squashed commit of the following:

commit 843168eddff34390f19fa661ac6315e1a51aafe2
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 14:34:03 2019 +0500

    logging improved for CCtokens.cpp

commit 43c5b3a5c4e36e76a235f987e07fe893d941d95e
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 14:23:41 2019 +0500

    more extra logging disabled for heir and token

commit a3f7ca963a0042237f4c97d6d89852646b541c6c
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 14:13:58 2019 +0500

    more extra logging disabled

commit f4dec8f8ad733c5a61dd0fc9f3decd103dd7a0c3
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 14:05:45 2019 +0500

    more extra logging disabled

commit eb9a41472004ccdacdacfc12b79880ac6da390ee
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 13:50:11 2019 +0500

    extra logging disabled in heir and tokens

commit 0fe01c8a7b52b03e0c0a3ba5d77f916862031d23
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 13:15:08 2019 +0500

    heir normal input validator changed to CNullValidator

commit 3b86e87c83b6993d5a3b4c056c10120223e8c9ed
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 12:58:03 2019 +0500

    enabled logiing in FinalizeCCtx

commit 2ea87c1b3c7967b316d22e2e65fc3c0203cc4b03
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 12:37:43 2019 +0500

    corrected parameters for tests

commit 216eb4ed84c6fd23e3fc22cd79509a09c8504c0c
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 12:22:30 2019 +0500

    changed to eval_assets for test

commit 2af850f06a4692200864a316208cdfc0709b1634
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 02:42:43 2019 +0500

    heiradd loggin vin

commit 28e033d2b2a1a01b2bc9c2d51a81b61ae53f3a29
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 02:04:33 2019 +0500

    logging added

commit ef1dbc504c5984a4997b5e06e736fa7b5b4e125d
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 01:29:46 2019 +0500

    logging added and corrected

commit 98c1e5a6896a97667c9d64f347c26b36c6a320a9
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 01:05:17 2019 +0500

    corrected isHeirSpendingBegan init in _UnmarshalOpret

commit 6006f073bfc136ed06c1636b3e6ffa7b403ce1d9
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 01:01:18 2019 +0500

    corrected dummyIsHeirSpendingBegan using

commit 9a95edf4e311a80538dd7b13aeeb201e97474ee8
Author: dimxy <dimxy@komodoplatform.com>
Date:   Wed Jan 9 00:53:50 2019 +0500

    isHeirSpendingBegan is put in opret

commit 4bd210709626e2f8b99889e50410eb0f75b3dbda
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 20:16:20 2019 +0500

    added logging to _FindLastextFundingTx for print C vouts

commit 3603b49c1143b1efe82dd545b9d7dca43f5bcec0
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 19:25:11 2019 +0500

    corrected isHeirSpendingBegun calc

commit e7d6923d4be080a5e98405634fafb175fa55f801
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 18:43:35 2019 +0500

    yet another cpToken correction in RunValidators

commit e425dcc4497652a062b45d4a5ce4c137bd2caa3d
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 18:22:08 2019 +0500

    changed cp param to cpTokens for heir tokens in validation

commit a4420f30d42d93dbc2729db4a5b2895d4b16d22b
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 17:11:10 2019 +0500

    corrected EVAL_HEIR in create opret

commit 788d75263fd5aaa7b66417441622c9bb6603ab81
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 16:41:07 2019 +0500

    corrected opret forming for 'F', tokens

commit 92bf6c53b36a5a4450b5c7079383792d634d61a7
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 16:12:09 2019 +0500

    _UnmarshalOpret corrected for non F

commit e4eb26e875d44f3e4c1d45aff6df8a7026b3329a
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 15:26:34 2019 +0500

    Revert "CCduration debug logging added"

    This reverts commit 5ffc2b0a8b49d387cd175754738d2c07701c7856.

commit ce97ac88af0b87b304ad1fc9cb29db0803d0bd42
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 15:17:10 2019 +0500

    changed pindex to pindexTip in CCduration for better reading

commit 5ffc2b0a8b49d387cd175754738d2c07701c7856
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 14:43:07 2019 +0500

    CCduration debug logging added

commit 34afdd16f0f6b5b97da864f082dcd019a7566da7
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 12:23:31 2019 +0500

    corrected again order to DecodeOpRet call in heir

commit bba6149969ea23aa4e3c6263a36bae0ba7fa6f5d
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 12:17:11 2019 +0500

    logging added in IsHeirFundingVout

commit 6c5d4b313ef3e54cb5eb2bf67b2fa78d9ffd0b04
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 12:02:15 2019 +0500

    logging added to Add1of2AddrInputs

commit 40d6d84971a8ed764523567f08df4c74fda4f12d
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 11:36:23 2019 +0500

    corrected vopretExtra getting for heir for coins

commit 36061d25fb8992551915afc3dd0600878a64c540
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 11:13:30 2019 +0500

    corrected CCinit C-param separate

commit 0a6710433868c315afe3f656c1bc5f5138fe5288
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 10:58:19 2019 +0500

    logging added in decodeheiropret

commit 2503d8cb59b94b024a9ded43a0602f89800a9549
Author: dimxy <dimxy@komodoplatform.com>
Date:   Tue Jan 8 10:39:21 2019 +0500

    corrected decode opret for heir for coins
This commit is contained in:
dimxy
2019-01-09 16:58:52 +05:00
parent 90f682f022
commit d1bd5b3b6c
4 changed files with 237 additions and 401 deletions

View File

@@ -92,7 +92,7 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCode, uint256
script = (uint8_t *)vopret.data();
tokenid = zeroid;
if (script != 0 /*enable all evals: && script[0] == EVAL_TOKENS*/)
if (script != 0 && vopret.size() > 2)
{
// NOTE: if parse error occures, parse might not be able to set error. It is safer to treat that it was eof if it is not set!
bool isEof = true;
@@ -114,7 +114,7 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCode, uint256
{
if (!(ccType >= 0 && ccType <= 2)) { //incorrect ccType
std::cerr << "DecodeTokenOpRet() incorrect ccType=" << (int)ccType << std::endl;
std::cerr << "DecodeTokenOpRet() incorrect ccType=" << (int)ccType << " tokenid=" << revuint256(tokenid).GetHex() << std::endl;
return (uint8_t)0;
}
@@ -128,7 +128,7 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCode, uint256
tokenid = revuint256(tokenid);
return(funcId);
}
std::cerr << "DecodeTokenOpRet() warning: bad opret format, isEof=" << isEof << " ccType=" << ccType << " tokenid=" << revuint256(tokenid).GetHex() << std::endl;
std::cerr << "DecodeTokenOpRet() bad opret format, isEof=" << isEof << " ccType=" << ccType << " tokenid=" << revuint256(tokenid).GetHex() << std::endl;
return (uint8_t)0;
default:
@@ -136,6 +136,9 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCode, uint256
return (uint8_t)0;
}
}
else {
std::cerr << "DecodeTokenOpRet() empty opret, could not parse" << std::endl;
}
return (uint8_t)0;
}
@@ -247,7 +250,7 @@ bool ValidateTokenOpret(CTransaction tx, int32_t v, uint256 tokenid, std::vector
if ((funcid = DecodeTokenOpRet(tx.vout[n - 1].scriptPubKey, evalCode, tokenidOpret, voutPubkeys, vopretExtra)) == 0)
{
std::cerr << indentStr << "ValidateTokenOpret() DecodeOpret returned null for n-1=" << n - 1 << " txid=" << tx.GetHash().GetHex() << std::endl;
std::cerr << indentStr << "ValidateTokenOpret() DecodeTokenOpret could not parse opret for txid=" << tx.GetHash().GetHex() << std::endl;
return(false);
}
else if (funcid == 'c')
@@ -330,7 +333,7 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *c
testVout = MakeCC1of2vout(EVAL_TOKENS, tx.vout[v].nValue, voutPubkeys[0], voutPubkeys[1]);
if (tx.vout[v].scriptPubKey == testVout.scriptPubKey) {
std::cerr << indentStr << "IsTokensvout() vout is EVAL_TOKENS, returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl;
//std::cerr << indentStr << "IsTokensvout() vout is EVAL_TOKENS, returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl;
return tx.vout[v].nValue;
}
}
@@ -340,7 +343,7 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *c
CTxOut testVout = MakeCC1vout(EVAL_TOKENS, tx.vout[v].nValue, *it);
if (tx.vout[v].scriptPubKey == testVout.scriptPubKey) {
std::cerr << indentStr << "IsTokensvout() vout is EVAL_TOKENS change, returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl;
//std::cerr << indentStr << "IsTokensvout() vout is EVAL_TOKENS change, returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl;
return tx.vout[v].nValue;
}
}
@@ -382,7 +385,7 @@ bool TokensExactAmounts(bool goDeeper, struct CCcontract_info *cpTokens, int64_t
if (cc_typeId(cond) == CC_Secp256k1) {
*(CPubKey*)_.context = buf2pk(cond->publicKey);
std::cerr << "findEval found pubkey=" << HexStr(*(CPubKey*)_.context) << std::endl;
//std::cerr << "findEval found pubkey=" << HexStr(*(CPubKey*)_.context) << std::endl;
r = true;
}
// false for a match, true for continue
@@ -483,7 +486,7 @@ int64_t AddTokenCCInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, C
Getscriptaddress(destaddr, vintx.vout[vout].scriptPubKey);
if (strcmp(destaddr, coinaddr) != 0 && strcmp(destaddr, cp->unspendableCCaddr) != 0 && strcmp(destaddr, cp->unspendableaddr2) != 0)
continue;
fprintf(stderr, "AddTokenCCInputs() check destaddress=%s vout amount=%.8f\n", destaddr, (double)vintx.vout[vout].nValue / COIN);
//fprintf(stderr, "AddTokenCCInputs() check destaddress=%s vout amount=%.8f\n", destaddr, (double)vintx.vout[vout].nValue / COIN);
std::vector<CPubKey> vinPubkeysEmpty;
if ((nValue = IsTokensvout(true, false/*<-- do not check spending outside EVAL_TOKENS for now */, cp, NULL, vopretExtra, vintx, vout, tokenid, vinPubkeysEmpty)) > 0 && myIsutxo_spentinmempool(txid, vout) == 0)