diff --git a/src/hush_bitcoind.h b/src/hush_bitcoind.h index 0271a80d1..ce90b6347 100644 --- a/src/hush_bitcoind.h +++ b/src/hush_bitcoind.h @@ -664,18 +664,6 @@ int32_t hush_isPoS(CBlock *pblock,int32_t height,bool fJustCheck) return(0); } -void komodo_disconnect(CBlockIndex *pindex,CBlock& block) -{ - char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp; - //fprintf(stderr,"disconnect ht.%d\n",pindex->GetHeight()); - hush_init(pindex->GetHeight()); - if ( (sp= hush_stateptr(symbol,dest)) != 0 ) - { - //sp->rewinding = pindex->GetHeight(); - //fprintf(stderr,"-%d ",pindex->GetHeight()); - } else printf("hush_disconnect: ht.%d cant get hush_state.(%s)\n",pindex->GetHeight(),SMART_CHAIN_SYMBOL); -} - int32_t hush_is_notarytx(const CTransaction& tx) { uint8_t *ptr; static uint8_t crypto555[33]; @@ -805,47 +793,6 @@ uint32_t hush_heightstamp(int32_t height) return(0); } -/*void komodo_pindex_init(CBlockIndex *pindex,int32_t height) gets data corrupted -{ - int32_t i,num; uint8_t pubkeys[64][33]; CBlock block; - if ( pindex->didinit != 0 ) - return; - //printf("pindex.%d komodo_pindex_init notary.%d from height.%d\n",pindex->GetHeight(),pindex->notaryid,height); - if ( pindex->didinit == 0 ) - { - pindex->notaryid = -1; - if ( HUSH_LOADINGBLOCKS == 0 ) - memset(pindex->pubkey33,0xff,33); - else memset(pindex->pubkey33,0,33); - if ( hush_blockload(block,pindex) == 0 ) - { - hush_block2pubkey33(pindex->pubkey33,&block); - //for (i=0; i<33; i++) - // fprintf(stderr,"%02x",pindex->pubkey33[i]); - //fprintf(stderr," set pubkey at height %d/%d\n",pindex->GetHeight(),height); - //if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 ) - // pindex->didinit = (HUSH_LOADINGBLOCKS == 0); - } // else fprintf(stderr,"error loading block at %d/%d",pindex->GetHeight(),height); - } - if ( pindex->didinit != 0 && pindex->GetHeight() >= 0 && (num= hush_notaries(pubkeys,(int32_t)pindex->GetHeight(),(uint32_t)pindex->nTime)) > 0 ) - { - for (i=0; ipubkey33,33) == 0 ) - { - pindex->notaryid = i; - break; - } - } - if ( 0 && i == num ) - { - for (i=0; i<33; i++) - fprintf(stderr,"%02x",pindex->pubkey33[i]); - fprintf(stderr," unmatched pubkey at height %d/%d\n",pindex->GetHeight(),height); - } - } -}*/ - void hush_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) { int32_t num,i; CBlock block; @@ -857,7 +804,7 @@ void hush_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) } } -int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height) +int32_t hush_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height) { // after the season HF block ALL new notaries instantly become elegible. int32_t i,j,n,duplicate; CBlock block; CBlockIndex *pindex; uint8_t notarypubs33[64][33]; @@ -880,7 +827,9 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blo break; } } - } else fprintf(stderr,"couldnt load block.%d\n",height); + } else { + fprintf(stderr,"%s: couldnt load block height %d\n",__func__,height); + } if ( mids[0] >= 0 && i > 0 && mids[i] == mids[0] ) duplicate++; } @@ -890,7 +839,7 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blo else return(0); } -int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) +int32_t hush_minerids(uint8_t *minerids,int32_t height,int32_t width) { int32_t i,j,nonz,numnotaries; CBlock block; CBlockIndex *pindex; uint8_t notarypubs33[64][33],pubkey33[33]; numnotaries = hush_notaries(notarypubs33,height,0); diff --git a/src/hush_defs.h b/src/hush_defs.h index d57b58644..e51255dd8 100644 --- a/src/hush_defs.h +++ b/src/hush_defs.h @@ -538,7 +538,7 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel); int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len); -int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width); +int32_t hush_minerids(uint8_t *minerids,int32_t height,int32_t width); int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[DRAGON_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen); uint32_t hush_blocktime(uint256 hash); diff --git a/src/main.cpp b/src/main.cpp index 6e3c24571..785dd5ee2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2952,7 +2952,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex *pfClean = false; bool fClean = true; - //komodo_disconnect(pindex,block); does nothing? + CBlockUndo blockUndo; CDiskBlockPos pos = pindex->GetUndoPos(); if (pos.IsNull()) diff --git a/src/miner.cpp b/src/miner.cpp index dd635493c..7e5e0361c 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -955,7 +955,7 @@ static bool ProcessBlockFound(CBlock* pblock) } int32_t hush_baseid(char *origbase); -int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height); +int32_t hush_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height); arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc); int32_t FOUND_BLOCK,HUSH_MAYBEMINED; extern int32_t HUSH_LASTMINED,HUSH_INSYNC; @@ -1188,7 +1188,7 @@ void static BitcoinMiner() int32_t dispflag = 0; if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) || notaryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 ) dispflag = 1; - komodo_eligiblenotary(pubkeys,mids,blocktimes,&nonzpkeys,pindexPrev->GetHeight()); + hush_eligiblenotary(pubkeys,mids,blocktimes,&nonzpkeys,pindexPrev->GetHeight()); if ( nonzpkeys > 0 ) { for (i=0; i<33; i++) diff --git a/src/pow.cpp b/src/pow.cpp index c8b30ea3f..e42af6720 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -679,7 +679,7 @@ extern int32_t HUSH_CHOSEN_ONE; extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN]; #define KOMODO_ELECTION_GAP 2000 -int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height); +int32_t hush_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height); int32_t HUSH_LOADINGBLOCKS = 1; extern std::string NOTARY_PUBKEY; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index f6a1f6dde..82f73036c 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -928,7 +928,7 @@ UniValue minerids(const UniValue& params, bool fHelp, const CPubKey& mypk) if ( pblockindex != 0 ) timestamp = pblockindex->GetBlockTime(); } - if ( (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) + if ( (n= hush_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) { memset(tally,0,sizeof(tally)); numnotaries = hush_notaries(pubkeys,height,timestamp);