This commit is contained in:
jl777
2019-02-10 04:23:23 -11:00
parent a4a93eb862
commit 73a696f008
3 changed files with 12 additions and 7 deletions

View File

@@ -157,7 +157,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
{ {
Getscriptaddress(destaddr,vintx.vout[utxovout].scriptPubKey); Getscriptaddress(destaddr,vintx.vout[utxovout].scriptPubKey);
//fprintf(stderr,"FinalizeCCTx() vin.%d is CC %.8f -> (%s)\n",i,(double)utxovalues[i]/COIN,destaddr); //fprintf(stderr,"FinalizeCCTx() vin.%d is CC %.8f -> (%s)\n",i,(double)utxovalues[i]/COIN,destaddr);
std::cerr << "FinalizeCCtx() searching destaddr=" << destaddr << " for vin[" << i << "] satoshis=" << utxovalues[i] << std::endl; //std::cerr << "FinalizeCCtx() searching destaddr=" << destaddr << " for vin[" << i << "] satoshis=" << utxovalues[i] << std::endl;
if( strcmp(destaddr, myaddr) == 0 ) if( strcmp(destaddr, myaddr) == 0 )
{ {
fprintf(stderr, "FinalizeCCTx() matched cc myaddr (%s)\n", myaddr); fprintf(stderr, "FinalizeCCTx() matched cc myaddr (%s)\n", myaddr);

View File

@@ -159,12 +159,14 @@ readchar(struct rogue_state *rs)
{ {
//if ( rs->ind == rs->numkeys-1 ) //if ( rs->ind == rs->numkeys-1 )
// rs->replaydone = (uint32_t)time(NULL); // rs->replaydone = (uint32_t)time(NULL);
fprintf(stderr,"(%c) ",rs->keystrokes[rs->ind]); //fprintf(stderr,"(%c) ",rs->keystrokes[rs->ind]);
return(rs->keystrokes[rs->ind++]); return(rs->keystrokes[rs->ind++]);
} }
fprintf(stderr,"replay finished but readchar called\n"); fprintf(stderr,"replay finished but readchar called\n");
rs->replaydone = (uint32_t)time(NULL); rs->replaydone = (uint32_t)time(NULL);
return('y'); if ( (rand() & 1) == 0 )
return(ESCAPE);
else return('y');
} }
if ( rs == 0 || rs->guiflag != 0 ) if ( rs == 0 || rs->guiflag != 0 )
{ {

View File

@@ -839,9 +839,12 @@ UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
return(cclib_error(result,"highlander must be a winner or last one standing")); return(cclib_error(result,"highlander must be a winner or last one standing"));
cashout += numplayers * buyin; cashout += numplayers * buyin;
} }
if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,cashout,16,cp->unspendableCCaddr)) > (uint64_t)P.gold*mult ) if ( cashout >= txfee )
CCchange = (inputsum - cashout); {
mtx.vout.push_back(CTxOut(cashout,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,cashout,16,cp->unspendableCCaddr)) > (uint64_t)P.gold*mult )
CCchange = (inputsum - cashout);
mtx.vout.push_back(CTxOut(cashout,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
}
//for (i=0; i<P.packsize; i++) //for (i=0; i<P.packsize; i++)
// fprintf(stderr,"object (%s) type.%d pack.(%c:%d)\n",inv_name(o,FALSE),o->_o._o_type,o->_o._o_packch,o->_o._o_packch); // fprintf(stderr,"object (%s) type.%d pack.(%c:%d)\n",inv_name(o,FALSE),o->_o._o_type,o->_o._o_packch,o->_o._o_packch);
} }
@@ -849,7 +852,7 @@ UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
Myprivkey(mypriv); Myprivkey(mypriv);
CCaddr1of2set(cp,roguepk,mypk,mypriv,myrogueaddr); CCaddr1of2set(cp,roguepk,mypk,mypriv,myrogueaddr);
rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,rogue_highlanderopret(funcid,gametxid,mypk,newdata)); rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,rogue_highlanderopret(funcid,gametxid,mypk,newdata));
return(rogue_rawtxresult(result,rawtx,1)); return(rogue_rawtxresult(result,rawtx,0));
} }
result.push_back(Pair("result","success")); result.push_back(Pair("result","success"));
} }