Hush is the extreme future, Komodo is the KYC past
This commit is contained in:
@@ -27,10 +27,6 @@ define $(package)_build_cmds
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$($(package)_install) -D ./make/gmock-all.o $($(package)_staging_dir)$(host_prefix)/lib/libgmock.a && \
|
||||
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
|
||||
|
||||
@@ -49,4 +49,3 @@ endef
|
||||
#define $(package)_postprocess_cmds
|
||||
# rm -rf bin share
|
||||
#endef
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ extern uint64_t ASSETCHAINS_CBOPRET;
|
||||
void hush_passport_iteration();
|
||||
int32_t hush_longestchain();
|
||||
void komodo_cbopretupdate(int32_t forceflag);
|
||||
CBlockIndex *komodo_chainactive(int32_t height);
|
||||
CBlockIndex *hush_chainactive(int32_t height);
|
||||
|
||||
void WaitForShutdown(boost::thread_group* threadGroup)
|
||||
{
|
||||
|
||||
@@ -257,9 +257,9 @@ void CCclearvars(struct CCcontract_info *cp);
|
||||
UniValue CClib(struct CCcontract_info *cp,char *method,char *jsonstr);
|
||||
UniValue CClib_info(struct CCcontract_info *cp);
|
||||
|
||||
//CBlockIndex *komodo_blockindex(uint256 hash); //moved to komodo_def.h
|
||||
//CBlockIndex *komodo_chainactive(int32_t height); //moved to komodo_def.h
|
||||
//int32_t komodo_blockheight(uint256 hash); //moved to komodo_def.h
|
||||
//CBlockIndex *hush_blockindex(uint256 hash); //moved to komodo_def.h
|
||||
//CBlockIndex *hush_chainactive(int32_t height); //moved to komodo_def.h
|
||||
//int32_t hush_blockheight(uint256 hash); //moved to komodo_def.h
|
||||
//void StartShutdown();
|
||||
|
||||
static const uint256 zeroid; //!< null uint256 constant
|
||||
|
||||
@@ -715,7 +715,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
|
||||
fprintf(stderr,"komodo_txnotarizedconfirmed no hashBlock for txid %s\n",txid.ToString().c_str());
|
||||
return(0);
|
||||
}
|
||||
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 || (txheight= pindex->GetHeight()) <= 0 )
|
||||
else if ( (pindex= hush_blockindex(hashBlock)) == 0 || (txheight= pindex->GetHeight()) <= 0 )
|
||||
{
|
||||
fprintf(stderr,"komodo_txnotarizedconfirmed no txheight.%d %p for txid %s\n",txheight,pindex,txid.ToString().c_str());
|
||||
return(0);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -67,7 +69,7 @@ void prices_bardisp(struct prices_bar *bar)
|
||||
int64_t prices_blockinfo(int32_t height,char *acaddr)
|
||||
{
|
||||
std::vector<uint8_t> vopret; CBlockIndex *pindex; CBlock block; CTransaction tx,vintx; uint64_t pricebits; char destaddr[64]; uint32_t aveprice=0,timestamp,uprice; uint256 hashBlock; int64_t dist,mindist=(1LL<<60),prizefund = 0; int32_t mini=-1,i,n,vini,numvouts,iter; struct prices_bar refbar;
|
||||
if ( (pindex= komodo_chainactive(height)) != 0 )
|
||||
if ( (pindex= hush_chainactive(height)) != 0 )
|
||||
{
|
||||
if ( komodo_blockload(block,pindex) == 0 )
|
||||
{
|
||||
|
||||
@@ -601,7 +601,7 @@ int32_t games_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa
|
||||
if ( (txid == zeroid || myGetTransaction(txid,tx,hashBlock) != 0) && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
if ( txid != zeroid )
|
||||
gameheight = komodo_blockheight(hashBlock);
|
||||
gameheight = hush_blockheight(hashBlock);
|
||||
else
|
||||
{
|
||||
txid = tx.GetHash();
|
||||
@@ -674,7 +674,7 @@ int32_t games_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
|
||||
{
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
{
|
||||
if ( pindex->GetHeight() <= gameht+GAMES_MAXKEYSTROKESGAP )
|
||||
alive++;
|
||||
@@ -857,7 +857,7 @@ int64_t games_buyins(uint256 gametxid,int32_t maxplayers)
|
||||
uint64_t games_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256 gametxid,char *mygamesaddr)
|
||||
{
|
||||
CBlockIndex *pindex; int32_t ht,openslots,delay,numplayers; uint256 hashBlock; uint64_t seed=0; char cmd[512]; CTransaction tx;
|
||||
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
{
|
||||
ht = pindex->GetHeight();
|
||||
delay = GAMES_REGISTRATION * (maxplayers > 1);
|
||||
@@ -865,7 +865,7 @@ uint64_t games_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256
|
||||
obj.push_back(Pair("start",ht+delay));
|
||||
if ( hush_nextheight() > ht+delay )
|
||||
{
|
||||
if ( (pindex= komodo_chainactive(ht+delay)) != 0 )
|
||||
if ( (pindex= hush_chainactive(ht+delay)) != 0 )
|
||||
{
|
||||
hashBlock = pindex->GetBlockHash();
|
||||
obj.push_back(Pair("starthash",hashBlock.ToString()));
|
||||
@@ -1066,7 +1066,7 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
|
||||
{
|
||||
if ( hashBlock == zeroid )
|
||||
batonht = hush_nextheight();
|
||||
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 )
|
||||
else if ( (pindex= hush_blockindex(hashBlock)) == 0 )
|
||||
return(-4);
|
||||
else batonht = pindex->GetHeight();
|
||||
batonvalue = batontx.vout[0].nValue;
|
||||
|
||||
@@ -903,7 +903,7 @@ UniValue OracleFund(const CPubKey& pk, int64_t txfee,uint256 oracletxid)
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()); CTransaction tx;
|
||||
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C; std::string name,desc,format; int32_t numvouts; uint256 hashBlock;
|
||||
|
||||
if (GetLatestTimestamp(komodo_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
|
||||
if (GetLatestTimestamp(hush_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
|
||||
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "oraclesfund not active yet, activation scheduled for July 15th");
|
||||
if (myGetTransaction(oracletxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
|
||||
@@ -942,7 +942,7 @@ UniValue OracleRegister(const CPubKey& pk, int64_t txfee,uint256 oracletxid,int6
|
||||
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
|
||||
if (AddNormalinputs(mtx,mypk,3*txfee,4,pk.IsValid()))
|
||||
{
|
||||
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
|
||||
if (GetLatestTimestamp(hush_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
|
||||
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
|
||||
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
|
||||
|
||||
@@ -268,7 +268,7 @@ bool payments_game(int32_t &top, int32_t &bottom)
|
||||
bool payments_lockedblocks(uint256 blockhash,int32_t lockedblocks,int32_t &blocksleft)
|
||||
{
|
||||
int32_t ht = chainActive.Height();
|
||||
CBlockIndex* pblockindex = komodo_blockindex(blockhash);
|
||||
CBlockIndex* pblockindex = hush_blockindex(blockhash);
|
||||
if ( pblockindex == 0 || pblockindex->GetHeight()+lockedblocks > ht)
|
||||
{
|
||||
blocksleft = pblockindex->GetHeight()+lockedblocks - ht;
|
||||
|
||||
@@ -104,7 +104,7 @@ extern uint64_t ASSETCHAINS_PEGSCCPARAMS[3];
|
||||
|
||||
extern uint8_t DecodeGatewaysBindOpRet(char *depositaddr,const CScript &scriptPubKey,uint256 &tokenid,std::string &coin,int64_t &totalsupply,uint256 &oracletxid,uint8_t &M,uint8_t &N,std::vector<CPubKey> &gatewaypubkeys,uint8_t &taddr,uint8_t &prefix,uint8_t &prefix2,uint8_t &wiftype);
|
||||
extern int64_t GetTokenBalance(CPubKey pk, uint256 tokenid);
|
||||
extern int32_t komodo_currentheight();
|
||||
extern int32_t hush_currentheight();
|
||||
extern int32_t prices_syntheticvec(std::vector<uint16_t> &vec, std::vector<std::string> synthetic);
|
||||
extern int64_t prices_syntheticprice(std::vector<uint16_t> vec, int32_t height, int32_t minmax, int16_t leverage);
|
||||
|
||||
@@ -529,7 +529,7 @@ int64_t PegsGetTokenPrice(uint256 tokenid)
|
||||
{
|
||||
std::vector<std::string> vexpr;
|
||||
SplitStr(desc, vexpr);
|
||||
if (prices_syntheticvec(exp, vexpr)>=0 && (price = prices_syntheticprice(exp, komodo_currentheight(), 0, 1))>=0)
|
||||
if (prices_syntheticvec(exp, vexpr)>=0 && (price = prices_syntheticprice(exp, hush_currentheight(), 0, 1))>=0)
|
||||
return (price);
|
||||
}
|
||||
return (0);
|
||||
|
||||
@@ -712,7 +712,7 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2
|
||||
}
|
||||
if ( amount > txfee )
|
||||
{
|
||||
reward = RewardsCalc((int64_t)amount,mtx.vin[0].prevout.hash,(int64_t)APR,(int64_t)minseconds,(int64_t)maxseconds,komodo_chainactive_timestamp());
|
||||
reward = RewardsCalc((int64_t)amount,mtx.vin[0].prevout.hash,(int64_t)APR,(int64_t)minseconds,(int64_t)maxseconds,hush_chainactive_timestamp());
|
||||
if ( scriptPubKey.size() > 0 )
|
||||
{
|
||||
if ( reward > txfee )
|
||||
|
||||
@@ -311,7 +311,7 @@ int32_t rogue_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa
|
||||
if ( (txid == zeroid || myGetTransaction(txid,tx,hashBlock) != 0) && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
if ( txid != zeroid )
|
||||
gameheight = komodo_blockheight(hashBlock);
|
||||
gameheight = hush_blockheight(hashBlock);
|
||||
else
|
||||
{
|
||||
txid = tx.GetHash();
|
||||
@@ -613,7 +613,7 @@ int32_t rogue_findbaton(struct CCcontract_info *cp,uint256 &playertxid,char **ke
|
||||
{
|
||||
if ( hashBlock == zeroid )
|
||||
batonht = hush_nextheight();
|
||||
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 )
|
||||
else if ( (pindex= hush_blockindex(hashBlock)) == 0 )
|
||||
return(-4);
|
||||
else batonht = pindex->GetHeight();
|
||||
batonvalue = batontx.vout[0].nValue;
|
||||
@@ -668,7 +668,7 @@ int32_t rogue_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
|
||||
{
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
{
|
||||
if ( pindex->GetHeight() <= gameht+ROGUE_MAXKEYSTROKESGAP )
|
||||
alive++;
|
||||
@@ -687,7 +687,7 @@ int32_t rogue_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
|
||||
uint64_t rogue_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256 gametxid,char *myrogueaddr)
|
||||
{
|
||||
CBlockIndex *pindex; int32_t ht,openslots,delay,numplayers; uint256 hashBlock; uint64_t seed=0; char cmd[512]; CTransaction tx;
|
||||
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
{
|
||||
ht = pindex->GetHeight();
|
||||
delay = ROGUE_REGISTRATION * (maxplayers > 1);
|
||||
@@ -695,7 +695,7 @@ uint64_t rogue_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256
|
||||
obj.push_back(Pair("start",ht+delay));
|
||||
if ( hush_nextheight() > ht+delay )
|
||||
{
|
||||
if ( (pindex= komodo_chainactive(ht+delay)) != 0 )
|
||||
if ( (pindex= hush_chainactive(ht+delay)) != 0 )
|
||||
{
|
||||
hashBlock = pindex->GetBlockHash();
|
||||
obj.push_back(Pair("starthash",hashBlock.ToString()));
|
||||
|
||||
@@ -2738,7 +2738,7 @@ UniValue sudoku_txidinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
||||
if ( sudoku_genopreturndecode(unsolved,tx.vout[numvouts-1].scriptPubKey) == 'G' )
|
||||
{
|
||||
result.push_back(Pair("result","success"));
|
||||
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
result.push_back(Pair("height",pindex->GetHeight()));
|
||||
Getscriptaddress(CCaddr,tx.vout[1].scriptPubKey);
|
||||
result.push_back(Pair("sudokuaddr",CCaddr));
|
||||
@@ -2790,7 +2790,7 @@ UniValue sudoku_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
if ( sudoku_genopreturndecode(unsolved,tx.vout[numvouts-1].scriptPubKey) == 'G' )
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
obj.push_back(Pair("height",pindex->GetHeight()));
|
||||
obj.push_back(Pair("amount",ValueFromAmount(tx.vout[1].nValue)));
|
||||
obj.push_back(Pair("txid",txid.GetHex()));
|
||||
|
||||
14
src/hush.h
14
src/hush.h
@@ -44,15 +44,15 @@ bool check_pprevnotarizedht();
|
||||
#include "hush_structs.h"
|
||||
#include "hush_globals.h"
|
||||
#include "hush_utils.h"
|
||||
#include "komodo_curve25519.h"
|
||||
#include "hush_curve25519.h"
|
||||
#include "komodo_cJSON.c"
|
||||
#include "hush_bitcoind.h"
|
||||
#include "komodo_pax.h"
|
||||
#include "hush_notary.h"
|
||||
|
||||
int32_t komodo_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *dest);
|
||||
int32_t hush_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *dest);
|
||||
#include "komodo_kv.h"
|
||||
#include "komodo_gateway.h"
|
||||
#include "hush_gateway.h"
|
||||
#include "komodo_events.h"
|
||||
#include "komodo_ccdata.h"
|
||||
|
||||
@@ -64,7 +64,7 @@ void hush_currentheight_set(int32_t height)
|
||||
}
|
||||
|
||||
extern struct NSPV_inforesp NSPV_inforesult;
|
||||
int32_t komodo_currentheight()
|
||||
int32_t hush_currentheight()
|
||||
{
|
||||
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp;
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
@@ -76,7 +76,7 @@ int32_t komodo_currentheight()
|
||||
else return(0);
|
||||
}
|
||||
|
||||
int32_t komodo_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *dest)
|
||||
int32_t hush_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *dest)
|
||||
{
|
||||
static int32_t errs;
|
||||
int32_t func,ht,notarized_height,num,matched=0,MoMdepth; uint256 MoM,notarized_hash,notarized_desttxid; uint8_t pubkeys[64][33];
|
||||
@@ -222,7 +222,7 @@ int32_t memread(void *dest,int32_t size,uint8_t *filedata,long *fposp,long datal
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int32_t komodo_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fposp,long datalen,char *symbol,char *dest)
|
||||
int32_t hush_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fposp,long datalen,char *symbol,char *dest)
|
||||
{
|
||||
static int32_t errs;
|
||||
int32_t func= -1,ht,notarized_height,MoMdepth,num,matched=0; uint256 MoM,notarized_hash,notarized_desttxid; uint8_t pubkeys[64][33]; long fpos = *fposp;
|
||||
@@ -380,7 +380,7 @@ void hush_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotarie
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"hush_faststateinit retval.%d\n",retval);
|
||||
while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 )
|
||||
while ( hush_parsestatefile(sp,fp,symbol,dest) >= 0 )
|
||||
;
|
||||
}
|
||||
} else fp = fopen(fname,"wb+");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017 The Zen Core developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Copyright (c) 2017 The Zen Core developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace hush {
|
||||
#define CERT_VALIDITY_DAYS (365 * 10) // period of validity, in days, for a self-signed certificate
|
||||
|
||||
WOLFSSL_EVP_PKEY* GenerateEcKey(int nid = NID_X9_62_prime256v1);
|
||||
|
||||
WOLFSSL_X509* GenerateCertificate(WOLFSSL_EVP_PKEY *keypair);
|
||||
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@ char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,
|
||||
int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width);
|
||||
int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[DRAGON_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
|
||||
|
||||
uint32_t komodo_blocktime(uint256 hash);
|
||||
uint32_t hush_blocktime(uint256 hash);
|
||||
int32_t hush_longestchain();
|
||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int8_t komodo_segid(int32_t nocache,int32_t height);
|
||||
@@ -562,7 +562,7 @@ int32_t hush_nextheight();
|
||||
uint32_t komodo_heightstamp(int32_t height);
|
||||
int64_t komodo_pricemult(int32_t ind);
|
||||
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
|
||||
int32_t komodo_currentheight();
|
||||
int32_t hush_currentheight();
|
||||
int32_t komodo_notarized_bracket(struct notarized_checkpoint *nps[2],int32_t height);
|
||||
arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime);
|
||||
bool hush_hardfork_active(uint32_t time);
|
||||
@@ -571,12 +571,12 @@ uint256 Parseuint256(const char *hexstr);
|
||||
void komodo_sendmessage(int32_t minpeers, int32_t maxpeers, const char *message, std::vector<uint8_t> payload);
|
||||
CBlockIndex *komodo_getblockindex(uint256 hash);
|
||||
int32_t hush_nextheight();
|
||||
CBlockIndex *komodo_blockindex(uint256 hash);
|
||||
CBlockIndex *komodo_chainactive(int32_t height);
|
||||
int32_t komodo_blockheight(uint256 hash);
|
||||
CBlockIndex *hush_blockindex(uint256 hash);
|
||||
CBlockIndex *hush_chainactive(int32_t height);
|
||||
int32_t hush_blockheight(uint256 hash);
|
||||
bool komodo_txnotarizedconfirmed(uint256 txid);
|
||||
int32_t komodo_blockload(CBlock& block, CBlockIndex *pindex);
|
||||
uint32_t komodo_chainactive_timestamp();
|
||||
uint32_t hush_chainactive_timestamp();
|
||||
uint32_t GetLatestTimestamp(int32_t height);
|
||||
|
||||
#ifndef HUSH_NSPV_FULLNODE
|
||||
|
||||
@@ -1153,7 +1153,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
||||
return(typestr);
|
||||
}
|
||||
|
||||
int32_t komodo_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fposp,long datalen,char *symbol,char *dest);
|
||||
int32_t hush_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fposp,long datalen,char *symbol,char *dest);
|
||||
|
||||
void hush_stateind_set(struct hush_state *sp,uint32_t *inds,int32_t n,uint8_t *filedata,long datalen,char *symbol,char *dest)
|
||||
{
|
||||
@@ -1232,7 +1232,7 @@ void hush_stateind_set(struct hush_state *sp,uint32_t *inds,int32_t n,uint8_t *f
|
||||
if ( doissue != 0 )
|
||||
{
|
||||
//printf("issue %c total.%d lastfpos.%ld\n",func,count,lastfpos);
|
||||
komodo_parsestatefiledata(sp,filedata,&lastfpos,datalen,symbol,dest);
|
||||
hush_parsestatefiledata(sp,filedata,&lastfpos,datalen,symbol,dest);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -1373,7 +1373,7 @@ int32_t hush_faststateinit(struct hush_state *sp,char *fname,char *symbol,char *
|
||||
if ( (indfp= fopen(indfname,"wb")) != 0 )
|
||||
fwrite(&prevpos100,1,sizeof(prevpos100),indfp), indcounter++;
|
||||
fprintf(stderr,"processing %s %ldKB, validated.%ld\n",fname,datalen/1024,validated);
|
||||
while ( (func= komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 )
|
||||
while ( (func= hush_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 )
|
||||
{
|
||||
lastfpos = komodo_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter);
|
||||
}
|
||||
@@ -1398,7 +1398,7 @@ int32_t hush_faststateinit(struct hush_state *sp,char *fname,char *symbol,char *
|
||||
fseek(indfp,indcounter * sizeof(uint32_t),SEEK_SET);
|
||||
if ( ftell(indfp) == indcounter * sizeof(uint32_t) )
|
||||
{
|
||||
while ( (func= komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 )
|
||||
while ( (func= hush_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest)) >= 0 )
|
||||
{
|
||||
lastfpos = komodo_indfile_update(indfp,&prevpos100,lastfpos,fpos,func,&indcounter);
|
||||
if ( lastfpos != fpos )
|
||||
@@ -1433,9 +1433,9 @@ void hush_passport_iteration()
|
||||
fprintf(stderr,"[%s] PASSPORT iteration waiting for HUSH_INITDONE\n",SMART_CHAIN_SYMBOL);
|
||||
sleep(3);
|
||||
}
|
||||
if ( komodo_chainactive_timestamp() > lastinterest )
|
||||
if ( hush_chainactive_timestamp() > lastinterest )
|
||||
{
|
||||
lastinterest = komodo_chainactive_timestamp();
|
||||
lastinterest = hush_chainactive_timestamp();
|
||||
}
|
||||
refsp = hush_stateptr(symbol,dest);
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 || strcmp(SMART_CHAIN_SYMBOL,"JUSTLIES") == 0 )
|
||||
@@ -1476,7 +1476,7 @@ void hush_passport_iteration()
|
||||
{
|
||||
fpos = 0;
|
||||
fprintf(stderr,"%s processing %s %ldKB\n",SMART_CHAIN_SYMBOL,fname,datalen/1024);
|
||||
while ( komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest) >= 0 )
|
||||
while ( hush_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest) >= 0 )
|
||||
lastfpos = fpos;
|
||||
fprintf(stderr,"%s took %d seconds to process %s %ldKB\n",SMART_CHAIN_SYMBOL,(int32_t)(time(NULL)-starttime),fname,datalen/1024);
|
||||
lastpos[baseid] = lastfpos;
|
||||
@@ -1492,7 +1492,7 @@ void hush_passport_iteration()
|
||||
if ( SMART_CHAIN_SYMBOL[0] != 0 )
|
||||
printf("%s passport refid.%d %s fname.(%s) base.%s %ld %ld\n",SMART_CHAIN_SYMBOL,refid,symbol,fname,base,ftell(fp),lastpos[baseid]);
|
||||
fseek(fp,lastpos[baseid],SEEK_SET);
|
||||
while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < limit )
|
||||
while ( hush_parsestatefile(sp,fp,symbol,dest) >= 0 && n < limit )
|
||||
{
|
||||
if ( n == limit-1 )
|
||||
{
|
||||
@@ -1628,7 +1628,7 @@ int32_t komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHei
|
||||
CBlockIndex *pindex; CBlock block;
|
||||
if ( seedp != 0 )
|
||||
*seedp = 0;
|
||||
if ( (pindex= komodo_chainactive(nHeight)) != 0 )
|
||||
if ( (pindex= hush_chainactive(nHeight)) != 0 )
|
||||
{
|
||||
if ( komodo_blockload(block,pindex) == 0 )
|
||||
{
|
||||
@@ -2306,7 +2306,7 @@ void komodo_cbopretupdate(int32_t forceflag)
|
||||
if ( (ExtremePrice.dir > 0 && PriceCache[0][ExtremePrice.ind] >= ExtremePrice.pricebits) || (ExtremePrice.dir < 0 && PriceCache[0][ExtremePrice.ind] <= ExtremePrice.pricebits) )
|
||||
{
|
||||
fprintf(stderr,"future price is close enough to allow approving previously rejected block ind.%d %u vs %u\n",ExtremePrice.ind,PriceCache[0][ExtremePrice.ind],ExtremePrice.pricebits);
|
||||
if ( (pindex= komodo_blockindex(ExtremePrice.blockhash)) != 0 )
|
||||
if ( (pindex= hush_blockindex(ExtremePrice.blockhash)) != 0 )
|
||||
pindex->nStatus &= ~BLOCK_FAILED_MASK;
|
||||
else fprintf(stderr,"couldnt find block.%s\n",ExtremePrice.blockhash.GetHex().c_str());
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ void komodo_prefetch(FILE *fp);
|
||||
uint32_t komodo_heightstamp(int32_t height);
|
||||
void hush_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth);
|
||||
void komodo_init(int32_t height);
|
||||
int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
|
||||
int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
|
||||
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp);
|
||||
char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port);
|
||||
void komodo_init(int32_t height);
|
||||
|
||||
@@ -298,7 +298,7 @@ int32_t hush_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *tx
|
||||
if ( (sp= hush_stateptr(symbol,dest)) != 0 )
|
||||
{
|
||||
CBlockIndex *pindex;
|
||||
if ( (pindex= komodo_blockindex(sp->NOTARIZED_HASH)) == 0 || pindex->GetHeight() < 0 )
|
||||
if ( (pindex= hush_blockindex(sp->NOTARIZED_HASH)) == 0 || pindex->GetHeight() < 0 )
|
||||
{
|
||||
//fprintf(stderr,"found orphaned notarization at ht.%d pindex.%p\n",sp->NOTARIZED_HEIGHT,(void *)pindex);
|
||||
memset(&sp->NOTARIZED_HASH,0,sizeof(sp->NOTARIZED_HASH));
|
||||
@@ -334,7 +334,7 @@ int32_t hush_dpowconfs(int32_t txheight,int32_t numconfs)
|
||||
return(numconfs);
|
||||
}
|
||||
|
||||
int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip)
|
||||
int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip)
|
||||
{
|
||||
struct notarized_checkpoint *np = 0;
|
||||
if ( (np= komodo_npptr(height)) != 0 )
|
||||
|
||||
@@ -33,7 +33,7 @@ uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth)
|
||||
return(zero);
|
||||
for (i=0; i<MoMdepth; i++)
|
||||
{
|
||||
if ( (pindex= komodo_chainactive(height - i)) != 0 )
|
||||
if ( (pindex= hush_chainactive(height - i)) != 0 )
|
||||
leaves.push_back(pindex->hashMerkleRoot);
|
||||
else
|
||||
return(zero);
|
||||
@@ -100,7 +100,7 @@ int32_t komodo_addpair(struct komodo_ccdataMoMoM *mdata,int32_t notarized_height
|
||||
return(maxpairs);
|
||||
}
|
||||
|
||||
int32_t komodo_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height)
|
||||
int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height)
|
||||
{
|
||||
uint8_t hexdata[8192]; struct komodo_ccdata *ccdata,*tmpptr; int32_t len,maxpairs,i,retval=-1,depth,starti,endi,CCid=0; struct komodo_ccdata_entry *allMoMs;
|
||||
starti = endi = depth = len = maxpairs = 0;
|
||||
|
||||
@@ -83,7 +83,7 @@ int32_t NSPV_ntzextract(struct NSPV_ntz *ptr,uint256 ntztxid,int32_t txidht,uint
|
||||
ptr->txidheight = txidht;
|
||||
ptr->othertxid = desttxid;
|
||||
ptr->txid = ntztxid;
|
||||
if ( (pindex= komodo_chainactive(ptr->txidheight)) != 0 )
|
||||
if ( (pindex= hush_chainactive(ptr->txidheight)) != 0 )
|
||||
ptr->timestamp = pindex->nTime;
|
||||
return(0);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ int32_t NSPV_getntzsresp(struct NSPV_ntzsresp *ptr,int32_t origreqheight)
|
||||
int32_t NSPV_setequihdr(struct NSPV_equihdr *hdr,int32_t height)
|
||||
{
|
||||
CBlockIndex *pindex;
|
||||
if ( (pindex= komodo_chainactive(height)) != 0 )
|
||||
if ( (pindex= hush_chainactive(height)) != 0 )
|
||||
{
|
||||
hdr->nVersion = pindex->nVersion;
|
||||
if ( pindex->pprev == 0 )
|
||||
@@ -141,7 +141,7 @@ int32_t NSPV_getinfo(struct NSPV_inforesp *ptr,int32_t reqheight)
|
||||
if ( NSPV_getntzsresp(&pair,ptr->height-1) < 0 )
|
||||
return(-1);
|
||||
ptr->notarization = pair.prevntz;
|
||||
if ( (pindex2= komodo_chainactive(ptr->notarization.txidheight)) != 0 )
|
||||
if ( (pindex2= hush_chainactive(ptr->notarization.txidheight)) != 0 )
|
||||
ptr->notarization.timestamp = pindex->nTime;
|
||||
//fprintf(stderr, "timestamp.%i\n", ptr->notarization.timestamp );
|
||||
if ( reqheight == 0 )
|
||||
@@ -761,11 +761,11 @@ int32_t NSPV_gettxproof(struct NSPV_txproof *ptr,int32_t vout,uint256 txid,int32
|
||||
ptr->vout = vout;
|
||||
ptr->hashblock = hashBlock;
|
||||
if ( height == 0 )
|
||||
ptr->height = komodo_blockheight(hashBlock);
|
||||
ptr->height = hush_blockheight(hashBlock);
|
||||
else
|
||||
{
|
||||
ptr->height = height;
|
||||
if ( (pindex= komodo_chainactive(height)) != 0 && komodo_blockload(block,pindex) == 0 )
|
||||
if ( (pindex= hush_chainactive(height)) != 0 && komodo_blockload(block,pindex) == 0 )
|
||||
{
|
||||
BOOST_FOREACH(const CTransaction&tx, block.vtx)
|
||||
{
|
||||
@@ -804,18 +804,18 @@ int32_t NSPV_getntzsproofresp(struct NSPV_ntzsproofresp *ptr,uint256 prevntztxid
|
||||
int32_t i; uint256 hashBlock,bhash0,bhash1,desttxid0,desttxid1; CTransaction tx;
|
||||
ptr->prevtxid = prevntztxid;
|
||||
ptr->prevntz = NSPV_getrawtx(tx,hashBlock,&ptr->prevtxlen,ptr->prevtxid);
|
||||
ptr->prevtxidht = komodo_blockheight(hashBlock);
|
||||
ptr->prevtxidht = hush_blockheight(hashBlock);
|
||||
if ( NSPV_notarizationextract(0,&ptr->common.prevht,&bhash0,&desttxid0,tx) < 0 )
|
||||
return(-2);
|
||||
else if ( komodo_blockheight(bhash0) != ptr->common.prevht )
|
||||
else if ( hush_blockheight(bhash0) != ptr->common.prevht )
|
||||
return(-3);
|
||||
|
||||
ptr->nexttxid = nextntztxid;
|
||||
ptr->nextntz = NSPV_getrawtx(tx,hashBlock,&ptr->nexttxlen,ptr->nexttxid);
|
||||
ptr->nexttxidht = komodo_blockheight(hashBlock);
|
||||
ptr->nexttxidht = hush_blockheight(hashBlock);
|
||||
if ( NSPV_notarizationextract(0,&ptr->common.nextht,&bhash1,&desttxid1,tx) < 0 )
|
||||
return(-5);
|
||||
else if ( komodo_blockheight(bhash1) != ptr->common.nextht )
|
||||
else if ( hush_blockheight(bhash1) != ptr->common.nextht )
|
||||
return(-6);
|
||||
|
||||
else if ( ptr->common.prevht > ptr->common.nextht || (ptr->common.nextht - ptr->common.prevht) > 1440 )
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
|
||||
98
src/main.cpp
98
src/main.cpp
@@ -75,7 +75,7 @@ CCriticalSection cs_main;
|
||||
extern uint8_t NOTARY_PUBKEY33[33];
|
||||
extern int32_t HUSH_LOADINGBLOCKS,HUSH_LONGESTCHAIN,HUSH_INSYNC,HUSH_CONNECTING,HUSH_EXTRASATOSHI;
|
||||
int32_t HUSH_NEWBLOCKS;
|
||||
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
||||
int32_t hush_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
||||
//void komodo_broadcast(CBlock *pblock,int32_t limit);
|
||||
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
||||
void hush_setactivation(int32_t height);
|
||||
@@ -697,7 +697,7 @@ bool komodo_dailysnapshot(int32_t height)
|
||||
{
|
||||
//fprintf(stderr, "undoing block.%i\n",n);
|
||||
CBlockIndex *pindex; CBlock block;
|
||||
if ( (pindex= komodo_chainactive(n)) == 0 || komodo_blockload(block, pindex) != 0 )
|
||||
if ( (pindex= hush_chainactive(n)) == 0 || komodo_blockload(block, pindex) != 0 )
|
||||
return false;
|
||||
// undo transactions in reverse order
|
||||
for (int32_t i = block.vtx.size() - 1; i >= 0; i--)
|
||||
@@ -1421,6 +1421,7 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: desprout
|
||||
// Transactions containing empty `vin` must have either non-empty
|
||||
// `vjoinsplit` or non-empty `vShieldedSpend`.
|
||||
if (tx.vin.empty() && tx.vjoinsplit.empty() && tx.vShieldedSpend.empty())
|
||||
@@ -1508,57 +1509,6 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that joinsplit values are well-formed
|
||||
BOOST_FOREACH(const JSDescription& joinsplit, tx.vjoinsplit)
|
||||
{
|
||||
if ( acpublic != 0 )
|
||||
{
|
||||
return state.DoS(100, error("CheckTransaction(): this is a public chain, no privacy allowed"),
|
||||
REJECT_INVALID, "bad-txns-acpublic-chain");
|
||||
}
|
||||
if ( tiptime >= KOMODO_SAPLING_DEADLINE )
|
||||
{
|
||||
return state.DoS(100, error("CheckTransaction(): no more sprout after deadline"),
|
||||
REJECT_INVALID, "bad-txns-sprout-expired");
|
||||
}
|
||||
if (joinsplit.vpub_old < 0) {
|
||||
return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_old negative"),
|
||||
REJECT_INVALID, "bad-txns-vpub_old-negative");
|
||||
}
|
||||
|
||||
if (joinsplit.vpub_new < 0) {
|
||||
return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_new negative"),
|
||||
REJECT_INVALID, "bad-txns-vpub_new-negative");
|
||||
}
|
||||
|
||||
if (joinsplit.vpub_old > MAX_MONEY) {
|
||||
return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_old too high"),
|
||||
REJECT_INVALID, "bad-txns-vpub_old-toolarge");
|
||||
}
|
||||
|
||||
if (joinsplit.vpub_new > MAX_MONEY) {
|
||||
return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_new too high"),
|
||||
REJECT_INVALID, "bad-txns-vpub_new-toolarge");
|
||||
}
|
||||
|
||||
if (joinsplit.vpub_new != 0 && joinsplit.vpub_old != 0) {
|
||||
return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_new and joinsplit.vpub_old both nonzero"),
|
||||
REJECT_INVALID, "bad-txns-vpubs-both-nonzero");
|
||||
}
|
||||
|
||||
nValueOut += joinsplit.vpub_old;
|
||||
if (!MoneyRange(nValueOut)) {
|
||||
return state.DoS(100, error("CheckTransaction(): txout total out of range"),
|
||||
REJECT_INVALID, "bad-txns-txouttotal-toolarge");
|
||||
}
|
||||
if ( joinsplit.vpub_new == 0 && joinsplit.vpub_old == 0 )
|
||||
z_z++;
|
||||
else if ( joinsplit.vpub_new == 0 && joinsplit.vpub_old != 0 )
|
||||
t_z++;
|
||||
else if ( joinsplit.vpub_new != 0 && joinsplit.vpub_old == 0 )
|
||||
z_t++;
|
||||
}
|
||||
|
||||
if ( ASSETCHAINS_PRIVATE != 0 && invalid_private_taddr != 0 )
|
||||
{
|
||||
static uint32_t counter;
|
||||
@@ -1591,15 +1541,6 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
||||
// to the value pool.
|
||||
{
|
||||
CAmount nValueIn = 0;
|
||||
for (std::vector<JSDescription>::const_iterator it(tx.vjoinsplit.begin()); it != tx.vjoinsplit.end(); ++it)
|
||||
{
|
||||
nValueIn += it->vpub_new;
|
||||
|
||||
if (!MoneyRange(it->vpub_new) || !MoneyRange(nValueIn)) {
|
||||
return state.DoS(100, error("CheckTransaction(): txin total out of range"),
|
||||
REJECT_INVALID, "bad-txns-txintotal-toolarge");
|
||||
}
|
||||
}
|
||||
|
||||
// Also check for Sapling
|
||||
if (tx.valueBalance >= 0) {
|
||||
@@ -1623,22 +1564,6 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
||||
vInOutPoints.insert(txin.prevout);
|
||||
}
|
||||
|
||||
// Check for duplicate joinsplit nullifiers in this transaction
|
||||
{
|
||||
set<uint256> vJoinSplitNullifiers;
|
||||
BOOST_FOREACH(const JSDescription& joinsplit, tx.vjoinsplit)
|
||||
{
|
||||
BOOST_FOREACH(const uint256& nf, joinsplit.nullifiers)
|
||||
{
|
||||
if (vJoinSplitNullifiers.count(nf))
|
||||
return state.DoS(100, error("CheckTransaction(): duplicate nullifiers"),
|
||||
REJECT_INVALID, "bad-joinsplits-nullifiers-duplicate");
|
||||
|
||||
vJoinSplitNullifiers.insert(nf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for duplicate sapling nullifiers in this transaction
|
||||
{
|
||||
set<uint256> vSaplingNullifiers;
|
||||
@@ -1652,8 +1577,7 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
||||
}
|
||||
}
|
||||
|
||||
if (tx.IsMint())
|
||||
{
|
||||
if (tx.IsMint()) {
|
||||
// There should be no joinsplits in a coinbase transaction
|
||||
if (tx.vjoinsplit.size() > 0)
|
||||
return state.DoS(100, error("CheckTransaction(): coinbase has joinsplits"),
|
||||
@@ -1670,9 +1594,7 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
||||
if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100)
|
||||
return state.DoS(100, error("CheckTransaction(): coinbase script size"),
|
||||
REJECT_INVALID, "bad-cb-length");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
if (txin.prevout.IsNull())
|
||||
return state.DoS(10, error("CheckTransaction(): prevout is null"),
|
||||
@@ -2310,7 +2232,7 @@ bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos,bo
|
||||
// Check the header
|
||||
if ( 0 && checkPOW != 0 )
|
||||
{
|
||||
komodo_block2pubkey33(pubkey33,(CBlock *)&block);
|
||||
hush_block2pubkey33(pubkey33,(CBlock *)&block);
|
||||
if (!(CheckEquihashSolution(&block, Params()) && CheckProofOfWork(block, pubkey33, height, Params().GetConsensus())))
|
||||
{
|
||||
int32_t i; for (i=0; i<33; i++)
|
||||
@@ -5035,7 +4957,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
{
|
||||
//if ( !CheckEquihashSolution(&block, Params()) )
|
||||
// return state.DoS(100, error("CheckBlock: Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
|
||||
komodo_block2pubkey33(pubkey33,(CBlock *)&block);
|
||||
hush_block2pubkey33(pubkey33,(CBlock *)&block);
|
||||
if ( !CheckProofOfWork(block,pubkey33,height,Params().GetConsensus()) )
|
||||
{
|
||||
int32_t z; for (z=31; z>=0; z--)
|
||||
@@ -5474,7 +5396,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
|
||||
CValidationState tmpstate; CBlockIndex *tmpindex; int32_t ht,longest;
|
||||
ht = (int32_t)pindex->GetHeight();
|
||||
longest = hush_longestchain();
|
||||
if ( (longest == 0 || ht < longest-6) && (tmpindex=komodo_chainactive(ht)) != 0 )
|
||||
if ( (longest == 0 || ht < longest-6) && (tmpindex=hush_chainactive(ht)) != 0 )
|
||||
{
|
||||
fprintf(stderr,"reconsider height.%d, longest.%d\n",(int32_t)ht,longest);
|
||||
if ( Queued_reconsiderblock == zeroid )
|
||||
@@ -6542,8 +6464,8 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
|
||||
nLoaded++;
|
||||
if (state.IsError())
|
||||
break;
|
||||
} else if (hash != chainparams.GetConsensus().hashGenesisBlock && komodo_blockheight(hash) % 1000 == 0) {
|
||||
LogPrintf("Block Import: already had block %s at height %d\n", hash.ToString(), komodo_blockheight(hash));
|
||||
} else if (hash != chainparams.GetConsensus().hashGenesisBlock && hush_blockheight(hash) % 1000 == 0) {
|
||||
LogPrintf("Block Import: already had block %s at height %d\n", hash.ToString(), hush_blockheight(hash));
|
||||
}
|
||||
|
||||
// Recursively process earlier encountered successors of this block
|
||||
|
||||
@@ -144,7 +144,7 @@ int64_t komodo_block_unlocktime(uint32_t nHeight);
|
||||
uint64_t the_commission(const CBlock *block,int32_t height);
|
||||
int32_t hush_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *ptr);
|
||||
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
||||
int32_t komodo_is_notarytx(const CTransaction& tx);
|
||||
int32_t hush_is_notarytx(const CTransaction& tx);
|
||||
uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &NotarizationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len);
|
||||
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||
int32_t komodo_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len);
|
||||
@@ -303,7 +303,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
} else {
|
||||
TMP_NotarizationNotaries.clear();
|
||||
bool fToCryptoAddress = false;
|
||||
if ( numSN != 0 && notarypubkeys[0][0] != 0 && komodo_is_notarytx(tx) == 1 )
|
||||
if ( numSN != 0 && notarypubkeys[0][0] != 0 && hush_is_notarytx(tx) == 1 )
|
||||
fToCryptoAddress = true;
|
||||
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#ifdef ENABLE_RUST
|
||||
#include "librustzcash.h"
|
||||
#endif // ENABLE_RUST
|
||||
uint32_t komodo_chainactive_timestamp();
|
||||
uint32_t hush_chainactive_timestamp();
|
||||
|
||||
#include "hush_defs.h"
|
||||
|
||||
@@ -674,8 +674,7 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param
|
||||
}
|
||||
|
||||
int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
||||
int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],uint32_t blocktimes[66],int32_t height,uint8_t pubkey33[33],uint32_t blocktime);
|
||||
int32_t komodo_currentheight();
|
||||
int32_t hush_currentheight();
|
||||
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height);
|
||||
bool komodo_checkopret(CBlock *pblock, CScript &merkleroot);
|
||||
CScript komodo_makeopret(CBlock *pblock, bool fNew);
|
||||
@@ -699,10 +698,10 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
|
||||
//fprintf(stderr," checkpow\n");
|
||||
memcpy(origpubkey33,pubkey33,33);
|
||||
memset(blocktimes,0,sizeof(blocktimes));
|
||||
tiptime = komodo_chainactive_timestamp();
|
||||
tiptime = hush_chainactive_timestamp();
|
||||
bnTarget.SetCompact(blkHeader.nBits, &fNegative, &fOverflow);
|
||||
if ( height == 0 ) {
|
||||
height = komodo_currentheight() + 1;
|
||||
height = hush_currentheight() + 1;
|
||||
//fprintf(stderr,"set height to %d\n",height);
|
||||
}
|
||||
arith_uint256 bnLimit = (height <= 1 || ASSETCHAINS_ALGO == ASSETCHAINS_EQUIHASH) ? UintToArith256(params.powLimit) : UintToArith256(params.powAlternate);
|
||||
|
||||
@@ -56,8 +56,8 @@ int32_t ensure_CCrequirements(uint8_t evalcode);
|
||||
bool EnsureWalletIsAvailable(bool avoidException);
|
||||
|
||||
|
||||
int32_t komodo_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
|
||||
int32_t komodo_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height);
|
||||
int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
|
||||
int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height);
|
||||
struct komodo_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi);
|
||||
uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth);
|
||||
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||
@@ -108,7 +108,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
height = chainActive.Tip()->GetHeight();
|
||||
}
|
||||
//fprintf(stderr,"height_MoM height.%d\n",height);
|
||||
depth = komodo_MoM(¬arized_height,&MoM,&kmdtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi);
|
||||
depth = hush_MoM(¬arized_height,&MoM,&kmdtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi);
|
||||
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL)));
|
||||
ret.push_back(Pair("height",height));
|
||||
ret.push_back(Pair("timestamp",(uint64_t)timestamp));
|
||||
|
||||
@@ -377,7 +377,7 @@ UniValue setgenerate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
}
|
||||
#endif
|
||||
|
||||
CBlockIndex *komodo_chainactive(int32_t height);
|
||||
CBlockIndex *hush_chainactive(int32_t height);
|
||||
arith_uint256 zawy_ctB(arith_uint256 bnTarget,uint32_t solvetime);
|
||||
|
||||
UniValue genminingCSV(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
@@ -393,7 +393,7 @@ UniValue genminingCSV(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
height = hush_nextheight();
|
||||
for (i=0; i<height; i++)
|
||||
{
|
||||
if ( (pindex= komodo_chainactive(i)) != 0 )
|
||||
if ( (pindex= hush_chainactive(i)) != 0 )
|
||||
{
|
||||
bnTarget.SetCompact(pindex->nBits,&fNegative,&fOverflow);
|
||||
solvetime = (prevtime==0) ? 0 : (int32_t)(pindex->nTime - prevtime);
|
||||
|
||||
@@ -58,13 +58,13 @@ using namespace std;
|
||||
int32_t hush_longestchain();
|
||||
int32_t hush_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp);
|
||||
bool komodo_txnotarizedconfirmed(uint256 txid);
|
||||
uint32_t komodo_chainactive_timestamp();
|
||||
uint32_t hush_chainactive_timestamp();
|
||||
int32_t hush_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
|
||||
extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
|
||||
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,HUSH_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC;
|
||||
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
|
||||
uint32_t komodo_segid32(char *coinaddr);
|
||||
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
||||
int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
||||
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *hushnotarized_heightp);
|
||||
uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount);
|
||||
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||
@@ -285,7 +285,7 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
if ( NOTARY_PUBKEY33[0] != 0 ) {
|
||||
char pubkeystr[65]; int32_t notaryid; std::string notaryname;
|
||||
if( (notaryid= hush_whoami(pubkeystr,(int32_t)chainActive.LastTip()->GetHeight(),komodo_chainactive_timestamp())) >= 0 ) {
|
||||
if( (notaryid= hush_whoami(pubkeystr,(int32_t)chainActive.LastTip()->GetHeight(),hush_chainactive_timestamp())) >= 0 ) {
|
||||
obj.push_back(Pair("notaryid", notaryid));
|
||||
if ( KOMODO_LASTMINED != 0 )
|
||||
obj.push_back(Pair("lastmined", KOMODO_LASTMINED));
|
||||
@@ -424,7 +424,7 @@ UniValue coinsupply(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
currentHeight = chainActive.Height();
|
||||
|
||||
if (height >= 0 && height <= currentHeight) {
|
||||
if ( (supply= komodo_coinsupply(&zfunds,&sproutfunds,height)) > 0 )
|
||||
if ( (supply= hush_coinsupply(&zfunds,&sproutfunds,height)) > 0 )
|
||||
{
|
||||
result.push_back(Pair("result", "success"));
|
||||
result.push_back(Pair("coin", SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL));
|
||||
@@ -438,9 +438,9 @@ UniValue coinsupply(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
blocks_per_year = 24*3600*365 / ASSETCHAINS_BLOCKTIME;
|
||||
if ( height > blocks_per_year )
|
||||
{
|
||||
supply1 = komodo_coinsupply(&zf1,&sf1,height - blocks_per_year/12);
|
||||
supply3 = komodo_coinsupply(&zf3,&sf3,height - blocks_per_year/4);
|
||||
supply12 = komodo_coinsupply(&zf12,&sf12,height - blocks_per_year);
|
||||
supply1 = hush_coinsupply(&zf1,&sf1,height - blocks_per_year/12);
|
||||
supply3 = hush_coinsupply(&zf3,&sf3,height - blocks_per_year/4);
|
||||
supply12 = hush_coinsupply(&zf12,&sf12,height - blocks_per_year);
|
||||
if ( supply1 != 0 && supply3 != 0 && supply12 != 0 )
|
||||
{
|
||||
result.push_back(Pair("lastmonth", ValueFromAmount(supply1+zf1)));
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
int32_t komodo_blockheight(uint256 hash);
|
||||
int32_t hush_blockheight(uint256 hash);
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ using namespace libzcash;
|
||||
extern char SMART_CHAIN_SYMBOL[65];
|
||||
|
||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int32_t komodo_blockheight(uint256 hash);
|
||||
int32_t hush_blockheight(uint256 hash);
|
||||
int tx_height( const uint256 &hash );
|
||||
bool hush_hardfork_active(uint32_t time);
|
||||
extern UniValue signrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
|
||||
@@ -138,10 +138,10 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
|
||||
entry.push_back(Pair("generated", true));
|
||||
if (confirms > 0)
|
||||
{
|
||||
entry.push_back(Pair("confirmations", hush_dpowconfs((int32_t)komodo_blockheight(wtx.hashBlock),confirms)));
|
||||
entry.push_back(Pair("confirmations", hush_dpowconfs((int32_t)hush_blockheight(wtx.hashBlock),confirms)));
|
||||
entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex()));
|
||||
entry.push_back(Pair("blockindex", wtx.nIndex));
|
||||
entry.push_back(Pair("blocktime", (uint64_t)komodo_blocktime(wtx.hashBlock)));
|
||||
entry.push_back(Pair("blocktime", (uint64_t)hush_blocktime(wtx.hashBlock)));
|
||||
entry.push_back(Pair("expiryheight", (int64_t)wtx.nExpiryHeight));
|
||||
} else entry.push_back(Pair("confirmations", confirms));
|
||||
uint256 hash = wtx.GetHash();
|
||||
@@ -1659,7 +1659,7 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
||||
tallyitem& item = mapTally[address];
|
||||
item.nAmount += txout.nValue;
|
||||
item.nConf = min(item.nConf, nDepth);
|
||||
item.nHeight = komodo_blockheight(wtx.hashBlock);
|
||||
item.nHeight = hush_blockheight(wtx.hashBlock);
|
||||
item.txids.push_back(wtx.GetHash());
|
||||
if (mine & ISMINE_WATCH_ONLY)
|
||||
item.fIsWatchonly = true;
|
||||
@@ -5561,8 +5561,8 @@ int32_t ensure_CCrequirements(uint8_t evalcode) {
|
||||
if ( ASSETCHAINS_CCDISABLES[evalcode] != 0 || (evalcode == EVAL_MARMARA && ASSETCHAINS_MARMARA == 0) )
|
||||
{
|
||||
// check if a height activation has been set.
|
||||
fprintf(stderr, "evalcode.%i activates at height. %i current height.%i\n", evalcode, mapHeightEvalActivate[evalcode], komodo_currentheight());
|
||||
if ( mapHeightEvalActivate[evalcode] == 0 || komodo_currentheight() == 0 || mapHeightEvalActivate[evalcode] > komodo_currentheight() )
|
||||
fprintf(stderr, "evalcode.%i activates at height. %i current height.%i\n", evalcode, mapHeightEvalActivate[evalcode], hush_currentheight());
|
||||
if ( mapHeightEvalActivate[evalcode] == 0 || hush_currentheight() == 0 || mapHeightEvalActivate[evalcode] > hush_currentheight() )
|
||||
{
|
||||
fprintf(stderr,"evalcode %d disabled\n",evalcode);
|
||||
return(-1);
|
||||
|
||||
@@ -64,7 +64,7 @@ bool fSendFreeTransactions = false;
|
||||
bool fPayAtLeastCustomFee = true;
|
||||
#include "hush_defs.h"
|
||||
|
||||
CBlockIndex *komodo_chainactive(int32_t height);
|
||||
CBlockIndex *hush_chainactive(int32_t height);
|
||||
extern std::string DONATION_PUBKEY;
|
||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int tx_height( const uint256 &hash );
|
||||
|
||||
@@ -38,7 +38,7 @@ using namespace std;
|
||||
|
||||
static uint64_t nAccountingEntryNumber = 0;
|
||||
static list<uint256> deadTxns;
|
||||
extern CBlockIndex *komodo_blockindex(uint256 hash);
|
||||
extern CBlockIndex *hush_blockindex(uint256 hash);
|
||||
|
||||
//
|
||||
// CWalletDB
|
||||
@@ -932,7 +932,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
||||
if (!EraseTx(hash))
|
||||
fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str());
|
||||
uint256 blockhash; CTransaction tx; CBlockIndex* pindex;
|
||||
if ( GetTransaction(hash,tx,blockhash,false) && (pindex= komodo_blockindex(blockhash)) != 0 && chainActive.Contains(pindex) )
|
||||
if ( GetTransaction(hash,tx,blockhash,false) && (pindex= hush_blockindex(blockhash)) != 0 && chainActive.Contains(pindex) )
|
||||
{
|
||||
CWalletTx wtx(pwallet,tx);
|
||||
pwallet->AddToWallet(wtx, true, NULL);
|
||||
|
||||
Reference in New Issue
Block a user