From d90c7309e6fea460d54ecc4c22cb2f972126cdc7 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 24 Aug 2018 17:46:36 +0200 Subject: [PATCH] Better errors from diceinfo --- qa/rpc-tests/cryptoconditions.py | 2 ++ src/cc/dice.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qa/rpc-tests/cryptoconditions.py b/qa/rpc-tests/cryptoconditions.py index 11f237c71..8baaf6345 100755 --- a/qa/rpc-tests/cryptoconditions.py +++ b/qa/rpc-tests/cryptoconditions.py @@ -246,6 +246,8 @@ class CryptoConditionsTest (BitcoinTestFramework): txid = rpc.sendrawtransaction(result['hex']) assert txid, 'got txid' + result = rpc.rewardscreatefunding("THIS_IS_NOT_VALID777", "7777", "25", "0", "10", "10") + # confirm the above xtn rpc.generate(1) result = rpc.rewardsinfo(txid) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index d5b451255..ced0c5e9c 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -16,6 +16,7 @@ #include "CCdice.h" extern std::string CCerror; +#define ERR_RESULT(x) result.push_back(Pair("result", "error")) , result.push_back(Pair("error", x)); // timeout @@ -817,13 +818,13 @@ UniValue DiceInfo(uint256 diceid) if ( GetTransaction(diceid,vintx,hashBlock,false) == 0 ) { fprintf(stderr,"cant find fundingtxid\n"); - result.push_back(Pair("error","cant find fundingtxid")); + ERR_RESULT("error","cant find fundingtxid"); return(result); } 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"); - result.push_back(Pair("error","fundingtxid isnt dice creation txid")); + ERR_RESULT("fundingtxid isnt dice creation txid"); return(result); } result.push_back(Pair("result","success"));