Better errors from diceinfo

This commit is contained in:
Jonathan "Duke" Leto
2018-08-24 17:46:36 +02:00
parent b918152f30
commit d90c7309e6
2 changed files with 5 additions and 2 deletions

View File

@@ -246,6 +246,8 @@ class CryptoConditionsTest (BitcoinTestFramework):
txid = rpc.sendrawtransaction(result['hex']) txid = rpc.sendrawtransaction(result['hex'])
assert txid, 'got txid' assert txid, 'got txid'
result = rpc.rewardscreatefunding("THIS_IS_NOT_VALID777", "7777", "25", "0", "10", "10")
# confirm the above xtn # confirm the above xtn
rpc.generate(1) rpc.generate(1)
result = rpc.rewardsinfo(txid) result = rpc.rewardsinfo(txid)

View File

@@ -16,6 +16,7 @@
#include "CCdice.h" #include "CCdice.h"
extern std::string CCerror; extern std::string CCerror;
#define ERR_RESULT(x) result.push_back(Pair("result", "error")) , result.push_back(Pair("error", x));
// timeout // timeout
@@ -817,13 +818,13 @@ UniValue DiceInfo(uint256 diceid)
if ( GetTransaction(diceid,vintx,hashBlock,false) == 0 ) if ( GetTransaction(diceid,vintx,hashBlock,false) == 0 )
{ {
fprintf(stderr,"cant find fundingtxid\n"); fprintf(stderr,"cant find fundingtxid\n");
result.push_back(Pair("error","cant find fundingtxid")); ERR_RESULT("error","cant find fundingtxid");
return(result); return(result);
} }
if ( vintx.vout.size() > 0 && DecodeDiceFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,minbet,maxbet,maxodds,timeoutblocks) == 0 ) if ( vintx.vout.size() > 0 && DecodeDiceFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,minbet,maxbet,maxodds,timeoutblocks) == 0 )
{ {
fprintf(stderr,"fundingtxid isnt dice creation txid\n"); fprintf(stderr,"fundingtxid isnt dice creation txid\n");
result.push_back(Pair("error","fundingtxid isnt dice creation txid")); ERR_RESULT("fundingtxid isnt dice creation txid");
return(result); return(result);
} }
result.push_back(Pair("result","success")); result.push_back(Pair("result","success"));