diff --git a/src/init.cpp b/src/init.cpp index 59dcc27b9..0f03aac21 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -641,6 +641,8 @@ static void ZC_LoadParams() /** Initialize bitcoin. * @pre Parameters should be parsed and config file should be read. */ +extern int32_t KOMODO_REWIND; + bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) { // ********************************************************* Step 1: setup @@ -1244,10 +1246,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("Prune: pruned datadir may not have more than %d blocks; -checkblocks=%d may fail\n", MIN_BLOCKS_TO_KEEP, GetArg("-checkblocks", 288)); } - if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3), - GetArg("-checkblocks", 288))) { - strLoadError = _("Corrupted block database detected"); - break; + if ( KOMODO_REWIND >= 0 ) + { + if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3), + GetArg("-checkblocks", 288))) { + strLoadError = _("Corrupted block database detected"); + break; + } } } catch (const std::exception& e) { if (fDebug) LogPrintf("%s\n", e.what()); @@ -1456,13 +1461,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) if (mapArgs.count("-blocknotify")) uiInterface.NotifyBlockTip.connect(BlockNotifyCallback); - - uiInterface.InitMessage(_("Activating best chain...")); - // scan for better chains in the block chain database, that are not yet connected in the active best chain - CValidationState state; - if ( !ActivateBestChain(state)) - strErrors << "Failed to connect best block"; - + if ( KOMODO_REWIND >= 0 ) + { + uiInterface.InitMessage(_("Activating best chain...")); + // scan for better chains in the block chain database, that are not yet connected in the active best chain + CValidationState state; + if ( !ActivateBestChain(state)) + strErrors << "Failed to connect best block"; + } std::vector vImportFiles; if (mapArgs.count("-loadblock")) { diff --git a/src/komodo.h b/src/komodo.h index 33e4ea544..62c5a02de 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -545,6 +545,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); notarized = 1; } + if ( NOTARY_PUBKEY33[0] != 0 ) + printf("(tx.%d: ",i); for (j=0; j= sizeof(uint32_t) && len <= sizeof(scriptbuf) ) { @@ -578,6 +582,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } } } + if ( NOTARY_PUBKEY33[0] != 0 ) + printf(") "); //printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification); if ( notarized != 0 && (notarizedheight != 0 || specialtx != 0) ) { @@ -618,6 +624,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } } } + if ( NOTARY_PUBKEY33[0] != 0 ) + printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height); if ( pindex->nHeight == hwmheight ) komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0); } else fprintf(stderr,"komodo_connectblock: unexpected null pindex\n"); diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index fcdcffd6b..558d69575 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -479,7 +479,8 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to } if ( i == 3 ) { - printf("%s not realtime ht.%d\n",ASSETCHAINS_SYMBOL,ht); + if ( tokomodo == 0 ) + printf("%s not realtime ht.%d\n",ASSETCHAINS_SYMBOL,ht); return(0); } if ( tokomodo == 0 ) @@ -575,7 +576,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to PENDING_KOMODO_TX += pax->komodoshis; printf(" len.%d vout.%u DEPOSIT %.8f <- pax.%s pending ht %d %d %.8f | ",len,pax->vout,(double)txNew->vout[numvouts].nValue/COIN,symbol,pax->height,pax->otherheight,dstr(PENDING_KOMODO_TX)); } - if ( numvouts++ >= 1 ) + if ( numvouts++ >= 64 ) break; } if ( numvouts > 1 ) @@ -693,6 +694,13 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above offset += komodo_scriptitemlen(&opretlen,&script[offset]); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { + extern int32_t KOMODO_REWIND; + if ( KOMODO_REWIND < 0 ) + { + fprintf(stderr,"rewind.%d\n",KOMODO_REWIND); + sleep(3); + KOMODO_REWIND = 0; + } for (i=0; inHeight,KOMODO_REWIND); - if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight >= KOMODO_REWIND ) + /*if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight >= KOMODO_REWIND ) { fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); while ( chainActive.Tip()->nHeight > KOMODO_REWIND ) diff --git a/src/miner.cpp b/src/miner.cpp index bd0e5c916..dfec5825a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -663,7 +663,7 @@ void static BitcoinMiner(CWallet *pwallet) if ( i == 33 ) externalflag = 1; else externalflag = 0; - if ( NOTARY_PUBKEY33[0] != 0 && notaryid < 3 ) + if ( NOTARY_PUBKEY33[0] != 0 && (notaryid < 3 || notaryid == 34 || notaryid == 51 || notaryid == 52) ) { for (i=1; i<66; i++) if ( memcmp(pubkeys[i],pubkeys[0],33) == 0 ) @@ -678,19 +678,21 @@ void static BitcoinMiner(CWallet *pwallet) } for (j=gpucount=0; j<65; j++) { - if ( mids[j] >= 0 ) + if ( mids[j] >= 0 || notaryid == 34 ) fprintf(stderr,"%d ",mids[j]); else fprintf(stderr,"GPU "); if ( mids[j] == -1 ) gpucount++; } - fprintf(stderr," <- prev minerids from ht.%d notary.%d gpucount.%d %.2f%%\n",pindexPrev->nHeight,notaryid,gpucount,100.*(double)gpucount/j); + fprintf(stderr," <- prev minerids from ht.%d notary.%d gpucount.%d %.2f%% t.%u\n",pindexPrev->nHeight,notaryid,gpucount,100.*(double)gpucount/j,(uint32_t)time(NULL)); } for (j=0; j<65; j++) if ( mids[j] == notaryid ) break; + if ( j == 65 ) + KOMODO_LASTMINED = 0; } else fprintf(stderr,"no nonz pubkeys\n"); - if ( (Mining_height >= 235300 && Mining_height < 236000) || (j == 65 && Mining_height > KOMODO_MAYBEMINED+3 && Mining_height > KOMODO_LASTMINED+64) ) + if ( (Mining_height >= 235300 && Mining_height < 236000) || (j == 65 && Mining_height > KOMODO_MAYBEMINED+1 && Mining_height > KOMODO_LASTMINED+64) ) { hashTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS); fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1);