From d0888260aa142faab3044a6ea0876a2ed5849a61 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:24:08 -1100 Subject: [PATCH 1/7] +print validgame --- src/cc/rogue_rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 9cef26d83..d1c63f592 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -1300,7 +1300,7 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C fprintf(stderr,"height.%d %s rogue_isvalidgame error.%d\n",height,gametxid.GetHex().c_str(),err); return eval->Invalid("invalid gametxid"); } - //fprintf(stderr,"height.%d %s rogue_isvalidgame\n",height,gametxid.GetHex().c_str()); + fprintf(stderr,"height.%d %s rogue_isvalidgame\n",height,gametxid.GetHex().c_str()); return(true); break; case 'R': From ef05677ec88427b56d6083c6711a0de05af00297 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:24:32 -1100 Subject: [PATCH 2/7] -print --- src/cc/rogue_rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index d1c63f592..9cef26d83 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -1300,7 +1300,7 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C fprintf(stderr,"height.%d %s rogue_isvalidgame error.%d\n",height,gametxid.GetHex().c_str(),err); return eval->Invalid("invalid gametxid"); } - fprintf(stderr,"height.%d %s rogue_isvalidgame\n",height,gametxid.GetHex().c_str()); + //fprintf(stderr,"height.%d %s rogue_isvalidgame\n",height,gametxid.GetHex().c_str()); return(true); break; case 'R': From ee5d656a2c1c7df3160281939ebebeab3fbeba8a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:31:02 -1100 Subject: [PATCH 3/7] 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"); From 67eb2929d63534398efdea4007c7d6192b598634 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:31:56 -1100 Subject: [PATCH 4/7] Zeroed --- src/cc/rogue_rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 78541b63c..9d493e5ae 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -1297,7 +1297,7 @@ 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(); gameheight = height; - if ( (err= rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,zerotxid,0)) != 0 ) + if ( (err= rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,zeroid,0)) != 0 ) { fprintf(stderr,"height.%d %s rogue_isvalidgame error.%d\n",height,gametxid.GetHex().c_str(),err); return eval->Invalid("invalid gametxid"); From 92c9825cdea8ad8be5a00b7f74412556840d69a3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:41:28 -1100 Subject: [PATCH 5/7] Test --- src/cc/rogue_rpc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 9d493e5ae..50492e2cf 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -333,6 +333,11 @@ int32_t rogue_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa { if ( txid != zeroid ) gameheight = komodo_blockheight(hashBlock); + else + { + txid = tx.GetHash(); + fprintf(stderr,"set txid %s %llu\n",txid.GetHex().c_str(),(long long)CCgettxout(txid,0,1)); + } 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' ) From fbe6061dc6e76a292ae49e284a1354dc2de4f8b0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:42:45 -1100 Subject: [PATCH 6/7] Test --- src/cc/rogue_rpc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 50492e2cf..2496d6a5e 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -1300,9 +1300,10 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C switch ( funcid ) { case 'G': // seems just need to make sure no vout abuse is left to do + gametx = tx; gametxid = tx.GetHash(); gameheight = height; - if ( (err= rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,zeroid,0)) != 0 ) + if ( (err= rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,zeroid,0)) != 0 ) { fprintf(stderr,"height.%d %s rogue_isvalidgame error.%d\n",height,gametxid.GetHex().c_str(),err); return eval->Invalid("invalid gametxid"); From 180114697aaf5f7ff6ee96ec51722e1150aeea42 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 19 Feb 2019 01:44:36 -1100 Subject: [PATCH 7/7] -print --- src/cc/rogue_rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 2496d6a5e..3d89e0568 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -336,7 +336,7 @@ int32_t rogue_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa else { txid = tx.GetHash(); - fprintf(stderr,"set txid %s %llu\n",txid.GetHex().c_str(),(long long)CCgettxout(txid,0,1)); + //fprintf(stderr,"set txid %s %llu\n",txid.GetHex().c_str(),(long long)CCgettxout(txid,0,1)); } if ( IsCClibvout(cp,tx,0,cp->unspendableCCaddr) == txfee && (unspentv0 == 0 || CCgettxout(txid,0,1) == txfee) ) {