fix build
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#define KOMODO_DEFS_H
|
#define KOMODO_DEFS_H
|
||||||
|
|
||||||
#define ASSETCHAINS_MINHEIGHT 128
|
#define ASSETCHAINS_MINHEIGHT 128
|
||||||
|
#define ASSETCHAINS_MAX_ERAS 3
|
||||||
#define KOMODO_ELECTION_GAP 2000
|
#define KOMODO_ELECTION_GAP 2000
|
||||||
#define ROUNDROBIN_DELAY 61
|
#define ROUNDROBIN_DELAY 61
|
||||||
#define KOMODO_ASSETCHAIN_MAXLEN 65
|
#define KOMODO_ASSETCHAIN_MAXLEN 65
|
||||||
|
|||||||
@@ -57,10 +57,8 @@ uint32_t ASSETCHAINS_MAGIC = 2387029918;
|
|||||||
uint64_t ASSETCHAINS_SUPPLY = 10;
|
uint64_t ASSETCHAINS_SUPPLY = 10;
|
||||||
uint64_t ASSETCHAINS_COMMISSION;
|
uint64_t ASSETCHAINS_COMMISSION;
|
||||||
|
|
||||||
#define _MAX_ERAS 3
|
|
||||||
int MAX_ERAS = _MAX_ERAS;
|
|
||||||
uint32_t ASSETCHAINS_ERAS = 1;
|
uint32_t ASSETCHAINS_ERAS = 1;
|
||||||
uint64_t ASSETCHAINS_ENDSUBSIDY[_MAX_ERAS],ASSETCHAINS_REWARD[_MAX_ERAS],ASSETCHAINS_HALVING[_MAX_ERAS],ASSETCHAINS_DECAY[_MAX_ERAS];
|
uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS];
|
||||||
|
|
||||||
uint32_t KOMODO_INITDONE;
|
uint32_t KOMODO_INITDONE;
|
||||||
char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t KMD_PORT = 7771,BITCOIND_PORT = 7771;
|
char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t KMD_PORT = 7771,BITCOIND_PORT = 7771;
|
||||||
|
|||||||
@@ -1501,8 +1501,9 @@ char *argv0names[] =
|
|||||||
int64_t komodo_max_money()
|
int64_t komodo_max_money()
|
||||||
{
|
{
|
||||||
uint64_t max_money;
|
uint64_t max_money;
|
||||||
|
int32_t baseid;
|
||||||
|
|
||||||
if ( (baseid = komodo_baseid(ASSETCHAINS_SYMBOL)) >= 0 && baseid < 32 )
|
if ( ( baseid = komodo_baseid(ASSETCHAINS_SYMBOL)) >= 0 && baseid < 32 )
|
||||||
max_money = komodo_maxallowed(baseid);
|
max_money = komodo_maxallowed(baseid);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1516,9 +1517,9 @@ int64_t komodo_max_money()
|
|||||||
if ( reward > 0 )
|
if ( reward > 0 )
|
||||||
{
|
{
|
||||||
uint64_t lastEnd = j == 0 ? 0 : ASSETCHAINS_ENDSUBSIDY[j - 1];
|
uint64_t lastEnd = j == 0 ? 0 : ASSETCHAINS_ENDSUBSIDY[j - 1];
|
||||||
uint64_t curEnd = ASSETCHAINS_ENDSUBSIDY[j] == 0 ? 10000000 : : ASSETCHAINS_ENDSUBSIDY[j];
|
uint64_t curEnd = ASSETCHAINS_ENDSUBSIDY[j] == 0 ? 10000000 : ASSETCHAINS_ENDSUBSIDY[j];
|
||||||
uint64_t period = ASSETCHAINS_HALVING[j];
|
uint64_t period = ASSETCHAINS_HALVING[j];
|
||||||
uint64_t decay = ASSETCHAINS_DECAY[j];
|
uint64_t nextReward, decay = ASSETCHAINS_DECAY[j];
|
||||||
|
|
||||||
// if exactly SATOSHIDEN, linear decay to zero or next era, same as:
|
// if exactly SATOSHIDEN, linear decay to zero or next era, same as:
|
||||||
// (next_era_reward + (starting reward - next_era_reward) / 2) * num_blocks
|
// (next_era_reward + (starting reward - next_era_reward) / 2) * num_blocks
|
||||||
@@ -1534,11 +1535,11 @@ int64_t komodo_max_money()
|
|||||||
// it can go either up or down if linear, swap to prevent underflow
|
// it can go either up or down if linear, swap to prevent underflow
|
||||||
if ( nextReward > reward )
|
if ( nextReward > reward )
|
||||||
{
|
{
|
||||||
tmp = reward;
|
uint64_t tmp = reward;
|
||||||
reward = nextReward;
|
reward = nextReward;
|
||||||
nextReward = tmp;
|
nextReward = tmp;
|
||||||
}
|
}
|
||||||
max_money += ((nextReward + ((reward - nextReward + 1) >> 1)) * (curEnd - lastEnd);
|
max_money += (nextReward + ((reward - nextReward + 1) >> 1)) * (curEnd - lastEnd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1598,7 +1599,7 @@ uint64_t komodo_ac_block_subsidy(int nHeight)
|
|||||||
nSubsidy = cached_subsidy;
|
nSubsidy = cached_subsidy;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i=0; i < numhalvings && nSubsidy != 0; i++)
|
for (int i=0; i < numhalvings && nSubsidy != 0; i++)
|
||||||
nSubsidy = (nSubsidy * ASSETCHAINS_DECAY[curEra]) / 100000000;
|
nSubsidy = (nSubsidy * ASSETCHAINS_DECAY[curEra]) / 100000000;
|
||||||
cached_subsidy = nSubsidy;
|
cached_subsidy = nSubsidy;
|
||||||
cached_numhalvings = numhalvings;
|
cached_numhalvings = numhalvings;
|
||||||
@@ -1648,20 +1649,20 @@ void komodo_args(char *argv0)
|
|||||||
}
|
}
|
||||||
if ( name.c_str()[0] != 0 )
|
if ( name.c_str()[0] != 0 )
|
||||||
{
|
{
|
||||||
ASSETCHAINS_ERAS = GetArg("-ac_eras",1)
|
ASSETCHAINS_ERAS = GetArg("-ac_eras", 1);
|
||||||
if ( ASSETCHAINS_ERAS < 1 || ASSETCHAINS_ERAS > MAX_ERAS )
|
if ( ASSETCHAINS_ERAS < 1 || ASSETCHAINS_ERAS > ASSETCHAINS_MAX_ERAS )
|
||||||
{
|
{
|
||||||
ASSETCHAINS_ERAS = 1;
|
ASSETCHAINS_ERAS = 1;
|
||||||
printf("ASSETCHAINS_ERAS, if specified, must be between 1 and %u. ASSETCHAINS_ERAS set to %u\n", MAX_ERAS, ASSETCHAINS_ERAS);
|
printf("ASSETCHAINS_ERAS, if specified, must be between 1 and %u. ASSETCHAINS_ERAS set to %u\n", ASSETCHAINS_MAX_ERAS, ASSETCHAINS_ERAS);
|
||||||
}
|
}
|
||||||
ASSETCHAINS_ERAS -= 1;
|
ASSETCHAINS_ERAS -= 1;
|
||||||
|
|
||||||
SplitToi64(GetArg("-ac_end",""), &ASSETCHAINS_ENDSUBSIDY, 0);
|
Split(GetArg("-ac_end",""), ASSETCHAINS_ENDSUBSIDY, 0);
|
||||||
SplitToi64(GetArg("-ac_reward",""), &ASSETCHAINS_REWARD, 0);
|
Split(GetArg("-ac_reward",""), ASSETCHAINS_REWARD, 0);
|
||||||
SplitToi64(GetArg("-ac_halving",""), &ASSETCHAINS_HALVING, 0);
|
Split(GetArg("-ac_halving",""), ASSETCHAINS_HALVING, 0);
|
||||||
SplitToi64(GetArg("-ac_decay",""), &ASSETCHAINS_DECAY, 0);
|
Split(GetArg("-ac_decay",""), ASSETCHAINS_DECAY, 0);
|
||||||
|
|
||||||
for ( int i = 0; i < MAX_ERAS; i++ )
|
for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_HALVING[i] != 0 && ASSETCHAINS_HALVING[i] < 1440 )
|
if ( ASSETCHAINS_HALVING[i] != 0 && ASSETCHAINS_HALVING[i] < 1440 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,7 +106,8 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
|
|||||||
#include "komodo_defs.h"
|
#include "komodo_defs.h"
|
||||||
|
|
||||||
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE;
|
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE;
|
||||||
extern uint32_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION;
|
extern uint64_t ASSETCHAINS_COMMISSION;
|
||||||
|
extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS];
|
||||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||||
extern std::string NOTARY_PUBKEY;
|
extern std::string NOTARY_PUBKEY;
|
||||||
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
||||||
@@ -733,7 +734,7 @@ void static BitcoinMiner()
|
|||||||
CBlock *pblock = &pblocktemplate->block;
|
CBlock *pblock = &pblocktemplate->block;
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_REWARD == 0 )
|
if ( ASSETCHAINS_REWARD[0] == 0 )
|
||||||
{
|
{
|
||||||
if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT )
|
if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT )
|
||||||
{
|
{
|
||||||
|
|||||||
14
src/util.cpp
14
src/util.cpp
@@ -364,12 +364,12 @@ void ParseParameters(int argc, const char* const argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitToi64(const std::string& strVal, int64_t[_MAX_ERAS] *outVals, const int64_t nDefault)
|
void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault)
|
||||||
{
|
{
|
||||||
istringstream ss(strVal);
|
istringstream ss(strVal);
|
||||||
vector<int64_t> vec;
|
vector<uint64_t> vec;
|
||||||
|
|
||||||
int64_t i, numVals = 0;
|
uint64_t i, nLast, numVals = 0;
|
||||||
|
|
||||||
while ( ss.peek() == ' ' )
|
while ( ss.peek() == ' ' )
|
||||||
ss.ignore();
|
ss.ignore();
|
||||||
@@ -388,11 +388,13 @@ void SplitToi64(const std::string& strVal, int64_t[_MAX_ERAS] *outVals, const in
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( numVals > 0 )
|
if ( numVals > 0 )
|
||||||
nDefault = outVals[numVals - 1];
|
nLast = outVals[numVals - 1];
|
||||||
|
else
|
||||||
|
nLast = nDefault;
|
||||||
|
|
||||||
for ( i=numVals; i < MAX_ERAS; i++ )
|
for ( i = numVals; i < ASSETCHAINS_MAX_ERAS; i++ )
|
||||||
{
|
{
|
||||||
outVals[i] = nDefault;
|
outVals[i] = nLast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ inline bool IsSwitchChar(char c)
|
|||||||
* else if the string has fewer than _MAX_ERAS entries, then the last
|
* else if the string has fewer than _MAX_ERAS entries, then the last
|
||||||
* entry fills remaining entries
|
* entry fills remaining entries
|
||||||
*/
|
*/
|
||||||
void SplitToi64(const std::string& strVal, int64_t[_MAX_ERAS] *outVals, int64_t nDefault);
|
void Split(const std::string& strVal, uint64_t *outVals, uint64_t nDefault);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return string argument or default value
|
* Return string argument or default value
|
||||||
|
|||||||
Reference in New Issue
Block a user