EARLYTXID fixes (#28)
This commit is contained in:
committed by
GitHub
parent
a7fe381748
commit
4ff591e40d
@@ -68,8 +68,13 @@ void komodo_cbopretupdate(int32_t forceflag);
|
|||||||
|
|
||||||
void WaitForShutdown(boost::thread_group* threadGroup)
|
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.
|
// 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 )
|
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||||
komodo_pricesinit();
|
komodo_pricesinit();
|
||||||
while (!fShutdown)
|
while (!fShutdown)
|
||||||
|
|||||||
@@ -86,12 +86,12 @@ pegs CC is able to create a coin backed (by any supported coin with gateways CC
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// start of consensus code
|
// start of consensus code
|
||||||
#ifndef PEGS_TRSHOLDS
|
#ifndef PEGS_THRESHOLDS
|
||||||
#define PEGS_TRSHOLDS
|
#define PEGS_THRESHOLDS
|
||||||
#define PEGS_ACCOUNT_YELLOW_ZONE 60
|
#define PEGS_ACCOUNT_YELLOW_ZONE 60
|
||||||
#define PEGS_ACCOUNT_TRESHOLD 90
|
#define PEGS_ACCOUNT_THRESHOLD 90
|
||||||
#define PEGS_GLOBAL_TRESHOLD 60
|
#define PEGS_GLOBAL_THRESHOLD 60
|
||||||
#endif // PEGS_TRSHOLDS
|
#endif // PEGS_THRESHOLDS
|
||||||
#define CC_MARKER_VALUE 10000
|
#define CC_MARKER_VALUE 10000
|
||||||
|
|
||||||
extern uint64_t ASSETCHAINS_PEGSCCPARAMS[3];
|
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);
|
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||||
return("");
|
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);
|
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1788,12 +1788,6 @@ void komodo_args(char *argv0)
|
|||||||
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
|
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
|
||||||
}
|
}
|
||||||
KOMODO_EARLYTXID = Parseuint256(GetArg("-earlytxid","0").c_str());
|
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();
|
|
||||||
}
|
|
||||||
ASSETCHAINS_EARLYTXIDCONTRACT = GetArg("-ac_earlytxidcontract",0);
|
ASSETCHAINS_EARLYTXIDCONTRACT = GetArg("-ac_earlytxidcontract",0);
|
||||||
if ( name.c_str()[0] != 0 )
|
if ( name.c_str()[0] != 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user