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

@@ -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')
/// \cond INTERNAL
#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 SATOSHIDEN ((uint64_t)100000000L)

View File

@@ -956,7 +956,7 @@ UniValue TokenInfo(uint256 tokenid)
result.push_back(Pair("error", "cant find tokenid"));
return(result);
}
if ( KOMODO_NSPV_FULLNODE && hashBlock.IsNull()) {
if ( HUSH_NSPV_FULLNODE && hashBlock.IsNull()) {
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "the transaction is still in mempool"));
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;
if ( vintx.vout[utxovout].scriptPubKey.IsPayToCryptoCondition() == 0 )
{
if ( KOMODO_NSPV_FULLNODE )
if ( HUSH_NSPV_FULLNODE )
{
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)
{
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);
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)
{
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);
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;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
NSPV_CCtxids(txids,coinaddr,ccflag,evalcode,filtertxid,func);
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)
{
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));
// 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;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
utxos = (struct CC_utxo *)calloc(CC_MAXVINS,sizeof(*utxos));
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)
{
if ( KOMODO_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height));
if ( HUSH_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height));
return(komodo_heightstamp(height));
} // :P
@@ -451,7 +451,7 @@ extern uint32_t NSPV_logintime;
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];
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
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 i,n; char destaddr[64];
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
return(NSPV_coinaddr_inmempool(logcategory,coinaddr,1));
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;
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
CTransaction tx; uint256 hashBlock;
@@ -668,7 +668,7 @@ uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::ve
extern struct NSPV_inforesp NSPV_inforesult;
int32_t komodo_get_current_height()
{
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
return (NSPV_inforesult.height);
}
@@ -684,7 +684,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
CBlockIndex *pindex;
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 )
{

View File

@@ -641,7 +641,7 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio
/*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));
} */