Browse Source

Better errors from diceinfo

pull/4/head
Jonathan "Duke" Leto 6 years ago
parent
commit
d90c7309e6
  1. 2
      qa/rpc-tests/cryptoconditions.py
  2. 5
      src/cc/dice.cpp

2
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)

5
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"));

Loading…
Cancel
Save