added cc marker spending in rogue_register

This commit is contained in:
dimxy
2019-02-11 23:27:39 +05:00
parent 73c33eb2a3
commit 672b3939f6
2 changed files with 2 additions and 1 deletions

View File

@@ -909,7 +909,7 @@ std::string CreateToken(int64_t txfee, int64_t tokensupply, std::string name, st
mtx.vout.push_back(MakeTokensCC1vout(destEvalCode, tokensupply, mypk));
//mtx.vout.push_back(CTxOut(txfee, CScript() << ParseHex(cp->CChexstr) << OP_CHECKSIG)); // old marker (non-burnable because spending could not be validated)
// NOTE: we should prevent spending fake-tokens from this marker in IsTokenvout():
mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS, txfee, GetUnspendable(cp, NULL))); // new marker to token cc addr, burnable and validated
mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS, txfee, GetUnspendable(cp, NULL))); // new marker to token cc addr, burnable and validated, this vout must be=1
return(FinalizeCCTx(0, cp, mtx, mypk, txfee, EncodeTokenCreateOpRet('c', Mypubkey(), name, description, nonfungibleData)));
}

View File

@@ -712,6 +712,7 @@ UniValue rogue_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
return(cclib_error(result,"couldnt find enough normal funds for buyin"));
if ( playertxid != zeroid )
AddNormalinputs2(mtx,txfee,10);
mtx.vin.push_back(CTxIn(playertxid, 1)); // spending cc marker as token is being burned
mtx.vout.push_back(MakeCC1of2vout(cp->evalcode,buyin + inputsum - txfee,roguepk,mypk));
GetCCaddress1of2(cp,destaddr,roguepk,roguepk);
CCaddr1of2set(cp,roguepk,roguepk,cp->CCpriv,destaddr);