Merge pull request #1608 from jl777/dev
-const in CBlockIndexWorkComparator
This commit is contained in:
@@ -268,5 +268,27 @@
|
|||||||
"ac_supply": "64000777",
|
"ac_supply": "64000777",
|
||||||
"ac_staked": "10",
|
"ac_staked": "10",
|
||||||
"addnode": ["18.197.20.21"]
|
"addnode": ["18.197.20.21"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ac_name": "HUSH3",
|
||||||
|
"ac_sapling": "1",
|
||||||
|
"ac_founders": "1",
|
||||||
|
"ac_reward": "0,1125000000,562500000",
|
||||||
|
"ac_end": "128,340000,5422111",
|
||||||
|
"ac_blocktime": "150",
|
||||||
|
"ac_supply": "6178674",
|
||||||
|
"ac_halving": "129,340000,840000",
|
||||||
|
"ac_cc": "2",
|
||||||
|
"ac_cclib": "hush3",
|
||||||
|
"ac_ccenable": "228,234,235,236,241",
|
||||||
|
"ac_perc": "11111111",
|
||||||
|
"ac_eras": "3",
|
||||||
|
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac",
|
||||||
|
"clientname": "GoldenSandtrout",
|
||||||
|
"addnode": [
|
||||||
|
"188.165.212.101",
|
||||||
|
"136.243.227.142",
|
||||||
|
"5.9.224.250"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -52,3 +52,4 @@ echo $pubkey
|
|||||||
./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 &
|
./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 &
|
./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 &
|
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 &
|
||||||
|
./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac &
|
||||||
|
|||||||
7
src/fiat/hush
Executable file
7
src/fiat/hush
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#set working directory to the location of this script
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
../komodo-cli -ac_name=HUSH3 "$@"
|
||||||
11
src/hush-cli
Executable file
11
src/hush-cli
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2019 Hush developers
|
||||||
|
|
||||||
|
# set working directory to the location of this script
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
NAME=HUSH3
|
||||||
|
|
||||||
|
CLI=${KOMODOCLI:-./komodo-cli}
|
||||||
|
$CLI -ac_name=$NAME "$@"
|
||||||
52
src/hushd
Executable file
52
src/hushd
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2019 Hush developers
|
||||||
|
|
||||||
|
# set working directory to the location of this script
|
||||||
|
DIR="$( cd "$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" && pwd )"
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
NAME=HUSH3
|
||||||
|
# this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn
|
||||||
|
SCRIPT=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac
|
||||||
|
|
||||||
|
# Chain parameters
|
||||||
|
ERAS=3
|
||||||
|
BLOCKTIME=150
|
||||||
|
# 6250000 - (sprout pool at block 500,000)
|
||||||
|
SUPPLY=6178674
|
||||||
|
FOUNDERS=1
|
||||||
|
REWARD=0,1125000000,562500000
|
||||||
|
PERC=11111111
|
||||||
|
HALVING=129,340000,840000
|
||||||
|
# NOTE: keep in sync with komodo_bitcoind.h
|
||||||
|
END=128,340000,5422111
|
||||||
|
CLIENTNAME=GoldenSandtrout
|
||||||
|
SEEDNODE1=188.165.212.101
|
||||||
|
SEEDNODE2=136.243.227.142
|
||||||
|
SEEDNODE3=5.9.224.250
|
||||||
|
CCLIB=hush3
|
||||||
|
|
||||||
|
# CryptoConditions/Custom Consensus params
|
||||||
|
FAUCET=228
|
||||||
|
HEIR=234
|
||||||
|
CHANNEL=235
|
||||||
|
ORACLE=236
|
||||||
|
GATEWAY=241
|
||||||
|
CCENABLE=$FAUCET,$HEIR,$CHANNEL,$ORACLE,$GATEWAY
|
||||||
|
|
||||||
|
KMD=${KOMODOD:-./komodod}
|
||||||
|
$KMD -ac_name=$NAME -ac_sapling=1 \
|
||||||
|
-ac_reward=$REWARD \
|
||||||
|
-ac_halving=$HALVING \
|
||||||
|
-ac_end=$END \
|
||||||
|
-ac_eras=$ERAS \
|
||||||
|
-ac_blocktime=$BLOCKTIME \
|
||||||
|
-ac_cc=2 -ac_ccenable=$CCENABLE \
|
||||||
|
-ac_founders=$FOUNDERS -ac_supply=$SUPPLY \
|
||||||
|
-ac_perc=$PERC \
|
||||||
|
-clientname=$CLIENTNAME \
|
||||||
|
-addnode=$SEEDNODE1 \
|
||||||
|
-addnode=$SEEDNODE2 \
|
||||||
|
-addnode=$SEEDNODE3 \
|
||||||
|
-ac_cclib=$CCLIB \
|
||||||
|
-ac_script=$SCRIPT "$@"
|
||||||
@@ -1256,16 +1256,53 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
|||||||
|
|
||||||
uint64_t komodo_commission(const CBlock *pblock,int32_t height)
|
uint64_t komodo_commission(const CBlock *pblock,int32_t height)
|
||||||
{
|
{
|
||||||
|
static bool didinit = false,ishush3 = false;
|
||||||
// LABS fungible chains, cannot have any block reward!
|
// LABS fungible chains, cannot have any block reward!
|
||||||
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 2 )
|
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 2 )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
|
if (!didinit) {
|
||||||
|
ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
||||||
|
didinit = true;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0;
|
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0;
|
||||||
if ( ASSETCHAINS_FOUNDERS != 0 )
|
if ( ASSETCHAINS_FOUNDERS != 0 )
|
||||||
{
|
{
|
||||||
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
|
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
|
||||||
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
|
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
|
||||||
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
|
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
|
||||||
|
|
||||||
|
if (ishush3) {
|
||||||
|
int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111;
|
||||||
|
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves.
|
||||||
|
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
|
||||||
|
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
|
||||||
|
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
|
||||||
|
// Transition period of 128 blocks has BR=FR=0
|
||||||
|
if (height < TRANSITION) {
|
||||||
|
commission = 0;
|
||||||
|
} else if (height < HALVING1) {
|
||||||
|
commission = starting_commission;
|
||||||
|
} else if (height < HALVING1+1*INTERVAL) {
|
||||||
|
commission = starting_commission / 2;
|
||||||
|
} else if (height < HALVING1+2*INTERVAL) {
|
||||||
|
commission = starting_commission / 4;
|
||||||
|
} else if (height < HALVING1+3*INTERVAL) {
|
||||||
|
commission = starting_commission / 8;
|
||||||
|
} else if (height < HALVING1+4*INTERVAL) {
|
||||||
|
commission = starting_commission / 16;
|
||||||
|
} else if (height < HALVING1+5*INTERVAL) {
|
||||||
|
commission = starting_commission / 32;
|
||||||
|
} else if (height < HALVING1+6*INTERVAL) { // Block 5380000
|
||||||
|
// Block reward will go to zero between 7th+8th halvings, ac_end may need adjusting
|
||||||
|
commission = starting_commission / 64;
|
||||||
|
} else if (height < HALVING1+7*INTERVAL) {
|
||||||
|
// Block reward will be zero before this is ever reached
|
||||||
|
commission = starting_commission / 128; // Block 6220000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ASSETCHAINS_FOUNDERS > 1 )
|
if ( ASSETCHAINS_FOUNDERS > 1 )
|
||||||
{
|
{
|
||||||
if ( (height % ASSETCHAINS_FOUNDERS) == 0 )
|
if ( (height % ASSETCHAINS_FOUNDERS) == 0 )
|
||||||
|
|||||||
@@ -1758,10 +1758,10 @@ void komodo_args(char *argv0)
|
|||||||
ASSETCHAINS_PUBLIC = GetArg("-ac_public",0);
|
ASSETCHAINS_PUBLIC = GetArg("-ac_public",0);
|
||||||
ASSETCHAINS_PRIVATE = GetArg("-ac_private",0);
|
ASSETCHAINS_PRIVATE = GetArg("-ac_private",0);
|
||||||
KOMODO_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0);
|
KOMODO_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0);
|
||||||
Split(GetArg("-ac_nk",""), ASSETCHAINS_NK, 0);
|
Split(GetArg("-ac_nk",""), sizeof(ASSETCHAINS_NK)/sizeof(*ASSETCHAINS_NK), ASSETCHAINS_NK, 0);
|
||||||
|
|
||||||
// -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height....
|
// -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height....
|
||||||
Split(GetArg("-ac_ccactivateht",""), ccEnablesHeight, 0);
|
Split(GetArg("-ac_ccactivateht",""), sizeof(ccEnablesHeight)/sizeof(*ccEnablesHeight), ccEnablesHeight, 0);
|
||||||
// fill map with all eval codes and activation height of 0.
|
// fill map with all eval codes and activation height of 0.
|
||||||
for ( int i = 0; i < 256; i++ )
|
for ( int i = 0; i < 256; i++ )
|
||||||
mapHeightEvalActivate[i] = 0;
|
mapHeightEvalActivate[i] = 0;
|
||||||
@@ -1833,11 +1833,11 @@ void komodo_args(char *argv0)
|
|||||||
ASSETCHAINS_TIMEUNLOCKFROM = ASSETCHAINS_TIMEUNLOCKTO = 0;
|
ASSETCHAINS_TIMEUNLOCKFROM = ASSETCHAINS_TIMEUNLOCKTO = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Split(GetArg("-ac_end",""), ASSETCHAINS_ENDSUBSIDY, 0);
|
Split(GetArg("-ac_end",""), sizeof(ASSETCHAINS_ENDSUBSIDY)/sizeof(*ASSETCHAINS_ENDSUBSIDY), ASSETCHAINS_ENDSUBSIDY, 0);
|
||||||
Split(GetArg("-ac_reward",""), ASSETCHAINS_REWARD, 0);
|
Split(GetArg("-ac_reward",""), sizeof(ASSETCHAINS_REWARD)/sizeof(*ASSETCHAINS_REWARD), ASSETCHAINS_REWARD, 0);
|
||||||
Split(GetArg("-ac_halving",""), ASSETCHAINS_HALVING, 0);
|
Split(GetArg("-ac_halving",""), sizeof(ASSETCHAINS_HALVING)/sizeof(*ASSETCHAINS_HALVING), ASSETCHAINS_HALVING, 0);
|
||||||
Split(GetArg("-ac_decay",""), ASSETCHAINS_DECAY, 0);
|
Split(GetArg("-ac_decay",""), sizeof(ASSETCHAINS_DECAY)/sizeof(*ASSETCHAINS_DECAY), ASSETCHAINS_DECAY, 0);
|
||||||
Split(GetArg("-ac_notarypay",""), ASSETCHAINS_NOTARY_PAY, 0);
|
Split(GetArg("-ac_notarypay",""), sizeof(ASSETCHAINS_NOTARY_PAY)/sizeof(*ASSETCHAINS_NOTARY_PAY), ASSETCHAINS_NOTARY_PAY, 0);
|
||||||
|
|
||||||
for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ )
|
for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ )
|
||||||
{
|
{
|
||||||
@@ -1906,7 +1906,7 @@ void komodo_args(char *argv0)
|
|||||||
if ( ASSETCHAINS_CC != 0 )
|
if ( ASSETCHAINS_CC != 0 )
|
||||||
{
|
{
|
||||||
ASSETCHAINS_CCLIB = GetArg("-ac_cclib","");
|
ASSETCHAINS_CCLIB = GetArg("-ac_cclib","");
|
||||||
Split(GetArg("-ac_ccenable",""), ccenables, 0);
|
Split(GetArg("-ac_ccenable",""), sizeof(ccenables)/sizeof(*ccenables), ccenables, 0);
|
||||||
for (i=nonz=0; i<0x100; i++)
|
for (i=nonz=0; i<0x100; i++)
|
||||||
{
|
{
|
||||||
if ( ccenables[i] != 0 )
|
if ( ccenables[i] != 0 )
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ namespace {
|
|||||||
|
|
||||||
struct CBlockIndexWorkComparator
|
struct CBlockIndexWorkComparator
|
||||||
{
|
{
|
||||||
bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
|
bool operator()(CBlockIndex *pa, const CBlockIndex *pb) const {
|
||||||
// First sort by most total work, ...
|
// First sort by most total work, ...
|
||||||
|
|
||||||
if (ASSETCHAINS_LWMAPOS) {
|
if (ASSETCHAINS_LWMAPOS) {
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ void SplitStr(const std::string& strVal, std::vector<std::string> &outVals)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault)
|
void Split(const std::string& strVal, int32_t outsize, uint64_t *outVals, const uint64_t nDefault)
|
||||||
{
|
{
|
||||||
stringstream ss(strVal);
|
stringstream ss(strVal);
|
||||||
vector<uint64_t> vec;
|
vector<uint64_t> vec;
|
||||||
@@ -442,7 +442,7 @@ void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault
|
|||||||
else
|
else
|
||||||
nLast = nDefault;
|
nLast = nDefault;
|
||||||
|
|
||||||
for ( i = numVals; i < ASSETCHAINS_MAX_ERAS; i++ )
|
for ( i = numVals; i < outsize; i++ )
|
||||||
{
|
{
|
||||||
outVals[i] = nLast;
|
outVals[i] = nLast;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,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 Split(const std::string& strVal, uint64_t *outVals, uint64_t nDefault);
|
void Split(const std::string& strVal, int32_t outsize, 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