Improve error checking on funds argument to faucetfund
This commit is contained in:
@@ -151,7 +151,7 @@ class BitcoinTestFramework(object):
|
|||||||
sys.exit(1)
|
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:
|
# binaries:
|
||||||
# 1 binary: test binary
|
# 1 binary: test binary
|
||||||
# 2 binaries: 1 test binary, 1 ref binary
|
# 2 binaries: 1 test binary, 1 ref binary
|
||||||
|
|||||||
@@ -5146,12 +5146,20 @@ UniValue faucetfund(const UniValue& params, bool fHelp)
|
|||||||
const CKeyStore& keystore = *pwalletMain;
|
const CKeyStore& keystore = *pwalletMain;
|
||||||
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;
|
||||||
hex = FaucetFund(0,funds);
|
if (funds > 0) {
|
||||||
if ( hex.size() > 0 )
|
hex = FaucetFund(0,funds);
|
||||||
{
|
if ( hex.size() > 0 )
|
||||||
result.push_back(Pair("result", "success"));
|
{
|
||||||
result.push_back(Pair("hex", hex));
|
result.push_back(Pair("result", "success"));
|
||||||
} else result.push_back(Pair("error", "couldnt create faucet funding transaction"));
|
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);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user