This commit is contained in:
jl777
2018-03-24 16:22:18 +02:00
parent b91ef9cf13
commit 15280cb441
2 changed files with 4 additions and 6 deletions

View File

@@ -621,7 +621,7 @@ int32_t komodo_block2height(CBlock *block)
//for (i=0; i<6; i++)
// printf("%02x",ptr[i]);
n = ptr[0];
for (i=0; i<n; i++)
for (i=0; i<4; i++)
{
//03bb81000101(bb 187) (81 48001) (00 12288256) <- coinbase.6 ht.12288256
height += ((uint32_t)ptr[i+1] << (i*8));
@@ -727,7 +727,7 @@ int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t hei
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 ( (pindex= chainActive[height]) != 0 )
if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 )
{
timestamp = pindex->GetBlockTime();
if ( pubkey33 == 0 )

View File

@@ -200,18 +200,16 @@ const char *Notaries_elected1[][2] =
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp)
{
int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp;
if ( timestamp == 0 && (timestamp= komodo_heightstamp(height)) == 0 )
timestamp = (uint32_t)time(NULL) - 777;
if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 )
{
if ( timestamp < KOMODO_NOTARIES_TIMESTAMP1 || height < KOMODO_NOTARIES_HEIGHT1 )
if ( (timestamp != 0 && timestamp < KOMODO_NOTARIES_TIMESTAMP1) || height < KOMODO_NOTARIES_HEIGHT1 )
{
n = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0));
for (i=0; i<n; i++)
decode_hex(pubkeys[i],33,(char *)Notaries_elected0[i][1]);
fprintf(stderr,"height.%d t.%u elected.%d notaries\n",height,timestamp,n);
}
else // if ( timestamp < KOMODO_NOTARIES_TIMESTAMP2 || height < KOMODO_NOTARIES_HEIGHT2 )
else //if ( (timestamp != 0 && timestamp < KOMODO_NOTARIES_TIMESTAMP2) || height < KOMODO_NOTARIES_HEIGHT2 )
{
n = (int32_t)(sizeof(Notaries_elected1)/sizeof(*Notaries_elected1));
for (i=0; i<n; i++)