From b86fa74a48e647cd4316307dc234bf61d0bb95f8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 12 Feb 2019 10:15:42 -1100 Subject: [PATCH] Pastgames --- src/cc/rogue_rpc.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index a54f81036..ec2f571ee 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -232,7 +232,7 @@ uint8_t rogue_registeropretdecode(uint256 &gametxid,uint256 &tokenid,uint256 &pl { return(f); } - fprintf(stderr,"e.%d f.%c game.%s playertxid.%s\n",e,f,gametxid.GetHex().c_str(),playertxid.GetHex().c_str()); + //fprintf(stderr,"e.%d f.%c game.%s playertxid.%s\n",e,f,gametxid.GetHex().c_str(),playertxid.GetHex().c_str()); return(0); } @@ -1052,7 +1052,7 @@ UniValue rogue_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) UniValue rogue_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) { - UniValue result(UniValue::VOBJ),a(UniValue::VARR); uint256 txid,hashBlock,gametxid,tokenid,playertxid; int32_t vout,numvouts; CPubKey roguepk,mypk; char coinaddr[64]; CTransaction tx; + UniValue result(UniValue::VOBJ),a(UniValue::VARR),b(UniValue::VARR); uint256 txid,hashBlock,gametxid,tokenid,playertxid; int32_t vout,numvouts; CPubKey roguepk,mypk; char coinaddr[64]; CTransaction tx; std::vector > addressIndex; //std::vector > unspentOutputs; roguepk = GetUnspendable(cp,0); @@ -1073,13 +1073,16 @@ UniValue rogue_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) { if ( rogue_registeropretdecode(gametxid,tokenid,playertxid,tx.vout[numvouts-1].scriptPubKey) == 'R' ) { - a.push_back(gametxid.GetHex()); + if ( CCgettxout(txid,vout,1) < 0 ) + b.push_back(gametxid.GetHex()); + else a.push_back(gametxid.GetHex()); } } } } + result.push_back(Pair("pastgames",b)); result.push_back(Pair("games",a)); - result.push_back(Pair("numgames",a.size())); + result.push_back(Pair("numgames",a.size()+b.size())); return(result); }