Browse Source

Fix bug in FaucetGet where it returns an int instead of a string

pull/4/head
Jonathan "Duke" Leto 6 years ago
parent
commit
9b30af9799
  1. 9
      qa/rpc-tests/cryptoconditions.py
  2. 2
      src/cc/faucet.cpp
  3. 5
      src/wallet/rpcwallet.cpp

9
qa/rpc-tests/cryptoconditions.py

@ -68,7 +68,7 @@ class CryptoConditionsTest (BitcoinTestFramework):
assert_greater_than(result['balance'], 0.0)
balance = result['balance']
# Begin actual CC tests
###### Begin actual CC tests ######
# Faucet tests
faucet = rpc.faucetaddress()
@ -77,6 +77,10 @@ class CryptoConditionsTest (BitcoinTestFramework):
for x in ['myCCaddress', 'FaucetCCaddress', 'Faucetmarker', 'myaddress']:
assert_equal(faucet[x][0], 'R')
# no funds in the faucet yet
result = rpc.faucetget()
assert_equal(result['result'], 'error')
result = rpc.faucetinfo()
assert_equal(result['result'], 'success')
@ -86,9 +90,6 @@ class CryptoConditionsTest (BitcoinTestFramework):
result = rpc.faucetfund("-1")
assert_equal(result['result'], 'error')
# why does this fail?
#result = rpc.faucetfund("1987")
# we need at least 1 + txfee to get
result = rpc.faucetfund("2")
assert_equal(result['result'], 'success')

2
src/cc/faucet.cpp

@ -169,7 +169,7 @@ std::string FaucetGet(uint64_t txfee)
mtx.vout.push_back(CTxOut(nValue,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(-1LL,cp,mtx,mypk,txfee,opret));
} else fprintf(stderr,"cant find faucet inputs\n");
return(0);
return("");
}
std::string FaucetFund(uint64_t txfee,int64_t funds)

5
src/wallet/rpcwallet.cpp

@ -5179,7 +5179,10 @@ UniValue faucetget(const UniValue& params, bool fHelp)
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", hex));
} else result.push_back(Pair("error", "couldnt create faucet get transaction"));
} else {
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "couldnt create faucet get transaction"));
}
return(result);
}

Loading…
Cancel
Save