Try again

This commit is contained in:
jl777
2018-03-26 18:17:21 +03:00
parent 2c0218f0ab
commit 487f2319cd
4 changed files with 8 additions and 15 deletions

View File

@@ -716,7 +716,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
if ( komodo_blockload(block,pindex) == 0 ) if ( komodo_blockload(block,pindex) == 0 )
{ {
komodo_block2pubkey33(pubkey33,block); komodo_block2pubkey33(pubkey33,block);
if ( 0 && (pubkey33[0] == 2 || pubkey33[0] == 3) ) if ( (pubkey33[0] == 2 || pubkey33[0] == 3) )
{ {
memcpy(pindex->pubkey33,pubkey33,33); memcpy(pindex->pubkey33,pubkey33,33);
if ( (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 ) if ( (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 )
@@ -754,7 +754,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33)
int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33];
if ( (pindex= chainActive[height]) != 0 ) if ( (pindex= chainActive[height]) != 0 )
{ {
if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 ) if ( (pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3) )
{ {
if ( pubkey33 != 0 ) if ( pubkey33 != 0 )
memcpy(pubkey33,pindex->pubkey33,33); memcpy(pubkey33,pindex->pubkey33,33);
@@ -806,16 +806,17 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non
else return(0); else return(0);
} }
int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) // deprecate
{ {
int32_t i,n=0; /*int32_t i,n=0;
for (i=0; i<width; i++,n++) for (i=0; i<width; i++,n++)
{ {
if ( height-i <= 0 ) if ( height-i <= 0 )
break; break;
minerids[i] = komodo_minerid(height - i,0); minerids[i] = komodo_minerid(height - i,0);
} }
return(n); return(n);*/
return(-1);
} }
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp) int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp)
@@ -833,7 +834,7 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp
for (i=1; i<limit; i++) for (i=1; i<limit; i++)
{ {
komodo_chosennotary(&nid,height-i,pubkey33,timestamp); komodo_chosennotary(&nid,height-i,pubkey33,timestamp);
if ( nid == notaryid ) //komodo_minerid(height-i,_pubkey33) if ( nid == notaryid )
{ {
if ( (0) && notaryid > 0 ) if ( (0) && notaryid > 0 )
fprintf(stderr,"ht.%d notaryid.%d already mined -i.%d nid.%d\n",height,notaryid,i,nid); fprintf(stderr,"ht.%d notaryid.%d already mined -i.%d nid.%d\n",height,notaryid,i,nid);

View File

@@ -523,7 +523,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
// //
// Internal miner // Internal miner
// //
int8_t komodo_minerid(int32_t height,uint8_t *pubkey33);
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
{ {
@@ -776,12 +775,6 @@ void static BitcoinMiner()
break; break;
if ( externalflag == 0 && i != 66 ) if ( externalflag == 0 && i != 66 )
printf("VIOLATION at %d\n",i); printf("VIOLATION at %d\n",i);
for (i=0; i<66; i++)
{ break;
for (j=0; j<33; j++)
printf("%02x",pubkeys[i][j]);
printf(" p%d -> %d\n",i,komodo_minerid(pindexPrev->nHeight-i,pubkeys[i]));
}
for (j=gpucount=0; j<65; j++) for (j=gpucount=0; j<65; j++)
{ {
if ( mids[j] >= 0 || notaryid == 34 ) if ( mids[j] >= 0 || notaryid == 34 )

View File

@@ -120,7 +120,6 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp);
int32_t komodo_currentheight(); int32_t komodo_currentheight();
CBlockIndex *komodo_chainactive(int32_t height); CBlockIndex *komodo_chainactive(int32_t height);
//int8_t komodo_minerid(int32_t height,uint8_t *pubkey33);
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height); void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height);
extern int32_t KOMODO_CHOSEN_ONE; extern int32_t KOMODO_CHOSEN_ONE;
extern char ASSETCHAINS_SYMBOL[]; extern char ASSETCHAINS_SYMBOL[];

View File

@@ -636,7 +636,7 @@ UniValue minerids(const UniValue& params, bool fHelp)
if ( pblockindex != 0 ) if ( pblockindex != 0 )
timestamp = pblockindex->GetBlockTime(); timestamp = pblockindex->GetBlockTime();
} }
if ( (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) if ( 0 && (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 )
{ {
memset(tally,0,sizeof(tally)); memset(tally,0,sizeof(tally));
numnotaries = komodo_notaries(pubkeys,height,timestamp); numnotaries = komodo_notaries(pubkeys,height,timestamp);