From ef0de476a5209186b460a54436a9e03e6a10a58b Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Apr 2018 21:37:42 +0300 Subject: [PATCH] Test --- src/komodo_bitcoind.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 1f03fabc7..b72814a2a 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -767,15 +767,15 @@ void komodo_pindex_init(CBlockIndex *pindex,int32_t height) void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) { - CBlock block; int32_t num,i; + int32_t num,i; //CBlock block; memset(pubkey33,0,33); if ( pindex != 0 ) { - if ( komodo_blockload(block,pindex) == 0 ) + /*if ( komodo_blockload(block,pindex) == 0 ) { komodo_block2pubkey33(pindex->pubkey33,&block); return; - } + }*/ if ( pindex->didinit != 0 ) { memcpy(pubkey33,pindex->pubkey33,33); @@ -810,6 +810,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *destpubkey33) return(i); } } + fprintf(stderr,"komodo_minerid height.%d null pindex\n"); return(komodo_electednotary(&numnotaries,pubkey33,height,timestamp)); } @@ -823,12 +824,11 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non { if ( pindex->didinit != 0 && (pindex->notaryid >= 64 || pindex->notaryid < -1) ) { - //fprintf(stderr,"unexpected notaryid.%d at ht.%d\n",pindex->notaryid,height-i); + fprintf(stderr,"unexpected notaryid.%d at ht.%d\n",pindex->notaryid,height-i); pindex->notaryid = -1; memset(pindex->pubkey33,0,33); pindex->didinit = 0; - if ( komodo_blockload(block,pindex) == 0 ) - komodo_block2pubkey33(pindex->pubkey33,&block); + komodo_pindex_init(pindex,height); } if ( pindex->notaryid >= 0 && pindex->didinit != 0 ) { @@ -839,8 +839,11 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non else { komodo_pindex_init(pindex,height-i); - //komodo_index2pubkey33(pubkey33,pindex,height-i); - memcpy(pubkeys[i],pindex->pubkey33,33); + if ( pindex->didinit == 0 ) + { + if ( komodo_blockload(block,pindex) == 0 ) + komodo_block2pubkey33(pubkeys[i],&block); + } else memcpy(pubkeys[i],pindex->pubkey33,33); if ( (mids[i]= komodo_minerid(height-i,0)) >= 0 ) { //mids[i] = *(int32_t *)pubkey33;