diff --git a/src/cc/CCdice.h b/src/cc/CCdice.h index e84252201..d9db490c3 100644 --- a/src/cc/CCdice.h +++ b/src/cc/CCdice.h @@ -23,7 +23,7 @@ bool DiceValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx); -std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds,const char *error); +std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds,std::string &error); std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid,int32_t winlosetimeout); double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid); std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t minbet,int64_t maxbet,int64_t maxodds,int64_t timeoutblocks); diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 6c5485e1c..7e0946d72 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -945,7 +945,7 @@ std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int6 return(""); } -std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds, const char *error) +std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds, std::string &error) { CMutableTransaction mtx; CScript fundingPubKey; CPubKey mypk,dicepk; uint64_t sbits,entropyval; int64_t funding,minbet,maxbet,maxodds,timeoutblocks; uint256 entropytxid,entropy,hentropy; struct CCcontract_info *cp,C; if ( bet < 0 ) @@ -974,7 +974,7 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet if ( entropytxs < 2 ) { CCerror = "Your dealer is broke, find a new casino."; fprintf(stderr,"%s\n", CCerror.c_str() ); - error = CCerror.c_str(); + error = CCerror; return(""); } if ( myIsutxo_spentinmempool(entropytxid,0) != 0 ) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e3a84395d..238ddb7d3 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -6135,7 +6135,7 @@ UniValue diceaddfunds(const UniValue& params, bool fHelp) UniValue dicebet(const UniValue& params, bool fHelp) { - UniValue result(UniValue::VOBJ); std::string hex; uint256 fundingtxid; int64_t amount,odds; char *name, *error; + UniValue result(UniValue::VOBJ); std::string hex,error; uint256 fundingtxid; int64_t amount,odds; char *name; if ( fHelp || params.size() != 4 ) throw runtime_error("dicebet name fundingtxid amount odds\n"); if ( ensure_CCrequirements() < 0 ) @@ -6158,7 +6158,6 @@ UniValue dicebet(const UniValue& params, bool fHelp) result.push_back(Pair("result", "success")); result.push_back(Pair("hex", hex)); } else if ( error[0] != 0 ) { - fprintf(stderr, "%s\n",error ); ERR_RESULT(error); } } else {