Browse Source

Disallow negative funding in faucetfund

metaverse
Jonathan "Duke" Leto 6 years ago
parent
commit
2098a4c9bb
  1. 1
      qa/rpc-tests/cryptoconditions.py
  2. 4
      src/wallet/rpcwallet.cpp

1
qa/rpc-tests/cryptoconditions.py

@ -81,7 +81,6 @@ class CryptoConditionsTest (BitcoinTestFramework):
result = rpc.faucetfund("1")
assert_equal(result['result'], 'success')
assert_true(result['hex'])
result = rpc.faucetfund("0")
assert_equal(result['result'], 'error')

4
src/wallet/rpcwallet.cpp

@ -5138,7 +5138,7 @@ UniValue faucetinfo(const UniValue& params, bool fHelp)
UniValue faucetfund(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint64_t funds; std::string hex;
UniValue result(UniValue::VOBJ); int64_t funds; std::string hex;
if ( fHelp || params.size() > 1 )
throw runtime_error("faucetfund amount\n");
if ( ensure_CCrequirements() < 0 )
@ -5147,7 +5147,7 @@ UniValue faucetfund(const UniValue& params, bool fHelp)
LOCK2(cs_main, pwalletMain->cs_wallet);
funds = atof(params[0].get_str().c_str()) * COIN;
if (funds > 0) {
hex = FaucetFund(0,funds);
hex = FaucetFund(0,(uint64_t) funds);
if ( hex.size() > 0 )
{
result.push_back(Pair("result", "success"));

Loading…
Cancel
Save