diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index ac4b661cf..6bcd3a70b 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -71,9 +71,21 @@ CBlockIndex *komodo_chainactive(int32_t height); void WaitForShutdown(boost::thread_group* threadGroup) { int32_t i,height; CBlockIndex *pindex; bool fShutdown = ShutdownRequested(); const uint256 zeroid; - //fprintf(stderr,"%s: fShutdown=%d, KOMODO_EARLYTXID_HEIGHT=%d\n", __FUNCTION__, fShutdown, KOMODO_EARLYTXID_HEIGHT); - //fprintf(stderr,"%s: earlytxid=%s, tx_height=%d\n", __FUNCTION__, KOMODO_EARLYTXID.GetHex(), tx_height(KOMODO_EARLYTXID) ); - //fprintf(stderr,"%s: komodo_currentheight=%d\n", __FUNCTION__, komodo_currentheight() ); + // Tell the main threads to shutdown. + if (komodo_currentheight()>KOMODO_EARLYTXID_HEIGHT && KOMODO_EARLYTXID!=zeroid && ((height=tx_height(KOMODO_EARLYTXID))==0 || height>KOMODO_EARLYTXID_HEIGHT)) + { + fprintf(stderr,"%s: error: earlytx must be before block height %d or tx does not exist\n",__FUNCTION__, KOMODO_EARLYTXID_HEIGHT); + fprintf(stderr,"%s: earlytxid=%s, tx_height=%d, komodo_currentheight=%d\n", __FUNCTION__, KOMODO_EARLYTXID.GetHex().c_str(), tx_height(KOMODO_EARLYTXID), komodo_currentheight() ); + StartShutdown(); + } + /*if ( ASSETCHAINS_STAKED == 0 && ASSETCHAINS_ADAPTIVEPOW == 0 && (pindex= komodo_chainactive(1)) != 0 ) + { + if ( pindex->nTime > ADAPTIVEPOW_CHANGETO_DEFAULTON ) + { + ASSETCHAINS_ADAPTIVEPOW = 1; + fprintf(stderr,"default activate adaptivepow\n"); + } else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,ADAPTIVEPOW_CHANGETO_DEFAULTON); + } //else fprintf(stderr,"cant find height 1\n");*/ if ( ASSETCHAINS_CBOPRET != 0 ) { komodo_pricesinit(); diff --git a/src/init.cpp b/src/init.cpp index 823867585..e1cf892c6 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -984,12 +984,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) std::set_new_handler(new_handler_terminate); - fprintf(stderr,"%s: set signal handlers\n", __FUNCTION__); + //fprintf(stderr,"%s: set signal handlers\n", __FUNCTION__); // ********************************************************* Step 2: parameter interactions const CChainParams& chainparams = Params(); - fprintf(stderr,"%s: got chain params\n", __FUNCTION__); + //fprintf(stderr,"%s: got chain params\n", __FUNCTION__); // Set this early so that experimental features are correctly enabled/disabled fExperimentalMode = GetBoolArg("-experimentalfeatures", true); @@ -2086,8 +2086,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) MilliSleep(10); } - fprintf(stderr,"%s fRequestShutdown=%d\n", __FUNCTION__, !!fRequestShutdown); - // ********************************************************* Step 11: start node fprintf(stderr,"Checking disk space...\n"); @@ -2108,7 +2106,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); #endif - fprintf(stderr,"%s fRequestShutdown=%d\n", __FUNCTION__, !!fRequestShutdown); // Start the thread that notifies listeners of transactions that have been // recently added to the mempool. threadGroup.create_thread(boost::bind(&TraceThread, "txnotify", &ThreadNotifyRecentlyAdded)); @@ -2135,15 +2132,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) SetRPCWarmupFinished(); fprintf(stderr,"RPC warmump finished\n"); uiInterface.InitMessage(_("Done loading!")); - fprintf(stderr,"%s fRequestShutdown=%d\n", __FUNCTION__, !!fRequestShutdown); #ifdef ENABLE_WALLET if (pwalletMain) { - fprintf(stderr,"%s reaccepting wallet xtns\n", __FUNCTION__); + fprintf(stderr,"%s Reaccepting wallet xtns\n", __FUNCTION__); // Add wallet transactions that aren't already in a block to mapTransactions pwalletMain->ReacceptWalletTransactions(); - fprintf(stderr,"%s starting wallet flusher thread\n", __FUNCTION__); + fprintf(stderr,"%s Starting wallet flusher thread\n", __FUNCTION__); // Run a thread to flush wallet periodically threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile))); } diff --git a/src/main.cpp b/src/main.cpp index 4a677204e..264cb0643 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4594,7 +4594,7 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc * that is already loaded (to avoid loading it again from disk). */ bool ActivateBestChain(bool fSkipdpow, CValidationState &state, CBlock *pblock) { - fprintf(stderr,"%s: fSkipdpow=%d\n", __FUNCTION__, fSkipdpow); + //fprintf(stderr,"%s: fSkipdpow=%d\n", __FUNCTION__, fSkipdpow); CBlockIndex *pindexNewTip = NULL; CBlockIndex *pindexMostWork = NULL; const CChainParams& chainParams = Params();