hush_init

This commit is contained in:
Duke Leto
2021-07-10 12:27:30 -04:00
parent 2331ed0c56
commit fc52a00c37
5 changed files with 10 additions and 10 deletions

View File

@@ -818,7 +818,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
return(0); return(0);
} }
memset(&zero,0,sizeof(zero)); memset(&zero,0,sizeof(zero));
komodo_init(pindex->GetHeight()); hush_init(pindex->GetHeight());
HUSH_INITDONE = (uint32_t)time(NULL); HUSH_INITDONE = (uint32_t)time(NULL);
if ( (sp= hush_stateptr(symbol,dest)) == 0 ) if ( (sp= hush_stateptr(symbol,dest)) == 0 )
{ {

View File

@@ -699,7 +699,7 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
{ {
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;
//fprintf(stderr,"disconnect ht.%d\n",pindex->GetHeight()); //fprintf(stderr,"disconnect ht.%d\n",pindex->GetHeight());
komodo_init(pindex->GetHeight()); hush_init(pindex->GetHeight());
if ( (sp= hush_stateptr(symbol,dest)) != 0 ) if ( (sp= hush_stateptr(symbol,dest)) != 0 )
{ {
//sp->rewinding = pindex->GetHeight(); //sp->rewinding = pindex->GetHeight();
@@ -754,7 +754,7 @@ int32_t hush_block2height(CBlock *block)
} }
//printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height); //printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height);
} }
//komodo_init(height); //hush_init(height);
} }
if ( height != height2 ) if ( height != height2 )
{ {

View File

@@ -20,11 +20,11 @@
void hush_prefetch(FILE *fp); void hush_prefetch(FILE *fp);
uint32_t hush_heightstamp(int32_t height); uint32_t hush_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 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); void hush_init(int32_t height);
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 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); 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); char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port);
void komodo_init(int32_t height); void hush_init(int32_t height);
int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
int32_t komodo_isrealtime(int32_t *kmdheightp); int32_t komodo_isrealtime(int32_t *kmdheightp);
uint64_t komodo_paxtotal(); uint64_t komodo_paxtotal();

View File

@@ -216,7 +216,7 @@ int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,ui
if ( height >= 250000 ) if ( height >= 250000 )
return(-1); return(-1);
if ( Pubkeys == 0 ) if ( Pubkeys == 0 )
komodo_init(0); hush_init(0);
htind = height / KOMODO_ELECTION_GAP; htind = height / KOMODO_ELECTION_GAP;
if ( htind >= HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP ) if ( htind >= HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP )
htind = (HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; htind = (HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1;
@@ -434,11 +434,11 @@ void komodo_notarized_update(struct hush_state *sp,int32_t nHeight,int32_t notar
portable_mutex_unlock(&komodo_mutex); portable_mutex_unlock(&komodo_mutex);
} }
void komodo_init(int32_t height) void hush_init(int32_t height)
{ {
static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33];
if ( 0 && height != 0 ) if ( 0 && height != 0 )
printf("komodo_init ht.%d didinit.%d\n",height,didinit); printf("hush_init ht.%d didinit.%d\n",height,didinit);
memset(&zero,0,sizeof(zero)); memset(&zero,0,sizeof(zero));
if ( didinit == 0 ) if ( didinit == 0 )
{ {

View File

@@ -94,7 +94,7 @@ extern bool hush_dailysnapshot(int32_t height);
extern int32_t HUSH_LOADINGBLOCKS; extern int32_t HUSH_LOADINGBLOCKS;
extern char SMART_CHAIN_SYMBOL[]; extern char SMART_CHAIN_SYMBOL[];
extern int32_t HUSH_SNAPSHOT_INTERVAL; extern int32_t HUSH_SNAPSHOT_INTERVAL;
extern void komodo_init(int32_t height); extern void hush_init(int32_t height);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
CWallet* pwalletMain = NULL; CWallet* pwalletMain = NULL;
@@ -1840,7 +1840,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// (we're likely using a testnet datadir, or the other way around). // (we're likely using a testnet datadir, or the other way around).
if (!mapBlockIndex.empty() && mapBlockIndex.count(chainparams.GetConsensus().hashGenesisBlock) == 0) if (!mapBlockIndex.empty() && mapBlockIndex.count(chainparams.GetConsensus().hashGenesisBlock) == 0)
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?")); return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
komodo_init(1); hush_init(1);
// Initialize the block index (no-op if non-empty database was already loaded) // Initialize the block index (no-op if non-empty database was already loaded)
if (!InitBlockIndex()) { if (!InitBlockIndex()) {
strLoadError = _("Error initializing block database"); strLoadError = _("Error initializing block database");