diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index ff329a0d6..f0055d7fd 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -68,8 +68,13 @@ void komodo_cbopretupdate(int32_t forceflag); void WaitForShutdown(boost::thread_group* threadGroup) { - int32_t i; bool fShutdown = ShutdownRequested(); + int32_t i,height; bool fShutdown = ShutdownRequested(); const uint256 zeroid; // Tell the main threads to shutdown. + if (komodo_currentheight()>100 && KOMODO_EARLYTXID!=zeroid && ((height=tx_height(KOMODO_EARLYTXID))==0 || height>100)) + { + fprintf(stderr,"error: earlytx must be before block height 100 or tx does not exist\n"); + StartShutdown(); + } if ( ASSETCHAINS_CBOPRET != 0 ) komodo_pricesinit(); while (!fShutdown) diff --git a/src/cc/pegs.cpp b/src/cc/pegs.cpp index 2e658fd0a..96c41b9ff 100644 --- a/src/cc/pegs.cpp +++ b/src/cc/pegs.cpp @@ -86,12 +86,12 @@ pegs CC is able to create a coin backed (by any supported coin with gateways CC */ // start of consensus code -#ifndef PEGS_TRSHOLDS -#define PEGS_TRSHOLDS +#ifndef PEGS_THRESHOLDS +#define PEGS_THRESHOLDS #define PEGS_ACCOUNT_YELLOW_ZONE 60 -#define PEGS_ACCOUNT_TRESHOLD 90 -#define PEGS_GLOBAL_TRESHOLD 60 -#endif // PEGS_TRSHOLDS +#define PEGS_ACCOUNT_THRESHOLD 90 +#define PEGS_GLOBAL_THRESHOLD 60 +#endif // PEGS_THRESHOLDS #define CC_MARKER_VALUE 10000 extern uint64_t ASSETCHAINS_PEGSCCPARAMS[3]; @@ -1154,9 +1154,9 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - if (PegsGetAccountRatio(pegstxid,tokenid,liquidatetxid)<(ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_TRESHOLD) || PegsGetGlobalRatio(pegstxid)<(ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_GLOBAL_TRESHOLD)) + if (PegsGetAccountRatio(pegstxid,tokenid,liquidatetxid)<(ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_THRESHOLD) || PegsGetGlobalRatio(pegstxid)<(ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_GLOBAL_THRESHOLD)) { - CCerror = strprintf("not able to liquidate account until account ratio > %lu%% and global ratio > %lu%%",(ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_TRESHOLD),(ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_GLOBAL_TRESHOLD)); + CCerror = strprintf("not able to liquidate account until account ratio > %lu%% and global ratio > %lu%%",(ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_THRESHOLD),(ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_GLOBAL_THRESHOLD)); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 3e2055204..6a8f9fdea 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1787,13 +1787,7 @@ void komodo_args(char *argv0) { printf("KOMODO_REWIND %d\n",KOMODO_REWIND); } - KOMODO_EARLYTXID = Parseuint256(GetArg("-earlytxid","0").c_str()); - CTransaction tx; uint256 blockhash; - if (KOMODO_EARLYTXID!=zeroid && myGetTransaction(KOMODO_EARLYTXID,tx,blockhash) && (mapBlockIndex[blockhash]->GetHeight() == 0 || mapBlockIndex[blockhash]->GetHeight() > 100)) - { - fprintf(stderr,"error: earlytx can be only in first 100 blocks or tx does not exist\n"); - StartShutdown(); - } + KOMODO_EARLYTXID = Parseuint256(GetArg("-earlytxid","0").c_str()); ASSETCHAINS_EARLYTXIDCONTRACT = GetArg("-ac_earlytxidcontract",0); if ( name.c_str()[0] != 0 ) {