HUSH NSPV

This commit is contained in:
Duke Leto
2020-12-09 19:22:51 -05:00
parent 86bd499818
commit 31fc4099df
24 changed files with 121 additions and 121 deletions

View File

@@ -80,7 +80,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
//fprintf(stderr,"call passport iteration\n"); //fprintf(stderr,"call passport iteration\n");
if ( SMART_CHAIN_SYMBOL[0] == 0 ) if ( SMART_CHAIN_SYMBOL[0] == 0 )
{ {
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
hush_passport_iteration(); hush_passport_iteration();
for (i=0; i<10; i++) for (i=0; i<10; i++)
{ {

View File

@@ -78,7 +78,7 @@ Details.
#define CC_BURNPUBKEY "02deaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead" //!< 'dead' pubkey in hex for burning tokens (if tokens are sent to it, they become 'burned') #define CC_BURNPUBKEY "02deaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead" //!< 'dead' pubkey in hex for burning tokens (if tokens are sent to it, they become 'burned')
/// \cond INTERNAL /// \cond INTERNAL
#define CC_MAXVINS 1024 #define CC_MAXVINS 1024
#define CC_REQUIREMENTS_MSG (KOMODO_NSPV_SUPERLITE?"to use CC contracts you need to nspv_login first\n":"to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n") #define CC_REQUIREMENTS_MSG (HUSH_NSPV_SUPERLITE?"to use CC contracts you need to nspv_login first\n":"to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n")
#define SMALLVAL 0.000000000000001 #define SMALLVAL 0.000000000000001
#define SATOSHIDEN ((uint64_t)100000000L) #define SATOSHIDEN ((uint64_t)100000000L)

View File

@@ -956,7 +956,7 @@ UniValue TokenInfo(uint256 tokenid)
result.push_back(Pair("error", "cant find tokenid")); result.push_back(Pair("error", "cant find tokenid"));
return(result); return(result);
} }
if ( KOMODO_NSPV_FULLNODE && hashBlock.IsNull()) { if ( HUSH_NSPV_FULLNODE && hashBlock.IsNull()) {
result.push_back(Pair("result", "error")); result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "the transaction is still in mempool")); result.push_back(Pair("error", "the transaction is still in mempool"));
return(result); return(result);

View File

@@ -182,7 +182,7 @@ UniValue FinalizeCCTxExt(bool remote, uint64_t CCmask, struct CCcontract_info *c
utxovout = mtx.vin[i].prevout.n; utxovout = mtx.vin[i].prevout.n;
if ( vintx.vout[utxovout].scriptPubKey.IsPayToCryptoCondition() == 0 ) if ( vintx.vout[utxovout].scriptPubKey.IsPayToCryptoCondition() == 0 )
{ {
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
if (!remote) if (!remote)
{ {
@@ -397,7 +397,7 @@ void NSPV_CCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag) void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag)
{ {
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses; int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
NSPV_CCunspents(unspentOutputs,coinaddr,ccflag); NSPV_CCunspents(unspentOutputs,coinaddr,ccflag);
return; return;
@@ -421,7 +421,7 @@ void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValu
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool ccflag) void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool ccflag)
{ {
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses; int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
NSPV_CCtxids(addressIndex,coinaddr,ccflag); NSPV_CCtxids(addressIndex,coinaddr,ccflag);
return; return;
@@ -446,7 +446,7 @@ void SetCCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_t
{ {
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses; int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
NSPV_CCtxids(txids,coinaddr,ccflag,evalcode,filtertxid,func); NSPV_CCtxids(txids,coinaddr,ccflag,evalcode,filtertxid,func);
return; return;
@@ -637,7 +637,7 @@ int32_t CC_vinselect(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *
int64_t AddNormalinputsLocal(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs) int64_t AddNormalinputsLocal(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs)
{ {
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector<COutput> vecOutputs; CTransaction tx; struct CC_utxo *utxos,*up; int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector<COutput> vecOutputs; CTransaction tx; struct CC_utxo *utxos,*up;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U)); return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
// if (mypk != pubkey2pk(Mypubkey())) //remote superlite mypk, do not use wallet since it is not locked for non-equal pks (see rpcs with nspv support)! // if (mypk != pubkey2pk(Mypubkey())) //remote superlite mypk, do not use wallet since it is not locked for non-equal pks (see rpcs with nspv support)!
@@ -746,7 +746,7 @@ int64_t AddNormalinputsRemote(CMutableTransaction &mtx, CPubKey mypk, int64_t to
{ {
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; char coinaddr[64]; uint256 txid,hashBlock; CTransaction tx; struct CC_utxo *utxos,*up; int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; char coinaddr[64]; uint256 txid,hashBlock; CTransaction tx; struct CC_utxo *utxos,*up;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U)); return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
utxos = (struct CC_utxo *)calloc(CC_MAXVINS,sizeof(*utxos)); utxos = (struct CC_utxo *)calloc(CC_MAXVINS,sizeof(*utxos));
if ( maxinputs > CC_MAXVINS ) if ( maxinputs > CC_MAXVINS )

View File

@@ -172,7 +172,7 @@ bool CheckTxFee(const CTransaction &tx, uint64_t txfee, uint32_t height, uint64_
uint32_t GetLatestTimestamp(int32_t height) uint32_t GetLatestTimestamp(int32_t height)
{ {
if ( KOMODO_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height)); if ( HUSH_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height));
return(komodo_heightstamp(height)); return(komodo_heightstamp(height));
} // :P } // :P
@@ -451,7 +451,7 @@ extern uint32_t NSPV_logintime;
bool Myprivkey(uint8_t myprivkey[]) bool Myprivkey(uint8_t myprivkey[])
{ {
char coinaddr[64],checkaddr[64]; std::string strAddress; char *dest; int32_t i,n; CBitcoinAddress address; CKeyID keyID; CKey vchSecret; uint8_t buf33[33]; char coinaddr[64],checkaddr[64]; std::string strAddress; char *dest; int32_t i,n; CBitcoinAddress address; CKeyID keyID; CKey vchSecret; uint8_t buf33[33];
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT ) if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
{ {
@@ -591,7 +591,7 @@ int32_t NSPV_coinaddr_inmempool(char const *logcategory,char *coinaddr,uint8_t C
int32_t myIs_coinaddr_inmempoolvout(char const *logcategory,char *coinaddr) int32_t myIs_coinaddr_inmempoolvout(char const *logcategory,char *coinaddr)
{ {
int32_t i,n; char destaddr[64]; int32_t i,n; char destaddr[64];
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
return(NSPV_coinaddr_inmempool(logcategory,coinaddr,1)); return(NSPV_coinaddr_inmempool(logcategory,coinaddr,1));
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx) BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
{ {
@@ -620,7 +620,7 @@ int32_t myGet_mempool_txs(std::vector<CTransaction> &txs,uint8_t evalcode,uint8_
{ {
int i=0; int i=0;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
CTransaction tx; uint256 hashBlock; CTransaction tx; uint256 hashBlock;
@@ -668,7 +668,7 @@ uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::ve
extern struct NSPV_inforesp NSPV_inforesult; extern struct NSPV_inforesp NSPV_inforesult;
int32_t komodo_get_current_height() int32_t komodo_get_current_height()
{ {
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
return (NSPV_inforesult.height); return (NSPV_inforesult.height);
} }
@@ -684,7 +684,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
CBlockIndex *pindex; CBlockIndex *pindex;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
if ( NSPV_myGetTransaction(txid,tx,hashBlock,txheight,currentheight) == 0 ) if ( NSPV_myGetTransaction(txid,tx,hashBlock,txheight,currentheight) == 0 )
{ {

View File

@@ -641,7 +641,7 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio
/*nt32_t GetLatestTimestamp(int32_t height) /*nt32_t GetLatestTimestamp(int32_t height)
{ {
if ( KOMODO_NSPV_SUPERLITE ) return (NSPV_blocktime(height)); if ( HUSH_NSPV_SUPERLITE ) return (NSPV_blocktime(height));
return(komodo_heightstamp(height)); return(komodo_heightstamp(height));
} */ } */

View File

@@ -18,16 +18,16 @@
******************************************************************************/ ******************************************************************************/
#include "consensus/upgrades.h" #include "consensus/upgrades.h"
extern int32_t KOMODO_NSPV; extern int32_t HUSH_NSPV;
#define NSPV_BRANCHID 0x76b809bb #define NSPV_BRANCHID 0x76b809bb
#ifndef KOMODO_NSPV_FULLNODE #ifndef HUSH_NSPV_FULLNODE
#define KOMODO_NSPV_FULLNODE (KOMODO_NSPV <= 0) #define HUSH_NSPV_FULLNODE (HUSH_NSPV <= 0)
#endif // !KOMODO_NSPV_FULLNODE #endif // !HUSH_NSPV_FULLNODE
#ifndef KOMODO_NSPV_SUPERLITE #ifndef HUSH_NSPV_SUPERLITE
#define KOMODO_NSPV_SUPERLITE (KOMODO_NSPV > 0) #define HUSH_NSPV_SUPERLITE (HUSH_NSPV > 0)
#endif // !KOMODO_NSPV_SUPERLITE #endif // !HUSH_NSPV_SUPERLITE
/** /**
* General information about each network upgrade. * General information about each network upgrade.
@@ -109,7 +109,7 @@ int CurrentEpoch(int nHeight, const Consensus::Params& params) {
uint32_t CurrentEpochBranchId(int nHeight, const Consensus::Params& params) uint32_t CurrentEpochBranchId(int nHeight, const Consensus::Params& params)
{ {
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
return(NSPV_BRANCHID); return(NSPV_BRANCHID);
return NetworkUpgradeInfo[CurrentEpoch(nHeight, params)].nBranchId; return NetworkUpgradeInfo[CurrentEpoch(nHeight, params)].nBranchId;
} }

View File

@@ -68,7 +68,7 @@ extern struct NSPV_inforesp NSPV_inforesult;
int32_t komodo_currentheight() int32_t komodo_currentheight()
{ {
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
return (NSPV_inforesult.height); return (NSPV_inforesult.height);
} }

View File

@@ -502,7 +502,7 @@ extern int32_t KOMODO_BLOCK_POSUNITS, KOMODO_CONSECUTIVE_POS_THRESHOLD, KOMODO_N
extern uint64_t ASSETCHAINS_TIMELOCKGTE; extern uint64_t ASSETCHAINS_TIMELOCKGTE;
extern uint32_t ASSETCHAINS_ALGO,ASSETCHAINS_EQUIHASH,HUSH_INITDONE; extern uint32_t ASSETCHAINS_ALGO,ASSETCHAINS_EQUIHASH,HUSH_INITDONE;
extern int32_t HUSH_MININGTHREADS,HUSH_LONGESTCHAIN,ASSETCHAINS_SEED,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,KOMODO_ON_DEMAND,HUSH_PASSPORT_INITDONE,ASSETCHAINS_STAKED,KOMODO_NSPV; extern int32_t HUSH_MININGTHREADS,HUSH_LONGESTCHAIN,ASSETCHAINS_SEED,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,KOMODO_ON_DEMAND,HUSH_PASSPORT_INITDONE,ASSETCHAINS_STAKED,HUSH_NSPV;
extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET; extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET;
extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2]; extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2];
extern const char *ASSETCHAINS_ALGORITHMS[]; extern const char *ASSETCHAINS_ALGORITHMS[];
@@ -579,11 +579,11 @@ int32_t komodo_blockload(CBlock& block, CBlockIndex *pindex);
uint32_t komodo_chainactive_timestamp(); uint32_t komodo_chainactive_timestamp();
uint32_t GetLatestTimestamp(int32_t height); uint32_t GetLatestTimestamp(int32_t height);
#ifndef KOMODO_NSPV_FULLNODE #ifndef HUSH_NSPV_FULLNODE
#define KOMODO_NSPV_FULLNODE (KOMODO_NSPV <= 0) #define HUSH_NSPV_FULLNODE (HUSH_NSPV <= 0)
#endif // !KOMODO_NSPV_FULLNODE #endif // !HUSH_NSPV_FULLNODE
#ifndef KOMODO_NSPV_SUPERLITE #ifndef HUSH_NSPV_SUPERLITE
#define KOMODO_NSPV_SUPERLITE (KOMODO_NSPV > 0) #define HUSH_NSPV_SUPERLITE (HUSH_NSPV > 0)
#endif // !KOMODO_NSPV_SUPERLITE #endif // !HUSH_NSPV_SUPERLITE
#endif #endif

View File

@@ -47,7 +47,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10; unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
uint256 KOMODO_EARLYTXID; uint256 KOMODO_EARLYTXID;
int32_t HUSH_MININGTHREADS = -1,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,HUSH_PASSPORT_INITDONE,KOMODO_PAX,HUSH_EXCHANGEWALLET,HUSH_REWIND,HUSH_CONNECTING = -1,KOMODO_DEALERNODE,HUSH_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV; int32_t HUSH_MININGTHREADS = -1,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,HUSH_PASSPORT_INITDONE,KOMODO_PAX,HUSH_EXCHANGEWALLET,HUSH_REWIND,HUSH_CONNECTING = -1,KOMODO_DEALERNODE,HUSH_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,HUSH_NSPV;
int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA;

View File

@@ -1770,7 +1770,7 @@ void hush_args(char *argv0)
FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512] = {0}; CTransaction earlytx; uint256 hashBlock; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512] = {0}; CTransaction earlytx; uint256 hashBlock;
IS_HUSH_NOTARY = GetBoolArg("-notary", false); IS_HUSH_NOTARY = GetBoolArg("-notary", false);
KOMODO_NSPV = GetArg("-nSPV",0); HUSH_NSPV = GetArg("-nSPV",0);
memset(ccenables,0,sizeof(ccenables)); memset(ccenables,0,sizeof(ccenables));
memset(disablebits,0,sizeof(disablebits)); memset(disablebits,0,sizeof(disablebits));
memset(ccEnablesHeight,0,sizeof(ccEnablesHeight)); memset(ccEnablesHeight,0,sizeof(ccEnablesHeight));

View File

@@ -1220,7 +1220,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
RegisterAllCoreRPCCommands(tableRPC); RegisterAllCoreRPCCommands(tableRPC);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
bool fDisableWallet = GetBoolArg("-disablewallet", false); bool fDisableWallet = GetBoolArg("-disablewallet", false);
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
fDisableWallet = true; fDisableWallet = true;
nLocalServices = 0; nLocalServices = 0;
@@ -1302,7 +1302,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// Option to startup with mocktime set (used for regression testing): // Option to startup with mocktime set (used for regression testing):
SetMockTime(GetArg("-mocktime", 0)); // SetMockTime(0) is a no-op SetMockTime(GetArg("-mocktime", 0)); // SetMockTime(0) is a no-op
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
if (GetBoolArg("-peerbloomfilters", true)) if (GetBoolArg("-peerbloomfilters", true))
nLocalServices |= NODE_BLOOM; nLocalServices |= NODE_BLOOM;
@@ -1458,7 +1458,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
//fprintf(stderr,"%s tik15\n", __FUNCTION__); //fprintf(stderr,"%s tik15\n", __FUNCTION__);
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
// Initialize Zcash circuit parameters // Initialize Zcash circuit parameters
ZC_LoadParams(chainparams); ZC_LoadParams(chainparams);
@@ -1650,7 +1650,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
} }
#endif #endif
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
std::vector<boost::filesystem::path> vImportFiles; std::vector<boost::filesystem::path> vImportFiles;
threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles)); threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles));
@@ -2117,7 +2117,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
PruneAndFlush(); PruneAndFlush();
} }
} }
if ( KOMODO_NSPV == 0 ) if ( HUSH_NSPV == 0 )
{ {
if ( GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX) != 0 ) if ( GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX) != 0 )
nLocalServices |= NODE_ADDRINDEX; nLocalServices |= NODE_ADDRINDEX;

View File

@@ -23,8 +23,8 @@
// make sure no files are updated (this is to allow nSPV=1 and later nSPV=0 without affecting database) // make sure no files are updated (this is to allow nSPV=1 and later nSPV=0 without affecting database)
// bug: under load, fullnode was returning all 0 nServices // bug: under load, fullnode was returning all 0 nServices
#ifndef KOMODO_NSPV_H #ifndef HUSH_NSPV_H
#define KOMODO_NSPV_H #define HUSH_NSPV_H
int32_t dragon_rwbuf(int32_t rwflag,uint8_t *serialized,int32_t len,uint8_t *buf) int32_t dragon_rwbuf(int32_t rwflag,uint8_t *serialized,int32_t len,uint8_t *buf)
{ {
@@ -599,4 +599,4 @@ int32_t NSPV_notarizationextract(int32_t verifyntz,int32_t *ntzheightp,uint256 *
} }
} else return(-1); } else return(-1);
} }
#endif // KOMODO_NSPV_H #endif // HUSH_NSPV_H

View File

@@ -14,8 +14,8 @@
* * * *
******************************************************************************/ ******************************************************************************/
#ifndef KOMODO_NSPVFULLNODE_H #ifndef HUSH_NSPVFULLNODE_H
#define KOMODO_NSPVFULLNODE_H #define HUSH_NSPVFULLNODE_H
// NSPV_get... functions need to return the exact serialized length, which is the size of the structure minus size of pointers, plus size of allocated data // NSPV_get... functions need to return the exact serialized length, which is the size of the structure minus size of pointers, plus size of allocated data
@@ -1227,4 +1227,4 @@ void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a req
} }
} }
#endif // KOMODO_NSPVFULLNODE_H #endif // HUSH_NSPVFULLNODE_H

View File

@@ -14,8 +14,8 @@
* * * *
******************************************************************************/ ******************************************************************************/
#ifndef KOMODO_NSPVSUPERLITE_H #ifndef HUSH_NSPVSUPERLITE_H
#define KOMODO_NSPVSUPERLITE_H #define HUSH_NSPVSUPERLITE_H
// nSPV client. VERY simplistic "single threaded" networking model. for production GUI best to multithread, etc. // nSPV client. VERY simplistic "single threaded" networking model. for production GUI best to multithread, etc.
// no caching, no optimizations, no reducing the number of ntzsproofs needed by detecting overlaps, etc. // no caching, no optimizations, no reducing the number of ntzsproofs needed by detecting overlaps, etc.
@@ -220,7 +220,7 @@ void komodo_nSPVresp(CNode *pfrom,std::vector<uint8_t> response) // received a r
CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind) CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind)
{ {
int32_t n,flag = 0; CNode *pnodes[64]; uint32_t timestamp = (uint32_t)time(NULL); int32_t n,flag = 0; CNode *pnodes[64]; uint32_t timestamp = (uint32_t)time(NULL);
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
return(0); return(0);
if ( pnode == 0 ) if ( pnode == 0 )
{ {
@@ -249,7 +249,7 @@ CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind)
std::vector<uint8_t> request; std::vector<uint8_t> request;
request.resize(len); request.resize(len);
memcpy(&request[0],msg,len); memcpy(&request[0],msg,len);
if ( (0) && KOMODO_NSPV_SUPERLITE ) if ( (0) && HUSH_NSPV_SUPERLITE )
fprintf(stderr,"pushmessage [%d] len.%d\n",msg[0],len); fprintf(stderr,"pushmessage [%d] len.%d\n",msg[0],len);
pnode->PushMessage("getnSPV",request); pnode->PushMessage("getnSPV",request);
pnode->prevtimes[ind] = timestamp; pnode->prevtimes[ind] = timestamp;
@@ -285,7 +285,7 @@ void komodo_nSPV(CNode *pto) // polling loop from SendMessages
return; return;
if ( pto->prevtimes[NSPV_INFO>>1] > timestamp ) if ( pto->prevtimes[NSPV_INFO>>1] > timestamp )
pto->prevtimes[NSPV_INFO>>1] = 0; pto->prevtimes[NSPV_INFO>>1] = 0;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
if ( timestamp > NSPV_lastinfo + ASSETCHAINS_BLOCKTIME/2 && timestamp > pto->prevtimes[NSPV_INFO>>1] + 2*ASSETCHAINS_BLOCKTIME/3 ) if ( timestamp > NSPV_lastinfo + ASSETCHAINS_BLOCKTIME/2 && timestamp > pto->prevtimes[NSPV_INFO>>1] + 2*ASSETCHAINS_BLOCKTIME/3 )
{ {
@@ -361,7 +361,7 @@ UniValue NSPV_getinfo_json(struct NSPV_inforesp *ptr)
{ {
UniValue result(UniValue::VOBJ); int32_t expiration; uint32_t timestamp = (uint32_t)time(NULL); UniValue result(UniValue::VOBJ); int32_t expiration; uint32_t timestamp = (uint32_t)time(NULL);
result.push_back(Pair("result","success")); result.push_back(Pair("result","success"));
result.push_back(Pair("nSPV",KOMODO_NSPV==-1?"disabled":(KOMODO_NSPV_SUPERLITE?"superlite":"fullnode"))); result.push_back(Pair("nSPV",HUSH_NSPV==-1?"disabled":(HUSH_NSPV_SUPERLITE?"superlite":"fullnode")));
if ( NSPV_address.size() != 0 ) if ( NSPV_address.size() != 0 )
{ {
result.push_back(Pair("address",NSPV_address)); result.push_back(Pair("address",NSPV_address));
@@ -543,7 +543,7 @@ UniValue NSPV_login(char *wifstr)
result.push_back(Pair("address",NSPV_address)); result.push_back(Pair("address",NSPV_address));
result.push_back(Pair("pubkey",HexStr(pubkey))); result.push_back(Pair("pubkey",HexStr(pubkey)));
strcpy(NSPV_pubkeystr,HexStr(pubkey).c_str()); strcpy(NSPV_pubkeystr,HexStr(pubkey).c_str());
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
decode_hex(NOTARY_PUBKEY33,33,NSPV_pubkeystr); decode_hex(NOTARY_PUBKEY33,33,NSPV_pubkeystr);
result.push_back(Pair("wifprefix",(int64_t)data[0])); result.push_back(Pair("wifprefix",(int64_t)data[0]));
result.push_back(Pair("compressed",(int64_t)(data[len-5] == 1))); result.push_back(Pair("compressed",(int64_t)(data[len-5] == 1)));
@@ -978,4 +978,4 @@ UniValue NSPV_ccmoduleutxos(char *coinaddr, int64_t amount, uint8_t evalcode, st
return(result); return(result);
} }
#endif // KOMODO_NSPVSUPERLITE_H #endif // HUSH_NSPVSUPERLITE_H

View File

@@ -14,8 +14,8 @@
* * * *
******************************************************************************/ ******************************************************************************/
#ifndef KOMODO_NSPVWALLET_H #ifndef HUSH_NSPVWALLET_H
#define KOMODO_NSPVWALLET_H #define HUSH_NSPVWALLET_H
// nSPV wallet uses superlite functions (and some komodod built in functions) to implement nSPV_spend // nSPV wallet uses superlite functions (and some komodod built in functions) to implement nSPV_spend
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry); extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
@@ -537,4 +537,4 @@ void NSPV_CCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_
for(int i=0;i<NSPV_mempoolresult.numtxids;i++) txids.push_back(NSPV_mempoolresult.txids[i]); for(int i=0;i<NSPV_mempoolresult.numtxids;i++) txids.push_back(NSPV_mempoolresult.txids[i]);
} }
#endif // KOMODO_NSPVWALLET_H #endif // HUSH_NSPVWALLET_H

View File

@@ -2143,7 +2143,7 @@ bool myAddtomempool(CTransaction &tx, CValidationState *pstate, bool fSkipExpiry
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock) bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
{ {
memset(&hashBlock,0,sizeof(hashBlock)); memset(&hashBlock,0,sizeof(hashBlock));
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
int64_t rewardsum = 0; int32_t i,retval,txheight,currentheight,height=0,vout = 0; int64_t rewardsum = 0; int32_t i,retval,txheight,currentheight,height=0,vout = 0;
for (i=0; i<NSPV_U.U.numutxos; i++) for (i=0; i<NSPV_U.U.numutxos; i++)
@@ -2197,7 +2197,7 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
bool NSPV_myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, int32_t &txheight, int32_t &currentheight) bool NSPV_myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, int32_t &txheight, int32_t &currentheight)
{ {
memset(&hashBlock,0,sizeof(hashBlock)); memset(&hashBlock,0,sizeof(hashBlock));
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
int64_t rewardsum = 0; int32_t i,retval,height=0,vout = 0; int64_t rewardsum = 0; int32_t i,retval,height=0,vout = 0;
for (i=0; i<NSPV_U.U.numutxos; i++) for (i=0; i<NSPV_U.U.numutxos; i++)
@@ -3226,7 +3226,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
{ {
CDiskBlockPos blockPos; CDiskBlockPos blockPos;
const CChainParams& chainparams = Params(); const CChainParams& chainparams = Params();
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
return(true); return(true);
if ( KOMODO_STOPAT != 0 && pindex->GetHeight() > KOMODO_STOPAT ) if ( KOMODO_STOPAT != 0 && pindex->GetHeight() > KOMODO_STOPAT )
return(false); return(false);
@@ -3820,7 +3820,7 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
void FlushStateToDisk() { void FlushStateToDisk() {
CValidationState state; CValidationState state;
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
FlushStateToDisk(state, FLUSH_STATE_ALWAYS); FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
} }
@@ -4065,13 +4065,13 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
mapBlockSource.erase(pindexNew->GetBlockHash()); mapBlockSource.erase(pindexNew->GetBlockHash());
nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2; nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2;
LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001); LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001);
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
assert(view.Flush()); assert(view.Flush());
} }
int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3; int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3;
LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001); LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001);
// Write the chain state to disk, if necessary. // Write the chain state to disk, if necessary.
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED)) if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED))
return false; return false;
@@ -4111,9 +4111,9 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
komodo_broadcast(pblock,8); komodo_broadcast(pblock,8);
else if ( SMART_CHAIN_SYMBOL[0] != 0 ) else if ( SMART_CHAIN_SYMBOL[0] != 0 )
komodo_broadcast(pblock,4);*/ komodo_broadcast(pblock,4);*/
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
//fprintf(stderr,"%s: KOMODO_NSPV_FULLNODE\n", __FUNCTION__); //fprintf(stderr,"%s: HUSH_NSPV_FULLNODE\n", __FUNCTION__);
if ( ASSETCHAINS_CBOPRET != 0 ) if ( ASSETCHAINS_CBOPRET != 0 )
komodo_pricesupdate(pindexNew->GetHeight(),pblock); komodo_pricesupdate(pindexNew->GetHeight(),pblock);
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 ) if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
@@ -6484,7 +6484,7 @@ bool InitBlockIndex() {
if (!ActivateBestChain(true, state, &block)) if (!ActivateBestChain(true, state, &block))
return error("LoadBlockIndex(): genesis block cannot be activated"); return error("LoadBlockIndex(): genesis block cannot be activated");
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data // Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
return FlushStateToDisk(state, FLUSH_STATE_ALWAYS); return FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
else return(true); else return(true);
} catch (const std::runtime_error& e) { } catch (const std::runtime_error& e) {
@@ -7044,7 +7044,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{ {
const CChainParams& chainparams = Params(); const CChainParams& chainparams = Params();
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id); LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
//if ( KOMODO_NSPV_SUPERLITE ) //if ( HUSH_NSPV_SUPERLITE )
//if ( strCommand != "version" && strCommand != "verack" ) //if ( strCommand != "version" && strCommand != "verack" )
// fprintf(stderr, "recv: %s (%u bytes) peer=%d\n", SanitizeString(strCommand).c_str(), (int32_t)vRecv.size(), (int32_t)pfrom->GetId()); // fprintf(stderr, "recv: %s (%u bytes) peer=%d\n", SanitizeString(strCommand).c_str(), (int32_t)vRecv.size(), (int32_t)pfrom->GetId());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
@@ -7216,7 +7216,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{ {
pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
if ( (pfrom->nServices & NODE_NSPV) == 0 ) if ( (pfrom->nServices & NODE_NSPV) == 0 )
{ {
@@ -7416,7 +7416,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
} }
else if (strCommand == "getnSPV") else if (strCommand == "getnSPV")
{ {
if ( KOMODO_NSPV == 0 )//&& HUSH_INSYNC != 0 ) if ( HUSH_NSPV == 0 )//&& HUSH_INSYNC != 0 )
{ {
std::vector<uint8_t> payload; std::vector<uint8_t> payload;
vRecv >> payload; vRecv >> payload;
@@ -7426,7 +7426,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
} }
else if (strCommand == "nSPV") else if (strCommand == "nSPV")
{ {
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
std::vector<uint8_t> payload; std::vector<uint8_t> payload;
vRecv >> payload; vRecv >> payload;
@@ -7434,7 +7434,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
} }
return(true); return(true);
} }
else if ( KOMODO_NSPV_SUPERLITE ) else if ( HUSH_NSPV_SUPERLITE )
return(true); return(true);
else if (strCommand == "inv") else if (strCommand == "inv")
{ {
@@ -8222,7 +8222,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
} }
state.fShouldBan = false; state.fShouldBan = false;
} }
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
komodo_nSPV(pto); komodo_nSPV(pto);
return(true); return(true);
@@ -8412,7 +8412,7 @@ extern "C" const char* getDataDir()
CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight) CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight)
{ {
CMutableTransaction mtx; CMutableTransaction mtx;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
mtx.fOverwintered = true; mtx.fOverwintered = true;
mtx.nExpiryHeight = 0; mtx.nExpiryHeight = 0;

View File

@@ -568,14 +568,14 @@ void CNode::CloseSocketDisconnect()
vRecvMsg.clear(); vRecvMsg.clear();
} }
extern int32_t KOMODO_NSPV; extern int32_t HUSH_NSPV;
#ifndef KOMODO_NSPV_FULLNODE #ifndef HUSH_NSPV_FULLNODE
#define KOMODO_NSPV_FULLNODE (KOMODO_NSPV <= 0) #define HUSH_NSPV_FULLNODE (HUSH_NSPV <= 0)
#endif // !KOMODO_NSPV_FULLNODE #endif // !HUSH_NSPV_FULLNODE
#ifndef KOMODO_NSPV_SUPERLITE #ifndef HUSH_NSPV_SUPERLITE
#define KOMODO_NSPV_SUPERLITE (KOMODO_NSPV > 0) #define HUSH_NSPV_SUPERLITE (HUSH_NSPV > 0)
#endif // !KOMODO_NSPV_SUPERLITE #endif // !HUSH_NSPV_SUPERLITE
void CNode::PushVersion() void CNode::PushVersion()
{ {
@@ -591,7 +591,7 @@ void CNode::PushVersion()
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id); LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe, PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
nLocalHostNonce, strSubVersion, nBestHeight, true); nLocalHostNonce, strSubVersion, nBestHeight, true);
//fprintf(stderr,"KOMODO_NSPV.%d PUSH services.%llx\n",KOMODO_NSPV,(long long)nLocalServices); //fprintf(stderr,"HUSH_NSPV.%d PUSH services.%llx\n",HUSH_NSPV,(long long)nLocalServices);
} }
@@ -2106,7 +2106,7 @@ bool StopNode()
for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++) for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
semOutbound->post(); semOutbound->post();
if (KOMODO_NSPV_FULLNODE && fAddressesInitialized) if (HUSH_NSPV_FULLNODE && fAddressesInitialized)
{ {
DumpAddresses(); DumpAddresses();
fAddressesInitialized = false; fAddressesInitialized = false;

View File

@@ -399,7 +399,7 @@ bool NSPV_inmempool(uint256 txid);
bool myIsutxo_spentinmempool(uint256 &spenttxid,int32_t &spentvini,uint256 txid,int32_t vout) bool myIsutxo_spentinmempool(uint256 &spenttxid,int32_t &spentvini,uint256 txid,int32_t vout)
{ {
int32_t vini = 0; int32_t vini = 0;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
return(NSPV_spentinmempool(spenttxid,spentvini,txid,vout)); return(NSPV_spentinmempool(spenttxid,spentvini,txid,vout));
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx) BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
{ {
@@ -423,7 +423,7 @@ bool myIsutxo_spentinmempool(uint256 &spenttxid,int32_t &spentvini,uint256 txid,
bool mytxid_inmempool(uint256 txid) bool mytxid_inmempool(uint256 txid)
{ {
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
{ {
} }

View File

@@ -230,7 +230,7 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
obj.push_back(Pair("prevMoMheight", prevMoMheight)); obj.push_back(Pair("prevMoMheight", prevMoMheight));
obj.push_back(Pair("notarizedhash", notarized_hash.ToString())); obj.push_back(Pair("notarizedhash", notarized_hash.ToString()));
obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString())); obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString()));
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
txid_height = notarizedtxid_height(SMART_CHAIN_SYMBOL[0] != 0 ? (char *)"HUSH" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&hushnotarized_height); txid_height = notarizedtxid_height(SMART_CHAIN_SYMBOL[0] != 0 ? (char *)"HUSH" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&hushnotarized_height);
if ( txid_height > 0 ) if ( txid_height > 0 )

View File

@@ -316,7 +316,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
const CTxOut& txout = tx.vout[i]; const CTxOut& txout = tx.vout[i];
UniValue out(UniValue::VOBJ); UniValue out(UniValue::VOBJ);
out.push_back(Pair("value", ValueFromAmount(txout.nValue))); out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
if ( KOMODO_NSPV_FULLNODE && SMART_CHAIN_SYMBOL[0] == 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 ) if ( HUSH_NSPV_FULLNODE && SMART_CHAIN_SYMBOL[0] == 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
{ {
int64_t interest; int32_t txheight; uint32_t locktime; int64_t interest; int32_t txheight; uint32_t locktime;
interest = komodo_accrued_interest(&txheight,&locktime,tx.GetHash(),i,0,txout.nValue,(int32_t)tipindex->GetHeight()); interest = komodo_accrued_interest(&txheight,&locktime,tx.GetHash(),i,0,txout.nValue,(int32_t)tipindex->GetHeight());
@@ -1251,7 +1251,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& m
bool fOverrideFees = false; bool fOverrideFees = false;
if (params.size() > 1) if (params.size() > 1)
fOverrideFees = params[1].get_bool(); fOverrideFees = params[1].get_bool();
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
CCoinsViewCache &view = *pcoinsTip; CCoinsViewCache &view = *pcoinsTip;
const CCoins* existingCoins = view.AccessCoins(hashTx); const CCoins* existingCoins = view.AccessCoins(hashTx);

View File

@@ -36,13 +36,13 @@ using namespace std;
typedef vector<unsigned char> valtype; typedef vector<unsigned char> valtype;
extern uint8_t ASSETCHAINS_TXPOW; extern uint8_t ASSETCHAINS_TXPOW;
extern char NSPV_wifstr[],NSPV_pubkeystr[]; extern char NSPV_wifstr[],NSPV_pubkeystr[];
extern int32_t KOMODO_NSPV; extern int32_t HUSH_NSPV;
#ifndef KOMODO_NSPV_FULLNODE #ifndef HUSH_NSPV_FULLNODE
#define KOMODO_NSPV_FULLNODE (KOMODO_NSPV <= 0) #define HUSH_NSPV_FULLNODE (HUSH_NSPV <= 0)
#endif // !KOMODO_NSPV_FULLNODE #endif // !HUSH_NSPV_FULLNODE
#ifndef KOMODO_NSPV_SUPERLITE #ifndef HUSH_NSPV_SUPERLITE
#define KOMODO_NSPV_SUPERLITE (KOMODO_NSPV > 0) #define HUSH_NSPV_SUPERLITE (HUSH_NSPV > 0)
#endif // !KOMODO_NSPV_SUPERLITE #endif // !HUSH_NSPV_SUPERLITE
uint256 SIG_TXHASH; uint256 SIG_TXHASH;
@@ -60,7 +60,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
} }
} }
SIG_TXHASH = hash; SIG_TXHASH = hash;
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
key = DecodeSecret(NSPV_wifstr); key = DecodeSecret(NSPV_wifstr);
else if (pprivKey) else if (pprivKey)
key = *pprivKey; key = *pprivKey;
@@ -81,7 +81,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
return false; return false;
} }
vchSig = CCSigVec(cc); vchSig = CCSigVec(cc);
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
memset((uint8_t *)key.begin(),0,32); memset((uint8_t *)key.begin(),0,32);
return true; return true;
} }
@@ -107,7 +107,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
} }
vchSig.push_back((unsigned char)nHashType); vchSig.push_back((unsigned char)nHashType);
if ( KOMODO_NSPV_SUPERLITE ) if ( HUSH_NSPV_SUPERLITE )
memset((uint8_t *)key.begin(),0,32); memset((uint8_t *)key.begin(),0,32);
return true; return true;
} }
@@ -388,7 +388,7 @@ static bool SignStep(const BaseSignatureCreator& creator, const CScript& scriptP
} }
else else
{ {
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
{ {
CPubKey vch; CPubKey vch;
creator.KeyStore().GetPubKey(keyID, vch); creator.KeyStore().GetPubKey(keyID, vch);

View File

@@ -1001,13 +1001,13 @@ UniValue z_exportviewingkey(const UniValue& params, bool fHelp, const CPubKey& m
return EncodeViewingKey(ivk); return EncodeViewingKey(ivk);
} }
extern int32_t KOMODO_NSPV; extern int32_t HUSH_NSPV;
#ifndef KOMODO_NSPV_FULLNODE #ifndef HUSH_NSPV_FULLNODE
#define KOMODO_NSPV_FULLNODE (KOMODO_NSPV <= 0) #define HUSH_NSPV_FULLNODE (HUSH_NSPV <= 0)
#endif // !KOMODO_NSPV_FULLNODE #endif // !HUSH_NSPV_FULLNODE
#ifndef KOMODO_NSPV_SUPERLITE #ifndef HUSH_NSPV_SUPERLITE
#define KOMODO_NSPV_SUPERLITE (KOMODO_NSPV > 0) #define HUSH_NSPV_SUPERLITE (HUSH_NSPV > 0)
#endif // !KOMODO_NSPV_SUPERLITE #endif // !HUSH_NSPV_SUPERLITE
uint256 zeroid; uint256 zeroid;
UniValue NSPV_getinfo_req(int32_t reqht); UniValue NSPV_getinfo_req(int32_t reqht);
UniValue NSPV_login(char *wifstr); UniValue NSPV_login(char *wifstr);
@@ -1031,7 +1031,7 @@ UniValue nspv_getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
int32_t reqht = 0; int32_t reqht = 0;
if ( fHelp || params.size() > 1 ) if ( fHelp || params.size() > 1 )
throw runtime_error("nspv_getinfo [hdrheight]\n"); throw runtime_error("nspv_getinfo [hdrheight]\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( params.size() == 1 ) if ( params.size() == 1 )
reqht = atoi((char *)params[0].get_str().c_str()); reqht = atoi((char *)params[0].get_str().c_str());
@@ -1042,7 +1042,7 @@ UniValue nspv_logout(const UniValue& params, bool fHelp, const CPubKey& mypk)
{ {
if ( fHelp || params.size() != 0 ) if ( fHelp || params.size() != 0 )
throw runtime_error("nspv_logout\n"); throw runtime_error("nspv_logout\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
return(NSPV_logout()); return(NSPV_logout());
} }
@@ -1051,7 +1051,7 @@ UniValue nspv_login(const UniValue& params, bool fHelp, const CPubKey& mypk)
{ {
if ( fHelp || params.size() != 1 ) if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_login wif\n"); throw runtime_error("nspv_login wif\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
return(NSPV_login((char *)params[0].get_str().c_str())); return(NSPV_login((char *)params[0].get_str().c_str()));
} }
@@ -1061,7 +1061,7 @@ UniValue nspv_listunspent(const UniValue& params, bool fHelp, const CPubKey& myp
int32_t skipcount = 0,CCflag = 0; int32_t skipcount = 0,CCflag = 0;
if ( fHelp || params.size() > 3 ) if ( fHelp || params.size() > 3 )
throw runtime_error("nspv_listunspent [address [isCC [skipcount]]]\n"); throw runtime_error("nspv_listunspent [address [isCC [skipcount]]]\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( params.size() == 0 ) if ( params.size() == 0 )
{ {
@@ -1086,7 +1086,7 @@ UniValue nspv_mempool(const UniValue& params, bool fHelp, const CPubKey& mypk)
memset(&txid,0,sizeof(txid)); memset(&txid,0,sizeof(txid));
if ( fHelp || params.size() > 5 ) 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"); 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_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
funcid = atoi((char *)params[0].get_str().c_str()); funcid = atoi((char *)params[0].get_str().c_str());
coinaddr = (char *)params[1].get_str().c_str(); coinaddr = (char *)params[1].get_str().c_str();
@@ -1106,7 +1106,7 @@ UniValue nspv_listtransactions(const UniValue& params, bool fHelp, const CPubKey
int32_t skipcount = 0,CCflag = 0; int32_t skipcount = 0,CCflag = 0;
if ( fHelp || params.size() > 3 ) if ( fHelp || params.size() > 3 )
throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n"); throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( params.size() == 0 ) if ( params.size() == 0 )
{ {
@@ -1131,7 +1131,7 @@ UniValue nspv_spentinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
uint256 txid; int32_t vout; uint256 txid; int32_t vout;
if ( fHelp || params.size() != 2 ) if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_spentinfo txid vout\n"); throw runtime_error("nspv_spentinfo txid vout\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
txid = Parseuint256((char *)params[0].get_str().c_str()); txid = Parseuint256((char *)params[0].get_str().c_str());
vout = atoi((char *)params[1].get_str().c_str()); vout = atoi((char *)params[1].get_str().c_str());
@@ -1143,7 +1143,7 @@ UniValue nspv_notarizations(const UniValue& params, bool fHelp, const CPubKey& m
int32_t height; int32_t height;
if ( fHelp || params.size() != 1 ) if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_notarizations height\n"); throw runtime_error("nspv_notarizations height\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
height = atoi((char *)params[0].get_str().c_str()); height = atoi((char *)params[0].get_str().c_str());
return(NSPV_notarizations(height)); return(NSPV_notarizations(height));
@@ -1154,7 +1154,7 @@ UniValue nspv_hdrsproof(const UniValue& params, bool fHelp, const CPubKey& mypk)
int32_t prevheight,nextheight; int32_t prevheight,nextheight;
if ( fHelp || params.size() != 2 ) if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_hdrsproof prevheight nextheight\n"); throw runtime_error("nspv_hdrsproof prevheight nextheight\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
prevheight = atoi((char *)params[0].get_str().c_str()); prevheight = atoi((char *)params[0].get_str().c_str());
nextheight = atoi((char *)params[1].get_str().c_str()); nextheight = atoi((char *)params[1].get_str().c_str());
@@ -1166,7 +1166,7 @@ UniValue nspv_txproof(const UniValue& params, bool fHelp, const CPubKey& mypk)
uint256 txid; int32_t height; uint256 txid; int32_t height;
if ( fHelp || params.size() != 2 ) if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_txproof txid height\n"); throw runtime_error("nspv_txproof txid height\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
txid = Parseuint256((char *)params[0].get_str().c_str()); txid = Parseuint256((char *)params[0].get_str().c_str());
height = atoi((char *)params[1].get_str().c_str()); height = atoi((char *)params[1].get_str().c_str());
@@ -1178,7 +1178,7 @@ UniValue nspv_spend(const UniValue& params, bool fHelp, const CPubKey& mypk)
uint64_t satoshis; uint64_t satoshis;
if ( fHelp || params.size() != 2 ) if ( fHelp || params.size() != 2 )
throw runtime_error("nspv_spend address amount\n"); throw runtime_error("nspv_spend address amount\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
if ( NSPV_address.size() == 0 ) if ( NSPV_address.size() == 0 )
throw runtime_error("to nspv_send you need an active nspv_login\n"); throw runtime_error("to nspv_send you need an active nspv_login\n");
@@ -1193,7 +1193,7 @@ UniValue nspv_broadcast(const UniValue& params, bool fHelp, const CPubKey& mypk)
{ {
if ( fHelp || params.size() != 1 ) if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_broadcast hex\n"); throw runtime_error("nspv_broadcast hex\n");
if ( KOMODO_NSPV_FULLNODE ) if ( HUSH_NSPV_FULLNODE )
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
return(NSPV_broadcast((char *)params[0].get_str().c_str())); return(NSPV_broadcast((char *)params[0].get_str().c_str()));
} }
@@ -1207,7 +1207,7 @@ UniValue nspv_listccmoduleunspent(const UniValue& params, bool fHelp, const CPub
"if amount is 0 just returns no utxos and available total.\n" "if amount is 0 just returns no utxos and available total.\n"
"funcids is a string of funcid symbols. The first symbol is considered as the creation funcid, so the txid param will be compared to the creation tx id.\n" "funcids is a string of funcid symbols. The first symbol is considered as the creation funcid, so the txid param will be compared to the creation tx id.\n"
"For the second+ funcids the txid param will be compared to txid in opreturn\n\n" ); "For the second+ funcids the txid param will be compared to txid in opreturn\n\n" );
if (KOMODO_NSPV_FULLNODE) if (HUSH_NSPV_FULLNODE)
throw runtime_error("-nSPV=1 must be set to use nspv\n"); throw runtime_error("-nSPV=1 must be set to use nspv\n");
std::string address = params[0].get_str().c_str(); std::string address = params[0].get_str().c_str();

View File

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