From 46406f3c25e7649c20df82e5d7d5b1882025874b Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 15 Jan 2019 13:06:06 +0500 Subject: [PATCH] corr CCinit in HeirClaim --- src/cc/CCtokens.cpp | 4 ++-- src/cc/heir.cpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/cc/CCtokens.cpp b/src/cc/CCtokens.cpp index d1dcf0b1f..e54919155 100644 --- a/src/cc/CCtokens.cpp +++ b/src/cc/CCtokens.cpp @@ -427,9 +427,9 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *c if (tx.vout[v].scriptPubKey == testDualVout.scriptPubKey) { if(voutPubkeys.size() == 1) - std::cerr << indentStr << "IsTokensvout() this is dual-eval token vout, eval2=" << evalCodeInOpret << ", returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl; + std::cerr << indentStr << "IsTokensvout() this is dual-eval token vout, eval2=" << (int)evalCodeInOpret << ", returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl; else - std::cerr << indentStr << "IsTokensvout() this is dual-eval token 1of2 vout or change, eval2=" << evalCodeInOpret << ", returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl; + std::cerr << indentStr << "IsTokensvout() this is dual-eval token 1of2 vout or change, eval2=" << (int)evalCodeInOpret << ", returning nValue=" << tx.vout[v].nValue << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl; return tx.vout[v].nValue; } } diff --git a/src/cc/heir.cpp b/src/cc/heir.cpp index f3a3913a3..8ee5d7e07 100644 --- a/src/cc/heir.cpp +++ b/src/cc/heir.cpp @@ -832,7 +832,8 @@ template UniValue HeirClaim(uint256 fundingtxid, uint64_t txfee std::string heirName; uint8_t hasHeirSpendingBegun = 0; - cp = CCinit(&C, Helper::getMyEval()); + //cp = CCinit(&C, Helper::getMyEval()); + cp = CCinit(&C, EVAL_HEIR); if (txfee == 0) txfee = 10000; @@ -919,8 +920,15 @@ template UniValue HeirClaim(uint256 fundingtxid, uint64_t txfee std::string rawhextx = FinalizeCCTx(0, cp, mtx, myPubkey, txfee, Helper::makeClaimOpRet(tokenid, voutTokenPubkeys, fundingtxid, (myPubkey == heirPubkey) ? 1 : hasHeirSpendingBegun)); // forward isHeirSpending to the next latest tx - result.push_back(Pair("result", "success")); - result.push_back(Pair("hextx", rawhextx)); + if (!rawhextx.empty()) { + result.push_back(Pair("result", "success")); + result.push_back(Pair("hextx", rawhextx)); + } + else { + std::cerr << "HeirAdd error in FinalizeCCtx" << std::endl; + result.push_back(Pair("result", "error")); + result.push_back(Pair("error", "sign error")); + } } else { fprintf(stderr, "HeirClaim() cant find Heir CC inputs\n");