Spend right playertxid vout

This commit is contained in:
jl777
2019-02-11 13:55:43 -11:00
parent 89de224d59
commit f50b207e62

View File

@@ -225,7 +225,7 @@ uint8_t rogue_registeropretdecode(uint256 &gametxid,uint256 &tokenid,uint256 &pl
}
else if ( script[1] != 'R' && (f= DecodeTokenOpRet(scriptPubKey, e, tokenid, voutPubkeys, vopretDummy)) != 0 )
{
//fprintf(stderr,"decode opret %c tokenid.%s\n",script[1],tokenid.GetHex().c_str());
fprintf(stderr,"decode opret %c tokenid.%s\n",script[1],tokenid.GetHex().c_str());
GetNonfungibleData(tokenid, vopretNonfungible); //load nonfungible data from the 'tokenbase' tx
vopret = vopretNonfungible;
}
@@ -747,8 +747,8 @@ 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);
if (playertxid != zeroid)
mtx.vin.push_back(CTxIn(playertxid, 1)); // spending cc marker as token is being burned
if (playertxid != zeroid )
mtx.vin.push_back(CTxIn(playertxid, vout)); // 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);
@@ -760,7 +760,7 @@ UniValue rogue_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
{
//fprintf(stderr,"playertxid.%s\n",playertxid.GetHex().c_str());
voutPubkeysEmpty.push_back(burnpk);
if ( GetTransaction(tokenid == zeroid ? playertxid : tokenid,playertx,hashBlock,false) != 0 )
if ( GetTransaction(playertxid,playertx,hashBlock,false) != 0 )
{
if ( (funcid= DecodeTokenOpRet(playertx.vout.back().scriptPubKey, e, tid, voutPubkeys, vopretExtra)) != 0)
{ // if token in the opret