diff --git a/src/cc/assets.cpp b/src/cc/assets.cpp index fc2b718e4..3a94aef02 100644 --- a/src/cc/assets.cpp +++ b/src/cc/assets.cpp @@ -507,6 +507,33 @@ std::string FinalizeCCTx(uint8_t evalcode,CMutableTransaction &mtx,CPubKey mypk, vinimask |= (1LL << i); } else + { + } + } else fprintf(stderr,"FinalizeCCTx couldnt find %s\n",mtx.vin[i].prevout.hash.ToString().c_str()); + } + if ( mycond != 0 ) + cc_free(mycond); + if ( othercond != 0 ) + cc_free(othercond); + if ( totalinputs >= totaloutputs+2*txfee ) + { + change = totalinputs - (totaloutputs+txfee); + mtx.vout.push_back(CTxOut(change,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); + } + mtx.vout.push_back(CTxOut(0,opret)); + PrecomputedTransactionData txdata(mtx); + n = mtx.vin.size(); + for (i=0; i (%s)\n",i,(double)utxovalues[i]/COIN,destaddr); @@ -527,36 +554,12 @@ std::string FinalizeCCTx(uint8_t evalcode,CMutableTransaction &mtx,CPubKey mypk, fprintf(stderr,"vini.%d has unknown CC address.(%s)\n",i,destaddr); continue; } - PrecomputedTransactionData txdata(mtx); uint256 sighash = SignatureHash(CCPubKey(cond), mtx, i, SIGHASH_ALL, 0, 0, &txdata); if ( cc_signTreeSecp256k1Msg32(cond,privkey,sighash.begin()) != 0 ) mtx.vin[i].scriptSig = CCSig(cond); else fprintf(stderr,"vini.%d has CC signing error address.(%s)\n",i,destaddr); } - } else fprintf(stderr,"FinalizeCCTx couldnt find %s\n",mtx.vin[i].prevout.hash.ToString().c_str()); - } - if ( mycond != 0 ) - cc_free(mycond); - if ( othercond != 0 ) - cc_free(othercond); - if ( totalinputs >= totaloutputs+2*txfee ) - { - change = totalinputs - (totaloutputs+txfee); - mtx.vout.push_back(CTxOut(change,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); - } - mtx.vout.push_back(CTxOut(0,opret)); - n = mtx.vin.size(); - for (i=0; i 0 )