From 1c12ebcf34fe1d1046481122e944dd4e1ca2379f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 26 Mar 2019 06:05:22 -1100 Subject: [PATCH] +print --- src/cc/gamescc.cpp | 19 ++++++++++--------- src/cc/tetris.cpp | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/cc/gamescc.cpp b/src/cc/gamescc.cpp index 650c051b9..8fa629b7f 100644 --- a/src/cc/gamescc.cpp +++ b/src/cc/gamescc.cpp @@ -927,7 +927,7 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven *keystrokesp = 0; for (i=0; i= 0 ) { if ( myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() > 0 ) @@ -946,17 +946,17 @@ fprintf(stderr,"findbaton.%d of %d\n",i,maxplayers); if ( matches == 1 ) { 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 ( games_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 || games_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) < 0 ) { @@ -973,9 +973,10 @@ fprintf(stderr,"matchtxid.%s matches.%d numvouts.%d\n",matchtx.GetHash().GetHex( } } txid = spenttxid; - fprintf(stderr,"n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini); + //fprintf(stderr,"n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini); if ( spentvini != 0 ) // game is over? { + fprintf(stderr,"gameisover n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini); return(0); } if ( keystrokesp != 0 && myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() >= 2 ) @@ -994,17 +995,17 @@ fprintf(stderr,"matchtxid.%s matches.%d numvouts.%d\n",matchtx.GetHash().GetHex( } numkeys += (int32_t)k.size() / sizeof(gamesevent); (*keystrokesp) = keystrokes; - fprintf(stderr,"updated keystrokes.%p[%d]\n",keystrokes,numkeys); + //fprintf(stderr,"updated keystrokes.%p[%d]\n",keystrokes,numkeys); } } - fprintf(stderr,"n.%d txid.%s\n",n,txid.GetHex().c_str()); + //fprintf(stderr,"n.%d txid.%s\n",n,txid.GetHex().c_str()); if ( ++n >= GAMES_MAXITERATIONS ) { fprintf(stderr,"games_findbaton n.%d, seems something is wrong\n",n); return(-5); } } - 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 @@ -1017,7 +1018,7 @@ fprintf(stderr,"matchtxid.%s matches.%d numvouts.%d\n",matchtx.GetHash().GetHex( 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"); } else fprintf(stderr,"error with playerdata\n"); diff --git a/src/cc/tetris.cpp b/src/cc/tetris.cpp index a91157dde..1a55de005 100644 --- a/src/cc/tetris.cpp +++ b/src/cc/tetris.cpp @@ -89,6 +89,7 @@ gamesevent *games_extractgame(int32_t makefiles,char *str,int32_t *numkeysp,std: if ( (retval= games_findbaton(cp,playertxid,&keystrokes,numkeys,regslot,playerdata,batontxid,batonvout,batonvalue,batonht,gametxid,gametx,maxplayers,gamesaddr,numplayers,symbol,pname)) == 0 ) { UniValue obj; + fprintf(stderr,"got baton\n"); seed = games_gamefields(obj,maxplayers,buyin,gametxid,gamesaddr); fprintf(stderr,"(%s) found baton %s numkeys.%d seed.%llu playerdata.%d playertxid.%s\n",pname.size()!=0?pname.c_str():Games_pname.c_str(),batontxid.ToString().c_str(),numkeys,(long long)seed,(int32_t)playerdata.size(),playertxid.GetHex().c_str()); memset(&P,0,sizeof(P));