test
This commit is contained in:
@@ -633,7 +633,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33)
|
|||||||
return(komodo_electednotary(pubkey33,height));
|
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];
|
int32_t i,duplicate; CBlockIndex *pindex; uint8_t pubkey33[33];
|
||||||
memset(mids,-1,sizeof(*mids)*66);
|
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 )
|
if ( pindex != 0 )
|
||||||
{
|
{
|
||||||
komodo_index2pubkey33(pubkey33,pindex,height-i);
|
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 )
|
if ( (mids[i]= komodo_minerid(height-i,pubkey33)) >= 0 )
|
||||||
{
|
{
|
||||||
//mids[i] = *(int32_t *)pubkey33;
|
//mids[i] = *(int32_t *)pubkey33;
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t komodo_baseid(char *origbase);
|
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)
|
void static BitcoinMiner(CWallet *pwallet)
|
||||||
{
|
{
|
||||||
@@ -615,18 +615,24 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
//
|
//
|
||||||
// Search
|
// 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;
|
savebits = pblock->nBits;
|
||||||
arith_uint256 hashTarget = arith_uint256().SetCompact(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 ( 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 )
|
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 ( nonzpkeys > 0 )
|
||||||
{
|
{
|
||||||
if ( notaryid < 2 )
|
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++)
|
for (j=0; j<65; j++)
|
||||||
fprintf(stderr,"%d ",mids[j]);
|
fprintf(stderr,"%d ",mids[j]);
|
||||||
fprintf(stderr," <- prev minerids from ht.%d notary.%d\n",pindexPrev->nHeight,notaryid);
|
fprintf(stderr," <- prev minerids from ht.%d notary.%d\n",pindexPrev->nHeight,notaryid);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
|||||||
extern int32_t KOMODO_CHOSEN_ONE;
|
extern int32_t KOMODO_CHOSEN_ONE;
|
||||||
#define KOMODO_ELECTION_GAP 2000
|
#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;
|
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;
|
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];
|
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);
|
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
|
||||||
if ( height == 0 )
|
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++)
|
//for (i=0; i<33; i++)
|
||||||
// printf("%02x",pubkey33[i]);
|
// printf("%02x",pubkey33[i]);
|
||||||
//printf(" <- ht.%d\n",height);
|
//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
|
if ( height > 34000 ) // 0 -> non-special notary
|
||||||
{
|
{
|
||||||
for (i=0; i<33; i++)
|
for (i=0; i<33; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user