Browse Source

Hush does not have elections

pull/71/head
Duke Leto 3 years ago
parent
commit
085f28a067
  1. 2
      src/hush.h
  2. 2
      src/hush_defs.h
  3. 2
      src/hush_globals.h
  4. 28
      src/hush_notary.h
  5. 2
      src/miner.cpp
  6. 2
      src/pow.cpp

2
src/hush.h

@ -944,7 +944,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
{
memset(&txhash,0,sizeof(txhash));
hush_stateupdate(height,pubkeys,numvalid,0,txhash,0,0,0,0,0,0,0,0,0,0,zero,0);
printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,height);
printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+HUSH_DPOW_GAP/2)/HUSH_DPOW_GAP)+1)*HUSH_DPOW_GAP,height);
} else printf("signedmask.%llx numvalid.%d wt.%d numnotaries.%d\n",(long long)signedmask,numvalid,bitweight(signedmask),numnotaries);
}
}

2
src/hush_defs.h

@ -23,7 +23,7 @@
#define HUSH_EARLYTXID_HEIGHT 100
#define ASSETCHAINS_MINHEIGHT 128
#define ASSETCHAINS_MAX_ERAS 7
#define KOMODO_ELECTION_GAP 2000
#define HUSH_DPOW_GAP 2000
#define ROUNDROBIN_DELAY 61
#define HUSH_SMART_CHAIN_MAXLEN 65
#define HUSH_LIMITED_NETWORKSIZE 4

2
src/hush_globals.h

@ -34,7 +34,7 @@ int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
int32_t hush_checkvout(int32_t vout,int32_t k,int32_t indallvouts);
pthread_mutex_t hush_mutex;
#define KOMODO_ELECTION_GAP 2000 //((SMART_CHAIN_SYMBOL[0] == 0) ? 2000 : 100)
#define HUSH_DPOW_GAP 2000 //((SMART_CHAIN_SYMBOL[0] == 0) ? 2000 : 100)
#define HUSH_SMART_CHAIN_MAXLEN 65
struct pax_transaction *PAX;

28
src/hush_notary.h

@ -143,17 +143,17 @@ void hush_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num)
static int32_t hwmheight;
int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N;
if ( Pubkeys == 0 )
Pubkeys = (struct knotaries_entry *)calloc(1 + (HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys));
Pubkeys = (struct knotaries_entry *)calloc(1 + (HUSH_MAXBLOCKS / HUSH_DPOW_GAP),sizeof(*Pubkeys));
memset(&N,0,sizeof(N));
if ( origheight > 0 )
{
height = (origheight + KOMODO_ELECTION_GAP/2);
height /= KOMODO_ELECTION_GAP;
height = ((height + 1) * KOMODO_ELECTION_GAP);
htind = (height / KOMODO_ELECTION_GAP);
if ( htind >= HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP )
htind = (HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1;
//printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,SMART_CHAIN_SYMBOL);
height = (origheight + HUSH_DPOW_GAP/2);
height /= HUSH_DPOW_GAP;
height = ((height + 1) * HUSH_DPOW_GAP);
htind = (height / HUSH_DPOW_GAP);
if ( htind >= HUSH_MAXBLOCKS / HUSH_DPOW_GAP )
htind = (HUSH_MAXBLOCKS / HUSH_DPOW_GAP) - 1;
//printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+HUSH_DPOW_GAP/2)/HUSH_DPOW_GAP)+1)*HUSH_DPOW_GAP,hwmheight,SMART_CHAIN_SYMBOL);
} else htind = 0;
pthread_mutex_lock(&hush_mutex);
for (k=0; k<num; k++)
@ -166,11 +166,11 @@ void hush_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num)
{
for (i=0; i<33; i++)
printf("%02x",pubkeys[k][i]);
printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*KOMODO_ELECTION_GAP);
printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*HUSH_DPOW_GAP);
}
}
N.numnotaries = num;
for (i=htind; i<HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP; i++)
for (i=htind; i<HUSH_MAXBLOCKS / HUSH_DPOW_GAP; i++)
{
if ( Pubkeys[i].height != 0 && origheight < hwmheight )
{
@ -178,7 +178,7 @@ void hush_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num)
break;
}
Pubkeys[i] = N;
Pubkeys[i].height = i * KOMODO_ELECTION_GAP;
Pubkeys[i].height = i * HUSH_DPOW_GAP;
}
pthread_mutex_unlock(&hush_mutex);
if ( origheight > hwmheight )
@ -207,9 +207,9 @@ int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,ui
return(-1);
if ( Pubkeys == 0 )
hush_init(0);
htind = height / KOMODO_ELECTION_GAP;
if ( htind >= HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP )
htind = (HUSH_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1;
htind = height / HUSH_DPOW_GAP;
if ( htind >= HUSH_MAXBLOCKS / HUSH_DPOW_GAP )
htind = (HUSH_MAXBLOCKS / HUSH_DPOW_GAP) - 1;
pthread_mutex_lock(&hush_mutex);
HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp);
pthread_mutex_unlock(&hush_mutex);

2
src/miner.cpp

@ -1183,7 +1183,7 @@ void static BitcoinMiner()
if ( SMART_CHAIN_SYMBOL[0] == 0 && notaryid >= 0 )
{
j = 65;
if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 || Mining_height > 1000000 )
if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % HUSH_DPOW_GAP) > 64 || (Mining_height % HUSH_DPOW_GAP) == 0 || Mining_height > 1000000 )
{
int32_t dispflag = 0;
if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) || notaryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 )

2
src/pow.cpp

@ -677,7 +677,7 @@ bool hush_checkopret(CBlock *pblock, CScript &merkleroot);
CScript hush_makeopret(CBlock *pblock, bool fNew);
extern int32_t HUSH_CHOSEN_ONE;
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
#define KOMODO_ELECTION_GAP 2000
#define HUSH_DPOW_GAP 2000
int32_t hush_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height);
int32_t HUSH_LOADINGBLOCKS = 1;

Loading…
Cancel
Save