Test
This commit is contained in:
@@ -708,6 +708,11 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
||||
memset(pubkey33,0,33);
|
||||
if ( pindex != 0 )
|
||||
{
|
||||
if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 )
|
||||
{
|
||||
memcpy(pubkey33,pindex->pubkey33,33);
|
||||
return;
|
||||
}
|
||||
if ( komodo_blockload(block,pindex) == 0 )
|
||||
{
|
||||
komodo_block2pubkey33(pubkey33,block);
|
||||
@@ -747,7 +752,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
||||
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];
|
||||
if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 )
|
||||
if ( (pindex= chainActive[height]) != 0 )
|
||||
{
|
||||
timestamp = pindex->GetBlockTime();
|
||||
if ( pubkey33 == 0 )
|
||||
@@ -755,6 +760,8 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33)
|
||||
pubkey33 = _pubkey33;
|
||||
komodo_index2pubkey33(pubkey33,pindex,height);
|
||||
}
|
||||
if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 )
|
||||
return(pindex->notaryid);
|
||||
if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 )
|
||||
{
|
||||
for (i=0; i<num; i++)
|
||||
@@ -807,9 +814,9 @@ int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width)
|
||||
|
||||
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp)
|
||||
{
|
||||
int32_t i,notaryid=0,minerid,limit,nid; uint8_t _pubkey33[33];
|
||||
int32_t i,notaryid=0,minerid,limit,nid; //uint8_t _pubkey33[33];
|
||||
if ( height >= 225000 )
|
||||
komodo_chosennotary(¬aryid,height,_pubkey33,timestamp);
|
||||
komodo_chosennotary(¬aryid,height,pubkey33,timestamp);
|
||||
if ( height >= 34000 && notaryid >= 0 )
|
||||
{
|
||||
if ( height < 79693 )
|
||||
@@ -819,7 +826,7 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp
|
||||
else limit = 66;
|
||||
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 ( (0) && notaryid > 0 )
|
||||
|
||||
@@ -339,7 +339,6 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,
|
||||
{
|
||||
// -1 if not notary, 0 if notary, 1 if special notary
|
||||
struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1;
|
||||
komodo_init(0);
|
||||
*notaryidp = -1;
|
||||
if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS )
|
||||
{
|
||||
@@ -356,6 +355,8 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,
|
||||
}
|
||||
if ( height >= 250000 )
|
||||
return(-1);
|
||||
if ( Pubkeys == 0 )
|
||||
komodo_init(0);
|
||||
htind = height / KOMODO_ELECTION_GAP;
|
||||
if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP )
|
||||
htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1;
|
||||
|
||||
@@ -112,7 +112,6 @@ extern std::string NOTARY_PUBKEY;
|
||||
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
||||
uint32_t Mining_start,Mining_height;
|
||||
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
||||
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp);
|
||||
int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize);
|
||||
uint64_t komodo_paxtotal();
|
||||
int32_t komodo_baseid(char *origbase);
|
||||
@@ -549,12 +548,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
||||
script[34] = OP_CHECKSIG;
|
||||
//scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
|
||||
}
|
||||
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
{
|
||||
for (i=0; i<65; i++)
|
||||
fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0));
|
||||
fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->GetBlockTime()),chainActive.Tip()->nHeight);
|
||||
}
|
||||
return CreateNewBlock(scriptPubKey);
|
||||
}
|
||||
|
||||
@@ -762,7 +755,7 @@ void static BitcoinMiner()
|
||||
savebits = pblock->nBits;
|
||||
arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits);
|
||||
roundrobin_delay = ROUNDROBIN_DELAY;
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )//komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 )
|
||||
if ( ASSETCHAINS_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 )
|
||||
|
||||
Reference in New Issue
Block a user