From 6a877e46d5ca4fb32ed07bd0b38e54f7137c58dc Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 12:23:35 +0200 Subject: [PATCH] Test --- src/init.cpp | 20 +++++--------------- src/komodo_globals.h | 2 +- src/komodo_utils.h | 4 ++-- src/main.cpp | 6 ++---- src/pow.cpp | 7 ++++--- src/wallet/wallet.cpp | 4 ++-- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 95bff62d5..59dcc27b9 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1244,14 +1244,10 @@ 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)); } - extern int32_t KOMODO_REWIND; - if ( KOMODO_REWIND == 0 ) - { - if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3), - GetArg("-checkblocks", 288))) { - strLoadError = _("Corrupted block database detected"); - break; - } + 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()); @@ -1464,13 +1460,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) 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; - extern int32_t KOMODO_REWIND; - if ( KOMODO_REWIND < 0 ) - { - KOMODO_REWIND = 0; - fprintf(stderr,"bypass ActivateBestChain\n"); - } - else if ( !ActivateBestChain(state)) + if ( !ActivateBestChain(state)) strErrors << "Failed to connect best block"; std::vector vImportFiles; diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 9af4d0b36..9b93ff57e 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -40,7 +40,7 @@ struct komodo_state KOMODO_STATES[34]; #define _COINBASE_MATURITY 100 int COINBASE_MATURITY = _COINBASE_MATURITY;//100; -int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET; +int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET; int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES; uint8_t NOTARY_PUBKEY33[33]; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 7c99aa4b2..1c32bb068 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1463,10 +1463,10 @@ void komodo_args() KOMODO_PAX = 1; } else KOMODO_PAX = GetArg("-pax",0); name = GetArg("-ac_name",""); - if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) + /*if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) { printf("KOMODO_REWIND %d\n",KOMODO_REWIND); - } + }*/ if ( name.c_str()[0] != 0 ) { ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); diff --git a/src/main.cpp b/src/main.cpp index 91e1ed721..a45caae1a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2758,7 +2758,6 @@ static void PruneBlockIndexCandidates() { * pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork. */ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork, CBlock *pblock) { - extern int32_t KOMODO_REWIND; AssertLockHeld(cs_main); bool fInvalidFound = false; const CBlockIndex *pindexOldTip = chainActive.Tip(); @@ -2769,6 +2768,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo if (!DisconnectTip(state)) return false; } + /*fprintf(stderr,"chaintip %d vs rewind.%d\n",(int32_t)chainActive.Tip()->nHeight,KOMODO_REWIND); if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight >= KOMODO_REWIND ) { fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); @@ -2783,15 +2783,13 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo fprintf(stderr,"end rewind ht.%d\n",chainActive.Tip()->nHeight); if ( chainActive.Tip()->nHeight == KOMODO_REWIND ) { - pindexOldTip = pindexMostWork = chainActive.Tip(); fprintf(stderr,"reached rewind.%d, best to do: ./komodo-cli stop\n",KOMODO_REWIND); - pindexFork = chainActive.FindFork(pindexMostWork); sleep(3); return(true); } pindexOldTip = chainActive.Tip(); pindexFork = chainActive.FindFork(pindexMostWork); - } + }*/ // Build list of new blocks to connect. std::vector vpindexToConnect; bool fContinue = true; diff --git a/src/pow.cpp b/src/pow.cpp index cfdaea121..655a9dfad 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -119,7 +119,7 @@ extern std::string NOTARY_PUBKEY; bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params) { - extern int32_t KOMODO_REWIND; + //extern int32_t KOMODO_REWIND; bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66]; arith_uint256 bnTarget; CBlockIndex *pindex; uint8_t pubkeys[66][33]; @@ -155,7 +155,8 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( (height < 235300 || height >= 236000) && KOMODO_LOADINGBLOCKS == 0 && height > 188000 && KOMODO_REWIND == 0 )//186269, 182507&& komodo_chainactive(height) != 0 && nonzpkeys > 0 + if ( (height < 235300 || height >= 236000) && KOMODO_LOADINGBLOCKS == 0 && height > 188000 ) + //&& KOMODO_REWIND == 0 )//186269, 182507&& komodo_chainactive(height) != 0 && nonzpkeys > 0 { int32_t i; for (i=31; i>=0; i--) @@ -163,7 +164,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in printf(" hash vs "); for (i=31; i>=0; i--) printf("%02x",((uint8_t *)&bnTarget)[i]); - printf(" ht.%d REWIND.%d special.%d notaryid.%d ht.%d mod.%d error\n",height,KOMODO_REWIND,special,notaryid,height,(height % 35)); + printf(" ht.%d special.%d notaryid.%d ht.%d mod.%d error\n",height,special,notaryid,height,(height % 35)); for (i=0; i<33; i++) printf("%02x",pubkey33[i]); printf(" <- pubkey\n"); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 091fb5e22..ac7f1f9f5 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -757,7 +757,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex, void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex) { - extern int32_t KOMODO_REWIND; + //extern int32_t KOMODO_REWIND; { LOCK(cs_wallet); for (std::pair& wtxItem : mapWallet) { @@ -806,7 +806,7 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex) extern char ASSETCHAINS_SYMBOL[16]; fprintf(stderr,"%s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize); } - if ( KOMODO_REWIND == 0 ) + //if ( KOMODO_REWIND == 0 ) assert(nWitnessCacheSize > 0); //if (fFileBacked) { // CWalletDB walletdb(strWalletFile);