From 2098a4c9bbfd60de2294fcebcd99cfe22f75cfe9 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Thu, 9 Aug 2018 23:37:38 +0200 Subject: [PATCH] Disallow negative funding in faucetfund --- qa/rpc-tests/cryptoconditions.py | 1 - src/wallet/rpcwallet.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/qa/rpc-tests/cryptoconditions.py b/qa/rpc-tests/cryptoconditions.py index 06f965340..97b41fd12 100755 --- a/qa/rpc-tests/cryptoconditions.py +++ b/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') diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 386997b3f..744b95b57 100644 --- a/src/wallet/rpcwallet.cpp +++ b/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"));