Improve error checking on funds argument to faucetfund
This commit is contained in:
@@ -151,7 +151,7 @@ class BitcoinTestFramework(object):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# Test framework for doing p2p comparison testing, which sets up some bitcoind
|
||||
# Test framework for doing p2p comparison testing, which sets up some komodod
|
||||
# binaries:
|
||||
# 1 binary: test binary
|
||||
# 2 binaries: 1 test binary, 1 ref binary
|
||||
|
||||
@@ -5146,12 +5146,20 @@ UniValue faucetfund(const UniValue& params, bool fHelp)
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
funds = atof(params[0].get_str().c_str()) * COIN;
|
||||
hex = FaucetFund(0,funds);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
result.push_back(Pair("result", "success"));
|
||||
result.push_back(Pair("hex", hex));
|
||||
} else result.push_back(Pair("error", "couldnt create faucet funding transaction"));
|
||||
if (funds > 0) {
|
||||
hex = FaucetFund(0,funds);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
result.push_back(Pair("result", "success"));
|
||||
result.push_back(Pair("hex", hex));
|
||||
} else {
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "couldnt create faucet funding transaction"));
|
||||
}
|
||||
} else {
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "funding amount must be positive"));
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user