This commit is contained in:
jl777
2017-02-02 20:38:40 +02:00
parent 611acf2262
commit 8c654ec508
3 changed files with 15 additions and 7 deletions

View File

@@ -633,7 +633,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33)
return(komodo_electednotary(pubkey33,height));
}
int32_t komodo_eligiblenotary(int32_t *mids,int32_t *nonzpkeysp,int32_t height)
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height)
{
int32_t i,duplicate; CBlockIndex *pindex; uint8_t pubkey33[33];
memset(mids,-1,sizeof(*mids)*66);
@@ -643,6 +643,8 @@ int32_t komodo_eligiblenotary(int32_t *mids,int32_t *nonzpkeysp,int32_t height)
if ( pindex != 0 )
{
komodo_index2pubkey33(pubkey33,pindex,height-i);
for (j=0; j<33; j++)
pubkeys[i][j] = pubkey33[j];
if ( (mids[i]= komodo_minerid(height-i,pubkey33)) >= 0 )
{
//mids[i] = *(int32_t *)pubkey33;

View File

@@ -520,7 +520,7 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese
}
int32_t komodo_baseid(char *origbase);
int32_t komodo_eligiblenotary(int32_t *mids,int32_t *nonzpkeysp,int32_t height);
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height);
void static BitcoinMiner(CWallet *pwallet)
{
@@ -615,18 +615,24 @@ void static BitcoinMiner(CWallet *pwallet)
//
// Search
//
int mids[66],nonzpkeys,j; uint32_t savebits; int64_t nStart = GetTime();
uint8_t pubkeys[66][33]; int mids[66],nonzpkeys,i,j; uint32_t savebits; int64_t nStart = GetTime();
savebits = pblock->nBits;
arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits);
if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )//komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 )
{
if ( (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 )
{
komodo_eligiblenotary(mids,&nonzpkeys,pindexPrev->nHeight);
komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,pindexPrev->nHeight);
if ( nonzpkeys > 0 )
{
if ( notaryid < 2 )
{
for (i=0; i<15; i++)
{
for (j=0; j<33; j++)
printf("%02x",pubkeys[i][j]);
printf(" p%d\n",i);
}
for (j=0; j<65; j++)
fprintf(stderr,"%d ",mids[j]);
fprintf(stderr," <- prev minerids from ht.%d notary.%d\n",pindexPrev->nHeight,notaryid);

View File

@@ -113,7 +113,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
extern int32_t KOMODO_CHOSEN_ONE;
#define KOMODO_ELECTION_GAP 2000
int32_t komodo_eligiblenotary(int32_t *mids,int32_t *nonzpkeysp,int32_t height);
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height);
extern std::string NOTARY_PUBKEY;
@@ -122,7 +122,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
{
extern int32_t KOMODO_REWIND;
bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66];
arith_uint256 bnTarget; CBlockIndex *pindex;
arith_uint256 bnTarget; CBlockIndex *pindex; uint8_t pubkeys[66][33];
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
if ( height == 0 )
@@ -131,7 +131,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
//for (i=0; i<33; i++)
// printf("%02x",pubkey33[i]);
//printf(" <- ht.%d\n",height);
flag = komodo_eligiblenotary(mids,&nonzpkeys,height);
flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height);
if ( height > 34000 ) // 0 -> non-special notary
{
for (i=0; i<33; i++)