Disallow negative funding in faucetfund
This commit is contained in:
@@ -81,7 +81,6 @@ class CryptoConditionsTest (BitcoinTestFramework):
|
|||||||
|
|
||||||
result = rpc.faucetfund("1")
|
result = rpc.faucetfund("1")
|
||||||
assert_equal(result['result'], 'success')
|
assert_equal(result['result'], 'success')
|
||||||
assert_true(result['hex'])
|
|
||||||
|
|
||||||
result = rpc.faucetfund("0")
|
result = rpc.faucetfund("0")
|
||||||
assert_equal(result['result'], 'error')
|
assert_equal(result['result'], 'error')
|
||||||
|
|||||||
@@ -5138,7 +5138,7 @@ UniValue faucetinfo(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
UniValue faucetfund(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 )
|
if ( fHelp || params.size() > 1 )
|
||||||
throw runtime_error("faucetfund amount\n");
|
throw runtime_error("faucetfund amount\n");
|
||||||
if ( ensure_CCrequirements() < 0 )
|
if ( ensure_CCrequirements() < 0 )
|
||||||
@@ -5147,7 +5147,7 @@ UniValue faucetfund(const UniValue& params, bool fHelp)
|
|||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||||
funds = atof(params[0].get_str().c_str()) * COIN;
|
funds = atof(params[0].get_str().c_str()) * COIN;
|
||||||
if (funds > 0) {
|
if (funds > 0) {
|
||||||
hex = FaucetFund(0,funds);
|
hex = FaucetFund(0,(uint64_t) funds);
|
||||||
if ( hex.size() > 0 )
|
if ( hex.size() > 0 )
|
||||||
{
|
{
|
||||||
result.push_back(Pair("result", "success"));
|
result.push_back(Pair("result", "success"));
|
||||||
|
|||||||
Reference in New Issue
Block a user