Tristate KOMODO_NSPV

This commit is contained in:
jl777
2019-07-30 05:11:57 -11:00
parent 20f1df3472
commit 0454333ff8
15 changed files with 68 additions and 65 deletions

View File

@@ -993,7 +993,7 @@ UniValue nspv_getinfo(const UniValue& params, bool fHelp)
int32_t reqht = 0;
if ( fHelp || params.size() > 1 )
throw runtime_error("nspv_getinfo [hdrheight]\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( params.size() == 1 )
reqht = atoi((char *)params[0].get_str().c_str());
@@ -1004,7 +1004,7 @@ UniValue nspv_logout(const UniValue& params, bool fHelp)
{
if ( fHelp || params.size() != 0 )
throw runtime_error("nspv_logout\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
return(NSPV_logout());
}
@@ -1013,7 +1013,7 @@ UniValue nspv_login(const UniValue& params, bool fHelp)
{
if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_login wif\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
return(NSPV_login((char *)params[0].get_str().c_str()));
}
@@ -1023,7 +1023,7 @@ UniValue nspv_listunspent(const UniValue& params, bool fHelp)
int32_t skipcount = 0,CCflag = 0;
if ( fHelp || params.size() > 3 )
throw runtime_error("nspv_listunspent [address [isCC [skipcount]]]\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( params.size() == 0 )
{
@@ -1048,7 +1048,7 @@ UniValue nspv_mempool(const UniValue& params, bool fHelp)
memset(&txid,0,sizeof(txid));
if ( fHelp || params.size() > 5 )
throw runtime_error("nspv_mempool func(0 all, 1 address recv, 2 txid/vout spent, 3 txid inmempool) address isCC [txid vout]]]\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
funcid = atoi((char *)params[0].get_str().c_str());
coinaddr = (char *)params[1].get_str().c_str();
@@ -1068,7 +1068,7 @@ UniValue nspv_listtransactions(const UniValue& params, bool fHelp)
int32_t skipcount = 0,CCflag = 0;
if ( fHelp || params.size() > 3 )
throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( params.size() == 0 )
{
@@ -1093,7 +1093,7 @@ UniValue nspv_spentinfo(const UniValue& params, bool fHelp)
uint256 txid; int32_t vout;
if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_spentinfo txid vout\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
txid = Parseuint256((char *)params[0].get_str().c_str());
vout = atoi((char *)params[1].get_str().c_str());
@@ -1105,7 +1105,7 @@ UniValue nspv_notarizations(const UniValue& params, bool fHelp)
int32_t height;
if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_notarizations height\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
height = atoi((char *)params[0].get_str().c_str());
return(NSPV_notarizations(height));
@@ -1116,7 +1116,7 @@ UniValue nspv_hdrsproof(const UniValue& params, bool fHelp)
int32_t prevheight,nextheight;
if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_hdrsproof prevheight nextheight\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
prevheight = atoi((char *)params[0].get_str().c_str());
nextheight = atoi((char *)params[1].get_str().c_str());
@@ -1128,7 +1128,7 @@ UniValue nspv_txproof(const UniValue& params, bool fHelp)
uint256 txid; int32_t height;
if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_txproof txid height\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
txid = Parseuint256((char *)params[0].get_str().c_str());
height = atoi((char *)params[1].get_str().c_str());
@@ -1140,7 +1140,7 @@ UniValue nspv_spend(const UniValue& params, bool fHelp)
uint64_t satoshis;
if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_spend address amount\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( NSPV_address.size() == 0 )
throw runtime_error("to nspv_send you need an active nspv_login\n");
@@ -1155,7 +1155,7 @@ UniValue nspv_broadcast(const UniValue& params, bool fHelp)
{
if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_broadcast hex\n");
if ( KOMODO_NSPV == 0 )
if ( KOMODO_NSPV <= 0 )
throw runtime_error("-nSPV=1 must be set to use nspv\n");
return(NSPV_broadcast((char *)params[0].get_str().c_str()));
}

View File

@@ -162,7 +162,7 @@ void OS_randombytes(unsigned char *x,long xlen);
UniValue getnewaddress(const UniValue& params, bool fHelp)
{
if ( KOMODO_NSPV == 0 && !EnsureWalletIsAvailable(fHelp) )
if ( KOMODO_NSPV <= 0 && !EnsureWalletIsAvailable(fHelp) )
return NullUniValue;
if (fHelp || params.size() > 1)
@@ -178,7 +178,7 @@ UniValue getnewaddress(const UniValue& params, bool fHelp)
+ HelpExampleRpc("getnewaddress", "")
);
if ( KOMODO_NSPV != 0 )
if ( KOMODO_NSPV > 0 )
{
UniValue result(UniValue::VOBJ); uint8_t priv32[32];
#ifndef __WIN32
@@ -2974,7 +2974,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
uint64_t komodo_interestsum()
{
#ifdef ENABLE_WALLET
if ( ASSETCHAINS_SYMBOL[0] == 0 && GetBoolArg("-disablewallet", false) == 0 && KOMODO_NSPV == 0 )
if ( ASSETCHAINS_SYMBOL[0] == 0 && GetBoolArg("-disablewallet", false) == 0 && KOMODO_NSPV <= 0 )
{
uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime;
vector<COutput> vecOutputs;
@@ -7002,7 +7002,7 @@ UniValue faucetfund(const UniValue& params, bool fHelp)
if ( fHelp || params.size() > 1 )
throw runtime_error("faucetfund amount\n");
funds = atof(params[0].get_str().c_str()) * COIN + 0.00000000499999;
if ( (0) && KOMODO_NSPV != 0 )
if ( (0) && KOMODO_NSPV > 0 )
{
char coinaddr[64]; struct CCcontract_info *cp,C; CTxOut v;
cp = CCinit(&C,EVAL_FAUCET);