This commit is contained in:
@@ -478,7 +478,7 @@ int32_t rogue_findbaton(struct CCcontract_info *cp,uint256 &playertxid,char **ke
|
||||
playertxid = zeroid;
|
||||
for (i=0; i<maxplayers; i++)
|
||||
{
|
||||
fprintf(stderr,"findbaton.%d of %d\n",i,maxplayers);
|
||||
//fprintf(stderr,"findbaton.%d of %d\n",i,maxplayers);
|
||||
if ( myIsutxo_spent(spenttxid,gametxid,i+1) >= 0 )
|
||||
{
|
||||
if ( myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() > 0 )
|
||||
@@ -490,26 +490,26 @@ int32_t rogue_findbaton(struct CCcontract_info *cp,uint256 &playertxid,char **ke
|
||||
matches++;
|
||||
regslot = i;
|
||||
matchtx = spenttx;
|
||||
} else fprintf(stderr,"%d+1 doesnt match %s vs %s\n",i,ccaddr,destaddr);
|
||||
} else fprintf(stderr,"%d+1 couldnt find spenttx.%s\n",i,spenttxid.GetHex().c_str());
|
||||
} else fprintf(stderr,"%d+1 unspent\n",i);
|
||||
} //else fprintf(stderr,"%d+1 doesnt match %s vs %s\n",i,ccaddr,destaddr);
|
||||
} //else fprintf(stderr,"%d+1 couldnt find spenttx.%s\n",i,spenttxid.GetHex().c_str());
|
||||
} //else fprintf(stderr,"%d+1 unspent\n",i);
|
||||
}
|
||||
if ( matches == 1 )
|
||||
{
|
||||
if ( myIsutxo_spent(spenttxid,gametxid,maxplayers+i+1) < 0 )
|
||||
{
|
||||
numvouts = matchtx.vout.size();
|
||||
fprintf(stderr,"matchtxid.%s matches.%d numvouts.%d\n",matchtx.GetHash().GetHex().c_str(),matches,numvouts);
|
||||
//fprintf(stderr,"matchtxid.%s matches.%d numvouts.%d\n",matchtx.GetHash().GetHex().c_str(),matches,numvouts);
|
||||
if ( rogue_registeropretdecode(txid,tokenid,playertxid,matchtx.vout[numvouts-1].scriptPubKey) == 'R' )//&& txid == gametxid )
|
||||
{
|
||||
fprintf(stderr,"tokenid.%s txid.%s vs gametxid.%s player.%s\n",tokenid.GetHex().c_str(),txid.GetHex().c_str(),gametxid.GetHex().c_str(),playertxid.GetHex().c_str());
|
||||
//fprintf(stderr,"tokenid.%s txid.%s vs gametxid.%s player.%s\n",tokenid.GetHex().c_str(),txid.GetHex().c_str(),gametxid.GetHex().c_str(),playertxid.GetHex().c_str());
|
||||
if ( tokenid != zeroid )
|
||||
active = tokenid;
|
||||
else active = playertxid;
|
||||
if ( active == zeroid || rogue_playerdata(cp,origplayergame,tid,pk,playerdata,symbol,pname,active) == 0 )
|
||||
{
|
||||
txid = matchtx.GetHash();
|
||||
fprintf(stderr,"scan forward active.%s spenttxid.%s\n",active.GetHex().c_str(),txid.GetHex().c_str());
|
||||
//fprintf(stderr,"scan forward active.%s spenttxid.%s\n",active.GetHex().c_str(),txid.GetHex().c_str());
|
||||
n = 0;
|
||||
while ( CCgettxout(txid,0,1) < 0 )
|
||||
{
|
||||
@@ -542,9 +542,9 @@ int32_t rogue_findbaton(struct CCcontract_info *cp,uint256 &playertxid,char **ke
|
||||
fprintf(stderr,"rogue_findbaton n.%d, seems something is wrong\n",n);
|
||||
return(-5);
|
||||
}
|
||||
fprintf(stderr,"n.%d txid.%s\n",n,txid.GetHex().c_str());
|
||||
//fprintf(stderr,"n.%d txid.%s\n",n,txid.GetHex().c_str());
|
||||
}
|
||||
fprintf(stderr,"set baton %s\n",txid.GetHex().c_str());
|
||||
//fprintf(stderr,"set baton %s\n",txid.GetHex().c_str());
|
||||
batontxid = txid;
|
||||
batonvout = 0; // not vini
|
||||
// how to detect timeout, bailedout, highlander
|
||||
@@ -557,7 +557,7 @@ int32_t rogue_findbaton(struct CCcontract_info *cp,uint256 &playertxid,char **ke
|
||||
return(-4);
|
||||
else batonht = pindex->GetHeight();
|
||||
batonvalue = batontx.vout[0].nValue;
|
||||
printf("batonht.%d keystrokes[%d]\n",batonht,numkeys);
|
||||
//printf("batonht.%d keystrokes[%d]\n",batonht,numkeys);
|
||||
return(0);
|
||||
} else fprintf(stderr,"couldnt find baton\n");
|
||||
}
|
||||
@@ -830,16 +830,13 @@ char *rogue_extractgame(char *str,int32_t *numkeysp,std::vector<uint8_t> &newdat
|
||||
roguepk = GetUnspendable(cp,0);
|
||||
*numkeysp = 0;
|
||||
seed = 0;
|
||||
fprintf(stderr,"calling validgame\n");
|
||||
if ( (err= rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid)) == 0 )
|
||||
{
|
||||
fprintf(stderr,"calling baton\n");
|
||||
if ( rogue_findbaton(cp,playertxid,&keystrokes,numkeys,regslot,playerdata,batontxid,batonvout,batonvalue,batonht,gametxid,gametx,maxplayers,rogueaddr,numplayers,symbol,pname) == 0 )
|
||||
{
|
||||
UniValue obj;
|
||||
fprintf(stderr,"calling gamefields\n");
|
||||
seed = rogue_gamefields(obj,maxplayers,buyin,gametxid,rogueaddr);
|
||||
fprintf(stderr,"(%s) found baton %s numkeys.%d seed.%llu playerdata.%d\n",pname.size()!=0?pname.c_str():Rogue_pname.c_str(),batontxid.ToString().c_str(),numkeys,(long long)seed,(int32_t)playerdata.size());
|
||||
//fprintf(stderr,"(%s) found baton %s numkeys.%d seed.%llu playerdata.%d\n",pname.size()!=0?pname.c_str():Rogue_pname.c_str(),batontxid.ToString().c_str(),numkeys,(long long)seed,(int32_t)playerdata.size());
|
||||
memset(&P,0,sizeof(P));
|
||||
if ( playerdata.size() > 0 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user