From ee5d656a2c1c7df3160281939ebebeab3fbeba8a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:31:02 -1100 Subject: [PATCH] Rework game validation --- src/cc/rogue_rpc.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 9cef26d83..78541b63c 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -329,9 +329,10 @@ int32_t rogue_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa { uint256 hashBlock; int32_t i,numvouts; char coinaddr[64]; CPubKey roguepk; uint64_t txfee = 10000; buyin = maxplayers = 0; - if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) + if ( (txid == zeroid || myGetTransaction(txid,tx,hashBlock) != 0) && (numvouts= tx.vout.size()) > 1 ) { - gameheight = komodo_blockheight(hashBlock); + if ( txid != zeroid ) + gameheight = komodo_blockheight(hashBlock); if ( IsCClibvout(cp,tx,0,cp->unspendableCCaddr) == txfee && (unspentv0 == 0 || CCgettxout(txid,0,1) == txfee) ) { if ( rogue_newgameopreturndecode(buyin,maxplayers,tx.vout[numvouts-1].scriptPubKey) == 'G' ) @@ -1295,7 +1296,8 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C { case 'G': // seems just need to make sure no vout abuse is left to do gametxid = tx.GetHash(); - if ( (err= rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid,0)) != 0 ) + gameheight = height; + if ( (err= rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,zerotxid,0)) != 0 ) { fprintf(stderr,"height.%d %s rogue_isvalidgame error.%d\n",height,gametxid.GetHex().c_str(),err); return eval->Invalid("invalid gametxid");