diff --git a/src/cc/CCtx.cpp b/src/cc/CCtx.cpp index 630f37dca..7640b35bb 100644 --- a/src/cc/CCtx.cpp +++ b/src/cc/CCtx.cpp @@ -43,10 +43,12 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus()); CTransaction vintx; std::string hex; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0; int64_t utxovalues[CC_MAXVINS],change,normalinputs=0,totaloutputs=0,normaloutputs=0,totalinputs=0,normalvins=0,ccvins=0; - int32_t i,utxovout,n,err = 0; char myaddr[64],destaddr[64],unspendable[64],mytokensaddr[64]; - uint8_t *privkey,myprivkey[32],unspendablepriv[32],*msg32 = 0; - CC *mycond=0, *othercond=0, *othercond2=0, *othercond3=0, *othercond1of2=NULL, *othercond1of2tokens = NULL, *cond, *mytokenscond = NULL; + int32_t i,utxovout,n,err = 0; + char myaddr[64], destaddr[64], unspendable[64], mytokensaddr[64], mysingletokensaddr[64]; + uint8_t *privkey, myprivkey[32], unspendablepriv[32], *msg32 = 0; + CC *mycond=0, *othercond=0, *othercond2=0, *othercond3=0, *othercond1of2=NULL, *othercond1of2tokens = NULL, *cond, *mytokenscond = NULL, *mysingletokenscond = NULL; CPubKey unspendablepk; + struct CCcontract_info *cpTokens, tokensC; n = mtx.vout.size(); for (i=0; ievalcode, mypk); + cpTokens = CCinit(&tokensC, EVAL_TOKENS); + GetCCaddress(cpTokens, mysingletokensaddr, mypk); + mysingletokenscond = MakeCCcond1(cpTokens->evalcode, mypk); + unspendablepk = GetUnspendable(cp,unspendablepriv); GetCCaddress(cp,unspendable,unspendablepk); othercond = MakeCCcond1(cp->evalcode,unspendablepk); @@ -149,6 +155,12 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran cond = mytokenscond; fprintf(stderr,"FinalizeCCTx() matched TokensCC1vout CC addr.(%s)\n",mytokensaddr); } + else if (strcmp(destaddr, mysingletokensaddr) == 0) // if this is TokensCC1vout + { + privkey = myprivkey; + cond = mysingletokenscond; + fprintf(stderr, "FinalizeCCTx() matched single-eval TokensCC1vout CC addr.(%s)\n", mytokensaddr); + } else if ( strcmp(destaddr,unspendable) == 0 ) { privkey = unspendablepriv;