Skip to content

Commit

Permalink
Exosis Core 0.18.18.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
uhliksk committed Aug 8, 2019
1 parent ce4fe04 commit f6774b7
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 51 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 18)
define(_CLIENT_VERSION_REVISION, 18)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_BUILD, 2)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
Expand Down
46 changes: 23 additions & 23 deletions src/chainparams.cpp
Expand Up @@ -74,7 +74,7 @@ class CMainParams : public CChainParams {

// Dash
consensus.nMasternodeMinimumConfirmations = 1;
consensus.nMasternodePaymentsStartBlock = 10;
consensus.nMasternodePaymentsStartBlock = 10;
consensus.nMasternodePaymentsIncreaseBlock = 50;
consensus.nMasternodePaymentsIncreasePeriod = 365 * 1440; // 1 common year
consensus.nMasternodeCollateralMinimum = 100000; // starting MN collateral
Expand Down Expand Up @@ -224,21 +224,21 @@ class CTestNetParams : public CChainParams {

// Dash
consensus.nMasternodeMinimumConfirmations = 1;
consensus.nMasternodePaymentsStartBlock = 10; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
consensus.nMasternodePaymentsIncreaseBlock = 10;
consensus.nMasternodePaymentsIncreasePeriod = 25;
consensus.nMasternodePaymentsStartBlock = 10;
consensus.nMasternodePaymentsIncreaseBlock = 50;
consensus.nMasternodePaymentsIncreasePeriod = 365 * 1440; // 1 common year
consensus.nMasternodeCollateralMinimum = 100000; // starting MN collateral
consensus.nMasternodeCollateralMaximum = 100000; // MN collateral at infinity

consensus.nInstantSendKeepLock = 6;
consensus.nInstantSendKeepLock = 24;

consensus.nBudgetPaymentsStartBlock = 999 * 365 * 576; // 999 common years
consensus.nBudgetPaymentsCycleBlocks = 50;
consensus.nBudgetPaymentsWindowBlocks = 10;
consensus.nBudgetProposalEstablishingTime = 60*20;
consensus.nBudgetPaymentsCycleBlocks = 10958; // weekly
consensus.nBudgetPaymentsWindowBlocks = 100;
consensus.nBudgetProposalEstablishingTime = 86400; // 1 day

consensus.nSuperblockStartBlock = 999 * 365 * 576; // 999 common years
consensus.nSuperblockCycle = 24;
consensus.nSuperblockStartBlock = 999 * 365 * 1440; // 999 common years
consensus.nSuperblockCycle = 10958; // weekly

consensus.nGovernanceMinQuorum = 10;
consensus.nGovernanceFilterElements = 20000;
Expand Down Expand Up @@ -353,32 +353,32 @@ class CRegTestParams : public CChainParams {
public:
explicit CRegTestParams(const ArgsManager& args) {
strNetworkID = "regtest";
consensus.nSubsidyHalvingInterval = 150;
consensus.nSubsidyHalvingInterval = 100000;

// EXOSIS BEGIN
consensus.nMinimumSubsidy = 0.00100000 * COIN;
// EXOSIS END

// Dash
consensus.nMasternodeMinimumConfirmations = 1;
consensus.nMasternodePaymentsStartBlock = 10;
consensus.nMasternodePaymentsIncreaseBlock = 10;
consensus.nMasternodePaymentsIncreasePeriod = 25;
consensus.nMasternodePaymentsStartBlock = 10;
consensus.nMasternodePaymentsIncreaseBlock = 50;
consensus.nMasternodePaymentsIncreasePeriod = 365 * 1440; // 1 common year
consensus.nMasternodeCollateralMinimum = 100000; // starting MN collateral
consensus.nMasternodeCollateralMaximum = 100000; // MN collateral at infinity

consensus.nInstantSendKeepLock = 6;
consensus.nInstantSendKeepLock = 24;

consensus.nBudgetPaymentsStartBlock = 99999999;
consensus.nBudgetPaymentsCycleBlocks = 50;
consensus.nBudgetPaymentsWindowBlocks = 10;
consensus.nBudgetProposalEstablishingTime = 60*20;
consensus.nBudgetPaymentsStartBlock = 999 * 365 * 576; // 999 common years
consensus.nBudgetPaymentsCycleBlocks = 10958; // weekly
consensus.nBudgetPaymentsWindowBlocks = 100;
consensus.nBudgetProposalEstablishingTime = 86400; // 1 day

consensus.nSuperblockStartBlock = 99999999;
consensus.nSuperblockCycle = 10;
consensus.nSuperblockStartBlock = 999 * 365 * 1440; // 999 common years
consensus.nSuperblockCycle = 10958; // weekly

consensus.nGovernanceMinQuorum = 1;
consensus.nGovernanceFilterElements = 100;
consensus.nGovernanceMinQuorum = 10;
consensus.nGovernanceFilterElements = 20000;
//

// EXOSIS TODO: BIP16Exception is valid for BTC blockchain only
Expand Down
2 changes: 1 addition & 1 deletion src/compressor.h
Expand Up @@ -106,7 +106,7 @@ class CTxOutCompressor
CScriptCompressor cscript(REF(txout.scriptPubKey));
READWRITE(cscript);
// EXOSIS BEGIN
if (txout.nValue == 100000 * COIN)
if (txout.nValue == 100000 * COIN && HexStr(txout.scriptPubKey.begin(), txout.scriptPubKey.end()) != "76a9142512f68cb0d161dee3c70f66caf6ba3ce8bb4e2788ac")
{
READWRITE(txout.masternodeIP);
READWRITE(txout.pubKeyMN);
Expand Down
11 changes: 6 additions & 5 deletions src/init.cpp
Expand Up @@ -650,6 +650,7 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex

std::string strCmd = gArgs.GetArg("-blocknotify", "");
if (!strCmd.empty()) {
boost::replace_all(strCmd, "%s.pow", pBlockIndex->GetBlockPoWHash().GetHex());
boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex());
std::thread t(runCommand, strCmd);
t.detach(); // thread runs free
Expand Down Expand Up @@ -1246,12 +1247,12 @@ bool AppInitParameterInteraction()
// algo switch
std::string strAlgo = gArgs.GetArg("-algo","x16r");
transform(strAlgo.begin(), strAlgo.end(), strAlgo.begin(), ::tolower);
if (strAlgo == "exosis")
miningAlgo = ALGO_EXOSIS;
else if (strAlgo == "x16r")
//if (strAlgo == "exosis")
// miningAlgo = ALGO_EXOSIS;
//else if (strAlgo == "x16r")
miningAlgo = ALGO_X16R;
else
miningAlgo = ALGO_EXOSIS; // EXOSIS TODO: we should not be here
//else
// miningAlgo = ALGO_EXOSIS; // EXOSIS TODO: we should not be here
// EXOSIS END

return true;
Expand Down
21 changes: 15 additions & 6 deletions src/pow.cpp
Expand Up @@ -19,17 +19,23 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockH
if (params.fPowNoRetargeting)
return pindexLast->nBits;

// block spacing fix active
const bool fFix = (pindexLast->nHeight >= sporkManager.GetSporkValue(SPORK_EXOSIS_05_FIX_HEIGHT));

const arith_uint256 bnPowLimit = UintToArith256(params.powLimit);

const int64_t nPastAlgoFastBlocks = 5; // fast average for algo
const int64_t nPastAlgoBlocks = nPastAlgoFastBlocks * 5; // average for algo
const int64_t nPastAlgoBlocks = nPastAlgoFastBlocks * (fFix ? ALGO_ACTIVE_COUNT : 5); // average for algo

const int64_t nPastFastBlocks = nPastAlgoFastBlocks * 2; //fast average for chain
int64_t nPastBlocks = nPastFastBlocks * 5; // average for chain
int64_t nPastBlocks = nPastFastBlocks * (fFix ? ALGO_ACTIVE_COUNT : 5); // average for chain

// stabilizing block spacing
if ((pindexLast->nHeight + 1) >= 0)
nPastBlocks *= 100;
// use daily average to stabilize difficulty
if (fFix)
nPastBlocks = 576;

// make sure we have at least ALGO_ACTIVE_COUNT blocks, otherwise just return powLimit
if (!pindexLast || pindexLast->nHeight < nPastBlocks) {
Expand Down Expand Up @@ -113,7 +119,7 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockH
if (pindexAlgo && pindexAlgoLast && nCountAlgoBlocks > 1)
{
// EXOSIS instamine protection for algo
if (pindexLast->GetBlockTime() - pindexAlgoFast->GetBlockTime() < params.nPowTargetSpacing * 5 / 2)
if (pindexLast->GetBlockTime() - pindexAlgoFast->GetBlockTime() < params.nPowTargetSpacing * (fFix ? ALGO_ACTIVE_COUNT : 5) / 2)
{
nCountAlgoBlocks = nCountAlgoFastBlocks;
pindexAlgo = pindexAlgoFast;
Expand All @@ -124,7 +130,7 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockH

// pindexLast instead of pindexAlgoLst on purpose
int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexAlgo->GetBlockTime();
int64_t nTargetTimespan = nCountAlgoBlocks * params.nPowTargetSpacing * 5;
int64_t nTargetTimespan = nCountAlgoBlocks * params.nPowTargetSpacing * (fFix ? ALGO_ACTIVE_COUNT : 5);

// higher algo diff faster
if (nActualTimespan < 1)
Expand Down Expand Up @@ -209,8 +215,11 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
{
unsigned int nBits = DarkGravityWave(pindexLast, pblock, params);

// Dead lock protection will halve work every block spacing when no block for 2 * 5 * block spacing (Exosis: every 2.5 minutes if no block for 25 minutes)
int nHalvings = (pblock->GetBlockTime() - pindexLast->GetBlockTime()) / (params.nPowTargetSpacing * 2) - 5 + 1;
// Block spacing fix active
const bool fFix = (pindexLast->nHeight >= sporkManager.GetSporkValue(SPORK_EXOSIS_05_FIX_HEIGHT));

// Dead lock protection will halve work every block spacing when no block for 2 * ALGO_ACTIVE_COUNT * block spacing (Exosis: every 2.5 minutes if no block for 5 minutes)
int nHalvings = (pblock->GetBlockTime() - pindexLast->GetBlockTime()) / (params.nPowTargetSpacing * 2) - (fFix ? ALGO_ACTIVE_COUNT : 5) + 1;
if (nHalvings > 0)
{
const arith_uint256 bnPowLimit = UintToArith256(params.powLimit);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/block.h
Expand Up @@ -24,7 +24,7 @@ enum {
ALGO_NULL
};

const unsigned int ALGO_ACTIVE_COUNT = 2;
const unsigned int ALGO_ACTIVE_COUNT = 1; // X16R only
// EXOSIS END

/** Nodes collect new transactions into a block, hash them into a hash tree,
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoin.cpp
Expand Up @@ -396,7 +396,7 @@ void BitcoinApplication::shutdownResult()

void BitcoinApplication::handleRunawayException(const QString &message)
{
QMessageBox::critical(nullptr, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + message);
QMessageBox::critical(nullptr, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Exosis can no longer continue safely and will quit.") + QString("\n\n") + message);
::exit(EXIT_FAILURE);
}

Expand Down
49 changes: 41 additions & 8 deletions src/rpc/masternode.cpp
Expand Up @@ -30,6 +30,16 @@

// EXOSIS BEGIN
#include <wallet/rpcwallet.h>

/*
static std::string FormatVersion(int nVersion)
{
if (nVersion % 100 == 0)
return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
else
return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100);
}
*/
// EXOSIS END

UniValue masternodelist(const JSONRPCRequest& request);
Expand Down Expand Up @@ -169,7 +179,7 @@ UniValue masternode(const JSONRPCRequest& request)
strCommand != "start-disabled" && strCommand != "outputs" &&
#endif // ENABLE_WALLET
strCommand != "list" && strCommand != "list-conf" && strCommand != "count" &&
strCommand != "debug" && strCommand != "current" && strCommand != "winner" && strCommand != "winners" && strCommand != "genkey" &&
strCommand != "debug" && //strCommand != "current" && strCommand != "winner" && strCommand != "winners" && strCommand != "genkey" &&
// EXOSIS BEGIN
//strCommand != "connect" && strCommand != "status"))
strCommand != "connect" && strCommand != "status" && strCommand != "collateral"))
Expand All @@ -180,8 +190,8 @@ UniValue masternode(const JSONRPCRequest& request)
{
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute, must be one of:\n"
" \"count\" - Print number of all known masternodes (optional: \"ps\", \"enabled\", \"all\", \"qualify\")\n"
" \"current\" - Print info on current masternode winner to be paid the next block (calculated locally)\n"
" \"genkey\" - Generate new masternodeprivkey\n"
//" \"current\" - Print info on current masternode winner to be paid the next block (calculated locally)\n"
//" \"genkey\" - Generate new masternodeprivkey\n"
#ifdef ENABLE_WALLET
" \"outputs\" - Print masternode compatible outputs\n"
" \"start-alias\" - Start single remote masternode by assigned alias configured in masternode.conf\n"
Expand All @@ -190,8 +200,8 @@ UniValue masternode(const JSONRPCRequest& request)
" \"status\" - Print masternode status information\n"
" \"list\" - Print list of all known masternodes (see masternodelist for more info)\n"
" \"list-conf\" - Print masternode.conf in JSON format\n"
" \"winner\" - Print info on next masternode winner to vote for\n"
" \"winners\" - Print list of masternode winners\n"
//" \"winner\" - Print info on next masternode winner to vote for\n"
//" \"winners\" - Print list of masternode winners\n"
// EXOSIS BEGIN
" \"collateral\" - Print actual masternode collateral value"
// EXOSIS END
Expand Down Expand Up @@ -524,14 +534,14 @@ UniValue masternode(const JSONRPCRequest& request)

UniValue masternodelist(const JSONRPCRequest& request)
{
std::string strMode = "status";
std::string strMode = "json";
std::string strFilter = "";

if (request.params.size() >= 1) strMode = request.params[0].get_str();
if (request.params.size() == 2) strFilter = request.params[1].get_str();

if (request.fHelp || (
strMode != "activeseconds" && strMode != "addr" && strMode != "full" && strMode != "info" &&
strMode != "activeseconds" && strMode != "addr" && strMode != "full" && strMode != "info" && strMode != "json" &&
strMode != "lastseen" && strMode != "lastpaidtime" && strMode != "lastpaidblock" &&
strMode != "protocol" && strMode != "payee" && strMode != "pubkey" &&
strMode != "rank" && strMode != "status"))
Expand All @@ -548,6 +558,7 @@ UniValue masternodelist(const JSONRPCRequest& request)
" (can be additionally filtered, partial match)\n"
" \"info\" - Print info in format 'status protocol payee lastseen activeseconds sentinelversion sentinelstate IP'\n"
" (can be additionally filtered, partial match)\n"
" \"json\" - Print info in JSON format (can be additionally filtered, partial match)\n"
" \"lastpaidblock\" - Print the last block height a node was paid on the network\n"
" \"lastpaidtime\" - Print the last time a node was paid on the network\n"
" \"lastseen\" - Print timestamp of when a masternode was last seen on the network\n"
Expand All @@ -571,7 +582,7 @@ UniValue masternodelist(const JSONRPCRequest& request)
}.ToString());
}

if (strMode == "full" || strMode == "lastpaidtime" || strMode == "lastpaidblock") {
if (strMode == "json" || strMode == "full" || strMode == "lastpaidtime" || strMode == "lastpaidblock") {
CBlockIndex* pindex = NULL;
{
LOCK(cs_main);
Expand Down Expand Up @@ -632,6 +643,28 @@ UniValue masternodelist(const JSONRPCRequest& request)
if (strFilter !="" && strInfo.find(strFilter) == std::string::npos &&
strOutpoint.find(strFilter) == std::string::npos) continue;
obj.pushKV(strOutpoint, strInfo);
} else if (strMode == "json") {
std::ostringstream streamJson;
streamJson << mn.addr.ToString() << " " <<
EncodeDestination(mn.pubKeyCollateralAddress.GetID()) << " " <<
mn.GetStatus() << " " <<
mn.nProtocolVersion << " " <<
mn.lastPing.nDaemonVersion << " " <<
(int64_t)mn.lastPing.sigTime << " " <<
(int64_t)(mn.lastPing.sigTime - mn.sigTime);
std::string strJson = streamJson.str();
if (strFilter !="" && strJson.find(strFilter) == std::string::npos &&
strOutpoint.find(strFilter) == std::string::npos) continue;
obj.pushKV(strOutpoint, strJson);
UniValue objMN(UniValue::VOBJ);
objMN.pushKV("address", mn.addr.ToString());
objMN.pushKV("payee", EncodeDestination(mn.pubKeyCollateralAddress.GetID()));
objMN.pushKV("status", mn.GetStatus());
objMN.pushKV("protocol", mn.nProtocolVersion);
//objMN.pushKV("daemonversion", mn.lastPing.nDaemonVersion > DEFAULT_DAEMON_VERSION ? FormatVersion(mn.lastPing.nDaemonVersion) : "Unknown");
//objMN.pushKV("lastseen", (int64_t)mn.lastPing.sigTime);
//objMN.pushKV("activeseconds", (int64_t)(mn.lastPing.sigTime - mn.sigTime));
obj.pushKV(strOutpoint, objMN);
} else if (strMode == "lastpaidblock") {
if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) continue;
obj.pushKV(strOutpoint, mn.GetLastPaidBlock());
Expand Down
8 changes: 8 additions & 0 deletions src/spork.cpp
Expand Up @@ -211,6 +211,8 @@ bool CSporkManager::IsSporkActive(int nSporkID)
case SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191: r = SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191_DEFAULT; break;
case SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255: r = SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255_DEFAULT; break;
#endif

case SPORK_EXOSIS_05_FIX_HEIGHT: r = SPORK_EXOSIS_05_FIX_HEIGHT_DEFAULT; break;
// EXOSIS END
default:
LogPrint(BCLog::SPORK, "CSporkManager::IsSporkActive -- Unknown Spork ID %d\n", nSporkID);
Expand Down Expand Up @@ -258,6 +260,8 @@ int64_t CSporkManager::GetSporkValue(int nSporkID)
case SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191: return SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191_DEFAULT;
case SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255: return SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255_DEFAULT;
#endif

case SPORK_EXOSIS_05_FIX_HEIGHT: return SPORK_EXOSIS_05_FIX_HEIGHT_DEFAULT;
// EXOSIS END
default:
LogPrint(BCLog::SPORK, "CSporkManager::GetSporkValue -- Unknown Spork ID %d\n", nSporkID);
Expand Down Expand Up @@ -297,6 +301,8 @@ int CSporkManager::GetSporkIDByName(std::string strName)
if (strName == "SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191") return SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191;
if (strName == "SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255") return SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255;
#endif

if (strName == "SPORK_EXOSIS_05_FIX_HEIGHT") return SPORK_EXOSIS_05_FIX_HEIGHT;
// EXOSIS END

LogPrint(BCLog::SPORK, "CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName);
Expand Down Expand Up @@ -335,6 +341,8 @@ std::string CSporkManager::GetSporkNameByID(int nSporkID)
case SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191: return "SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_128_191";
case SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255: return "SPORK_EXOSIS_04_CHECKPOINT_HASHBITS_192_255";
#endif

case SPORK_EXOSIS_05_FIX_HEIGHT: return "SPORK_EXOSIS_05_FIX_HEIGHT";
// EXOSIS END
default:
LogPrint(BCLog::SPORK, "CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID);
Expand Down

0 comments on commit f6774b7

Please sign in to comment.